mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
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:
1 parent
bca16a0581
commit
de6d663a67
1 file changed
+2
-1
+2
-1
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user