0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-cluster-http-pipe.js
Ben Noordhuis de88255b0f Revert "lib,src: add unix socket getsockname/getpeername"
This reverts commit 6cd0e2664b.
This reverts commit 7a999a1376.
This reverts commit f337595441.

It turns out that on Windows, uv_pipe_getsockname() is a no-op for
client sockets.  It slipped through testing because of a CI snafu.

PR-URL: https://github.com/nodejs/node/pull/2584
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-08-28 00:14:13 +02:00

47 lines
1.1 KiB
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');
const http = require('http');
if (common.isWindows) {
console.log('1..0 # Skipped: It is not possible to send pipe handles over ' +
'the IPC pipe on Windows');
return;
}
if (cluster.isMaster) {
common.refreshTmpDir();
var ok = false;
var worker = cluster.fork();
worker.on('message', function(msg) {
assert.equal(msg, 'DONE');
ok = true;
});
worker.on('exit', function() {
process.exit();
});
process.on('exit', function() {
assert(ok);
});
return;
}
http.createServer(function(req, res) {
assert.equal(req.connection.remoteAddress, undefined);
assert.equal(req.connection.localAddress, undefined); // TODO common.PIPE?
res.writeHead(200);
res.end('OK');
}).listen(common.PIPE, function() {
var self = this;
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
res.resume();
res.on('end', function(err) {
if (err) throw err;
process.send('DONE');
process.exit();
});
});
});