-
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.
PR-URL: #51929 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
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
7 changes: 7 additions & 0 deletions
7
test/parallel/test-net-server-close-before-calling-lookup-callback.js
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,7 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const net = require('net'); | ||
// Process should exit because it does not create a real TCP server. | ||
// Paas localhost to ensure create TCP handle asynchronously because It causes DNS resolution. | ||
net.createServer().listen(0, 'localhost', common.mustNotCall()).close(); |
22 changes: 22 additions & 0 deletions
22
test/parallel/test-net-server-close-before-ipc-response.js
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,22 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const net = require('net'); | ||
const cluster = require('cluster'); | ||
|
||
// Process should exit | ||
if (cluster.isPrimary) { | ||
cluster.fork(); | ||
} else { | ||
const send = process.send; | ||
process.send = function(message) { | ||
// listenOnPrimaryHandle in net.js should call handle.close() | ||
if (message.act === 'close') { | ||
setImmediate(() => { | ||
process.disconnect(); | ||
}); | ||
} | ||
return send.apply(this, arguments); | ||
}; | ||
net.createServer().listen(0, common.mustNotCall()).close(); | ||
} |