Forráskód Böngészése

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 éve
szülő
commit
5464647164
1 módosított fájl, 2 hozzáadás és 2 törlés
  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());
             }
         }
     }