From 3d7bae58c4b9b128e6000a2fe1fe65595235bb14 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 6 Jul 2016 15:24:26 +0000 Subject: misc fixes --- src/conversation/conversation.h | 8 ++++++++ src/conversation/conversation_api.c | 2 +- src/conversation/gnunet-service-conversation.c | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/conversation') diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h index aaeed1df3..1bd358e78 100644 --- a/src/conversation/conversation.h +++ b/src/conversation/conversation.h @@ -39,6 +39,14 @@ extern "C" #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) +/** + * Highest bit in a 32-bit unsigned integer, + * bit set if we are making an outgoing call, + * bit unset for local lines. + */ +#define HIGH_BIT ((uint32_t) (1LL << 31)) + + /** * Message to transmit the audio (between client and helpers). */ diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c index 730cf1c70..e3bab295e 100644 --- a/src/conversation/conversation_api.c +++ b/src/conversation/conversation_api.c @@ -609,7 +609,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg, "LINE"); return NULL; } - if (line >= (1 << 31)) + if (line >= HIGH_BIT) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "CONVERSATION", diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index 425f0a3c2..3b2237229 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c @@ -285,7 +285,7 @@ handle_client_register_message (void *cls, GNUNET_CONTAINER_DLL_insert (lines_head, lines_tail, line); - line->local_line = ntohl (msg->line) & (~ (1 << 31)); + line->local_line = ntohl (msg->line) & (~ HIGH_BIT); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -703,7 +703,7 @@ handle_client_call_message (void *cls, } line = GNUNET_new (struct Line); line->client = client; - line->local_line = (local_line_cnt++) | (1 << 31); + line->local_line = (local_line_cnt++) | HIGH_BIT; GNUNET_SERVER_client_set_user_context (client, line); GNUNET_SERVER_notification_context_add (nc, client); GNUNET_CONTAINER_DLL_insert (lines_head, -- cgit v1.2.3