Do not send unsubscribe messages to destroyed Providers (#4678).

This commit is contained in:
Richard Moore 2024-04-16 21:32:34 -04:00
parent 38e32d8214
commit c45935e29c
2 changed files with 2 additions and 0 deletions

View File

@ -69,6 +69,7 @@ export class SocketSubscriber implements Subscriber {
stop(): void { stop(): void {
(<Promise<number>>(this.#filterId)).then((filterId) => { (<Promise<number>>(this.#filterId)).then((filterId) => {
if (this.#provider.destroyed) { return; }
this.#provider.send("eth_unsubscribe", [ filterId ]); this.#provider.send("eth_unsubscribe", [ filterId ]);
}); });
this.#filterId = null; this.#filterId = null;

View File

@ -118,6 +118,7 @@ export class FilterIdSubscriber implements Subscriber {
if (filterIdPromise) { if (filterIdPromise) {
this.#filterIdPromise = null; this.#filterIdPromise = null;
filterIdPromise.then((filterId) => { filterIdPromise.then((filterId) => {
if (this.#provider.destroyed) { return; }
this.#provider.send("eth_uninstallFilter", [ filterId ]); this.#provider.send("eth_uninstallFilter", [ filterId ]);
}); });
} }