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

tls: accept empty net.Sockets #1046

Closed
wants to merge 1 commit into from
Closed

Conversation

indutny
Copy link
Member

@indutny indutny commented Mar 3, 2015

Accept new net.Socket() as a socket option to tls.connect()
without triggering an assertion error in C++.

This is done by wrapping it into a JSStream to ensure that there will be
a handle at the time of wrapping the socket into TLSSocket.

Fix: #987

cc @iojs/streams @iojs/crypto @iojs/collaborators

Accept `new net.Socket()` as a `socket` option to `tls.connect()`
without triggering an assertion error in C++.

This is done by wrapping it into a JSStream to ensure that there will be
a handle at the time of wrapping the socket into TLSSocket.

Fix: nodejs#987
@@ -506,6 +513,7 @@ TLSSocket.prototype._start = function() {
return;
}

debug('start');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm tired of putting console.log() here during debugging :)

@bnoordhuis
Copy link
Member

LGTM. What does the CI say?

@indutny
Copy link
Member Author

indutny commented Mar 3, 2015

@rvagg
Copy link
Member

rvagg commented Mar 3, 2015

does the test cover the same reduced case you narrowed down in #987?

@indutny
Copy link
Member Author

indutny commented Mar 3, 2015

Yes.

@rvagg
Copy link
Member

rvagg commented Mar 3, 2015

:shipit: I have no opinion on which one of the two options to presented in #987 except that you've produced code for one of them so it wins.

@indutny
Copy link
Member Author

indutny commented Mar 3, 2015

@rvagg second one is actually a continuation of this. I decided to do the simple first and harder later :)

indutny added a commit that referenced this pull request Mar 3, 2015
Accept `new net.Socket()` as a `socket` option to `tls.connect()`
without triggering an assertion error in C++.

This is done by wrapping it into a JSStream to ensure that there will be
a handle at the time of wrapping the socket into TLSSocket.

Fix: #987
PR-URL: #1046
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
@indutny
Copy link
Member Author

indutny commented Mar 3, 2015

Landed in 7b3b8ac, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants