-
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.
lib: return directly if udp socket close before lookup
- Loading branch information
Showing
2 changed files
with
19 additions
and
3 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
16 changes: 16 additions & 0 deletions
16
test/parallel/test-dgram-bind-socket-close-before-lookup.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,16 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const dgram = require('dgram'); | ||
|
||
const socket = dgram.createSocket({ | ||
type: 'udp4', | ||
lookup: (...args) => { | ||
setTimeout(() => { | ||
args[args.length - 1](new Error('an error')); | ||
}, 1000); | ||
} | ||
}); | ||
|
||
socket.on('error', common.mustNotCall()); | ||
socket.bind(12345, 'localhost'); | ||
socket.close(); |