Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/agent-client-protocol/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ where
serde_json::to_writer(&mut outgoing_line, &JsonRpcMessage::wrap(&message)).map_err(Error::into_internal_error)?;
log::trace!("send: {}", String::from_utf8_lossy(&outgoing_line));
outgoing_line.push(b'\n');
outgoing_bytes.write_all(&outgoing_line).await.ok();
if let Err(e) = outgoing_bytes.write_all(&outgoing_line).await {
log::warn!("failed to send message to peer: {e}");
}
broadcast.outgoing(&message);
} else {
break;
Expand All @@ -194,7 +196,9 @@ where
match Local::decode_request(&method, message.params) {
Ok(request) => {
broadcast.incoming_request(id.clone(), &*method, &request);
incoming_tx.unbounded_send(IncomingMessage::Request { id, request }).ok();
if let Err(e) = incoming_tx.unbounded_send(IncomingMessage::Request { id, request }) {
log::warn!("failed to send request to handler, channel full: {e:?}");
}
}
Err(error) => {
outgoing_line.clear();
Expand All @@ -206,7 +210,9 @@ where
serde_json::to_writer(&mut outgoing_line, &JsonRpcMessage::wrap(&error_response))?;
log::trace!("send: {}", String::from_utf8_lossy(&outgoing_line));
outgoing_line.push(b'\n');
outgoing_bytes.write_all(&outgoing_line).await.ok();
if let Err(e) = outgoing_bytes.write_all(&outgoing_line).await {
log::warn!("failed to send error response to peer: {e}");
}
broadcast.outgoing(&error_response);
}
}
Expand Down Expand Up @@ -235,7 +241,9 @@ where
match Local::decode_notification(&method, message.params) {
Ok(notification) => {
broadcast.incoming_notification(&*method, &notification);
incoming_tx.unbounded_send(IncomingMessage::Notification { notification }).ok();
if let Err(e) = incoming_tx.unbounded_send(IncomingMessage::Notification { notification }) {
log::warn!("failed to send notification to handler, channel full: {e:?}");
}
}
Err(err) => {
log::error!("failed to decode {:?}: {err}", message.params);
Expand Down