diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-02-25 17:19:11 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-08-27 17:45:04 +0200 |
commit | f337595441641ad36f6ab8ae770e56c1673ef692 (patch) | |
tree | 7abaa1634975c873d72f3003c17f996810680e35 /lib/net.js | |
parent | a43af39ffc369776f776c69e5287c9632349fc2b (diff) | |
download | android-node-v8-f337595441641ad36f6ab8ae770e56c1673ef692.tar.gz android-node-v8-f337595441641ad36f6ab8ae770e56c1673ef692.tar.bz2 android-node-v8-f337595441641ad36f6ab8ae770e56c1673ef692.zip |
lib,src: add unix socket getsockname/getpeername
The implementation is a minor API change in that socket.address() now
returns a `{ address: '/path/to/socket' }` object, like it does for TCP
and UDP sockets. Before this commit, it returned `socket._pipeName`,
which is a string when present.
Change common.PIPE on Windows from '\\\\.\\pipe\\libuv-test' to
'\\\\?\\pipe\\libuv-test'. Windows converts the '.' to a '?' when
creating a named pipe, meaning that common.PIPE didn't match the
result from NtQueryInformationFile().
Fixes: https://github.com/nodejs/node/issues/954
PR-URL: https://github.com/nodejs/node/pull/956
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'lib/net.js')
-rw-r--r-- | lib/net.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/net.js b/lib/net.js index 10e7896784..c3ccebb642 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1339,16 +1339,14 @@ Server.prototype.listen = function() { else listen(self, null, h.port | 0, 4, backlog, undefined, h.exclusive); } else if (h.path && isPipeName(h.path)) { - var pipeName = self._pipeName = h.path; - listen(self, pipeName, -1, -1, backlog, undefined, h.exclusive); + listen(self, h.path, -1, -1, backlog, undefined, h.exclusive); } else { throw new Error('Invalid listen argument: ' + h); } } } else if (isPipeName(arguments[0])) { // UNIX socket or Windows pipe. - var pipeName = self._pipeName = arguments[0]; - listen(self, pipeName, -1, -1, backlog); + listen(self, arguments[0], -1, -1, backlog); } else if (arguments[1] === undefined || typeof arguments[1] === 'function' || @@ -1381,8 +1379,6 @@ Server.prototype.address = function() { this._handle.getsockname(out); // TODO(bnoordhuis) Check err and throw? return out; - } else if (this._pipeName) { - return this._pipeName; } else { return null; } |