pw_rpc: Deprecate CANCEL packet type
The CANCEL packet type is redundant. It is identical to a CLIENT_ERROR
packet with status CANCELLED.
- For backwards compatibility, set the status to CANCELLED in a CANCEL
packet and treat it like a CLIENT_ERROR.
- Have clients send CLIENT_ERRORs instead of CANCEL.
- Rename PacketType::CANCEL to PacketType::DEPRECATED_CANCEL.
Change-Id: If32e68a28248d0117de0876e758f033a140a32a0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/66252
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
diff --git a/pw_rpc/server.cc b/pw_rpc/server.cc
index f1a352e..21b5a8a 100644
--- a/pw_rpc/server.cc
+++ b/pw_rpc/server.cc
@@ -88,15 +88,11 @@
HandleClientStreamPacket(packet, *channel, call);
break;
case PacketType::CLIENT_ERROR:
+ case PacketType::DEPRECATED_CANCEL:
if (call != nullptr && call->id() == packet.call_id()) {
call->HandleError(packet.status());
}
break;
- case PacketType::CANCEL:
- if (call != nullptr && call->id() == packet.call_id()) {
- call->HandleError(Status::Cancelled());
- }
- break;
case PacketType::CLIENT_STREAM_END:
HandleClientStreamPacket(packet, *channel, call);
break;