mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: cover dgram socket close during bind case
This commit tests the scenario where a dgram socket closes during a call to Socket#bind(). PR-URL: https://github.com/nodejs/node/pull/11383 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
1 parent
642eec162d
commit
a196895ecc
1 file changed
+16
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const dgram = require('dgram');
|
||||
const socket = dgram.createSocket('udp4');
|
||||
const lookup = socket._handle.lookup;
|
||||
|
||||
// Test the scenario where the socket is closed during a bind operation.
|
||||
socket._handle.bind = common.mustNotCall('bind() should not be called.');
|
||||
|
||||
socket._handle.lookup = common.mustCall(function(address, callback) {
|
||||
socket.close(common.mustCall(() => {
|
||||
lookup.call(this, address, callback);
|
||||
}));
|
||||
});
|
||||
|
||||
socket.bind(common.mustNotCall('Socket should not bind.'));
|
||||
Reference in new issue
Block a user