-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
- Loading branch information
1 parent
db30428
commit c6cc3ed
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(); | ||
})); |