balanced buffers and channel sizes

This commit is contained in:
2026-03-20 18:00:19 +07:00
parent 43a0b9daed
commit b258db671b
3 changed files with 7 additions and 5 deletions
+4 -3
View File
@@ -28,7 +28,8 @@ use tokio::{
};
use tokio_util::sync::CancellationToken;
pub const BUF_SIZE: usize = 16384;
pub const BUF_SIZE: usize = 65536;
pub const CHANNEL_SIZE: usize = 256;
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ConnectionRole {
@@ -139,7 +140,7 @@ impl ClientHandler {
}
}
let (mux_tx, mux_rx) = mpsc::channel(BUF_SIZE);
let (mux_tx, mux_rx) = mpsc::channel(CHANNEL_SIZE);
let muxer = Muxer::new(mux_tx, true);
let handler =
@@ -281,7 +282,7 @@ impl ServerHandler {
impl TunnelHandler for ServerHandler {
async fn run(mut self) -> Result<(), String> {
info!("Acting as TLS Server");
let (mux_tx, mux_rx) = mpsc::channel(BUF_SIZE);
let (mux_tx, mux_rx) = mpsc::channel(CHANNEL_SIZE);
let muxer = Muxer::new(mux_tx, false);
// Тайм-аут для защиты от "сканеров-молчунов" (Active Probing)