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

Method send

__tests__/flow-control.test.ts:43–54  ·  view source on GitHub ↗
(size: number)

Source from the content-addressed store, hash-verified

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).

Callers 2

fillWindowMethod · 0.95
saturateForMethod · 0.95

Calls 1

onSendMethod · 0.80

Tested by

no test coverage detected