From 1d9581632fe3a99c2068d8c0cece9345c9397cc8 Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Fri, 21 Sep 2018 20:25:54 +0200 Subject: [PATCH] Cancel keep alive on join room --- server/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/index.js b/server/index.js index b6c4ab7..17e6b07 100644 --- a/server/index.js +++ b/server/index.js @@ -11,7 +11,6 @@ class SnapdropServer { this._wss.on('headers', (headers, response) => this._onHeaders(headers, response)); this._rooms = {}; - this._timerID = 0; console.log('Snapdrop is running on port', port); } @@ -119,6 +118,7 @@ class SnapdropServer { } _keepAlive(peer) { + this._cancelKeepAlive(peer); var timeout = 10000; if (!peer.lastBeat) { peer.lastBeat = Date.now(); @@ -130,7 +130,6 @@ class SnapdropServer { this._send(peer, { type: 'ping' }); - this._cancelKeepAlive(peer); peer.timerId = setTimeout(() => this._keepAlive(peer), timeout); }