瀏覽代碼

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.
Paul Lietar 9 年之前
父節點
當前提交
5464647164
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/mercury.rs

+ 2 - 2
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());
             }
         }
     }