From 04eaa5c3d01a8f3a599a3a1abf7205eed80df4a2 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 25 Dec 2024 06:16:10 +0000 Subject: remove dependency on bytes crate for azalea-protocol and fix memory leak --- azalea-client/src/raw_connection.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'azalea-client/src') diff --git a/azalea-client/src/raw_connection.rs b/azalea-client/src/raw_connection.rs index 3eacf528..2091c14e 100644 --- a/azalea-client/src/raw_connection.rs +++ b/azalea-client/src/raw_connection.rs @@ -33,12 +33,12 @@ pub struct RawConnection { #[derive(Clone)] struct RawConnectionReader { - pub incoming_packet_queue: Arc>>>, + pub incoming_packet_queue: Arc>>>, pub run_schedule_sender: mpsc::UnboundedSender<()>, } #[derive(Clone)] struct RawConnectionWriter { - pub outgoing_packets_sender: mpsc::UnboundedSender>, + pub outgoing_packets_sender: mpsc::UnboundedSender>, } #[derive(Error, Debug)] @@ -54,7 +54,7 @@ pub enum WritePacketError { SendError { #[from] #[backtrace] - source: SendError>, + source: SendError>, }, } @@ -93,7 +93,7 @@ impl RawConnection { } } - pub fn write_raw_packet(&self, raw_packet: Vec) -> Result<(), WritePacketError> { + pub fn write_raw_packet(&self, raw_packet: Box<[u8]>) -> Result<(), WritePacketError> { self.writer.outgoing_packets_sender.send(raw_packet)?; Ok(()) } @@ -120,7 +120,7 @@ impl RawConnection { !self.read_packets_task.is_finished() } - pub fn incoming_packet_queue(&self) -> Arc>>> { + pub fn incoming_packet_queue(&self) -> Arc>>> { self.reader.incoming_packet_queue.clone() } @@ -161,7 +161,7 @@ impl RawConnectionWriter { pub async fn write_task( self, mut write_conn: RawWriteConnection, - mut outgoing_packets_receiver: mpsc::UnboundedReceiver>, + mut outgoing_packets_receiver: mpsc::UnboundedReceiver>, ) { while let Some(raw_packet) = outgoing_packets_receiver.recv().await { if let Err(err) = write_conn.write(&raw_packet).await { -- cgit v1.2.3