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

Function closeSocket

packages/platform/node-shared/src/NodeSocket.ts:61–68  ·  view source on GitHub ↗
(conn: Net.Socket, isOpen: boolean)

Source from the content-addressed store, hash-verified

59 Arr.map(Arr.ensure(input), (value) => Buffer.from(value))
60
61const closeSocket = (conn: Net.Socket, isOpen: boolean) => {
62 if (conn.closed !== false) return
63 if (!isOpen || !("destroySoon" in conn)) {
64 conn.destroy()
65 } else {
66 conn.destroySoon()
67 }
68}
69
70/**
71 * Opens a Node TCP connection as an Effect socket.

Callers 2

makeNetFunction · 0.70
makeTlsFunction · 0.70

Calls 1

destroyMethod · 0.45

Tested by

no test coverage detected