RPC: eliminate NO_RESPONSE

Using a sentinel value in the response-id is ambiguous because the
msgpack-rpc spec allows all values (including zero/max). And clients
control the id, so we can't be sure they won't use the sentinel value.

Instead of a sentinel value, check the message type explicitly.

ref #8850
This commit is contained in:
Justin M. Keyes
2019-04-12 02:06:49 +02:00
parent b4ca56d96d
commit fd00806f01
4 changed files with 52 additions and 44 deletions

View File

@@ -29,14 +29,13 @@ typedef enum {
} ErrorType;
typedef enum {
kMessageTypeRequest,
kMessageTypeResponse,
kMessageTypeNotification
kMessageTypeUnknown = -1,
// Per msgpack-rpc spec.
kMessageTypeRequest = 0,
kMessageTypeResponse = 1,
kMessageTypeNotification = 2,
} MessageType;
/// Used as the message ID of notifications.
#define NO_RESPONSE UINT64_MAX
/// Mask for all internal calls
#define INTERNAL_CALL_MASK (((uint64_t)1) << (sizeof(uint64_t) * 8 - 1))