-
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.
net: fix connect crash when call destroy in lookup handler
PR-URL: #51826 Fixes: #50841 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
- Loading branch information
1 parent
b7ce547
commit 870ef5a
Showing
2 changed files
with
20 additions
and
1 deletion.
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
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 net = require('net'); | ||
|
||
// Test that the process does not crash. | ||
const socket = net.connect({ | ||
port: 12345, | ||
host: 'localhost', | ||
// Make sure autoSelectFamily is true | ||
// so that lookupAndConnectMultiple is called. | ||
autoSelectFamily: true, | ||
}); | ||
// DNS resolution fails or succeeds | ||
socket.on('lookup', common.mustCall(() => { | ||
socket.destroy(); | ||
})); |