From ec6d35c2f3b13afbf4a000520ff5bb50af003d3b Mon Sep 17 00:00:00 2001 From: Tim Lundqvist Date: Tue, 15 May 2018 15:16:17 +0200 Subject: [PATCH] fix: reject on server listen error See trs/ftp-srv#84 --- src/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.js b/src/index.js index 68e5a700..8869b1ec 100644 --- a/src/index.js +++ b/src/index.js @@ -64,7 +64,9 @@ class FtpServer extends EventEmitter { .then(hostname => { this.url.hostname = hostname; return new Promise((resolve, reject) => { + this.server.once('error', reject); this.server.listen(this.url.port, err => { + this.server.removeListener('error', reject); if (err) return reject(err); this.log.info({ protocol: this.url.protocol.replace(/\W/g, ''),