From 7505ffc8b7cf9cdf6ae3da9058b3fabc58897f52 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Tue, 31 Jul 2012 14:23:25 +0000 Subject: [PATCH] - more debug, client side ACK --- src/mesh/gnunet-service-mesh.c | 7 +++--- src/mesh/mesh.h | 3 --- src/mesh/mesh_api.c | 39 +++++++++++++++++++++++++++--- src/mesh/test_mesh_local_traffic.c | 2 +- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 98bd498a1..f8d578679 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -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, - ©->header, GNUNET_YES); + ©->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); diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h index 66d6d6cb1..15599c4ba 100644 --- a/src/mesh/mesh.h +++ b/src/mesh/mesh.h @@ -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 ******************************/ /******************************************************************************/ diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index b9ac8f94d..f1c9a78e5 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -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"); + } } diff --git a/src/mesh/test_mesh_local_traffic.c b/src/mesh/test_mesh_local_traffic.c index 78e1049f6..0138cb623 100644 --- a/src/mesh/test_mesh_local_traffic.c +++ b/src/mesh/test_mesh_local_traffic.c @@ -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 -- 2.25.1