gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r23015 - gnunet/src/mesh
Date: Tue, 31 Jul 2012 16:23:25 +0200

Author: bartpolot
Date: 2012-07-31 16:23:25 +0200 (Tue, 31 Jul 2012)
New Revision: 23015

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
   gnunet/src/mesh/mesh.h
   gnunet/src/mesh/mesh_api.c
   gnunet/src/mesh/test_mesh_local_traffic.c
Log:
- more debug, client side ACK

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2012-07-31 12:38:23 UTC (rev 
23014)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2012-07-31 14:23:25 UTC (rev 
23015)
@@ -1905,7 +1905,7 @@
       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 @@
     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 @@
   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);
 

Modified: gnunet/src/mesh/mesh.h
===================================================================
--- gnunet/src/mesh/mesh.h      2012-07-31 12:38:23 UTC (rev 23014)
+++ gnunet/src/mesh/mesh.h      2012-07-31 14:23:25 UTC (rev 23015)
@@ -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      
******************************/
 
/******************************************************************************/

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2012-07-31 12:38:23 UTC (rev 23014)
+++ gnunet/src/mesh/mesh_api.c  2012-07-31 14:23:25 UTC (rev 23015)
@@ -683,6 +683,28 @@
 
 
 /**
+ * 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
  * @param cls closure (mesh handle)
@@ -755,8 +777,9 @@
   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 @@
 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 @@
       {
         LOG (GNUNET_ERROR_TYPE_DEBUG,
              "callback completed successfully\n");
+        send_ack (h, t);
       }
     }
   }
@@ -1205,8 +1230,16 @@
          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");
+  }
 }
 
 

Modified: gnunet/src/mesh/test_mesh_local_traffic.c
===================================================================
--- gnunet/src/mesh/test_mesh_local_traffic.c   2012-07-31 12:38:23 UTC (rev 
23014)
+++ gnunet/src/mesh/test_mesh_local_traffic.c   2012-07-31 14:23:25 UTC (rev 
23015)
@@ -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
 




reply via email to

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