Class RemoteCidQueue
java.lang.Object
io.github.mahmoudimus.quic.connection.RemoteCidQueue
The connection IDs the peer issued to this endpoint (RFC 9000 section 5.1.2): a window of at
most
limit IDs, our active_connection_id_limit, starting with the one in use. It
may have gaps from loss or reordering.
NEW_CONNECTION_ID frames that would exceed the limit are a CONNECTION_ID_LIMIT_ERROR;
Retire Prior To retires the IDs below it, and the caller sends RETIRE_CONNECTION_ID for them.
Threads. Not thread-safe; owned by one connection.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSignals that an ID could not be stored; seeRemoteCidQueue.InsertError.static enumThe outcome ofinsert(io.github.mahmoudimus.quic.frame.Frame.NewConnectionId).static final recordSequence numbers to retire, and the reset token of the ID now in use. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intquinn's window, and theactive_connection_id_limitit advertises. -
Constructor Summary
ConstructorsConstructorDescriptionRemoteCidQueue(ConnectionId initial) A queue with quinn's window of 5.RemoteCidQueue(ConnectionId initial, int limit) A queue holding the ID the handshake used, sequence number 0. -
Method Summary
Modifier and TypeMethodDescriptionactive()The ID in use.The reset token of the ID in use.longThe sequence number of the ID in use.insert(Frame.NewConnectionId frame) Stores a NEW_CONNECTION_ID frame's ID, retiring those below its Retire Prior To.next()Switches to the next known ID, as when migrating or for a server leaving the handshake ID.onNewConnectionId(Frame.NewConnectionId frame, Retransmits pending) Processes a NEW_CONNECTION_ID frame as the connection does: stores the ID and queues RETIRE_CONNECTION_ID frames for the IDs it retires.peekNext()The IDnext()would switch to, without switching: a probe of a new path uses it before the connection moves there (RFC 9000 section 9.5).voidReplaces the initial ID, after a Retry or the server's first Initial.
-
Field Details
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMITquinn's window, and theactive_connection_id_limitit advertises.- See Also:
-
-
Constructor Details
-
RemoteCidQueue
A queue holding the ID the handshake used, sequence number 0.- Parameters:
initial- the peer's first Source Connection IDlimit- ouractive_connection_id_limit, at least 2
-
RemoteCidQueue
A queue with quinn's window of 5.- Parameters:
initial- the peer's first Source Connection ID
-
-
Method Details
-
insert
public RemoteCidQueue.Retired insert(Frame.NewConnectionId frame) throws RemoteCidQueue.CidInsertException Stores a NEW_CONNECTION_ID frame's ID, retiring those below its Retire Prior To.- Parameters:
frame- the frame- Returns:
- null if nothing was retired, else the sequence numbers to retire and the new active ID's reset token
- Throws:
RemoteCidQueue.CidInsertException- if the ID was already retired or exceeds the limit
-
onNewConnectionId
public StatelessResetToken onNewConnectionId(Frame.NewConnectionId frame, Retransmits pending) throws QuicException Processes a NEW_CONNECTION_ID frame as the connection does: stores the ID and queues RETIRE_CONNECTION_ID frames for the IDs it retires.- Parameters:
frame- the framepending- where to queue RETIRE_CONNECTION_ID- Returns:
- the reset token of a new active ID, or null if the active ID did not change
- Throws:
QuicException-PROTOCOL_VIOLATIONif the peer uses zero-length IDs or reuses a sequence number for another ID,CONNECTION_ID_LIMIT_ERRORif it exceeds our limit
-
peekNext
The IDnext()would switch to, without switching: a probe of a new path uses it before the connection moves there (RFC 9000 section 9.5).- Returns:
- the ID, or null if the peer supplied no unused one
-
next
Switches to the next known ID, as when migrating or for a server leaving the handshake ID.- Returns:
- the new ID's reset token and the sequence numbers to retire, or null if no other ID is known
-
updateInitialCid
Replaces the initial ID, after a Retry or the server's first Initial.- Parameters:
cid- the new ID
-
active
The ID in use.- Returns:
- the ID
-
activeSeq
public long activeSeq()The sequence number of the ID in use.- Returns:
- the sequence number
-
activeResetToken
The reset token of the ID in use.- Returns:
- the token, or null for the handshake ID (whose token, if any, came in the transport parameters)
-