Skip to content

Commit

Permalink
pw_rpc: Add more debug logs
Browse files Browse the repository at this point in the history
Change-Id: I2bb2298c70c3544e6fdb16d8680afcc4954b6eba
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/92717
Reviewed-by: Alexei Frolov <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Apr 29, 2022
1 parent f22e4ab commit 49098a4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pw_rpc/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ Status Server::ProcessPacket(ConstByteSpan packet_data,
.IgnoreError();
}
internal::rpc_lock().unlock();
PW_LOG_DEBUG("Received packet on channel %u for unknown RPC %08x/%08x",
static_cast<unsigned>(packet.channel_id()),
static_cast<unsigned>(packet.service_id()),
static_cast<unsigned>(packet.method_id()));
return OkStatus(); // OK since the packet was handled.
}

Expand Down Expand Up @@ -142,13 +146,25 @@ void Server::HandleClientStreamPacket(const internal::Packet& packet,
channel.Send(Packet::ServerError(packet, Status::InvalidArgument()))
.IgnoreError(); // Errors are logged in Channel::Send.
internal::rpc_lock().unlock();
PW_LOG_DEBUG(
"Received client stream packet for %u:%08x/%08x, which doesn't have a "
"client stream",
static_cast<unsigned>(packet.channel_id()),
static_cast<unsigned>(packet.service_id()),
static_cast<unsigned>(packet.method_id()));
return;
}

if (!call->client_stream_open()) {
channel.Send(Packet::ServerError(packet, Status::FailedPrecondition()))
.IgnoreError(); // Errors are logged in Channel::Send.
internal::rpc_lock().unlock();
PW_LOG_DEBUG(
"Received client stream packet for %u:%08x/%08x, but its client stream "
"is closed",
static_cast<unsigned>(packet.channel_id()),
static_cast<unsigned>(packet.service_id()),
static_cast<unsigned>(packet.method_id()));
return;
}

Expand Down

0 comments on commit 49098a4

Please sign in to comment.