diff options
| author | mat <github@matdoes.dev> | 2021-12-16 23:33:06 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2021-12-16 23:33:06 -0600 |
| commit | c4eecaf13a4f8f0a81dc278078727df23caa8411 (patch) | |
| tree | 5082f54d1a9242281d80c250e587235a3ac3755b /azalea-client/src | |
| parent | 1dc56b6f519f386b6e0b5eac47a84576cedbbb33 (diff) | |
| download | azalea-drasl-c4eecaf13a4f8f0a81dc278078727df23caa8411.tar.xz | |
try to implement compression
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/connect.rs | 29 |
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(()) } |
