net: support Server.listen(Pipe)

pull/24503/head
Andreas Madsen 2012-07-14 09:43:10 +02:00 committed by isaacs
parent 085a09874b
commit ddb02b978d
1 changed files with 2 additions and 1 deletions

View File

@ -972,6 +972,7 @@ Server.prototype._listen = function() {
var backlog = toNumber(arguments[1]) || toNumber(arguments[2]);
var TCP = process.binding('tcp_wrap').TCP;
var Pipe = process.binding('pipe_wrap').Pipe;
if (arguments.length == 0 || typeof arguments[0] == 'function') {
// Bind to a random port.
@ -984,7 +985,7 @@ Server.prototype._listen = function() {
} else if (h.handle) {
h = h.handle;
}
if (h instanceof TCP) {
if (h instanceof TCP || h instanceof Pipe) {
self._handle = h;
listen(self, null, -1, -1, backlog);
} else if (typeof h.fd === 'number' && h.fd >= 0) {