-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dgram: sync the old handle state to new handle
PR-URL: #46041 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]>
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const dgram = require('dgram'); | ||
const cluster = require('cluster'); | ||
const assert = require('assert'); | ||
|
||
if (common.isWindows) | ||
common.skip('dgram clustering is currently not supported on Windows.'); | ||
|
||
if (cluster.isPrimary) { | ||
cluster.fork(); | ||
} else { | ||
const socket = dgram.createSocket('udp4'); | ||
socket.unref(); | ||
socket.bind(); | ||
socket.on('listening', common.mustCall(() => { | ||
const sockets = process.getActiveResourcesInfo().filter((item) => { | ||
return item === 'UDPWrap'; | ||
}); | ||
assert.ok(sockets.length === 0); | ||
process.disconnect(); | ||
})); | ||
} |