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:
Родитель
bca16a0581
Коммит
de6d663a67
|
@ -1167,12 +1167,13 @@ Server.prototype.listen = function () {
|
|||
}
|
||||
};
|
||||
|
||||
Server.prototype.listenFD = function (fd) {
|
||||
Server.prototype.listenFD = function (fd, type) {
|
||||
if (this.fd) {
|
||||
throw new Error('Server already opened');
|
||||
}
|
||||
|
||||
this.fd = fd;
|
||||
this.type = type || null;
|
||||
this._startWatcher();
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче