MCPcopy Index your code
hub / github.com/nodejs/node / connect

Function connect

test/parallel/test-gc-tls-external-memory.js:28–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26connect();
27
28function connect() {
29 if (runs % 64 === 0)
30 globalThis.gc();
31 const externalMemoryUsage = process.memoryUsage().external;
32 assert(externalMemoryUsage >= 0, `${externalMemoryUsage} < 0`);
33 if (runs++ === 512) {
34 // Make sure at least half the TLS sockets have been garbage collected
35 // (so that this test can actually check what it's testing):
36 assert(gced >= 256, `${gced} < 256`);
37 return;
38 }
39
40 const [ clientSide, serverSide ] = duplexPair();
41
42 const tlsSocket = tls.connect({ socket: clientSide });
43 tlsSocket.on('error', common.mustCall(connect));
44 onGC(tlsSocket, { ongc });
45
46 // Use setImmediate so that we don't trigger the error within the same
47 // event loop tick.
48 setImmediate(() => serverSide.write(dummyPayload));
49}

Callers 1

Calls 7

duplexPairFunction · 0.85
onGCFunction · 0.85
connectMethod · 0.65
assertFunction · 0.50
setImmediateFunction · 0.50
onMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…