gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27802 - gnunet/src/mesh
Date: Mon, 8 Jul 2013 19:45:03 +0200

Author: bartpolot
Date: 2013-07-08 19:45:02 +0200 (Mon, 08 Jul 2013)
New Revision: 27802

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
- fix relay data retransmission of repeated messages

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2013-07-08 16:57:37 UTC (rev 
27801)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2013-07-08 17:45:02 UTC (rev 
27802)
@@ -3591,19 +3591,6 @@
     return GNUNET_OK;
   }
   pid = ntohl (msg->pid);
-  if (t->prev_fc.last_pid_recv == pid)
-  {
-    GNUNET_STATISTICS_update (stats, "# duplicate PID drops", 1, GNUNET_NO);
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                " Already seen pid %u, DROPPING!\n", pid);
-    return GNUNET_OK;
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                " pid %u not seen yet, forwarding\n", pid);
-  }
-
   if (GMC_is_pid_bigger (pid, t->prev_fc.last_ack_sent))
   {
     GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO);
@@ -3623,8 +3610,21 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "  it's for us! sending to clients...\n");
     GNUNET_STATISTICS_update (stats, "# unicast received", 1, GNUNET_NO);
-    tunnel_send_client_ucast (t, msg);
-    tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST);
+//     if (GMC_is_pid_bigger(pid, t->prev_fc.last_pid_recv)) FIXME use
+    if (pid == t->prev_fc.last_pid_recv + 1)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  " pid %u not seen yet, forwarding\n", pid);
+      tunnel_send_client_ucast (t, msg);
+      tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST);
+    }
+    else
+    {
+//       GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO);
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  " Pid %u not expected, sending FWD ACK!\n", pid);
+      tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_DATA_ACK);
+    }
     return GNUNET_OK;
   }
   if (0 == t->next_hop)
@@ -3684,7 +3684,6 @@
               GNUNET_MESH_DEBUG_M2S (ntohs (msg[1].header.type)));
   t = tunnel_get (&msg->oid, ntohl (msg->tid));
   pid = ntohl (msg->pid);
-
   if (NULL == t)
   {
     /* TODO notify that we dont know this tunnel (whom)? */
@@ -3695,16 +3694,6 @@
     return GNUNET_OK;
   }
 
-  if (t->next_fc.last_pid_recv == pid)
-  {
-    /* already seen this packet, drop */
-    GNUNET_STATISTICS_update (stats, "# duplicate PID drops BCK", 1, 
GNUNET_NO);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                " Already seen pid %u, DROPPING!\n", pid);
-    tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK);
-    return GNUNET_OK;
-  }
-
   if (GMC_is_pid_bigger (pid, t->next_fc.last_ack_sent))
   {
     GNUNET_STATISTICS_update (stats, "# unsolicited to_orig", 1, GNUNET_NO);
@@ -3725,8 +3714,18 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "  it's for us! sending to clients...\n");
     GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO);
-    tunnel_send_client_to_orig (t, msg);
-    tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN);
+    if (pid == t->next_fc.last_pid_recv + 1) // FIXME use "futures" as 
accepting
+    {
+      tunnel_send_client_to_orig (t, msg);
+      tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN);
+    }
+    else
+    {
+//       GNUNET_STATISTICS_update (stats, "# duplicate PID drops BCK", 1, 
GNUNET_NO);
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  " Pid %u not expected, sending FWD ACK!\n", pid);
+      tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_DATA_ACK);
+    }
     return GNUNET_OK;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,




reply via email to

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