Try to improve tracing messages when client disconnects

Nathan Sobo created

Change summary

crates/collab/src/rpc.rs | 4 ++--
crates/rpc/src/peer.rs   | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

Detailed changes

crates/collab/src/rpc.rs 🔗

@@ -289,7 +289,7 @@ impl Server {
                 futures::select_biased! {
                     result = handle_io => {
                         if let Err(error) = result {
-                            tracing::error!(%error, %user_id, %login, %connection_id, %address, "error handling I/O");
+                            tracing::error!(?error, %user_id, %login, %connection_id, %address, "error handling I/O");
                         }
                         break;
                     }
@@ -327,7 +327,7 @@ impl Server {
 
             tracing::info!(%user_id, %login, %connection_id, %address, "signing out");
             if let Err(error) = this.sign_out(connection_id).await {
-                tracing::error!(%user_id, %login, %connection_id, %address, %error, "error signing out");
+                tracing::error!(%user_id, %login, %connection_id, %address, ?error, "error signing out");
             }
 
             Ok(())

crates/rpc/src/peer.rs 🔗

@@ -190,8 +190,8 @@ impl Peer {
                             },
                         },
                         incoming = read_message => {
+                            let incoming = incoming.context("error reading rpc message from socket")?;
                             tracing::debug!(%connection_id, "incoming rpc message: received");
-                            let incoming = incoming.context("received invalid RPC message")?;
                             tracing::debug!(%connection_id, "receive timeout: resetting");
                             receive_timeout.set(create_timer(RECEIVE_TIMEOUT).fuse());
                             if let proto::Message::Envelope(incoming) = incoming {