gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r28803 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r28803 - gnunet/src/mesh
Date: Fri, 23 Aug 2013 02:58:50 +0200

Author: bartpolot
Date: 2013-08-23 02:58:50 +0200 (Fri, 23 Aug 2013)
New Revision: 28803

Modified:
   gnunet/src/mesh/gnunet-service-mesh-enc.c
Log:
- fixes


Modified: gnunet/src/mesh/gnunet-service-mesh-enc.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-23 00:05:14 UTC (rev 
28802)
+++ gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-23 00:58:50 UTC (rev 
28803)
@@ -3001,7 +3001,7 @@
 
   if (NULL != ch->dest)
   {
-    GNUNET_break(0);
+    GNUNET_break (0);
     return;
   }
 
@@ -3020,6 +3020,12 @@
     GNUNET_break (0);
     return;
   }
+
+  GNUNET_break (NULL == ch->bck_rel);
+  ch->bck_rel = GNUNET_new (struct MeshChannelReliability);
+  ch->bck_rel->ch = ch;
+  ch->bck_rel->expected_delay = MESH_RETRANSMIT_TIME;
+
   ch->dest = c;
 }
 
@@ -3113,6 +3119,8 @@
 /**
  * Send an end-to-end FWD ACK message for the most recent in-sequence payload.
  *
+ * If channel is not reliable, do nothing.
+ *
  * @param ch Channel this is about.
  * @param fwd Is for FWD traffic? (ACK dest->owner)
  */
@@ -3129,7 +3137,6 @@
 
   if (GNUNET_NO == ch->reliable)
   {
-    GNUNET_break (0);
     return;
   }
   rel = fwd ? ch->bck_rel       : ch->fwd_rel;
@@ -4707,7 +4714,7 @@
     }
     if (GNUNET_SCHEDULER_NO_TASK == fc->poll_task)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO, "*   %s starting poll timeout\n");
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "*   starting poll timeout\n");
       fc->poll_task =
           GNUNET_SCHEDULER_add_delayed (fc->poll_time, &connection_poll, fc);
     }
@@ -5078,6 +5085,7 @@
   uint16_t size;
   uint16_t i;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received a connection create msg\n");
 
   /* Check size */
@@ -5197,6 +5205,7 @@
   struct MeshPeerPath *p;
   struct MeshConnection *c;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received a connection ACK msg\n");
   msg = (struct GNUNET_MESH_ConnectionACK *) message;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  on connection %s\n",
@@ -5375,6 +5384,12 @@
   {
     /* Probably a retransmission, safe to ignore */
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "   already exists...\n");
+    if (NULL != ch->dest)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "   duplicate CC!!\n");
+      channel_send_ack (ch, !fwd);
+      return GNUNET_OK;
+    }
   }
   else
   {
@@ -5522,10 +5537,11 @@
       sizeof (struct GNUNET_MESH_Encrypted) +
       sizeof (struct GNUNET_MessageHeader))
   {
-    GNUNET_break (0);
+    GNUNET_break_op (0);
     return GNUNET_OK;
   }
   type = ntohs (msg->header.type);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got a %s message from %s\n",
               GNUNET_MESH_DEBUG_M2S (type), GNUNET_i2s (peer));
 
@@ -5588,14 +5604,14 @@
     msgh = (struct GNUNET_MessageHeader *) cbuf;
     switch (ntohs (msgh->type))
     {
+      case GNUNET_MESSAGE_TYPE_MESH_DATA:
+        /* Don't send hop ACK, wait for client to ACK */
+        return handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd);
+
       case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
         r = handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh, fwd);
         break;
 
-      case GNUNET_MESSAGE_TYPE_MESH_DATA:
-        r = handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd);
-        break;
-
       case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
         r = handle_channel_create (t,
                                    (struct GNUNET_MESH_ChannelCreate *) msgh,
@@ -5703,6 +5719,7 @@
   GNUNET_PEER_Id id;
   uint32_t ack;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK packet from %s!\n",
               GNUNET_i2s (peer));
   msg = (struct GNUNET_MESH_ACK *) message;
@@ -5774,6 +5791,7 @@
   GNUNET_PEER_Id id;
   uint32_t pid;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a POLL packet from %s!\n",
               GNUNET_i2s (peer));
 
@@ -6179,7 +6197,7 @@
   channel_set_options (ch, ntohl (msg->opt));
 
   /* In unreliable channels, we'll use the DLL to buffer data for the root */
-  ch->fwd_rel = GNUNET_malloc (sizeof (struct MeshChannelReliability));
+  ch->fwd_rel = GNUNET_new (struct MeshChannelReliability);
   ch->fwd_rel->ch = ch;
   ch->fwd_rel->expected_delay = MESH_RETRANSMIT_TIME;
 




reply via email to

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