mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 22:25:44 +00:00

FreeBSD jails act differently than your average vm or similar application container. All routing passes through one ip address, which makes things like localhost or 0.0.0.0 resolve differently. Introduce a helper that allows us to verify if we're in a jail and another one for returning an ip address for localhost. Also, skip one test instead of trading additional complexity in common.js for one specific user scenario. PR-URL: https://github.com/iojs/io.js/pull/1167 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
27 lines
640 B
JavaScript
27 lines
640 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var net = require('net');
|
|
|
|
var conns = 0, conns_closed = 0;
|
|
|
|
var server = net.createServer(function(socket) {
|
|
conns++;
|
|
assert.equal(common.localhost_ipv4, socket.localAddress);
|
|
assert.equal(socket.localPort, common.PORT);
|
|
socket.on('end', function() {
|
|
server.close();
|
|
});
|
|
socket.resume();
|
|
});
|
|
|
|
server.listen(common.PORT, common.localhost_ipv4, function() {
|
|
var client = net.createConnection(common.PORT, common.localhost_ipv4);
|
|
client.on('connect', function() {
|
|
client.end();
|
|
});
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(1, conns);
|
|
});
|