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

Fix Issue #659 #682

Merged
merged 6 commits into from
Jan 20, 2018
Merged

Fix Issue #659 #682

merged 6 commits into from
Jan 20, 2018

Conversation

Hadis-Knj
Copy link

@Hadis-Knj Hadis-Knj commented Jan 13, 2018

issue #659 : socket is assigned and attempted to connect after the connection has transitioned to final state by connect timeout.

@@ -689,17 +689,22 @@ class Connection extends EventEmitter {
if (err) {
return this.socketError(err);
}
if (this.state === this.STATE.FINAL) {
if (socket) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm pretty sure socket is always set here.

Can we change the code to do an early return instead?

if (this.state === this.STATE.FINAL) {
  socket.destroy();
  return;
}

this.socket = socket;
...

Also, could you add an empty newline before the if statement here?

@arthurschreiber
Copy link
Collaborator

This is great, thank you very much! I left a tiny comment regarding the code style, other than that, this is looking great! 👍

Can we also add an integration test for this, somehow?


this.socketConnect();
if (this.state === this.STATE.FINAL) {
socket.destroy();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The whitespace is still a bit off here. 😅

@Hadis-Knj
Copy link
Author

@arthurschreiber the pause-resume test has failed on Appveyor build. The test is flaky and fails when I test on a remote server, there's also a discussion about it in 518, could you please fix it?

@arthurschreiber
Copy link
Collaborator

@Hadis-Fard I'll see what I can do. 😄

@arthurschreiber
Copy link
Collaborator

Perfect! Thanks for following up with the style changes. 😍 I'll merge and release this ASAP!

@arthurschreiber
Copy link
Collaborator

This was just released as part of [email protected] (currently still tagged as next).

@pbarbiero
Copy link

@arthurschreiber is there any chance we can get this back-ported to the 1.x branch for those of us stuck for the time being? We've started having servers die due to this recently, and we are not in a position to upgrade to v2 currently in some cases.

@arthurschreiber
Copy link
Collaborator

If I remember correctly, the upgrade to v2 should be pretty painless. The only real change was dropping support for node versions earlier to 4.

If possible I'd like to avoid spending time on backporting changes, but if you absolutely can not upgrade, I can go and do it. Please let me know! 😄

@pbarbiero
Copy link

Thanks Arthur,

If thats the main churn to v2, I can probably force it through our release process. I don't want to burden you with more releases in light of that.

I appreciate the response!

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