Created
January 19, 2012 21:42
-
-
Save orlandov/1642928 to your computer and use it in GitHub Desktop.
[PATCH] Re-enable listenFD via pipe_wrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 25d5da023f0fbb901c3b91b5137191b506e9ee0d Mon Sep 17 00:00:00 2001 | |
| From: Orlando Vazquez <[email protected]> | |
| Date: Thu, 19 Jan 2012 10:20:01 -0800 | |
| Subject: [PATCH] Re-enable listenFD via pipe_wrap | |
| --- | |
| deps/uv/src/unix/pipe.c | 1 - | |
| lib/net.js | 9 +++++++-- | |
| 2 files changed, 7 insertions(+), 3 deletions(-) | |
| diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c | |
| index 5509136..f1be9e9 100644 | |
| --- a/deps/uv/src/unix/pipe.c | |
| +++ b/deps/uv/src/unix/pipe.c | |
| @@ -251,7 +251,6 @@ void uv__pipe_accept(EV_P_ ev_io* watcher, int revents) { | |
| pipe = watcher->data; | |
| assert(pipe->type == UV_NAMED_PIPE); | |
| - assert(pipe->pipe_fname != NULL); | |
| sockfd = uv__accept(pipe->fd, (struct sockaddr *)&saddr, sizeof saddr); | |
| if (sockfd == -1) { | |
| diff --git a/lib/net.js b/lib/net.js | |
| index 8547941..81f19c6 100644 | |
| --- a/lib/net.js | |
| +++ b/lib/net.js | |
| @@ -870,8 +870,13 @@ Server.prototype._emitCloseIfDrained = function() { | |
| }; | |
| -Server.prototype.listenFD = function(fd, type) { | |
| - throw new Error('This API is no longer supported. See child_process.fork'); | |
| +Server.prototype.listenFD = function(fd) { | |
| + var Pipe = process.binding("pipe_wrap").Pipe; | |
| + var p = new Pipe(true); | |
| + p.open(fd); | |
| + p.readable = p.writable = true; | |
| + this._handle = p; | |
| + this.listen(); | |
| }; | |
| -- | |
| 1.7.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment