GrantTerms

data class GrantTerms(val readmitFor: Duration, val reach: GrantReach = GrantReach.ThisRoom)

What a host promises a newcomer it admits: how long the device may come back without being asked again (readmitFor), and where (reach).

readmitFor is a floor: a device away up to readmitFor after its last contact always gets back in on its pass, and up to one and a half times it, depending on when it dropped, however long ago it first joined. The pass itself lasts one and a half times readmitFor (notAfter), and the room issues a fresh one every half of readmitFor while the member stays connected, so the pass a device holds when it drops has at least readmitFor left. A renewal that fails to sign or to send is tried again, more often as the device's pass nears its end (#3711). One the link took and then lost costs nothing either: the host lets a device whose seat is gone back in on the last pass it signed it, as on one the device presents (#3745). Only a host restart, or 256 later departures pushing that record out, leaves the device with the pass before it. Duration.INFINITE means the pass never runs out.

A grant is dated in whole epoch milliseconds and must end after it starts, so readmitFor is at least one millisecond; a part millisecond beyond that is dropped.

Throws

when readmitFor is under one millisecond, zero or negative.

Constructors

Link copied to clipboard
constructor(readmitFor: Duration, reach: GrantReach = GrantReach.ThisRoom)

Properties

Link copied to clipboard

Where the pass is good. This room only, by default.

Link copied to clipboard

How long after its last contact a device is sure to get back in on its pass. At least 1 ms, or infinite.

Functions

Link copied to clipboard
fun notAfter(issuedAt: Long): Long

The Grant.notAfter these terms stamp on a pass issued at issuedAt, in epoch milliseconds: issuedAt plus the pass's life, one and a half times readmitFor rounded up to the millisecond, or Grant.NO_EXPIRY when readmitFor is infinite. The half is what keeps readmitFor a floor when the pass held at a device's last contact was issued a renewal period earlier.