mirror of
https://github.com/danbulant/discord.js
synced 2026-06-18 06:01:03 +00:00
Fix sequence and timestamp growing too large
This commit is contained in:
parent
7f90d4ebc5
commit
a76e4c064d
1 changed files with 2 additions and 0 deletions
|
|
@ -50,6 +50,8 @@ class StreamDispatcher extends Writable {
|
|||
const next = FRAME_LENGTH + (this.startTime + (this._sdata.count * FRAME_LENGTH) - Date.now());
|
||||
setTimeout(done.bind(this), next);
|
||||
// Do overflow checks here!
|
||||
if (this._sdata.sequence === (2 ** 16) - 1) this._sdata.sequence = -1;
|
||||
if (this._sdata.timestamp === (2 ** 32) - 1) this._sdata.timestamp = -1;
|
||||
this._sdata.sequence++;
|
||||
this._sdata.timestamp += 960;
|
||||
this._sdata.count++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue