diff --git a/crates/core/src/bc_protocol/connection/bcconn.rs b/crates/core/src/bc_protocol/connection/bcconn.rs index 08270cb..63cdf93 100644 --- a/crates/core/src/bc_protocol/connection/bcconn.rs +++ b/crates/core/src/bc_protocol/connection/bcconn.rs @@ -19,6 +19,9 @@ type MsgHandler = dyn 'static + Send + Sync + for<'a> Fn(&'a Bc) -> BoxFuture<'a #[derive(Default)] struct Subscriber { /// Subscribers based on their ID and their num + /// First filtered by ID then number + /// If num is None it will be upgraded to a Some based on the number the + /// camera assigns num: BTreeMap, Sender>>>, /// Subscribers based on their ID id: BTreeMap>, @@ -194,12 +197,22 @@ impl Poller { PollCommand::Bc(boxed_response) => { match *boxed_response { Ok(response) => { - let msg_num = response.meta.msg_num; let msg_id = response.meta.msg_id; - + let msg_num = response.meta.msg_num; + log::trace!( + "Looking for ID: {} with num: {}, in {:?} and {:?}", + msg_id, + msg_num, + self.subscribers.id.keys().to_owned(), + self.subscribers + .num + .iter() + .map(|(k, v)| (k, v.keys())) + .collect::>(), + ); match ( self.subscribers.id.get(&msg_id), - self.subscribers.num.get_mut(&msg_id), + self.subscribers.num.get_mut(&msg_id), // Both filter first on ID ) { (Some(occ), _) => { if let Some(reply) = occ(&response).await { diff --git a/crates/core/src/bc_protocol/snap.rs b/crates/core/src/bc_protocol/snap.rs index a1d23e1..ab7c09c 100644 --- a/crates/core/src/bc_protocol/snap.rs +++ b/crates/core/src/bc_protocol/snap.rs @@ -57,6 +57,7 @@ impl BcCamera { .. }) = msg.body { + drop(sub_get); // Ensure that we are NOT listening on that msgnum as the reply can come on ANY msgnum log::trace!("Got snap XML {} with size {}", filename, expected_size); // Messages are now sent on ID 109 but not with the same message ID // preumably because the camera considers it to be a new message rather