aboutsummaryrefslogtreecommitdiff
path: root/azalea-client
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-12-16 23:33:06 -0600
committermat <github@matdoes.dev>2021-12-16 23:33:06 -0600
commitc4eecaf13a4f8f0a81dc278078727df23caa8411 (patch)
tree5082f54d1a9242281d80c250e587235a3ac3755b /azalea-client
parent1dc56b6f519f386b6e0b5eac47a84576cedbbb33 (diff)
downloadazalea-drasl-c4eecaf13a4f8f0a81dc278078727df23caa8411.tar.xz
try to implement compression
Diffstat (limited to 'azalea-client')
-rw-r--r--azalea-client/src/connect.rs29
1 files changed, 16 insertions, 13 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs
index fad5fa92..2a2eb1ac 100644
--- a/azalea-client/src/connect.rs
+++ b/azalea-client/src/connect.rs
@@ -29,25 +29,28 @@ pub async fn join_server(address: &ServerAddress) -> Result<(), String> {
.await;
let mut conn = conn.login();
- // login start
+ // login
conn.write(ServerboundHelloPacket { username }.get()).await;
- // encryption request
- loop {
+ let mut conn = loop {
match conn.read().await.unwrap() {
- LoginPacket::ClientboundHelloPacket(encryption_request_packet) => {
- println!(
- "Got encryption request {:?} {:?}",
- encryption_request_packet.nonce, encryption_request_packet.public_key
- );
+ LoginPacket::ClientboundHelloPacket(p) => {
+ println!("Got encryption request {:?} {:?}", p.nonce, p.public_key);
}
- _ => (),
+ LoginPacket::ClientboundLoginCompressionPacket(p) => {
+ println!("Got compression request {:?}", p.compression_threshold);
+ conn.set_compression_threshold(p.compression_threshold);
+ }
+ LoginPacket::ClientboundGameProfilePacket(p) => {
+ println!("Got profile {:?}", p.game_profile);
+ break conn.game();
+ }
+ _ => panic!("unhandled packet"),
}
- }
-
- // TODO: client auth
+ };
- // TODO: encryption response
+ // game
+ panic!("ok i haven't implemented game yet");
Ok(())
}