Skip to content

net: _connectionKey given wrong value for large port #5727

Description

@trevnorris
  • Version: v0.12+
  • Platform: all
  • Subsystem: net, affects child_process

Reproduce with:

$ node -e "var s = require('net').createServer().listen(-1 >>> 0); console.log(s._connectionKey, s.address().port)"

Output:

6::::4294967295 65535

Expected output:

6::::65535 65535

Conversation with @indutny:

<trevnorris> indutny: does ._connectionKey do anything?
<indutny> yep
<indutny> child_process.js
<indutny> actually, internal/child_process.js
<indutny> it is used for sharing servers
<trevnorris> okay. well guess it should get fixed then.
<trevnorris> e.g.: var s = net.createServer().listen(-1 >>> 0); s._connectionKey == '6::::4294967295'; s.address().port == 65535
<indutny> mmm
<indutny> yeah
<indutny> this is bad

Haven't gotten around to a fix, so making this up for grabs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.netIssues and PRs related to the net subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions