mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
don't panic if connection closes on join
This commit is contained in:
parent
9de6c03dfb
commit
f235c9d064
1 changed files with 38 additions and 45 deletions
|
@ -182,9 +182,8 @@ impl Client {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let (conn, game_profile) = loop {
|
let (conn, game_profile) = loop {
|
||||||
let packet_result = conn.read().await;
|
let packet = conn.read().await?;
|
||||||
match packet_result {
|
match packet {
|
||||||
Ok(packet) => match packet {
|
|
||||||
ClientboundLoginPacket::Hello(p) => {
|
ClientboundLoginPacket::Hello(p) => {
|
||||||
debug!("Got encryption request");
|
debug!("Got encryption request");
|
||||||
let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap();
|
let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap();
|
||||||
|
@ -203,9 +202,7 @@ impl Client {
|
||||||
|
|
||||||
conn.write(
|
conn.write(
|
||||||
ServerboundKeyPacket {
|
ServerboundKeyPacket {
|
||||||
nonce_or_salt_signature: NonceOrSaltSignature::Nonce(
|
nonce_or_salt_signature: NonceOrSaltSignature::Nonce(e.encrypted_nonce),
|
||||||
e.encrypted_nonce,
|
|
||||||
),
|
|
||||||
key_bytes: e.encrypted_public_key,
|
key_bytes: e.encrypted_public_key,
|
||||||
}
|
}
|
||||||
.get(),
|
.get(),
|
||||||
|
@ -228,10 +225,6 @@ impl Client {
|
||||||
ClientboundLoginPacket::CustomQuery(p) => {
|
ClientboundLoginPacket::CustomQuery(p) => {
|
||||||
debug!("Got custom query {:?}", p);
|
debug!("Got custom query {:?}", p);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
Err(e) => {
|
|
||||||
panic!("Error: {e:?}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue