From 58eccf96b0b60ccbc15884e55b5eeafa00923c82 Mon Sep 17 00:00:00 2001 From: TheiLLeniumStudios <104288623+TheiLLeniumStudios@users.noreply.github.com> Date: Mon, 15 Jan 2024 11:01:29 +0000 Subject: [PATCH] Incorporate SlantingStds changes --- src/client.rs | 9 ++++++--- src/server/tcp.rs | 2 +- src/server/udp.rs | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/client.rs b/src/client.rs index 4c6d448..149ad3d 100644 --- a/src/client.rs +++ b/src/client.rs @@ -71,8 +71,9 @@ impl Client { publisher: Sender, ) -> Self { let tokens = authenticate.get_tokens().iter().map(|token| token.to_string()).collect(); - let mut targets = Vec::with_capacity(30); - targets.resize_with(30, Default::default); + let capacity = 256; + let mut targets = Vec::with_capacity(capacity); + targets.resize_with(capacity, Default::default); Self { version, @@ -182,13 +183,15 @@ impl Client { let mut server_sync = ServerSync::default(); server_sync.set_max_bandwidth(144000); server_sync.set_session(self.session_id); - server_sync.set_welcome_text("SoZ Mumble Server".to_string()); + server_sync.set_welcome_text("ZUMBLE Server".to_string()); self.send_message(MessageKind::ServerSync, &server_sync).await } pub async fn send_server_config(&self) -> Result<(), MumbleError> { let mut server_config = ServerConfig::default(); + server_config.set_max_bandwidth(144000); + server_config.set_max_users(2048); server_config.set_allow_html(true); server_config.set_message_length(512); server_config.set_image_message_length(0); diff --git a/src/server/tcp.rs b/src/server/tcp.rs index aa81fc6..1fc4eb0 100644 --- a/src/server/tcp.rs +++ b/src/server/tcp.rs @@ -60,7 +60,7 @@ async fn handle_new_client(acceptor: TlsAcceptor, let (version, authenticate, crypt_state) = Client::init(&mut stream, server_version).await.context("init client")?; let (read, write) = io::split(stream); - let (tx, rx) = mpsc::channel(128); + let (tx, rx) = mpsc::channel(1024 * 4); let username = authenticate.get_username().to_string(); let client = { diff --git a/src/server/udp.rs b/src/server/udp.rs index 0a781f4..6370f6e 100644 --- a/src/server/udp.rs +++ b/src/server/udp.rs @@ -45,9 +45,9 @@ async fn handle_packet(mut buffer: BytesMut, size: usize, addr: SocketAddr, prot let mut send = Cursor::new(vec![0u8; 24]); send.write_u32::(protocol_version)?; send.write_u64::(timestamp)?; - send.write_u32::(0)?; - send.write_u32::(250)?; - send.write_u32::(72000)?; + send.write_u32::(state.read_err().await?.clients.len() as u32)?; + send.write_u32::(2048)?; + send.write_u32::(144000)?; socket.send_to(send.get_ref().as_slice(), addr).await?;