aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-07-31 14:23:25 +0000
committerBart Polot <bart@net.in.tum.de>2012-07-31 14:23:25 +0000
commit7505ffc8b7cf9cdf6ae3da9058b3fabc58897f52 (patch)
treeb47af274ab4e52eac3c3d88ed9d553c2e64201d6 /src/mesh
parent45f337dd083ac69a65550bc3259646dfbdbc85c1 (diff)
downloadgnunet-7505ffc8b7cf9cdf6ae3da9058b3fabc58897f52.tar.gz
gnunet-7505ffc8b7cf9cdf6ae3da9058b3fabc58897f52.zip
- more debug, client side ACK
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh.c7
-rw-r--r--src/mesh/mesh.h3
-rw-r--r--src/mesh/mesh_api.c39
-rw-r--r--src/mesh/test_mesh_local_traffic.c2
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,
1905 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending\n"); 1905 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending\n");
1906 GNUNET_SERVER_notification_context_unicast (nc, c->handle, 1906 GNUNET_SERVER_notification_context_unicast (nc, c->handle,
1907 (struct GNUNET_MessageHeader 1907 (struct GNUNET_MessageHeader
1908 *) cbuf, GNUNET_YES); 1908 *) cbuf, GNUNET_NO);
1909 } 1909 }
1910 } 1910 }
1911 return count; 1911 return count;
@@ -4662,7 +4662,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
4662 copy->tid = htonl (t->local_tid); 4662 copy->tid = htonl (t->local_tid);
4663 GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO); 4663 GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO);
4664 GNUNET_SERVER_notification_context_unicast (nc, t->owner->handle, 4664 GNUNET_SERVER_notification_context_unicast (nc, t->owner->handle,
4665 &copy->header, GNUNET_YES); 4665 &copy->header, GNUNET_NO);
4666 return GNUNET_OK; 4666 return GNUNET_OK;
4667 } 4667 }
4668 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4668 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -6872,8 +6872,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
6872 types = GNUNET_CONTAINER_multihashmap_create (32); 6872 types = GNUNET_CONTAINER_multihashmap_create (32);
6873 6873
6874 GNUNET_SERVER_add_handlers (server_handle, client_handlers); 6874 GNUNET_SERVER_add_handlers (server_handle, client_handlers);
6875 nc = GNUNET_SERVER_notification_context_create (server_handle, 6875 nc = GNUNET_SERVER_notification_context_create (server_handle, 1);
6876 LOCAL_QUEUE_SIZE);
6877 GNUNET_SERVER_disconnect_notify (server_handle, 6876 GNUNET_SERVER_disconnect_notify (server_handle,
6878 &handle_local_client_disconnect, NULL); 6877 &handle_local_client_disconnect, NULL);
6879 6878
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 @@
78#define GNUNET_MESH_LOCAL_TUNNEL_ID_CLI 0x80000000 78#define GNUNET_MESH_LOCAL_TUNNEL_ID_CLI 0x80000000
79#define GNUNET_MESH_LOCAL_TUNNEL_ID_SERV 0xB0000000 79#define GNUNET_MESH_LOCAL_TUNNEL_ID_SERV 0xB0000000
80 80
81#define CORE_QUEUE_SIZE 1
82#define LOCAL_QUEUE_SIZE 100
83
84/******************************************************************************/ 81/******************************************************************************/
85/************************** MESSAGES ******************************/ 82/************************** MESSAGES ******************************/
86/******************************************************************************/ 83/******************************************************************************/
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
@@ -683,6 +683,28 @@ send_packet (struct GNUNET_MESH_Handle *h,
683 683
684 684
685/** 685/**
686 * Send an ack on the tunnel to confirm the processing of a message.
687 *
688 * @param h Mesh handle.
689 * @param t Tunnel on which to send the ACK.
690 */
691static void
692send_ack (struct GNUNET_MESH_Handle *h, struct GNUNET_MESH_Tunnel *t)
693{
694 struct GNUNET_MESH_LocalAck msg;
695
696 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK);
697 msg.header.size = htons (sizeof (msg));
698 msg.tunnel_id = htonl (t->tid);
699 msg.max_pid = t->pid + 1;
700
701 send_packet (h, &msg.header, t);
702 return;
703}
704
705
706
707/**
686 * Reconnect callback: tries to reconnect again after a failer previous 708 * Reconnect callback: tries to reconnect again after a failer previous
687 * reconnecttion 709 * reconnecttion
688 * @param cls closure (mesh handle) 710 * @param cls closure (mesh handle)
@@ -755,8 +777,9 @@ do_reconnect (struct GNUNET_MESH_Handle *h)
755 LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n"); 777 LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
756 LOG (GNUNET_ERROR_TYPE_DEBUG, "******* RECONNECT *******\n"); 778 LOG (GNUNET_ERROR_TYPE_DEBUG, "******* RECONNECT *******\n");
757 LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n"); 779 LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
780 LOG (GNUNET_ERROR_TYPE_DEBUG, "******** on %p *******\n", h);
781 LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
758 782
759 h->in_receive = GNUNET_NO;
760 /* disconnect */ 783 /* disconnect */
761 if (NULL != h->th) 784 if (NULL != h->th)
762 { 785 {
@@ -869,6 +892,7 @@ static void
869reconnect (struct GNUNET_MESH_Handle *h) 892reconnect (struct GNUNET_MESH_Handle *h)
870{ 893{
871 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requested RECONNECT\n"); 894 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requested RECONNECT\n");
895 h->in_receive = GNUNET_NO;
872 if (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task) 896 if (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task)
873 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, 897 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time,
874 &reconnect_cbk, h); 898 &reconnect_cbk, h);
@@ -1103,6 +1127,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
1103 { 1127 {
1104 LOG (GNUNET_ERROR_TYPE_DEBUG, 1128 LOG (GNUNET_ERROR_TYPE_DEBUG,
1105 "callback completed successfully\n"); 1129 "callback completed successfully\n");
1130 send_ack (h, t);
1106 } 1131 }
1107 } 1132 }
1108 } 1133 }
@@ -1205,8 +1230,16 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg)
1205 ntohs (msg->type)); 1230 ntohs (msg->type));
1206 } 1231 }
1207 LOG (GNUNET_ERROR_TYPE_DEBUG, "message processed\n"); 1232 LOG (GNUNET_ERROR_TYPE_DEBUG, "message processed\n");
1208 GNUNET_CLIENT_receive (h->client, &msg_received, h, 1233 if (GNUNET_YES == h->in_receive)
1209 GNUNET_TIME_UNIT_FOREVER_REL); 1234 {
1235 GNUNET_CLIENT_receive (h->client, &msg_received, h,
1236 GNUNET_TIME_UNIT_FOREVER_REL);
1237 }
1238 else
1239 {
1240 LOG (GNUNET_ERROR_TYPE_DEBUG,
1241 "in receive off, not calling CLIENT_receive\n");
1242 }
1210} 1243}
1211 1244
1212 1245
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 @@
32 32
33#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 33#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
34 34
35#define TARGET 1000 35#define TARGET 100
36 36
37GNUNET_NETWORK_STRUCT_BEGIN 37GNUNET_NETWORK_STRUCT_BEGIN
38 38