snapdrop

A Progressive Web App for local file sharing
git clone http://git.hanabi.in/repos/snapdrop.git
Log | Files | Refs | README | LICENSE

commit 61697d3abc5430ad58478b12a9b7fc36d8978881
parent b0fd89eb96f69279a01b64ce5db29c020838f87d
Author: RobinLinus <robinlinus@users.noreply.github.com>
Date:   Fri, 21 Sep 2018 20:01:59 +0200

Cancel keep alive on join room

Diffstat:
Mserver/index.js | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/index.js b/server/index.js @@ -53,11 +53,13 @@ class SnapdropServer { } _joinRoom(peer) { - this._cancelKeepAlive(peer); // if room doesn't exist, create it if (!this._rooms[peer.ip]) { this._rooms[peer.ip] = {}; } + if (this._rooms[peer.ip][peer.id]) { + this._cancelKeepAlive(this._rooms[peer.ip][peer.id]); + } // console.log(peer.id, ' joined the room', peer.ip); // notify all other peers @@ -128,6 +130,7 @@ class SnapdropServer { type: 'ping' }); } + this._cancelKeepAlive(peer); peer.timerId = setTimeout(() => this._keepAlive(peer), timeout); }