From 3a919aef545feeaecd79e7cd9b4f40eb1bbafe0c Mon Sep 17 00:00:00 2001 From: lc Date: Sat, 15 Nov 2025 00:27:09 +0800 Subject: [PATCH] minor change --- examples/webrtc.rs | 5 ++++- examples/webrtc_dummy.rs | 2 +- src/webrtc.rs | 18 +++++++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/examples/webrtc.rs b/examples/webrtc.rs index e9af423..80e405a 100644 --- a/examples/webrtc.rs +++ b/examples/webrtc.rs @@ -20,7 +20,10 @@ use webrtc::peer_connection::math_rand_alpha; async fn main() -> Result<()> { #[cfg(not(feature = "webrtc"))] if true { - println!("The webrtc feature is not enabled. Please enable the webrtc feature to run this example."); + println!( + "The webrtc feature is not enabled. \ + Please enable the webrtc feature to run this example." + ); return Ok(()); } let app = Command::new("webrtc-stream") diff --git a/examples/webrtc_dummy.rs b/examples/webrtc_dummy.rs index 78d5490..e406990 100644 --- a/examples/webrtc_dummy.rs +++ b/examples/webrtc_dummy.rs @@ -42,4 +42,4 @@ impl WebRTCStream { } } -fn main() {} +fn _main() {} diff --git a/src/webrtc.rs b/src/webrtc.rs index 7fda077..5c0bc4c 100644 --- a/src/webrtc.rs +++ b/src/webrtc.rs @@ -218,8 +218,8 @@ impl WebRTCStream { log::debug!("WebRTC session stream closed"); let mut lock = SESSIONS.lock().await; - match Self::get_key_for_peer(&pc_for_close2, start_local_offer).await.ok() { - Some(k) => { + match Self::get_key_for_peer(&pc_for_close2, start_local_offer).await { + Ok(k) => { lock.remove(&k); log::debug!( "WebRTC session removed key from cache: {} current len: {}", @@ -227,7 +227,7 @@ impl WebRTCStream { lock.len() ); } - None => return, + Err(_e) => {} } } _ => {} @@ -421,7 +421,8 @@ mod tests { "" ); - sdp_str = "v=0 + sdp_str = "\ +v=0 o=- 7400546379179479477 208696200 IN IP4 0.0.0.0 s=- t=0 0 @@ -443,7 +444,8 @@ a=ice-pwd:BtIqlWHfwhsJdFiBROeLuEbNmYfHxRfT".to_owned(); "sha-256 97:52:D6:1F:1E:87:6C:DA:B8:21:95:64:A5:85:89:FA:02:71:C7:4D:B3:FD:25:92:40:FB:6B:65:24:3C:79:88" ); - sdp_str = "v=0 + sdp_str = "\ +v=0 o=- 7400546379179479477 208696200 IN IP4 0.0.0.0 s=- t=0 0 @@ -465,7 +467,8 @@ a=ice-pwd:BtIqlWHfwhsJdFiBROeLuEbNmYfHxRfT".to_owned(); "sha-256 97:52:D6:1F:1E:87:6C:DA:B8:21:95:64:A5:85:89:FA:02:71:C7:4D:B3:FD:25:92:40:FB:6B:65:24:3C:79:88" ); - sdp_str = "v=0 + sdp_str = "\ +v=0 o=- 7400546379179479477 208696200 IN IP4 0.0.0.0 s=- t=0 0 @@ -488,7 +491,8 @@ a=ice-pwd:BtIqlWHfwhsJdFiBROeLuEbNmYfHxRfT" "can not find fingerprint attribute" ); - sdp_str = "v=0 + sdp_str = "\ +v=0 o=- 7400546379179479477 208696200 IN IP4 0.0.0.0 s=- t=0 0