Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unix socket reconnect fails #168

Open
datvong-wm opened this issue Jun 11, 2018 · 2 comments
Open

unix socket reconnect fails #168

datvong-wm opened this issue Jun 11, 2018 · 2 comments

Comments

@datvong-wm
Copy link

On linux, call to connect
socket.connect("unix:///home/mypath")

fails with

RangeError: "port" option should be >= 0 and < 65536: NaN
    at lookupAndConnect (net.js:970:13)
    at Socket.connect (net.js:945:5)
    at Socket.connect (net.js:904:37)
    at SubSocket.Socket.connect (/home/app/node_modules/axon/lib/sockets/sock.js:295:8)
    at Timeout._onTimeout (/home/app/node_modules/axon/lib/sockets/sock.js:280:12)

First time called, the port containing "unix:///home/mypath" is parsed so port="/home/mypath"

if (port.protocol == "unix:") {

    if (port.protocol == "unix:") {
      host = fn;
      fn = undefined;
      port = port.pathname;

On timeout and subsequent retry, port of "/home/mypath" will fail because protocol "unix://" has been stripped from port.

    setTimeout(function(){
      debug('%s attempting reconnect', self.type);
      self.emit('reconnect attempt');
      sock.destroy();
      self.connect(port, host);
@datvong-wm
Copy link
Author

PR #150 is a fix for this issue.

@METACEO
Copy link

METACEO commented Jun 19, 2018

@datvong-wm nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants