The sequence number counter of the underlying transport for incoming/outgoing chunks.
The sequence number counters are being used to be able to resume a
session after the connection has been severed. A sequence number is a
simple 32 bit unsigned counter starting at 0
, that MUST be incremented
by 1
for every chunk being sent (outgoing counter) or received
(incoming counter).
Once the connection is set up, both peers MUST asynchronously send an
update/connectionInfo
message before sending any other
messages. On receiving the connection info of the remote peer, if the
connectionInfo.data.resume
field is present and
connectionInfo.data.resume.id
of the remote peer's message equals the
one sent in the local message, the peers SHALL try to resume a session.
In any other case, cached chunks SHALL be
discarded and the connection MUST be treated as a newly established web
session.
To resume a session, the peer first compares the received
connectionInfo.data.resume.sequenceNumber
with the sequence number for
outgoing chunks of the former connection. All cached chunks before this
sequence number SHALL be discarded. In addition, each cached chunks that
has been tagged by the blacklist
SHALL be discarded from the cache. The remaining cached chunks MUST be
transferred to the current connection by assigning the current outgoing
sequence number counter as an offset to the cached chunks.
For example, if there are three cached chunks with the former sequence
numbers of 5, 6, 7
and the last used outgoing sequence number
(the one used for sending the last update/connectionInfo
chunk) is
11
, they will be remapped to the sequence numbers 12, 13, 14
. This
will prevent losing cached chunks in case the newly established
connection is being severed as well before all cached chunks have been
sent.
Now, the cached chunks MUST be sent in order to the other peer.
Other chunks of newly created messages SHALL NOT interfere with the order
and MUST be appended to the chunk cache as well.
In addition, a peer SHOULD periodically report the current sequence
number for incoming chunks to the other peer by sending an
update/connectionAck
10 seconds after a chunk has been
received. This allows the other peer to remove cached chunks that have
been acknowledged. However, a peer MUST respond with a connectionAck
update in case the other peer explicitly sends a
request/connectionAck
.
Note: The sequence number counter represents the amount of chunks sent or received but not its index.