diff options
author | Henauxg <19689618+Henauxg@users.noreply.github.com> | 2023-01-16 19:44:51 +0100 |
---|---|---|
committer | Henauxg <19689618+Henauxg@users.noreply.github.com> | 2023-01-16 19:44:51 +0100 |
commit | e316d994e4e00e0e79809aa3fb89df00de3ce91f (patch) | |
tree | db5b2661cba27167a1973b5d5ecb1d4b45be9e08 /src/client.rs | |
parent | d3b063dbb5595c2609ded29f0cd8cc90de40fff8 (diff) |
[client & server] Close waiter: only signal connection closed if the internal channel still exists
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client.rs b/src/client.rs index 6416395..6b63b29 100644 --- a/src/client.rs +++ b/src/client.rs @@ -611,10 +611,13 @@ async fn connection_task(spawn_config: ConnectionSpawnConfig) { tokio::spawn(async move { let conn_err = conn.closed().await; info!("Disconnected: {}", conn_err); - to_sync_client - .send(ClientAsyncMessage::ConnectionClosed(conn_err)) - .await - .expect("Failed to signal connection lost to sync client"); + // If we requested the connection to close, channel may have been closed already. + if !to_sync_client.is_closed() { + to_sync_client + .send(ClientAsyncMessage::ConnectionClosed(conn_err)) + .await + .expect("Failed to signal connection lost to sync client"); + } }) }; |