This commit is contained in:
water bottle 2024-05-22 10:10:21 +10:00 committed by GitHub
parent 72a6c78f75
commit d7b6992617
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -389,7 +389,7 @@ impl<T: Read + Write> DataBufferReader for MinecraftConnection<T> {
Ok(buf) Ok(buf)
} }
}, },
Err(err) => Err(ProtocolError::ReadError), Err(_) => Err(ProtocolError::ReadError),
} }
} }
fn read_byte(&mut self) -> Result<u8, ProtocolError> { fn read_byte(&mut self) -> Result<u8, ProtocolError> {
@ -415,7 +415,7 @@ impl<T: Read + Write> DataBufferWriter for MinecraftConnection<T> {
impl<T: Read + Write> MinecraftConnection<T> { impl<T: Read + Write> MinecraftConnection<T> {
pub fn new(stream: T) -> MinecraftConnection<T> { pub fn new(stream: T) -> MinecraftConnection<T> {
MinecraftConnection { MinecraftConnection {
stream, stream,
compress: false, compress: false,
compress_threashold: 0 compress_threashold: 0
@ -555,8 +555,8 @@ fn compress_zlib(bytes: &[u8]) -> Result<Vec<u8>, ProtocolError> {
match compresser.compress_vec(&bytes, &mut output, FlushCompress::Finish) { match compresser.compress_vec(&bytes, &mut output, FlushCompress::Finish) {
Ok(i) => { Ok(i) => {
match i { match i {
Status::BufError => Err(ProtocolError::ZlibError), Status::Ok => Ok(output),
_ => Ok(output), _ => Err(ProtocolError::ZlibError),
} }
}, },
Err(_) => Err(ProtocolError::ZlibError) Err(_) => Err(ProtocolError::ZlibError)
@ -569,8 +569,8 @@ fn decompress_zlib(bytes: &[u8], packet_length: usize) -> Result<Vec<u8>, Protoc
match compresser.decompress_vec(&bytes, &mut output, FlushDecompress::Sync) { match compresser.decompress_vec(&bytes, &mut output, FlushDecompress::Sync) {
Ok(i) => { Ok(i) => {
match i { match i {
Status::BufError => Err(ProtocolError::ZlibError), Status::Ok => Ok(output),
_ => Ok(output), _ => Err(ProtocolError::ZlibError),
} }
}, },
Err(_) => Err(ProtocolError::ZlibError) Err(_) => Err(ProtocolError::ZlibError)