Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2,tls: account for buffered data before creating socket wraps #34958

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! tls: account for buffered data before creating TLSSocket wrap
addaleax committed Oct 6, 2020

Verified

This commit was signed with the committer’s verified signature.
addaleax Anna Henningsen
commit 52863d56a12a01dd6155c3778ce15dc602c4ce68
5 changes: 3 additions & 2 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
@@ -481,8 +481,9 @@ function TLSSocket(socket, opts) {
let wrap;
// Ideally, the readableLength check would not be necessary, and we would
// have a way to handle the buffered data at the C++ StreamBase level.
if (((socket instanceof net.Socket && socket._handle) || !socket) &&
socket.readableLength === 0) {
if ((socket instanceof net.Socket &&
socket._handle &&
socket.readableLength === 0) || !socket) {
// 1. connected socket
// 2. no socket, one will be created with net.Socket().connect
wrap = socket;