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
This commit is contained in:
Fedor Indutny committed 2014-03-27 23:25:30 +04:00
1 parent e781832ea1
commit ef096f8d8f
2 files changed
+7 -5

No files matched your search

+5 -5
View File
@@ -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()
@@ -55,6 +55,8 @@ var server = tls.createServer(options, function(socket) {
server.close();
});
});
assert(client.readable);
assert(client.writable);
}
// Already connected socket