gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30970 - gnunet/src/mesh
Date: Fri, 29 Nov 2013 13:30:56 +0100

Author: bartpolot
Date: 2013-11-29 13:30:56 +0100 (Fri, 29 Nov 2013)
New Revision: 30970

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
Log:
- do not count channel management traffic as payload


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-29 11:59:08 UTC 
(rev 30969)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-29 12:30:56 UTC 
(rev 30970)
@@ -222,6 +222,11 @@
   struct MeshPeerQueue *q;
 
   /**
+   * Was this a forced message? (Do not account for it)
+   */
+  int forced;
+
+  /**
    * Continuation to call once sent.
    */
   GMC_sent cont;
@@ -527,6 +532,7 @@
   struct MeshFlowControl *fc;
   struct MeshConnectionQueue *q = cls;
   double usecsperbyte;
+  int forced;
 
   fc = fwd ? &c->fwd_fc : &c->bck_fc;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -536,6 +542,7 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  C_P- %p %u\n", c, c->pending_messages);
   if (NULL != q)
   {
+    forced = q->forced;
     if (NULL != q->cont)
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG, "!  calling cont\n");
@@ -543,6 +550,15 @@
     }
     GNUNET_free (q);
   }
+  else if (type == GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED)
+  {
+    /* If NULL == q and ENCRYPTED == type, message must have been ch_mngmnt */
+    forced = GNUNET_YES;
+  }
+  else
+  {
+    forced = GNUNET_NO;
+  }
   c->pending_messages--;
   if (GNUNET_YES == c->destroy && 0 == c->pending_messages)
   {
@@ -556,10 +572,19 @@
     case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
       fc->last_pid_sent++;
       LOG (GNUNET_ERROR_TYPE_DEBUG, "!  Q_N- %p %u\n", fc, fc->queue_n);
-      fc->queue_n--;
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "!   accounting pid %u\n",
-           fc->last_pid_sent);
+      if (GNUNET_NO == forced)
+      {
+        fc->queue_n--;
+        LOG (GNUNET_ERROR_TYPE_DEBUG,
+            "!   accounting pid %u\n",
+            fc->last_pid_sent);
+      }
+      else
+      {
+        LOG (GNUNET_ERROR_TYPE_DEBUG,
+             "!   forced, Q_N not accounting pid %u\n",
+             fc->last_pid_sent);
+      }
       GMC_send_ack (c, fwd, GNUNET_NO);
       break;
 
@@ -2545,10 +2570,17 @@
       emsg->ttl = htonl (ttl - 1);
       emsg->pid = htonl (fc->next_pid++);
       LOG (GNUNET_ERROR_TYPE_DEBUG, "  Q_N+ %p %u\n", fc, fc->queue_n);
-      fc->queue_n++;
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "pid %u\n", ntohl (emsg->pid));
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid sent %u\n", fc->last_pid_sent);
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "     ack recv %u\n", fc->last_ack_recv);
+      if (GNUNET_YES == droppable)
+      {
+        fc->queue_n++;
+        LOG (GNUNET_ERROR_TYPE_DEBUG, "pid %u\n", ntohl (emsg->pid));
+        LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid sent %u\n", fc->last_pid_sent);
+        LOG (GNUNET_ERROR_TYPE_DEBUG, "     ack recv %u\n", fc->last_ack_recv);
+      }
+      else
+      {
+        LOG (GNUNET_ERROR_TYPE_DEBUG, "  not droppable, Q_N stays the same\n");
+      }
       if (GM_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv))
       {
         GMC_start_poll (c, fwd);
@@ -2617,14 +2649,8 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  C_P+ %p %u\n", c, c->pending_messages);
   c->pending_messages++;
 
-  if (NULL == cont)
-  {
-    (void) GMP_queue_add (get_hop (c, fwd), data, type, size, c, fwd,
-                          &message_sent, NULL);
-    return NULL;
-  }
-
   q = GNUNET_new (struct MeshConnectionQueue);
+  q->forced = !droppable;
   q->q = GMP_queue_add (get_hop (c, fwd), data, type, size, c, fwd,
                         &message_sent, q);
   if (NULL == q->q)




reply via email to

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