From 54646471642ce05273c5e6d7ff3f1896bf5ac65f Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Sat, 2 Jan 2016 15:50:43 +0100 Subject: [PATCH] Ignore messages from unknown channels. It occasionally happens that messages on a channel are received before the subscription confirmation, which would cause a panic when looking for the subscription. Changed to simply ignore those. --- src/mercury.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mercury.rs b/src/mercury.rs index d317b2e..e2dd311 100644 --- a/src/mercury.rs +++ b/src/mercury.rs @@ -147,8 +147,8 @@ impl MercuryManager { MercuryCallback::Subscription(tx) => self.complete_subscription(response, tx), MercuryCallback::Channel => { self.subscriptions - .get(header.get_uri()).unwrap() - .send(response).unwrap() + .get(header.get_uri()) + .map(|tx| tx.send(response).unwrap()); } } }