From eed5fdb54cc261756c828d9c6bd1114e16ec6aa8 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sat, 22 Jun 2024 15:53:22 +0200 Subject: jsonrpc/client: close the subscription channel when calling unsubscribe --- jsonrpc/src/client/subscriptions.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'jsonrpc/src/client') diff --git a/jsonrpc/src/client/subscriptions.rs b/jsonrpc/src/client/subscriptions.rs index fe66f96..3583b33 100644 --- a/jsonrpc/src/client/subscriptions.rs +++ b/jsonrpc/src/client/subscriptions.rs @@ -78,7 +78,9 @@ impl Subscriptions { /// Unsubscribe from the provided subscription id. pub(super) async fn unsubscribe(&self, id: &SubscriptionID) { - self.subs.lock().await.remove(id); + if let Some(sub) = self.subs.lock().await.remove(id) { + sub.close(); + } } /// Notifies the subscription about the given notification. -- cgit v1.2.3