aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2023-01-16 19:44:51 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2023-01-16 19:44:51 +0100
commite316d994e4e00e0e79809aa3fb89df00de3ce91f (patch)
treedb5b2661cba27167a1973b5d5ecb1d4b45be9e08 /src/client.rs
parentd3b063dbb5595c2609ded29f0cd8cc90de40fff8 (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.rs11
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");
+ }
})
};