aboutsummaryrefslogtreecommitdiff
path: root/jsonrpc/src/client
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-06-22 15:53:22 +0200
committerhozan23 <hozan23@karyontech.net>2024-06-22 15:53:22 +0200
commiteed5fdb54cc261756c828d9c6bd1114e16ec6aa8 (patch)
tree703e0b31b2d84b9df3eb917e3b2dbf29fb7b0049 /jsonrpc/src/client
parent6c793e7ed3f3736e2169976f11e304f288ca6813 (diff)
jsonrpc/client: close the subscription channel when calling unsubscribe
Diffstat (limited to 'jsonrpc/src/client')
-rw-r--r--jsonrpc/src/client/subscriptions.rs4
1 files changed, 3 insertions, 1 deletions
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.