MCPcopy
hub / github.com/cloudflare/capnweb / onSend

Method onSend

src/streams.ts:199–212  ·  view source on GitHub ↗
(size: number)

Source from the content-addressed store, hash-verified

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.

Callers 3

writeFunction · 0.80
sendMethod · 0.80

Calls

no outgoing calls

Tested by 1

sendMethod · 0.64