Socket.prototype._getpeername = function() {
- if (!this._handle || !this._handle.getpeername) {
- return {};
- }
if (!this._peername) {
+ if (!this._handle || !this._handle.getpeername) {
+ return {};
+ }
var out = {};
var err = this._handle.getpeername(out);
if (err) return {}; // FIXME(bnoordhuis) Throw?
this._writableState.errorEmitted = false;
this.destroyed = false;
this._handle = null;
+ this._peername = null;
}
var self = this;
socket.on('end', function() {
if (++conns_closed == 2) server.close();
});
+ socket.on('close', function() {
+ assert.notEqual(-1, remoteAddrCandidates.indexOf(socket.remoteAddress));
+ assert.notEqual(-1, remoteFamilyCandidates.indexOf(socket.remoteFamily));
+ });
socket.resume();
});
assert.equal(common.PORT, client.remotePort);
client.end();
});
+ client.on('close', function() {
+ assert.notEqual(-1, remoteAddrCandidates.indexOf(client.remoteAddress));
+ assert.notEqual(-1, remoteFamilyCandidates.indexOf(client.remoteFamily));
+ });
client2.on('connect', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client2.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client2.remoteFamily));
assert.equal(common.PORT, client2.remotePort);
client2.end();
});
+ client2.on('close', function() {
+ assert.notEqual(-1, remoteAddrCandidates.indexOf(client2.remoteAddress));
+ assert.notEqual(-1, remoteFamilyCandidates.indexOf(client2.remoteFamily));
+ });
});
process.on('exit', function() {