(size: number)
| 197 | // Called when a write of `size` bytes is about to be sent. Returns a token that must be |
| 198 | // passed to onAck() when the ack arrives, and whether the sender should block (window full). |
| 199 | onSend(size: number): { token: SendToken, shouldBlock: boolean } { |
| 200 | this.bytesInFlight += size; |
| 201 | |
| 202 | let token: SendToken = { |
| 203 | sentTime: this.now(), |
| 204 | size, |
| 205 | deliveredAtSend: this.delivered, |
| 206 | deliveredTimeAtSend: this.deliveredTime, |
| 207 | windowAtSend: this.window, |
| 208 | windowFullAtSend: this.bytesInFlight >= this.window, |
| 209 | }; |
| 210 | |
| 211 | return { token, shouldBlock: token.windowFullAtSend }; |
| 212 | } |
| 213 | |
| 214 | // Called when a previously-sent write fails. Restores bytesInFlight without updating |
| 215 | // any BDP estimates. |
no outgoing calls