Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/parallel/test-dgram-close-during-bind.js
Original file line number Diff line number Diff line change
@@ -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.'));