diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 6d760c19ed281e..271afd73a97998 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -269,15 +269,17 @@ function onerror(err) { } } -function initRead(tls, wrapped) { +// Used by both client and server TLSSockets to start data flowing from _handle, +// read(0) causes a StreamBase::ReadStart, via Socket._read. +function initRead(tls, socket) { // If we were destroyed already don't bother reading if (!tls._handle) return; // Socket already has some buffered data - emulate receiving it - if (wrapped && wrapped.readableLength) { + if (socket && socket.readableLength) { var buf; - while ((buf = wrapped.read()) !== null) + while ((buf = socket.read()) !== null) tls._handle.receive(buf); }