Skip to content

Commit

Permalink
Update protocol for closed data messages
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dmcgowan committed Mar 15, 2022
1 parent 27b4008 commit 59a85ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 59a85ba

Please sign in to comment.