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

net: add localAddress/Port for better error msgs #3946

Closed
wants to merge 4 commits into from

Conversation

jscissr
Copy link
Contributor

@jscissr jscissr commented Nov 20, 2015

That could result in an error being thrown while creating an error...

@mscdex mscdex added the net Issues and PRs related to the net subsystem. label Nov 20, 2015
@jasnell
Copy link
Member

jasnell commented Nov 20, 2015

how odd that this wasn't caught before. LGTM but it would be helpful to have a quick test case included that fails before this is fix but works after.

@evanlucas
Copy link
Contributor

Yea, apologies on that...not sure how that was missed :/

LGTM

@jscissr
Copy link
Contributor Author

jscissr commented Nov 21, 2015

I'll try making a test

@jasnell
Copy link
Member

jasnell commented Nov 21, 2015

It's not critical, just helpful. :) thank you!
On Nov 20, 2015 4:50 PM, "Jan Schär" notifications@github.com wrote:

I'll try making a test


Reply to this email directly or view it on GitHub
#3946 (comment).

@jscissr
Copy link
Contributor Author

jscissr commented Nov 21, 2015

Hmm, it looks like req.localAddress and req.localPort isn't even set anywhere, so the if block will never execute...
Should I add them after https://github.com/jscissr/node/blob/patch-2/lib/net.js#L819 ?

At least it means the worst that can happen is that you don't get a nice error message in the onerror event.

The code generating the errror messages was already there, but it could
never execute because these properties were not set.
var net = require('net');

var client = net.connect({
port: common.PORT + 1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure which port to use here, it simply should produce an ECONNREFUSED error when connecting.

@@ -0,0 +1,21 @@
'use strict';
var common = require('../common');
Copy link
Contributor

Choose a reason for hiding this comment

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

mind making these const instead of var?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied that from another test. Should I make a PR that changes this for every test where it isn't already the new way?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the plan is to update them as we go. But in general, all new tests should use const wherever possible

@cjihrig
Copy link
Contributor

cjihrig commented Nov 23, 2015

LGTM pending comments and CI

@jscissr jscissr changed the title net: variable ex used before defined net: add localAddress/Port for better error msgs Nov 23, 2015
@evanlucas
Copy link
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/816/

LGTM if CI is happy

@jscissr
Copy link
Contributor Author

jscissr commented Nov 24, 2015

It looks like something was wrong with the CI server. Can you restart it @evanlucas?

@evanlucas
Copy link
Contributor

evanlucas pushed a commit that referenced this pull request Nov 24, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.

PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@evanlucas
Copy link
Contributor

Landed in d7b199d. I went ahead and squashed the commits into 1 also. Thanks!

@evanlucas evanlucas closed this Nov 24, 2015
@jscissr jscissr deleted the patch-2 branch November 25, 2015 21:02
MylesBorins pushed a commit that referenced this pull request Dec 1, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.

PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
rvagg pushed a commit that referenced this pull request Dec 4, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.

PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
rvagg pushed a commit that referenced this pull request Dec 5, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.

PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@jasnell jasnell mentioned this pull request Dec 17, 2015
jasnell pushed a commit that referenced this pull request Dec 17, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.

PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
jasnell pushed a commit that referenced this pull request Dec 23, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.

PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants