ReliableWindowBuffer
This implements an asynchronous transfer window buffer with automatic repeat request (ARQ) semantics.
It keeps a window of windowSize packets that can ben transferred until an acknowledgement needs to be received by the other side. If it takes longer than the specified resendTimeout for an acknowledgement to arrive from the remote side the expired packets will be repeated. Once a packet is acknowledged it is removed from the window buffer. If the buffer is full adding more packets will suspend until there is more space available.
Constructors
Functions
Acknowledges all packets in the buffer that come before the specified sequenceNumber. This should be called when the receiver sends back an acknowledgement sequence number. If any packets are acknowledged by this call it will fee up space in the sending window and notify any suspended sendData calls.
Returns the next packet that is scheduled to be send to the receiver. If there are no packets up for immediate sending this will suspend until one is added by a call to sendData or if the timeout of any packets in the buffer expire, triggering an automatic repeat request (a resend). Returns null
when the buffer is currently being destroyed.
Sends an acknowledgement with the specified sequenceNumber to the receiver. The acknowledgement will be send immediately, either as part of a data packet that is queued for immediate sending or as a new pure acknowledgement packet.