refactor: 清理死代码和优化日志级别

- 删除未使用的函数和常量
  - create_public_key_message (rustdesk/connection)
  - decode_audio_packet, AudioPacketHeader (web/audio_ws)
  - io_error_to_hid_error, close_device, close_all_devices (hid)
  - shutdown_rx (rustdesk/mod)
  - CONNECT_TIMEOUT_MS, RESP_ERR_SEND_FAILED

- 调整日志级别
  - Session lagged: warn -> debug
  - 移除 H264 NAL trace 日志
  - 移除 Frame distribution lagged trace 日志
  - 移除 absolute mouse report trace 日志

- 优化 broadcast channel 缓冲区大小 8 -> 16

- 修复条件编译
  - static_files.rs: 添加 debug_assertions 条件
This commit is contained in:
mofeng-git
2026-01-02 01:48:44 +08:00
parent 13516d5cbd
commit 0fc5be21c6
22 changed files with 255 additions and 141 deletions

View File

@@ -723,16 +723,6 @@ impl Connection {
}
}
/// Create public key message (for legacy compatibility)
fn create_public_key_message(&self) -> hbb::Message {
hbb::Message {
union: Some(message::Union::PublicKey(hbb::PublicKey {
asymmetric_value: self.keypair.public_key_bytes().to_vec(),
symmetric_value: vec![],
})),
}
}
/// Handle peer's public key and negotiate session encryption
/// After successful negotiation, send Hash message for password authentication
async fn handle_peer_public_key(

View File

@@ -383,12 +383,6 @@ impl RustDeskService {
self.start().await
}
/// Get a shutdown receiver for graceful shutdown handling
#[allow(dead_code)]
pub fn shutdown_rx(&self) -> broadcast::Receiver<()> {
self.shutdown_tx.subscribe()
}
/// Save keypair and UUID to config
/// Returns the updated config if changes were made
pub fn save_credentials(&self) -> Option<RustDeskConfig> {

View File

@@ -31,10 +31,6 @@ const MIN_REG_TIMEOUT_MS: u64 = 3_000;
/// Maximum registration timeout
const MAX_REG_TIMEOUT_MS: u64 = 30_000;
/// Connection timeout
#[allow(dead_code)]
const CONNECT_TIMEOUT_MS: u64 = 18_000;
/// Timer interval for checking registration status
const TIMER_INTERVAL_MS: u64 = 300;
@@ -682,7 +678,6 @@ impl AddrMangle {
}
/// Decode bytes to SocketAddr using RustDesk's mangle algorithm
#[allow(dead_code)]
pub fn decode(bytes: &[u8]) -> Option<SocketAddr> {
use std::convert::TryInto;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddrV4};