From 567c6f4f2c39976d170111b816806453636f8241 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 1 May 2022 21:54:03 -0500 Subject: Reduce usage of AsyncRead We already receive everything from the server when it tells us the length, so we can actually just treat the stream as a Read instead of an AsyncRead. --- .../src/packets/login/clientbound_login_compression_packet.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs') diff --git a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs index a88c6cbf..a5ab78bb 100755 --- a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs @@ -1,4 +1,4 @@ -use std::hash::Hash; +use std::{hash::Hash, io::Read}; use crate::mc_buf::{Readable, Writable}; @@ -19,10 +19,8 @@ impl ClientboundLoginCompressionPacket { Ok(()) } - pub async fn read( - buf: &mut T, - ) -> Result { - let compression_threshold = buf.read_varint().await?; + pub fn read(buf: &mut impl Read) -> Result { + let compression_threshold = buf.read_varint()?; Ok(ClientboundLoginCompressionPacket { compression_threshold, -- cgit v1.2.3