- more debug, client side ACK
authorBart Polot <bart@net.in.tum.de>
Tue, 31 Jul 2012 14:23:25 +0000 (14:23 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 31 Jul 2012 14:23:25 +0000 (14:23 +0000)
src/mesh/gnunet-service-mesh.c
src/mesh/mesh.h
src/mesh/mesh_api.c
src/mesh/test_mesh_local_traffic.c

index 98bd498a1c40b3c23dea60671a1e2648fa965d6a..f8d5786795252684bc91fa6406680a0889da46a6 100644 (file)
@@ -1905,7 +1905,7 @@ send_subscribed_clients (const struct GNUNET_MessageHeader *msg,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "     sending\n");
       GNUNET_SERVER_notification_context_unicast (nc, c->handle,
                                                   (struct GNUNET_MessageHeader
-                                                   *) cbuf, GNUNET_YES);
+                                                   *) cbuf, GNUNET_NO);
     }
   }
   return count;
@@ -4662,7 +4662,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
     copy->tid = htonl (t->local_tid);
     GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO);
     GNUNET_SERVER_notification_context_unicast (nc, t->owner->handle,
-                                                &copy->header, GNUNET_YES);
+                                                &copy->header, GNUNET_NO);
     return GNUNET_OK;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -6872,8 +6872,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
   types = GNUNET_CONTAINER_multihashmap_create (32);
 
   GNUNET_SERVER_add_handlers (server_handle, client_handlers);
-  nc = GNUNET_SERVER_notification_context_create (server_handle,
-                                                  LOCAL_QUEUE_SIZE);
+  nc = GNUNET_SERVER_notification_context_create (server_handle, 1);
   GNUNET_SERVER_disconnect_notify (server_handle,
                                    &handle_local_client_disconnect, NULL);
 
index 66d6d6cb13851d7bc5cbe66bab45fd19474a1894..15599c4ba48611360d7c609bfbaa63f68fcfa186 100644 (file)
@@ -78,9 +78,6 @@
 #define GNUNET_MESH_LOCAL_TUNNEL_ID_CLI 0x80000000
 #define GNUNET_MESH_LOCAL_TUNNEL_ID_SERV 0xB0000000
 
-#define CORE_QUEUE_SIZE         1
-#define LOCAL_QUEUE_SIZE        100
-
 /******************************************************************************/
 /**************************        MESSAGES      ******************************/
 /******************************************************************************/
index b9ac8f94d17aeff378275408dd623d5f1fe7cc11..f1c9a78e5713f780097e7ac46a21284c622059e3 100644 (file)
@@ -682,6 +682,28 @@ send_packet (struct GNUNET_MESH_Handle *h,
              struct GNUNET_MESH_Tunnel *tunnel);
 
 
+/**
+ * Send an ack on the tunnel to confirm the processing of a message.
+ * 
+ * @param h Mesh handle.
+ * @param t Tunnel on which to send the ACK.
+ */
+static void
+send_ack (struct GNUNET_MESH_Handle *h, struct GNUNET_MESH_Tunnel *t)
+{
+  struct GNUNET_MESH_LocalAck msg;
+
+  msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK);
+  msg.header.size = htons (sizeof (msg));
+  msg.tunnel_id = htonl (t->tid);
+  msg.max_pid = t->pid + 1;
+
+  send_packet (h, &msg.header, t);
+  return;
+}
+
+
+
 /**
  * Reconnect callback: tries to reconnect again after a failer previous
  * reconnecttion
@@ -755,8 +777,9 @@ do_reconnect (struct GNUNET_MESH_Handle *h)
   LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
   LOG (GNUNET_ERROR_TYPE_DEBUG, "*******   RECONNECT   *******\n");
   LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "******** on %p *******\n", h);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
 
-  h->in_receive = GNUNET_NO;
   /* disconnect */
   if (NULL != h->th)
   {
@@ -869,6 +892,7 @@ static void
 reconnect (struct GNUNET_MESH_Handle *h)
 {
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Requested RECONNECT\n");
+  h->in_receive = GNUNET_NO;
   if (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task)
     h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time,
                                                       &reconnect_cbk, h);
@@ -1103,6 +1127,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
       {
         LOG (GNUNET_ERROR_TYPE_DEBUG,
              "callback completed successfully\n");
+        send_ack (h, t);
       }
     }
   }
@@ -1205,8 +1230,16 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg)
          ntohs (msg->type));
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG, "message processed\n");
-  GNUNET_CLIENT_receive (h->client, &msg_received, h,
-                         GNUNET_TIME_UNIT_FOREVER_REL);
+  if (GNUNET_YES == h->in_receive)
+  {
+    GNUNET_CLIENT_receive (h->client, &msg_received, h,
+                           GNUNET_TIME_UNIT_FOREVER_REL);
+  }
+  else
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "in receive off, not calling CLIENT_receive\n");
+  }
 }
 
 
index 78e1049f679d92a86cd8b05e44ebaeb2d39823a6..0138cb623ff0c6c05f45bfe6c07c88d4f655ff15 100644 (file)
@@ -32,7 +32,7 @@
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
 
-#define TARGET 1000
+#define TARGET 100
 
 GNUNET_NETWORK_STRUCT_BEGIN