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

Function initRead

lib/internal/tls/wrap.js:597–615  ·  view source on GitHub ↗
(tlsSocket, socket)

Source from the content-addressed store, hash-verified

595// Used by both client and server TLSSockets to start data flowing from _handle,
596// read(0) causes a StreamBase::ReadStart, via Socket._read.
597function initRead(tlsSocket, socket) {
598 debug('%s initRead',
599 tlsSocket._tlsOptions.isServer ? 'server' : 'client',
600 'handle?', !!tlsSocket._handle,
601 'buffered?', !!socket && socket.readableLength,
602 );
603 // If we were destroyed already don't bother reading
604 if (!tlsSocket._handle)
605 return;
606
607 // Socket already has some buffered data - emulate receiving it
608 if (socket?.readableLength) {
609 let buf;
610 while ((buf = socket.read()) !== null)
611 tlsSocket._handle.receive(buf);
612 }
613
614 tlsSocket.read(0);
615}
616
617/**
618 * Provides a wrap of socket stream to do encrypted communication.

Callers

nothing calls this directly

Calls 2

debugFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…