diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 2c31e8eef3..714ffe6925 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -530,10 +530,13 @@ impl Client { let cx = cx.clone(); let this = self.clone(); async move { + let mut message_id = 0_usize; while let Some(message) = incoming.next().await { let mut state = this.state.write(); - let payload_type_id = message.payload_type_id(); + message_id += 1; let type_name = message.payload_type_name(); + let payload_type_id = message.payload_type_id(); + let sender_id = message.original_sender_id().map(|id| id.0); let model = state .models_by_message_type @@ -575,8 +578,10 @@ impl Client { let client_id = this.id; log::debug!( - "rpc message received. client_id:{}, name:{}", + "rpc message received. client_id:{}, message_id:{}, sender_id:{:?}, type:{}", client_id, + message_id, + sender_id, type_name ); cx.foreground() @@ -584,15 +589,19 @@ impl Client { match future.await { Ok(()) => { log::debug!( - "rpc message handled. client_id:{}, name:{}", + "rpc message handled. client_id:{}, message_id:{}, sender_id:{:?}, type:{}", client_id, + message_id, + sender_id, type_name ); } Err(error) => { log::error!( - "error handling message. client_id:{}, name:{}, {}", + "error handling message. client_id:{}, message_id:{}, sender_id:{:?}, type:{}, error:{:?}", client_id, + message_id, + sender_id, type_name, error ); diff --git a/crates/rpc/src/proto.rs b/crates/rpc/src/proto.rs index 333bbd400e..5ec46eb353 100644 --- a/crates/rpc/src/proto.rs +++ b/crates/rpc/src/proto.rs @@ -37,6 +37,7 @@ pub trait AnyTypedEnvelope: 'static + Send + Sync { fn as_any(&self) -> &dyn Any; fn into_any(self: Box) -> Box; fn is_background(&self) -> bool; + fn original_sender_id(&self) -> Option; } pub enum MessagePriority { @@ -64,6 +65,10 @@ impl AnyTypedEnvelope for TypedEnvelope { fn is_background(&self) -> bool { matches!(T::PRIORITY, MessagePriority::Background) } + + fn original_sender_id(&self) -> Option { + self.original_sender_id + } } macro_rules! messages {