Skip to content

Commit

Permalink
pw_rpc: Debug logs for call termination
Browse files Browse the repository at this point in the history
Change-Id: I0ae9cff6f28f81d66866495ac9fde77a89312113
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/250152
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
Lint: Lint 🤖 <[email protected]>
Reviewed-by: Ronan Chauvin <[email protected]>
Presubmit-Verified: CQ Bot Account <[email protected]>
Docs-Not-Needed: Wyatt Hepler <[email protected]>
Reviewed-by: Alexei Frolov <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Dec 2, 2024
1 parent eb762ca commit 74663b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pw_rpc/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ Status Client::ProcessPacket(ConstByteSpan data) {

switch (packet.type()) {
case PacketType::RESPONSE:
PW_LOG_DEBUG("Client call %u for %u:%08x/%08x completed with status %s",
static_cast<unsigned>(packet.call_id()),
static_cast<unsigned>(packet.channel_id()),
static_cast<unsigned>(packet.service_id()),
static_cast<unsigned>(packet.method_id()),
packet.status().str());
// RPCs without a server stream include a payload with the final packet.
if (call->has_server_stream()) {
static_cast<internal::StreamResponseClientCall&>(*call).HandleCompleted(
Expand All @@ -72,6 +78,12 @@ Status Client::ProcessPacket(ConstByteSpan data) {
}
break;
case PacketType::SERVER_ERROR:
PW_LOG_DEBUG("Client call %u for %u:%08x/%08x terminated with error %s",
static_cast<unsigned>(packet.call_id()),
static_cast<unsigned>(packet.channel_id()),
static_cast<unsigned>(packet.service_id()),
static_cast<unsigned>(packet.method_id()),
packet.status().str());
call->HandleError(packet.status());
break;
case PacketType::SERVER_STREAM:
Expand Down
6 changes: 6 additions & 0 deletions pw_rpc/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ Status Server::ProcessPacket(internal::Packet packet) {
break;
case PacketType::CLIENT_ERROR:
if (call != calls_end()) {
PW_LOG_DEBUG("Server call %u for %u:%08x/%08x terminated with error %s",
static_cast<unsigned>(packet.call_id()),
static_cast<unsigned>(packet.channel_id()),
static_cast<unsigned>(packet.service_id()),
static_cast<unsigned>(packet.method_id()),
packet.status().str());
call->HandleError(packet.status());
} else {
internal::rpc_lock().unlock();
Expand Down

0 comments on commit 74663b2

Please sign in to comment.