| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
When a net.Socket is constructed from a net.BoundSocket, support synchronous connect(). Signed-off-by: Guy Bedford <guybedford@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #64375 +/- ##
==========================================
+ Coverage 90.23% 90.25% +0.02%
==========================================
Files 741 741
Lines 241194 241218 +24
Branches 45432 45434 +2
==========================================
+ Hits 217640 217722 +82
+ Misses 15129 15083 -46
+ Partials 8425 8413 -12
... and 37 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
connect(2) is asynchronous on Windows (ConnectEx), so a family-mismatch failure is deferred rather than thrown in-tick. Guard the sync-throw assertion to POSIX and note the platform difference in the docs.
Keep the synchronous connect(2) issuance for adopted BoundSockets (so the concrete source address is observable via localAddress once connect() returns), but deliver connection failures through the normal deferred 'error' event on all platforms instead of throwing synchronously. This gives a single, consistent error channel across POSIX and Windows, where connect(2) is asynchronous (ConnectEx).
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/64375 ✔ Done loading data for nodejs/node/pull/64375 ----------------------------------- PR info ------------------------------------ Title net: support sync connect for BoundSocket (#64375) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch guybedford:bound-socket-sync-connect -> nodejs:main Labels net, author ready, commit-queue-squash Commits 3 - net: support sync connect for BoundSocket - net: skip BoundSocket sync-throw test on Windows - net: report BoundSocket connect errors asynchronously Committers 1 - Guy Bedford <gbedford@cloudflare.com> PR-URL: https://github.com/nodejs/node/pull/64375 Reviewed-By: James M Snell <jasnell@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/64375 Reviewed-By: James M Snell <jasnell@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Wed, 08 Jul 2026 23:44:40 GMT ✔ Approvals: 1 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/64375#pullrequestreview-4666628175 ✘ This PR needs to wait 120 more hours to land (or 0 minutes if there is one more approval) ✔ Last GitHub CI successful ℹ Last Full PR CI on 2026-07-10T00:55:06Z: https://ci.nodejs.org/job/node-test-pull-request/74714/ - Querying data for job/node-test-pull-request/74714/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/29131746171 |
Sorry, something went wrong.
When a net.Socket is constructed from a net.BoundSocket, support synchronous connect(). Signed-off-by: Guy Bedford <guybedford@gmail.com> PR-URL: #64375 Reviewed-By: James M Snell <jasnell@gmail.com>
When a net.Socket is constructed from a net.BoundSocket, support synchronous connect(). Signed-off-by: Guy Bedford <guybedford@gmail.com> PR-URL: #64375 Reviewed-By: James M Snell <jasnell@gmail.com>
When a net.Socket is constructed from a net.BoundSocket, support synchronous connect(). Signed-off-by: Guy Bedford <guybedford@gmail.com> PR-URL: #64375 Reviewed-By: James M Snell <jasnell@gmail.com>
When a net.Socket is constructed from a net.BoundSocket, support synchronous connect(). Signed-off-by: Guy Bedford <guybedford@gmail.com> PR-URL: #64375 Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
This allows obtaining socket.localAddress / socket.localPort synchronously, immediately after socket.connect(), when the socket is constructed from a net.BoundSocket.
#63951 added bind2()-style early binding for net.Socket, enabling synchronous local port reservation. This extends the same idea to connect(): the kernel resolves the concrete source address (autobind + source selection) inside the connect(2) syscall itself (without blocking), so a bound socket connecting to an IP literal can provide that address immediately matching POSIX/libuv semantics.
net.Socket.connect() normally defers connect(2) to a later tick due to the DNS lookup step, which doesn't exist for a net.BoundSocket, so connect(2) can be issued synchronously.
Tests are included for a concrete source resolved via localAddress/localPort synchronously after connect(), as well as a synchronous throw.