gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r34050 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r34050 - gnunet/src/cadet
Date: Fri, 25 Jul 2014 05:30:03 +0200

Author: bartpolot
Date: 2014-07-25 05:30:03 +0200 (Fri, 25 Jul 2014)
New Revision: 34050

Modified:
   gnunet/src/cadet/gnunet-service-cadet_channel.c
Log:
- fix handling of SYNACK corner case

Modified: gnunet/src/cadet/gnunet-service-cadet_channel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_channel.c     2014-07-25 03:30:02 UTC 
(rev 34049)
+++ gnunet/src/cadet/gnunet-service-cadet_channel.c     2014-07-25 03:30:03 UTC 
(rev 34050)
@@ -336,10 +336,9 @@
  *
  * @param ch The channel to confirm.
  * @param fwd Should we send a FWD ACK? (going dest->root)
- * @param reaction This ACK is a reaction to a duplicate CREATE, don't save.
  */
 static void
-send_ack (struct CadetChannel *ch, int fwd, int reaction);
+send_ack (struct CadetChannel *ch, int fwd);
 
 
 
@@ -777,7 +776,7 @@
   }
   else if (rel == rel->ch->dest_rel)
   {
-    send_ack (rel->ch, GNUNET_YES, GNUNET_NO);
+    send_ack (rel->ch, GNUNET_YES);
   }
   else
   {
@@ -903,10 +902,9 @@
  *
  * @param ch The channel to confirm.
  * @param fwd Should we send a FWD ACK? (going dest->root)
- * @param reaction This ACK is a reaction to a duplicate CREATE, don't save.
  */
 static void
-send_ack (struct CadetChannel *ch, int fwd, int reaction)
+send_ack (struct CadetChannel *ch, int fwd)
 {
   struct GNUNET_CADET_ChannelManage msg;
 
@@ -916,7 +914,7 @@
        GC_f2s (fwd), GCCH_2s (ch));
 
   msg.chid = htonl (ch->gid);
-  GCCH_send_prebuilt_message (&msg.header, ch, !fwd, reaction ? &msg : NULL);
+  GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL);
 }
 
 
@@ -1186,19 +1184,16 @@
       GCT_cancel (rel->uniq->tq);
       /* ch_message_sent will free and NULL uniq */
     }
-    else
+    else if (GNUNET_NO == is_loopback (ch))
     {
-      if (GNUNET_NO == is_loopback (ch))
-      {
-        /* We SHOULD have been trying to retransmit this! */
-        GNUNET_break (0);
-      }
+      /* We SHOULD have been trying to retransmit this! */
+      GNUNET_break (0);
     }
   }
 
   /* In case of a FWD ACK (SYNACK) send a BCK ACK (ACK). */
   if (GNUNET_YES == fwd)
-    send_ack (ch, GNUNET_NO, GNUNET_NO);
+    send_ack (ch, GNUNET_NO);
 }
 
 
@@ -2106,9 +2101,7 @@
   struct CadetChannel *ch;
   struct CadetClient *c;
   int new_channel;
-  int reaction;
 
-  reaction = GNUNET_NO;
   chid = ntohl (msg->chid);
   ch = GCT_get_channel (t, chid);
   if (NULL == ch)
@@ -2163,7 +2156,6 @@
   else
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  duplicate create channel\n");
-    reaction = GNUNET_YES;
     if (GNUNET_SCHEDULER_NO_TASK != ch->dest_rel->retry_task)
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG, "  clearing retry task\n");
@@ -2171,8 +2163,13 @@
       GNUNET_SCHEDULER_cancel (ch->dest_rel->retry_task);
       ch->dest_rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
     }
+    else if (NULL != ch->dest_rel->uniq)
+    {
+      /* we are waiting to for our 'SYNACK' to leave the queue, all done! */
+      return ch;
+    }
   }
-  send_ack (ch, GNUNET_YES, reaction);
+  send_ack (ch, GNUNET_YES);
 
   return ch;
 }
@@ -2360,16 +2357,9 @@
       break;
 
 
-    case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
-      if (GNUNET_YES == fwd || NULL != existing_copy)
-      {
-        /* BCK ACK (going FWD) is just a response for a SYNACK, don't keep*/
-        fire_and_forget (message, ch, GNUNET_YES);
-        return;
-      }
-      /* fall-trough */
     case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
     case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+    case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
       chq = GNUNET_new (struct CadetChannelQueue);
       chq->type = type;
       chq->rel = fwd ? ch->root_rel : ch->dest_rel;
@@ -2379,6 +2369,7 @@
         {
           GCT_cancel (chq->rel->uniq->tq);
           /* ch_message_sent is called, freeing and NULLing uniq */
+          GNUNET_break (NULL == chq->rel->uniq);
         }
         else
         {
@@ -2386,6 +2377,9 @@
           GNUNET_free (chq->rel->uniq);
         }
       }
+      else
+        GNUNET_break (0);
+
       chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES,
                                            &ch_message_sent, chq);
       if (NULL == chq->tq)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]