Add 'type' parameter to net.Server.listenFD()
This is needed in case the provided socket is not the default 'tcp4' type (i.e. and needs different read/write/etc methods). With this patch, one can call listenFD(sock, 'unix') to bind to existing UNIX domain sockets.
This commit is contained in:
parent
bca16a0581
commit
de6d663a67
@ -1167,12 +1167,13 @@ Server.prototype.listen = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Server.prototype.listenFD = function (fd) {
|
Server.prototype.listenFD = function (fd, type) {
|
||||||
if (this.fd) {
|
if (this.fd) {
|
||||||
throw new Error('Server already opened');
|
throw new Error('Server already opened');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fd = fd;
|
this.fd = fd;
|
||||||
|
this.type = type || null;
|
||||||
this._startWatcher();
|
this._startWatcher();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user