Skip to content

Commit c45935e

Browse files
committed
Do not send unsubscribe messages to destroyed Providers (#4678).
1 parent 38e32d8 commit c45935e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src.ts/providers/provider-socket.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class SocketSubscriber implements Subscriber {
6969

7070
stop(): void {
7171
(<Promise<number>>(this.#filterId)).then((filterId) => {
72+
if (this.#provider.destroyed) { return; }
7273
this.#provider.send("eth_unsubscribe", [ filterId ]);
7374
});
7475
this.#filterId = null;

src.ts/providers/subscriber-filterid.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class FilterIdSubscriber implements Subscriber {
118118
if (filterIdPromise) {
119119
this.#filterIdPromise = null;
120120
filterIdPromise.then((filterId) => {
121+
if (this.#provider.destroyed) { return; }
121122
this.#provider.send("eth_uninstallFilter", [ filterId ]);
122123
});
123124
}

0 commit comments

Comments
 (0)