mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
improve shutdowns
This commit is contained in:
parent
3ad32806dc
commit
0b9d7dff03
1 changed files with 7 additions and 1 deletions
|
@ -314,7 +314,12 @@ impl Client {
|
||||||
|
|
||||||
/// Disconnect from the server, ending all tasks.
|
/// Disconnect from the server, ending all tasks.
|
||||||
pub async fn shutdown(self) -> Result<(), std::io::Error> {
|
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();
|
let tasks = self.tasks.lock();
|
||||||
for task in tasks.iter() {
|
for task in tasks.iter() {
|
||||||
task.abort();
|
task.abort();
|
||||||
|
@ -491,6 +496,7 @@ impl Client {
|
||||||
}
|
}
|
||||||
ClientboundGamePacket::Disconnect(p) => {
|
ClientboundGamePacket::Disconnect(p) => {
|
||||||
debug!("Got disconnect packet {:?}", p);
|
debug!("Got disconnect packet {:?}", p);
|
||||||
|
client.shutdown().await?;
|
||||||
}
|
}
|
||||||
ClientboundGamePacket::UpdateRecipes(_p) => {
|
ClientboundGamePacket::UpdateRecipes(_p) => {
|
||||||
debug!("Got update recipes packet");
|
debug!("Got update recipes packet");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue