MCPcopy Create free account
hub / github.com/Effect-TS/effect / accept

Method accept

packages/platform/node-shared/src/internal/proxyProcess.ts:428–444  ·  view source on GitHub ↗
(socket: Net.Socket)

Source from the content-addressed store, hash-verified

426 }
427
428 private accept(socket: Net.Socket): void {
429 // Errors are reported to the readers and writers of the stdio streams
430 socket.on("error", () => {})
431 const onReadable = () => {
432 const header: Buffer | null = socket.read(headerLength)
433 if (header === null) return
434 socket.off("readable", onReadable)
435 const command =
436 header.length === headerLength && Crypto.timingSafeEqual(header.subarray(0, tokenLength), this.token)
437 ? this.commands.get(header.readUInt32BE(tokenLength))
438 : undefined
439 if (command === undefined || !command.attach(header.readUInt32BE(tokenLength + 4), socket)) {
440 socket.destroy()
441 }
442 }
443 socket.on("readable", onReadable)
444 }
445
446 /**
447 * Best effort, and never throws, since it runs while exits and losses are

Callers 7

constructorMethod · 0.95
NpmPromote.tsFile · 0.80
makeClientFunction · 0.80
acceptFunction · 0.80
runTlsEchoServerFunction · 0.80
runEchoServerFunction · 0.80
DenoSocket.test.tsFile · 0.80

Calls 1

onMethod · 0.65

Tested by 3

acceptFunction · 0.64
runTlsEchoServerFunction · 0.64
runEchoServerFunction · 0.64