From a08d1c815cb62b194c4dcbacbc4fdf97376482d4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 23 Jan 2017 15:03:29 +0100 Subject: [PATCH] do not send duplicate LOCAL_CHANNEL_CREATE message --- src/cadet/gnunet-service-cadet-new.c | 12 ++++++------ src/cadet/gnunet-service-cadet-new_channel.c | 13 ------------- src/cadet/test_cadet.c | 9 +++++++++ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index ef0870158..441511e45 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c @@ -282,7 +282,7 @@ GSC_bind (struct CadetClient *c, uint32_t options) { struct GNUNET_MQ_Envelope *env; - struct GNUNET_CADET_LocalChannelCreateMessage *msg; + struct GNUNET_CADET_LocalChannelCreateMessage *cm; struct GNUNET_CADET_ClientChannelNumber ccn; ccn = client_get_next_ccn (c); @@ -298,12 +298,12 @@ GSC_bind (struct CadetClient *c, GNUNET_h2s (port), ntohl (options)); /* notify local client about incoming connection! */ - env = GNUNET_MQ_msg (msg, + env = GNUNET_MQ_msg (cm, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE); - msg->ccn = ccn; - msg->port = *port; - msg->opt = htonl (options); - msg->peer = *GCP_get_id (dest); + cm->ccn = ccn; + cm->port = *port; + cm->opt = htonl (options); + cm->peer = *GCP_get_id (dest); GSC_send_to_client (c, env); return ccn; diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index 673921458..45609107b 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -804,8 +804,6 @@ void GCCH_bind (struct CadetChannel *ch, struct CadetClient *c) { - struct GNUNET_MQ_Envelope *env; - struct GNUNET_CADET_LocalChannelCreateMessage *tcm; uint32_t options; LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -850,17 +848,6 @@ GCCH_bind (struct CadetChannel *ch, ch); } /* give client it's initial supply of ACKs */ - env = GNUNET_MQ_msg (tcm, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE); - tcm->ccn = ch->ccn_dest; - if (GNUNET_YES == ch->is_loopback) - tcm->peer = my_full_id; - else - tcm->peer = *GCP_get_id (GCT_get_destination (ch->t)); - tcm->port = ch->port; - tcm->opt = htonl (options); - GSC_send_to_client (ch->dest, - env); for (unsigned int i=0;imax_pending_messages;i++) send_ack_to_client (ch, ch->dest); diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index 16466ca0d..ce0178bd5 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -787,7 +787,16 @@ incoming_channel (void *cls, ok++; GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); if ((long) cls == peers_requested - 1) + { + if (NULL != incoming_ch) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Duplicate incoming channel for client %lu\n", + (long) cls); + GNUNET_break(0); + } incoming_ch = channel; + } else { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, -- 2.25.1