lib: make sure close the net server
If perform asynchronous operations in the listen
function of net.js
(execute dns.lookup
or ask the main process to create a server), the server will not close properly.
The example is as follows.
// The "closed" TCP server will keep the process because
// after calling close function, a TCP handle is created in the callback of `dns.lookup`.
const net = require('net');
net.createServer().listen(9999, 'localhost').close();
See https://github.com/nodejs/node/blob/c08b7975735aaa633e2573da692a05aa3f13d700/lib/net.js#L2092.
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines