aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-30 02:10:21 -0500
committermat <github@matdoes.dev>2022-04-30 02:10:21 -0500
commit153b5b45e42a031e9ee7dd2764840b07ce1cb47b (patch)
treeb8673fbad5ceb31d7bfa29a364415ca8804e2a91 /azalea-protocol/src
parentc37fcfe4da7a55208bf8241c7a776905513d5e0e (diff)
downloadazalea-drasl-153b5b45e42a031e9ee7dd2764840b07ce1cb47b.tar.xz
misc fixes
Diffstat (limited to 'azalea-protocol/src')
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs2
-rwxr-xr-xazalea-protocol/src/read.rs24
2 files changed, 14 insertions, 12 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs
index 33b710d5..afaa7fdd 100755
--- a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs
@@ -76,7 +76,7 @@ impl<T: McBufWritable> McBufWritable for BrigadierNumber<T> {
if self.max.is_some() {
flags |= 0x02;
}
- buf.write_i8(flags);
+ buf.write_byte(flags)?;
if let Some(min) = &self.min {
min.write_into(buf)?;
}
diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs
index b249e3d7..51224499 100755
--- a/azalea-protocol/src/read.rs
+++ b/azalea-protocol/src/read.rs
@@ -1,4 +1,8 @@
-use std::{cell::Cell, pin::Pin};
+use std::{
+ cell::Cell,
+ pin::Pin,
+ task::{Context, Poll},
+};
use crate::{connect::PacketFlow, mc_buf::Readable, packets::ProtocolPacket};
use async_compression::tokio::bufread::ZlibDecoder;
@@ -35,13 +39,13 @@ where
{
// Packet ID
let packet_id = stream.read_varint().await?;
- Ok(P::read(packet_id.try_into().unwrap(), flow, stream).await?)
+ P::read(packet_id.try_into().unwrap(), flow, stream).await
}
// this is always true in multiplayer, false in singleplayer
static VALIDATE_DECOMPRESSED: bool = true;
-pub static MAXIMUM_UNCOMPRESSED_LENGTH: u32 = 8388608;
+pub static MAXIMUM_UNCOMPRESSED_LENGTH: u32 = 2097152;
async fn compression_decoder<R>(
stream: &mut R,
@@ -103,28 +107,26 @@ where
impl<R> AsyncRead for EncryptedStream<'_, R>
where
- R: AsyncRead + std::marker::Unpin + std::marker::Send,
+ R: AsyncRead + Unpin + Send,
{
fn poll_read(
mut self: Pin<&mut Self>,
- cx: &mut std::task::Context<'_>,
+ cx: &mut Context<'_>,
buf: &mut tokio::io::ReadBuf<'_>,
- ) -> std::task::Poll<std::io::Result<()>> {
+ ) -> Poll<std::io::Result<()>> {
// i hate this
let polled = self.as_mut().stream.as_mut().poll_read(cx, buf);
match polled {
- std::task::Poll::Ready(r) => {
+ Poll::Ready(r) => {
if let Some(cipher) = self.as_mut().cipher.get_mut() {
azalea_auth::encryption::decrypt_packet(cipher, buf.initialized_mut());
}
match r {
- Ok(()) => std::task::Poll::Ready(Ok(())),
+ Ok(()) => Poll::Ready(Ok(())),
Err(e) => panic!("{:?}", e),
}
}
- std::task::Poll::Pending => {
- return std::task::Poll::Pending;
- }
+ Poll::Pending => Poll::Pending,
}
}
}