gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r32864 - gnunet/src/mesh
Date: Tue, 1 Apr 2014 02:16:59 +0200

Author: bartpolot
Date: 2014-04-01 02:16:59 +0200 (Tue, 01 Apr 2014)
New Revision: 32864

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_peer.c
   gnunet/src/mesh/gnunet-service-mesh_peer.h
Log:
Do not account canceled messages as sent regarding flow control

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2014-04-01 00:16:55 UTC 
(rev 32863)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2014-04-01 00:16:59 UTC 
(rev 32864)
@@ -557,6 +557,7 @@
  *
  * @param cls Closure (ConnectionQueue Handle).
  * @param c Connection this message was on.
+ * @param sent Was it really sent? (Could have been canceled)
  * @param type Type of message sent.
  * @param fwd Was this a FWD going message?
  * @param size Size of the message.
@@ -564,8 +565,8 @@
  */
 static void
 message_sent (void *cls,
-              struct MeshConnection *c, uint16_t type,
-              int fwd, size_t size,
+              struct MeshConnection *c, int sent,
+              uint16_t type, int fwd, size_t size,
               struct GNUNET_TIME_Relative wait)
 {
   struct MeshConnectionPerformance *p;
@@ -575,10 +576,8 @@
   int forced;
 
   fc = fwd ? &c->fwd_fc : &c->bck_fc;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "!  sent %s %s\n",
-       GM_f2s (fwd),
-       GM_m2s (type));
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "!  %ssent %s %s\n",
+       sent ? "" : "not ", GM_f2s (fwd), GM_m2s (type));
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  C_P- %p %u\n", c, c->pending_messages);
   if (NULL != q)
   {
@@ -618,7 +617,9 @@
       break;
 
     case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
-      fc->last_pid_sent++;
+      if (GNUNET_YES == sent)
+        fc->last_pid_sent++;
+
       LOG (GNUNET_ERROR_TYPE_DEBUG, "!  Q_N- %p %u\n", fc, fc->queue_n);
       if (GNUNET_NO == forced)
       {
@@ -633,8 +634,11 @@
              "!   forced, Q_N not accounting pid %u\n",
              fc->last_pid_sent);
       }
-      GMC_send_ack (c, fwd, GNUNET_NO);
-      connection_reset_timeout (c, fwd);
+      if (GNUNET_YES == sent)
+      {
+        GMC_send_ack (c, fwd, GNUNET_NO);
+        connection_reset_timeout (c, fwd);
+      }
       break;
 
     case GNUNET_MESSAGE_TYPE_MESH_POLL:
@@ -2936,7 +2940,7 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  GMC cancel message\n");
 
   /* queue destroy calls message_sent, which calls q->cont and frees q */
-  GMP_queue_destroy (q->q, GNUNET_YES);
+  GMP_queue_destroy (q->q, GNUNET_YES, GNUNET_NO);
 }
 
 

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2014-04-01 00:16:55 UTC (rev 
32863)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2014-04-01 00:16:59 UTC (rev 
32864)
@@ -946,7 +946,7 @@
   }
 
   /* Free queue, but cls was freed by send_core_* */
-  GMP_queue_destroy (queue, GNUNET_NO);
+  GMP_queue_destroy (queue, GNUNET_NO, GNUNET_YES);
 
   /* If more data in queue, send next */
   queue = peer_get_first_message (peer);
@@ -993,9 +993,10 @@
  *
  * @param queue Queue handler to cancel.
  * @param clear_cls Is it necessary to free associated cls?
+ * @param sent Was it really sent? (Could have been canceled)
  */
 void
-GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls)
+GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls, int sent)
 {
   struct MeshPeer *peer;
 
@@ -1039,7 +1040,7 @@
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "#   Calling callback\n");
     queue->callback (queue->callback_cls,
-                     queue->c, queue->type,
+                     queue->c, sent, queue->type,
                      queue->fwd, queue->size,
                      GNUNET_TIME_absolute_get_duration (queue->start_waiting));
   }
@@ -1137,11 +1138,16 @@
                                            peer);
     queue->start_waiting = GNUNET_TIME_absolute_get ();
   }
+  else if (GNUNET_NO == call_core)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s not needed\n",
+         GMP_2s (peer));
+
+  }
   else
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-                "core tmt rdy towards %s already called\n",
-                GMP_2s (peer));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s already called\n",
+         GMP_2s (peer));
 
   }
   return queue;
@@ -1168,7 +1174,7 @@
     if (q->c == c)
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP_cancel_queue %s\n", GM_m2s (q->type));
-      GMP_queue_destroy (q, GNUNET_YES);
+      GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO);
 
       /* Get next from prev, q->next might be already freed:
        * queue destroy -> callback -> GMC_destroy -> cancel_queues -> here
@@ -1250,13 +1256,13 @@
       case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
       case GNUNET_MESSAGE_TYPE_MESH_ACK:
       case GNUNET_MESSAGE_TYPE_MESH_POLL:
-        GMP_queue_destroy (q, GNUNET_YES);
+        GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO);
         continue;
 
       case GNUNET_MESSAGE_TYPE_MESH_KX:
       case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
         msg = (struct GNUNET_MessageHeader *) q->cls;
-        GMP_queue_destroy (q, GNUNET_NO);
+        GMP_queue_destroy (q, GNUNET_NO, GNUNET_NO);
         return msg;
 
       default:

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.h  2014-04-01 00:16:55 UTC (rev 
32863)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.h  2014-04-01 00:16:59 UTC (rev 
32864)
@@ -57,14 +57,15 @@
  *
  * @param cls Closure.
  * @param c Connection this message was on.
+ * @param sent Was it really sent? (Could have been canceled)
  * @param type Type of message sent.
  * @param fwd Was this a FWD going message?
  * @param size Size of the message.
  * @param wait Time spent waiting for core (only the time for THIS message)
  */
 typedef void (*GMP_sent) (void *cls,
-                          struct MeshConnection *c, uint16_t type,
-                          int fwd, size_t size,
+                          struct MeshConnection *c, int sent,
+                          uint16_t type, int fwd, size_t size,
                           struct GNUNET_TIME_Relative wait);
 
 
/******************************************************************************/
@@ -125,9 +126,10 @@
  *
  * @param queue Queue handler to cancel.
  * @param clear_cls Is it necessary to free associated cls?
+ * @param sent Was it really sent? (Could have been canceled)
  */
 void
-GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls);
+GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls, int sent);
 
 /**
  * @brief Queue and pass message to core when possible.




reply via email to

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