From 5bc36cc591c5d2f80f950a51cf326143dd871b2f Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Wed, 24 Nov 2021 16:22:28 -0600 Subject: [PATCH] Correctly replace subscriptions if ID matches --- src/proto.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/proto.rs b/src/proto.rs index e6dc070..0f529b6 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -55,9 +55,11 @@ impl Proto { info!("Dropping subscription with huge ({}) length", sub_id_len); return; } - // check if an existing subscription exists. + // check if an existing subscription exists, and replace if so if self.subscriptions.contains_key(&k) { - info!("Client requested a subscription with an already-existing key"); + self.subscriptions.remove(&k); + self.subscriptions.insert(k, s); + info!("Replaced existing subscription"); return; }