From 845f99088390ba348641c2d7ecd3ff0b0abe4a5a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 21 Feb 2023 12:31:43 +1000 Subject: [PATCH] protocol: change the context type enum to start at 1 This avoids future bugs for treating this as a boolean field. --- proto/protocol.xml | 4 ++-- src/libeis-connection-setup.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/proto/protocol.xml b/proto/protocol.xml index fdbc0df..9787b21 100644 --- a/proto/protocol.xml +++ b/proto/protocol.xml @@ -143,8 +143,8 @@ from the EIS implementation. A context type of sender is a libei context sending events to the EIS implementation. - - + + diff --git a/src/libeis-connection-setup.c b/src/libeis-connection-setup.c index 0fedda5..54296cf 100644 --- a/src/libeis-connection-setup.c +++ b/src/libeis-connection-setup.c @@ -137,9 +137,11 @@ client_msg_context_type(struct eis_connection_setup *setup, uint32_t type) { switch(type) { case EIS_CONNECTION_SETUP_CONTEXT_TYPE_SENDER: + setup->is_sender = true; + return NULL; case EIS_CONNECTION_SETUP_CONTEXT_TYPE_RECEIVER: - setup->is_sender = !!type; - return 0; + setup->is_sender = false; + return NULL; } return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_VALUE, "Invalid context type %u", type);