Skip to content

Commit

Permalink
fix: wrap _rpcWebSocketGeneration around when about to overflow (#28428)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher authored Oct 17, 2022
1 parent f896513 commit 5d17215
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web3.js/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5d17215

Please sign in to comment.