Browse Source

tls: force readable/writable to `true`

These are an old and deprecated properties that was used by previous
stream implementation, and are still in use in some user-land modules.

Prior to this commit, they were read from the underlying socket, which
may be non-readable/non-writable while connecting or while staying
uninitialized.

Force set them to `true`, just to make sure that there will be no
inconsistency.

fix #7152
v0.11.13-release
Fedor Indutny 11 years ago
parent
commit
ef096f8d8f
  1. 10
      lib/_tls_wrap.js
  2. 2
      test/simple/test-tls-connect-given-socket.js

10
lib/_tls_wrap.js

@ -171,11 +171,11 @@ function TLSSocket(socket, options) {
// Disallow wrapping TLSSocket in TLSSocket
assert(!(socket instanceof TLSSocket));
net.Socket.call(this, socket && {
handle: socket._handle,
allowHalfOpen: socket.allowHalfOpen,
readable: socket.readable,
writable: socket.writable
net.Socket.call(this, {
handle: socket && socket._handle,
allowHalfOpen: socket && socket.allowHalfOpen,
readable: true,
writable: true
});
// To prevent assertion in afterConnect()

2
test/simple/test-tls-connect-given-socket.js

@ -55,6 +55,8 @@ var server = tls.createServer(options, function(socket) {
server.close();
});
});
assert(client.readable);
assert(client.writable);
}
// Already connected socket

Loading…
Cancel
Save