From 59a85ba56652e1374013ddce4d0708d04f792dc4 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Thu, 10 Mar 2022 21:12:50 -0800 Subject: [PATCH] Update protocol for closed data messages Add flag to indicate that a data message used with a close flag is not sending any data. This clears up any ambiguity over whether the final data message is transmitting a zero length data message or no data at all. Signed-off-by: Derek McGowan --- PROTOCOL.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PROTOCOL.md b/PROTOCOL.md index de0835d68..5475e0be6 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -95,11 +95,20 @@ client or server may send data. A data message is not allowed on a unary stream. A data message should not be sent after indicating `remote closed` to the peer. The last data message on a stream must set the `remote closed` flag. +The `no data` flag is used to indicate that the data message does not include +any data. This is normally used with the `remote closed` flag to indicate the +stream is now closed without transmitting any data. Since ttrpc normally +transmits a single object per message, a zero length data message may be +interpreted as an empty object. For example, transmitting the number zero as a +protobuf message ends up with a data length of zero, but the message is still +considered data and should be processed. + #### Data | Flag | Name | Description | |------|-----------------|-----------------------------------| | 0x01 | `remote closed` | No more data expected from remote | +| 0x04 | `no data` | This message does not have data | ## Streaming