From 8d87af870f365e08406c807b1948f143d05a74d0 Mon Sep 17 00:00:00 2001 From: Christopher Monsanto Date: Sat, 11 Apr 2015 21:11:19 -0400 Subject: [PATCH] Use 0.0.0.0 if Config.bindaddress is missing. This is because io.js tries ipv6 first, which the rest of PS does not support very well. --- sockets.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sockets.js b/sockets.js index 24ad5c6f76..05fc31a216 100644 --- a/sockets.js +++ b/sockets.js @@ -427,17 +427,17 @@ if (cluster.isMaster) { }); }); server.installHandlers(app, {}); - if (Config.bindaddress === '0.0.0.0') Config.bindaddress = undefined; - app.listen(Config.port, Config.bindaddress || undefined); - console.log('Worker ' + cluster.worker.id + ' now listening on ' + (Config.bindaddress || '*') + ':' + Config.port); + if (!Config.bindaddress) Config.bindaddress = '0.0.0.0'; + app.listen(Config.port, Config.bindaddress); + console.log('Worker ' + cluster.worker.id + ' now listening on ' + Config.bindaddress + ':' + Config.port); if (appssl) { server.installHandlers(appssl, {}); - appssl.listen(Config.ssl.port); + appssl.listen(Config.ssl.port, Config.bindaddress); console.log('Worker ' + cluster.worker.id + ' now listening for SSL on port ' + Config.ssl.port); } - console.log('Test your server at http://' + (Config.bindaddress || 'localhost') + ':' + Config.port); + console.log('Test your server at http://' + (Config.bindaddress === '0.0.0.0' ? 'localhost' : Config.bindaddress) + ':' + Config.port); require('./repl.js').start('sockets-', cluster.worker.id + '-' + process.pid, function (cmd) { return eval(cmd); }); }