forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: nodejs#43009 If calling `this._handle.getpeername` returns an error at the first call, its result shouldn't be cached to `this._peername`. Signed-off-by: Daeyeon Jeong [email protected] PR-URL: nodejs#43010 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
- Loading branch information
Showing
2 changed files
with
27 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
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,23 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const net = require('net'); | ||
const { strictEqual } = require('assert'); | ||
|
||
const server = net.createServer(); | ||
|
||
server.listen(common.mustCall(function() { | ||
const socket = net.connect({ port: server.address().port }); | ||
|
||
strictEqual(socket.connecting, true); | ||
strictEqual(socket.remoteAddress, undefined); | ||
|
||
socket.on('connect', common.mustCall(function() { | ||
strictEqual(socket.remoteAddress !== undefined, true); | ||
socket.end(); | ||
})); | ||
|
||
socket.on('end', common.mustCall(function() { | ||
server.close(); | ||
})); | ||
})); |