Skip to content

Commit 52863d5

Browse files
committed
fixup! tls: account for buffered data before creating TLSSocket wrap
1 parent 54fc9a1 commit 52863d5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/_tls_wrap.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,9 @@ function TLSSocket(socket, opts) {
481481
let wrap;
482482
// Ideally, the readableLength check would not be necessary, and we would
483483
// have a way to handle the buffered data at the C++ StreamBase level.
484-
if (((socket instanceof net.Socket && socket._handle) || !socket) &&
485-
socket.readableLength === 0) {
484+
if ((socket instanceof net.Socket &&
485+
socket._handle &&
486+
socket.readableLength === 0) || !socket) {
486487
// 1. connected socket
487488
// 2. no socket, one will be created with net.Socket().connect
488489
wrap = socket;

0 commit comments

Comments
 (0)