aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/read.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-07-29 02:59:40 -0500
committermat <github@matdoes.dev>2022-07-29 02:59:40 -0500
commit4ee4687053b7442f518823b08099c156f4da4e83 (patch)
tree11bb56330ed172a961d0a19069a086798d0aa804 /azalea-protocol/src/read.rs
parentaadf2de3cb751d563e743599a7fb345c08010f5a (diff)
downloadazalea-drasl-4ee4687053b7442f518823b08099c156f4da4e83.tar.xz
Split clientbound and serverbound packets
Diffstat (limited to 'azalea-protocol/src/read.rs')
-rwxr-xr-xazalea-protocol/src/read.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs
index e19b5538..6a56ccfb 100755
--- a/azalea-protocol/src/read.rs
+++ b/azalea-protocol/src/read.rs
@@ -1,4 +1,4 @@
-use crate::{connect::PacketFlow, packets::ProtocolPacket};
+use crate::packets::ProtocolPacket;
use azalea_buf::{read_varint_async, Readable};
use azalea_crypto::Aes128CfbDec;
use flate2::read::ZlibDecoder;
@@ -31,13 +31,10 @@ where
}
}
-fn packet_decoder<P: ProtocolPacket>(
- stream: &mut impl Read,
- flow: &PacketFlow,
-) -> Result<P, String> {
+fn packet_decoder<P: ProtocolPacket>(stream: &mut impl Read) -> Result<P, String> {
// Packet ID
let packet_id = stream.read_varint()?;
- P::read(packet_id.try_into().unwrap(), flow, stream)
+ P::read(packet_id.try_into().unwrap(), stream)
}
// this is always true in multiplayer, false in singleplayer
@@ -121,7 +118,6 @@ where
}
pub async fn read_packet<'a, P: ProtocolPacket, R>(
- flow: &PacketFlow,
stream: &'a mut R,
compression_threshold: Option<u32>,
cipher: &mut Option<Aes128CfbDec>,
@@ -150,7 +146,7 @@ where
}
// println!("decoding packet ({}ms)", start_time.elapsed().as_millis());
- let packet = packet_decoder(&mut buf.as_slice(), flow)?;
+ let packet = packet_decoder(&mut buf.as_slice())?;
// println!("decoded packet ({}ms)", start_time.elapsed().as_millis());
Ok(packet)