diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-02-14 09:56:32 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-02-14 11:43:24 +0300 |
commit | 3397720da67423f8e0125b671ab1336776241c8e (patch) | |
tree | 3d97609e2a1943e5f56dd2d30c30c9d73274aac9 /bin | |
parent | fcc0ff0ffa105023f7203df9f59cb901946e19af (diff) |
cmd: proper fatal error on port taken
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cmd.js | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -323,13 +323,11 @@ function runDownload (torrentId) { server.listen(argv.port, initServer) .on('error', function (err) { - // In case the port is unusable if (err.code === 'EADDRINUSE' || err.code === 'EACCES') { - // Let the OS choose one for us - server.listen(0, initServer) - } else { - throw err + // If port is taken, pick one a free one automatically + return server.listen(0, initServer) } + fatalError(err) }) server.once('connection', function () { |