Cancel keep alive on join room
This commit is contained in:
parent
e71564a97c
commit
1d9581632f
1 changed files with 1 additions and 2 deletions
|
@ -11,7 +11,6 @@ class SnapdropServer {
|
||||||
this._wss.on('headers', (headers, response) => this._onHeaders(headers, response));
|
this._wss.on('headers', (headers, response) => this._onHeaders(headers, response));
|
||||||
|
|
||||||
this._rooms = {};
|
this._rooms = {};
|
||||||
this._timerID = 0;
|
|
||||||
|
|
||||||
console.log('Snapdrop is running on port', port);
|
console.log('Snapdrop is running on port', port);
|
||||||
}
|
}
|
||||||
|
@ -119,6 +118,7 @@ class SnapdropServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
_keepAlive(peer) {
|
_keepAlive(peer) {
|
||||||
|
this._cancelKeepAlive(peer);
|
||||||
var timeout = 10000;
|
var timeout = 10000;
|
||||||
if (!peer.lastBeat) {
|
if (!peer.lastBeat) {
|
||||||
peer.lastBeat = Date.now();
|
peer.lastBeat = Date.now();
|
||||||
|
@ -130,7 +130,6 @@ class SnapdropServer {
|
||||||
|
|
||||||
this._send(peer, { type: 'ping' });
|
this._send(peer, { type: 'ping' });
|
||||||
|
|
||||||
this._cancelKeepAlive(peer);
|
|
||||||
peer.timerId = setTimeout(() => this._keepAlive(peer), timeout);
|
peer.timerId = setTimeout(() => this._keepAlive(peer), timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue