From 5cf5bea884c0d22e2d5f66e67e3cd3c8ed8d4fea Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Wed, 8 Aug 2018 04:16:13 +0300 Subject: [PATCH] fix(ssh): prevent ssh relay startup on exit --- src/background/p2p.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/background/p2p.js b/src/background/p2p.js index 7a4c1fc..2bdb32d 100644 --- a/src/background/p2p.js +++ b/src/background/p2p.js @@ -139,6 +139,9 @@ class p2p { checkPortAndRedirect(address, port) { isPortReachable(port, {host: address}).then((isAvailable) => { + if(this.closing) + return // responce can be very late, and ssh can start after closing of program, this will break on linux + this.p2pStatus = isAvailable ? 2 : 0 this.send('p2pStatus', this.p2pStatus) @@ -183,6 +186,7 @@ class p2p { close() { + this.closing = true if(this.ssh) { logT('ssh', 'closing ssh...')