aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/write.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-29 20:20:56 -0500
committermat <github@matdoes.dev>2022-04-29 20:20:56 -0500
commit8317b5b28153794770a8c7b84a1b6dd50eaa3f80 (patch)
tree888372c6a42d3f290db614602961c41e03a1e571 /azalea-protocol/src/write.rs
parent2575da38edac2e4e546e0b49bfd308003c62263f (diff)
downloadazalea-drasl-8317b5b28153794770a8c7b84a1b6dd50eaa3f80.tar.xz
upgrade aes and cfb8
Diffstat (limited to 'azalea-protocol/src/write.rs')
-rwxr-xr-xazalea-protocol/src/write.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs
index e72a74b1..e39ce18e 100755
--- a/azalea-protocol/src/write.rs
+++ b/azalea-protocol/src/write.rs
@@ -1,8 +1,9 @@
use crate::{mc_buf::Writable, packets::ProtocolPacket, read::MAXIMUM_UNCOMPRESSED_LENGTH};
use async_compression::tokio::bufread::ZlibEncoder;
-use azalea_auth::encryption::Aes128Cfb;
+use azalea_auth::encryption::Aes128CfbEnc;
+use std::fmt::Debug;
use tokio::{
- io::{AsyncReadExt, AsyncWriteExt},
+ io::{AsyncReadExt, AsyncWrite, AsyncWriteExt},
net::TcpStream,
};
@@ -51,13 +52,14 @@ async fn compression_encoder(data: &[u8], compression_threshold: u32) -> Result<
}
}
-pub async fn write_packet<P>(
+pub async fn write_packet<P, W>(
packet: P,
- stream: &mut TcpStream,
+ stream: &mut W,
compression_threshold: Option<u32>,
- cipher: &mut Option<Aes128Cfb>,
+ cipher: &mut Option<Aes128CfbEnc>,
) where
- P: ProtocolPacket + std::fmt::Debug,
+ P: ProtocolPacket + Debug,
+ W: AsyncWrite + Unpin + Send,
{
let mut buf = packet_encoder(&packet).unwrap();
if let Some(threshold) = compression_threshold {