Skip to content

Commit

Permalink
fix: wrap _rpcWebSocketGeneration around when about to overflow (sola…
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher authored and nickfrosty committed Jan 4, 2023
1 parent 0e37dbe commit 6139976
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 6139976

Please sign in to comment.