MCPcopy Create free account
hub / github.com/deepclause/agentvm / _handleTcpEnd

Method _handleTcpEnd

src/network.js:212–227  ·  view source on GitHub ↗

* Handle TCP end (FIN from remote) from main thread * @private

(msg)

Source from the content-addressed store, hash-verified

210 let written = 0;
211 while (written < length) {
212 const chunk = this.txChunks[0];
213 const count = Math.min(chunk.length - this.txOffset, length - written);
214 chunk.copy(result, written, this.txOffset, this.txOffset + count);
215 written += count;
216 this.txOffset += count;
217 if (this.txOffset === chunk.length) {
218 this.txChunks.shift();
219 this.txOffset = 0;
220 }
221 }
222 }
223 this.txBytes -= length;
224
225 // Reading from the frame pipe creates room for pending TCP data. Pump
226 // all flows here so host sockets resume without waiting for an
227 // unrelated ACK or host event.
228 if (this.txBytes < NIC_TX_HIGH_WATER) this._pumpTcpFlows();
229 return result;
230 }

Callers 1

pollNetResponsesMethod · 0.95

Calls 1

sendTCPMethod · 0.95

Tested by

no test coverage detected