diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index fc515bbc3b1..e17a0646be7 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -177,8 +177,8 @@ function TLSSocket(socket, options) { net.Socket.call(this, { handle: socket && socket._handle, allowHalfOpen: socket && socket.allowHalfOpen, - readable: true, - writable: true + readable: false, + writable: false }); // To prevent assertion in afterConnect() @@ -210,6 +210,12 @@ function TLSSocket(socket, options) { } else { this._init(socket); } + + // Make sure to setup all required properties like: `_connecting` before + // starting the flow of the data + this.readable = true; + this.writable = true; + this.read(0); } util.inherits(TLSSocket, net.Socket); exports.TLSSocket = TLSSocket;