From fd00806f01673891a4970851612dea1838a39fb9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 12 Apr 2019 02:06:49 +0200 Subject: 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 --- src/nvim/api/private/defs.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/nvim/api/private/defs.h') diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h index feca140547..978c55691b 100644 --- a/src/nvim/api/private/defs.h +++ b/src/nvim/api/private/defs.h @@ -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)) -- cgit