gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27858 - gnunet/src/mesh
Date: Wed, 10 Jul 2013 03:11:29 +0200

Author: bartpolot
Date: 2013-07-10 03:11:29 +0200 (Wed, 10 Jul 2013)
New Revision: 27858

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
   gnunet/src/mesh/mesh_protocol.h
Log:
- don't use deltas, send last PID in POLL message instead

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2013-07-10 00:52:55 UTC (rev 
27857)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2013-07-10 01:11:29 UTC (rev 
27858)
@@ -1624,6 +1624,7 @@
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL);
   msg.header.size = htons (sizeof (msg));
   msg.tid = htonl (t->id.tid);
+  msg.pid = htonl (fc->last_pid_sent);
   GNUNET_PEER_resolve (t->id.oid, &msg.oid);
 
   if (fc == &t->prev_fc)
@@ -2065,7 +2066,6 @@
 tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
 {
   uint32_t ack;
-  int use_delta = GNUNET_NO;
 
   /* Is it after unicast retransmission? */
   switch (type)
@@ -2088,8 +2088,6 @@
       tunnel_send_fwd_data_ack (t);
       break;
     case GNUNET_MESSAGE_TYPE_MESH_POLL:
-      use_delta = GNUNET_YES;
-      /* falltrough */
     case GNUNET_MESSAGE_TYPE_MESH_PATH_ACK:
       t->force_ack = GNUNET_YES;
       break;
@@ -2113,8 +2111,7 @@
   }
 
   /* Ok, ACK might be necessary, what PID to ACK? */
-  ack = t->queue_max - t->next_fc.queue_n;
-  ack += use_delta ? 0 : t->prev_fc.last_pid_recv;
+  ack = t->prev_fc.last_pid_recv + t->queue_max - t->next_fc.queue_n;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK %u\n", ack);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               " last %u, qmax %u, q %u\n",
@@ -2125,8 +2122,7 @@
     return;
   }
 
-  if (GNUNET_NO == use_delta) 
-    t->prev_fc.last_ack_sent = ack;
+  t->prev_fc.last_ack_sent = ack;
   if (NULL != t->owner)
     send_local_ack (t, t->owner, ack, GNUNET_YES);
   else if (0 != t->prev_hop)
@@ -3640,11 +3636,8 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Received PID %u, ACK %u\n",
                 pid, t->prev_fc.last_ack_sent);
-    // FIXME address this in some sensible manner
-    // - remember that we were polled and last ack might not be accurate
-    // - eliminate altogether and just drop messages of full queue
-//     tunnel_send_fwd_ack(t, GNUNET_MESSAGE_TYPE_MESH_POLL);
-//     return GNUNET_OK;
+    tunnel_send_fwd_ack(t, GNUNET_MESSAGE_TYPE_MESH_POLL);
+    return GNUNET_OK;
   }
 
   tunnel_reset_timeout (t);
@@ -3751,11 +3744,8 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Received PID %u, ACK %u\n",
                 pid, t->next_fc.last_ack_sent);
-    // FIXME address this in some sensible manner
-    // - remember that we were polled and last ack might not be accurate
-    // - eliminate altogether and just drop messages of full queue
-//     tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
-//     return GNUNET_OK;
+    tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
+    return GNUNET_OK;
   }
 
   if (myid == t->id.oid)
@@ -3957,11 +3947,6 @@
     return GNUNET_OK;
   }
 
-  /* If we have already polled, the response will be a delta (free queue) */
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  LAST %u\n", fc->last_pid_sent);
-  if (fc->poll_time.rel_value > GNUNET_TIME_UNIT_SECONDS.rel_value)
-    ack += fc->last_pid_sent;
-
   if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task &&
       GMC_is_pid_bigger (ack, fc->last_ack_recv))
   {
@@ -4019,11 +4004,13 @@
   if (t->next_hop == id)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  from FWD\n");
+    t->next_fc.last_pid_recv = ntohl (msg->pid);
     tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
   }
   else if (t->prev_hop == id)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  from BCK\n");
+    t->prev_fc.last_pid_recv = ntohl (msg->pid);
     tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
   }
   else

Modified: gnunet/src/mesh/mesh_protocol.h
===================================================================
--- gnunet/src/mesh/mesh_protocol.h     2013-07-10 00:52:55 UTC (rev 27857)
+++ gnunet/src/mesh/mesh_protocol.h     2013-07-10 01:11:29 UTC (rev 27858)
@@ -216,6 +216,11 @@
    * OID of the tunnel
    */
   struct GNUNET_PeerIdentity oid;
+
+  /**
+   * Last packet sent.
+   */
+  uint32_t pid GNUNET_PACKED;
 };
 
 /**




reply via email to

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