gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30625 - gnunet/src/mesh
Date: Fri, 8 Nov 2013 13:09:54 +0100

Author: bartpolot
Date: 2013-11-08 13:09:54 +0100 (Fri, 08 Nov 2013)
New Revision: 30625

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_peer.c
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- fix polling


Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-11-08 12:04:46 UTC 
(rev 30624)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-11-08 12:09:54 UTC 
(rev 30625)
@@ -1629,7 +1629,8 @@
       GNUNET_break (0);
       return;
     }
-    fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO;
+    /* Inverted: if message came 'FWD' is a 'BCK ACK'. */
+    fwd = (NULL != ch->dest) ? GNUNET_NO : GNUNET_YES;
   }
 
   ack = ntohl (msg->mid);
@@ -1646,7 +1647,7 @@
   }
   if (NULL == rel)
   {
-    GNUNET_break (0);
+    GNUNET_break_op (0);
     return;
   }
 

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-08 12:04:46 UTC 
(rev 30624)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-08 12:09:54 UTC 
(rev 30625)
@@ -445,7 +445,6 @@
 
   fc = fwd ? &c->fwd_fc : &c->bck_fc;
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  sent %s\n", GNUNET_MESH_DEBUG_M2S (type));
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "!  Q_N- %p %u\n", fc, fc->queue_n);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  C_P- %p %u\n", c, c->pending_messages);
   c->pending_messages--;
   if (GNUNET_YES == c->destroy && 0 == c->pending_messages)
@@ -459,6 +458,7 @@
   {
     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",
@@ -604,6 +604,7 @@
                  GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
                  sizeof (struct GNUNET_MESH_ConnectionACK),
                  connection, fwd, &message_sent, NULL);
+  connection->pending_messages++;
   if (MESH_TUNNEL3_NEW == GMT_get_state (t))
     GMT_change_state (t, MESH_TUNNEL3_WAITING);
   if (MESH_CONNECTION_READY != connection->state)
@@ -1724,12 +1725,12 @@
   id = GNUNET_PEER_search (peer);
   if (GMP_get_short_id (get_next_hop (c)) == id)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  FWD ACK\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  FWD FC\n");
     fc = &c->fwd_fc;
   }
   else if (GMP_get_short_id (get_prev_hop (c)) == id)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  BCK ACK\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  BCK FC\n");
     fc = &c->bck_fc;
   }
   else
@@ -1739,10 +1740,9 @@
   }
 
   pid = ntohl (msg->pid);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "  PID %u, OLD %u\n",
-              pid, fc->last_pid_recv);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  PID %u, OLD %u\n", pid, fc->last_pid_recv);
   fc->last_pid_recv = pid;
-  fwd = fc == &c->fwd_fc;
+  fwd = fc == &c->bck_fc;
   GMC_send_ack (c, fwd);
 
   return GNUNET_OK;
@@ -2230,7 +2230,7 @@
   data = GNUNET_malloc (size);
   memcpy (data, message, size);
   type = ntohs (message->type);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u) on connection %s\n",
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u bytes) on connection %s\n",
               GNUNET_MESH_DEBUG_M2S (type), size, GMC_2s (c));
 
   fc = fwd ? &c->fwd_fc : &c->bck_fc;

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-11-08 12:04:46 UTC (rev 
30624)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-11-08 12:09:54 UTC (rev 
30625)
@@ -1008,26 +1008,15 @@
   queue->fwd = fwd;
   queue->callback = cont;
   queue->callback_cls = cont_cls;
-  if (100 <= priority)
+  if (100 > priority)
   {
-    struct MeshPeerQueue *copy;
-    struct MeshPeerQueue *next;
-
-    for (copy = peer->queue_head; NULL != copy; copy = next)
-    {
-      next = copy->next;
-      if (copy->type == type && copy->c == c && copy->fwd == fwd)
-      {
-        /* Example: also a FWD ACK for connection XYZ */
-        queue_destroy (copy, GNUNET_YES);
-      }
-    }
-    GNUNET_CONTAINER_DLL_insert (peer->queue_head, peer->queue_tail, queue);
+    GNUNET_CONTAINER_DLL_insert_tail (peer->queue_head, peer->queue_tail, 
queue);
+    peer->queue_n++;
   }
   else
   {
-    GNUNET_CONTAINER_DLL_insert_tail (peer->queue_head, peer->queue_tail, 
queue);
-    peer->queue_n++;
+    GNUNET_CONTAINER_DLL_insert (peer->queue_head, peer->queue_tail, queue);
+    call_core = GNUNET_YES;
   }
 
   if (NULL == peer->core_transmit && GNUNET_YES == call_core)

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-11-08 12:04:46 UTC 
(rev 30624)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-11-08 12:09:54 UTC 
(rev 30625)
@@ -2007,6 +2007,7 @@
   switch (type)
   {
     case GNUNET_MESSAGE_TYPE_MESH_DATA:
+    case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:




reply via email to

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