Skip to content

net: make TCP Server and Socket transferable across worker threads#9

Draft
mcollina wants to merge 5 commits into
mainfrom
net-transfer-handles-worker-threads
Draft

net: make TCP Server and Socket transferable across worker threads#9
mcollina wants to merge 5 commits into
mainfrom
net-transfer-handles-worker-threads

Conversation

@mcollina

@mcollina mcollina commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Move a listening net.Server or an accepted net.Socket to another thread via a worker_threads postMessage() transferList. Unix only; Windows throws.

mcollina added 5 commits July 1, 2026 09:51
Allow a listening net.Server or an accepted net.Socket to be moved to
another thread by listing it in the transferList of a worker_threads
postMessage() call. Unix only; Windows throws.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Previously a transferred net.Socket stayed alive on the sending side and
silently dropped writes. Destroy it so further use fails with
ERR_STREAM_DESTROYED.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Use explicit workerData roles for helper workers so the test file remains the coordinator when run via tools/test.py --worker.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
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.

1 participant