mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-02-16 02:20:43 +00:00
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -14,6 +14,7 @@ use bytes::Bytes;
|
|||||||
use clap::{Arg, Command};
|
use clap::{Arg, Command};
|
||||||
use tokio::time::Duration;
|
use tokio::time::Duration;
|
||||||
|
|
||||||
|
#[cfg(feature = "webrtc")]
|
||||||
use webrtc::peer_connection::math_rand_alpha;
|
use webrtc::peer_connection::math_rand_alpha;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|||||||
@@ -42,4 +42,4 @@ impl WebRTCStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _main() {}
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ pub struct WebRTCStream {
|
|||||||
send_timeout: u64,
|
send_timeout: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// message size limit for Chromium
|
/// Standard maximum message size for WebRTC data channels (RFC 8831, 65535 bytes).
|
||||||
|
/// Most browsers, including Chromium, enforce this protocol limit.
|
||||||
const DATA_CHANNEL_BUFFER_SIZE: u16 = u16::MAX;
|
const DATA_CHANNEL_BUFFER_SIZE: u16 = u16::MAX;
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
@@ -222,9 +223,8 @@ impl WebRTCStream {
|
|||||||
Ok(k) => {
|
Ok(k) => {
|
||||||
lock.remove(&k);
|
lock.remove(&k);
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"WebRTC session removed key from cache: {} current len: {}",
|
"WebRTC session removed key from cache: {}",
|
||||||
k,
|
k
|
||||||
lock.len()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(_e) => {}
|
Err(_e) => {}
|
||||||
@@ -274,7 +274,7 @@ impl WebRTCStream {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub async fn get_local_endpoint(&self) -> ResultType<String> {
|
pub async fn get_local_endpoint(&self) -> ResultType<String> {
|
||||||
if let Some(local_desc) = self.pc.local_description().await {
|
if let Some(local_desc) = self.pc.local_description().await {
|
||||||
let sdp = serde_json::to_string(&local_desc).unwrap_or_default();
|
let sdp = serde_json::to_string(&local_desc)?;
|
||||||
let endpoint = Self::sdp_to_endpoint(&sdp);
|
let endpoint = Self::sdp_to_endpoint(&sdp);
|
||||||
Ok(endpoint)
|
Ok(endpoint)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user