fix: wrap _rpcWebSocketGeneration around when about to overflow (#28428)

This commit is contained in:
Steven Luscher 2022-10-16 23:33:28 -07:00 committed by GitHub
parent f896513864
commit 5d172151a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -5084,7 +5084,8 @@ export class Connection {
*/
_wsOnClose(code: number) {
this._rpcWebSocketConnected = false;
this._rpcWebSocketGeneration++;
this._rpcWebSocketGeneration =
(this._rpcWebSocketGeneration + 1) % Number.MAX_SAFE_INTEGER;
if (this._rpcWebSocketIdleTimeout) {
clearTimeout(this._rpcWebSocketIdleTimeout);
this._rpcWebSocketIdleTimeout = null;