Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-02-14 09:56:32 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-02-14 11:43:24 +0300
commit3397720da67423f8e0125b671ab1336776241c8e (patch)
tree3d97609e2a1943e5f56dd2d30c30c9d73274aac9 /bin
parentfcc0ff0ffa105023f7203df9f59cb901946e19af (diff)
cmd: proper fatal error on port taken
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cmd.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index ad822d6..0820dd8 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -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 () {