Comparing version 2.0.4 to 2.0.5
@@ -373,46 +373,40 @@ | ||
this.server.on('error', function(e) { | ||
//if (e.code == 'ECONNREFUSED') { | ||
// No other server listening, so we can delete stale | ||
// socket file and reopen server socket | ||
try { | ||
fs.unlink(port); | ||
} catch(e) { | ||
} | ||
self.server.listen(port, host, fn); | ||
//} | ||
}); | ||
if (unixSocket) { | ||
// TODO: move out | ||
this.server.on('error', function(e) { | ||
debug('Got error while trying to bind', e.stack || e); | ||
if (e.code == 'EADDRINUSE') { | ||
// Unix file socket and error EADDRINUSE is the case if | ||
// the file socket exists. We check if other processes | ||
// listen on file socket, otherwise it is a stale socket | ||
// that we could reopen | ||
// We try to connect to socket via plain network socket | ||
var clientSocket = new net.Socket(); | ||
clientSocket.on('error', function(e2) { | ||
debug('Got sub-error', e2); | ||
if (e2.code == 'ECONNREFUSED') { | ||
// No other server listening, so we can delete stale | ||
// socket file and reopen server socket | ||
try { | ||
fs.unlink(port); | ||
self.server.listen(port, host, fn); | ||
} catch(e) { | ||
console.error(e.stack || e); | ||
} | ||
} | ||
}); | ||
// if (unixSocket) { | ||
// // TODO: move out | ||
// this.server.on('error', function(e) { | ||
// if (e.code == 'EADDRINUSE') { | ||
// // Unix file socket and error EADDRINUSE is the case if | ||
// // the file socket exists. We check if other processes | ||
// // listen on file socket, otherwise it is a stale socket | ||
// // that we could reopen | ||
// // We try to connect to socket via plain network socket | ||
// var clientSocket = new net.Socket(); | ||
clientSocket.connect({path: port}, function() { | ||
// Connection is possible, so other server is listening | ||
// on this file socket | ||
console.error('Process is already listening on socket %s', port); | ||
process.exit(0); | ||
}); | ||
} | ||
}); | ||
} | ||
// clientSocket.on('error', function(e2) { | ||
// if (e2.code == 'ECONNREFUSED') { | ||
// // No other server listening, so we can delete stale | ||
// // socket file and reopen server socket | ||
// fs.unlink(port); | ||
// self.server.listen(port, host, fn); | ||
// } | ||
// }); | ||
// clientSocket.connect({path: port}, function() { | ||
// // Connection is possible, so other server is listening | ||
// // on this file socket | ||
// throw e; | ||
// }); | ||
// } | ||
// }); | ||
// } | ||
this.server.listen(port, host, fn); | ||
return this; | ||
}; |
{ | ||
"name": "pm2-axon", | ||
"description": "High-level messaging & socket patterns implemented in pure js", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38800
1026