test: fix up pummel/test-net-pingpong
Fix up a bad assumption in pummel/test-net-pingpong, namely that binding to 'localhost' or '' means that incoming connections will have an IPv4 address. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
This commit is contained in:
parent
a367f62adf
commit
13553c1332
@ -36,12 +36,14 @@ function pingPongTest(port, host, on_complete) {
|
|||||||
var server = net.createServer({ allowHalfOpen: true }, function(socket) {
|
var server = net.createServer({ allowHalfOpen: true }, function(socket) {
|
||||||
assert.equal(true, socket.remoteAddress !== null);
|
assert.equal(true, socket.remoteAddress !== null);
|
||||||
assert.equal(true, socket.remoteAddress !== undefined);
|
assert.equal(true, socket.remoteAddress !== undefined);
|
||||||
if (host === '127.0.0.1' || host === 'localhost' || !host) {
|
var address = socket.remoteAddress;
|
||||||
assert.equal(socket.remoteAddress, '127.0.0.1');
|
if (host === '127.0.0.1') {
|
||||||
|
assert.equal(address, '127.0.0.1');
|
||||||
|
} else if (host == null || host === 'localhost') {
|
||||||
|
assert(address === '127.0.0.1' || address === '::ffff:127.0.0.1');
|
||||||
} else {
|
} else {
|
||||||
console.log('host = ' + host +
|
console.log('host = ' + host + ', remoteAddress = ' + address);
|
||||||
', remoteAddress = ' + socket.remoteAddress);
|
assert.equal(address, '::1');
|
||||||
assert.equal(socket.remoteAddress, '::1');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.setEncoding('utf8');
|
socket.setEncoding('utf8');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user