diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client.rs | 11 | ||||
-rw-r--r-- | src/server.rs | 15 |
2 files changed, 16 insertions, 10 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"); + } }) }; diff --git a/src/server.rs b/src/server.rs index 7b94eac..5d3a50a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -751,12 +751,15 @@ async fn client_connection_task( tokio::spawn(async move { let conn_err = conn.closed().await; info!("Client {} connection closed: {}", client_id, conn_err); - to_sync_server - .send(ServerAsyncMessage::ClientConnectionClosed( - client_id, conn_err, - )) - .await - .expect("Failed to signal connection lost to sync server"); + // If we requested the connection to close, channel may have been closed already. + if !to_sync_server.is_closed() { + to_sync_server + .send(ServerAsyncMessage::ClientConnectionClosed( + client_id, conn_err, + )) + .await + .expect("Failed to signal connection lost to sync server"); + } }); }; |