1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

don't panic if connection closes on join

This commit is contained in:
mat 2022-10-29 13:54:19 -05:00
parent 9de6c03dfb
commit f235c9d064

View file

@ -182,9 +182,8 @@ impl Client {
.await?;
let (conn, game_profile) = loop {
let packet_result = conn.read().await;
match packet_result {
Ok(packet) => match packet {
let packet = conn.read().await?;
match packet {
ClientboundLoginPacket::Hello(p) => {
debug!("Got encryption request");
let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap();
@ -203,9 +202,7 @@ impl Client {
conn.write(
ServerboundKeyPacket {
nonce_or_salt_signature: NonceOrSaltSignature::Nonce(
e.encrypted_nonce,
),
nonce_or_salt_signature: NonceOrSaltSignature::Nonce(e.encrypted_nonce),
key_bytes: e.encrypted_public_key,
}
.get(),
@ -228,10 +225,6 @@ impl Client {
ClientboundLoginPacket::CustomQuery(p) => {
debug!("Got custom query {:?}", p);
}
},
Err(e) => {
panic!("Error: {e:?}");
}
}
};