do not send duplicate LOCAL_CHANNEL_CREATE message
authorChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 14:03:29 +0000 (15:03 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 14:03:29 +0000 (15:03 +0100)
src/cadet/gnunet-service-cadet-new.c
src/cadet/gnunet-service-cadet-new_channel.c
src/cadet/test_cadet.c

index ef0870158336ac7e28e6a41d1d82f1386e623ae5..441511e457ce54415dd662b95a9941461d5d6eb8 100644 (file)
@@ -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;
index 673921458b7c6098dd6c2fbec0feb50b864a1422..45609107b13860bcc725b7f5ccd1599cf0b8750a 100644 (file)
@@ -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;i<ch->max_pending_messages;i++)
     send_ack_to_client (ch,
                         ch->dest);
index 16466ca0d694226c58a26beb35a79a0316cc14ae..ce0178bd5b2c5869f5756ed44c32a771406d3c36 100644 (file)
@@ -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,