(size: number)
| 41 | |
| 42 | // Send a chunk at the current time. |
| 43 | send(size: number) { |
| 44 | // The new message begins sending now, unless some other message is still sending, in which |
| 45 | // case it sends after that message. It occupies the link until all the bytes are sent, based |
| 46 | // on the bandwidth. |
| 47 | this.linkOccupiedUntil = Math.max(this.linkOccupiedUntil, this.t) + size / this.bandwidth; |
| 48 | |
| 49 | let { token, shouldBlock } = this.fc.onSend(size); |
| 50 | |
| 51 | // ackTime = time when the chunk finishes writing out to the pipe, plus 1 rtt |
| 52 | this.inFlight.push({ token, ackTime: this.linkOccupiedUntil + this.rtt }); |
| 53 | this.blocked = shouldBlock; |
| 54 | } |
| 55 | |
| 56 | // Fill the window by sending chunks of the given size. Returns the number of chunks sent |
| 57 | // (the last one caused blocking). |
no test coverage detected