diff --git a/extensions/warp-blink-wrtc/src/blink_impl/blink_controller.rs b/extensions/warp-blink-wrtc/src/blink_impl/blink_controller.rs index a4efb353d..e8c347b6c 100644 --- a/extensions/warp-blink-wrtc/src/blink_impl/blink_controller.rs +++ b/extensions/warp-blink-wrtc/src/blink_impl/blink_controller.rs @@ -284,7 +284,7 @@ async fn run( let peer_str = peer_id.to_string(); if peer_str < own_id_str { log::debug!("dialing peer"); - if let Err(e) = webrtc_controller.dial(&peer_id).await { + if let Err(e) = webrtc_controller.dial(peer_id).await { log::error!("failed to dial peer: {e}"); continue; } diff --git a/extensions/warp-blink-wrtc/src/blink_impl/data/mod.rs b/extensions/warp-blink-wrtc/src/blink_impl/data/mod.rs index d6b36511b..8872bbe9a 100644 --- a/extensions/warp-blink-wrtc/src/blink_impl/data/mod.rs +++ b/extensions/warp-blink-wrtc/src/blink_impl/data/mod.rs @@ -70,14 +70,14 @@ impl CallDataMap { } pub fn get_active_mut(&mut self) -> Option<&mut CallData> { - match self.active_call.clone() { + match self.active_call { None => None, Some(call_id) => self.map.get_mut(&call_id), } } pub fn get_active(&self) -> Option<&CallData> { - match self.active_call.clone() { + match self.active_call { None => None, Some(call_id) => self.map.get(&call_id), } diff --git a/extensions/warp-blink-wrtc/src/blink_impl/gossipsub_sender.rs b/extensions/warp-blink-wrtc/src/blink_impl/gossipsub_sender.rs index 4c88a55bb..31cac9de3 100644 --- a/extensions/warp-blink-wrtc/src/blink_impl/gossipsub_sender.rs +++ b/extensions/warp-blink-wrtc/src/blink_impl/gossipsub_sender.rs @@ -218,41 +218,33 @@ async fn run( _ = retry_timer.tick() => { for (_dest, queue) in ecdh_queue.iter_mut() { while let Some(cmd) = queue.pop_front() { - match cmd { - GossipSubCmd::SendEcdh { dest, signal, topic } => { - let encrypted = match ecdh_encrypt(&own_id, &dest, signal.clone()) { - Ok(r) => r, - Err(e) => { - log::error!("failed to encrypt ecdh message: {e}"); - continue; - } - }; - if ipfs.pubsub_publish(topic.clone(), encrypted).await.is_err() { - queue.push_front(GossipSubCmd::SendEcdh { dest, signal, topic }); - break; + if let GossipSubCmd::SendEcdh { dest, signal, topic } = cmd { + let encrypted = match ecdh_encrypt(&own_id, &dest, signal.clone()) { + Ok(r) => r, + Err(e) => { + log::error!("failed to encrypt ecdh message: {e}"); + continue; } + }; + if ipfs.pubsub_publish(topic.clone(), encrypted).await.is_err() { + queue.push_front(GossipSubCmd::SendEcdh { dest, signal, topic }); + break; } - _ => {} } } } } _ = announce_timer.tick() => { - if let Some(cmd) = to_announce.as_ref() { - match cmd { - GossipSubCmd::Announce { group_key, signal, topic } => { - let encrypted = match Cipher::direct_encrypt(&signal, &group_key) { - Ok(r) => r, - Err(e) => { - log::error!("failed to encrypt aes message: {e}"); - continue; - } - }; - if let Err(e) = ipfs.pubsub_publish(topic.clone(), encrypted).await { - log::error!("failed to publish aes message: {e}"); - } + if let Some(GossipSubCmd::Announce { group_key, signal, topic }) = to_announce.as_ref() { + let encrypted = match Cipher::direct_encrypt(signal, group_key) { + Ok(r) => r, + Err(e) => { + log::error!("failed to encrypt aes message: {e}"); + continue; } - _ => {} + }; + if let Err(e) = ipfs.pubsub_publish(topic.clone(), encrypted).await { + log::error!("failed to publish aes message: {e}"); } } } @@ -288,7 +280,7 @@ async fn run( } }; if ipfs.pubsub_publish(topic.clone(), encrypted).await.is_err() { - let queue = ecdh_queue.entry(dest.clone()).or_insert(VecDeque::new()); + let queue = ecdh_queue.entry(dest.clone()).or_default(); queue.push_back(GossipSubCmd::SendEcdh { dest, signal, topic }); } }