diff options
| author | mat <github@matdoes.dev> | 2022-11-21 14:10:37 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-11-21 14:10:37 -0600 |
| commit | 0b9d7dff03ddcac73eba092478e26d9b0071d4e6 (patch) | |
| tree | c3d0bd6e47b36ef2b30363d558cd0af1d9ed7589 /azalea-client | |
| parent | 3ad32806dcaffda6e221ad0e24c7900cc4027c7c (diff) | |
| download | azalea-drasl-0b9d7dff03ddcac73eba092478e26d9b0071d4e6.tar.xz | |
improve shutdowns
Diffstat (limited to 'azalea-client')
| -rw-r--r-- | azalea-client/src/client.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index c2d5b745..75661d19 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -314,7 +314,12 @@ impl Client { /// Disconnect from the server, ending all tasks. pub async fn shutdown(self) -> Result<(), std::io::Error> { - self.write_conn.lock().await.shutdown().await?; + if let Err(e) = self.write_conn.lock().await.shutdown().await { + warn!( + "Error shutting down connection, but it might be fine: {}", + e + ); + } let tasks = self.tasks.lock(); for task in tasks.iter() { task.abort(); @@ -491,6 +496,7 @@ impl Client { } ClientboundGamePacket::Disconnect(p) => { debug!("Got disconnect packet {:?}", p); + client.shutdown().await?; } ClientboundGamePacket::UpdateRecipes(_p) => { debug!("Got update recipes packet"); |
