summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-10-14 16:23:32 +0000
committerBart Polot <bart@net.in.tum.de>2011-10-14 16:23:32 +0000
commita4646d6b2d0f8ad1ecb5f2217f814c8991a6da16 (patch)
treeca218c9471482820785b4448902a542aa0553361 /src
parent4a918fb57eca1b5c107954f4ef8424568b6dfa18 (diff)
WiP
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 2fb1070ae..7a49c3be8 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -66,6 +66,10 @@
GNUNET_TIME_UNIT_SECONDS,\
5)
+#define UNACKNOWLEDGED_WAIT GNUNET_TIME_relative_multiply(\
+ GNUNET_TIME_UNIT_SECONDS,\
+ 2)
+
/******************************************************************************/
/************************ DATA STRUCTURES ****************************/
/******************************************************************************/
@@ -103,6 +107,9 @@ struct MeshDataDescriptor
/** Size of the data */
size_t size;
+ /** Used to allow a client send more traffic to the service after a
+ * previous packet was tried to be sent to a neighbor and couldn't */
+ GNUNET_SCHEDULER_TaskIdentifier timeout_task;
};
@@ -674,6 +681,17 @@ client_is_subscribed (uint16_t message_type, struct MeshClient *c)
return GNUNET_CONTAINER_multihashmap_contains (c->types, &hc);
}
+static void
+client_allow_send(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct MeshDataDescriptor *info = cls;
+
+ if (GNUNET_SCHEDULER_REASON_SHUTDOWN == tc->reason)
+ return;
+ info->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_SERVER_receive_done(info->client, GNUNET_OK);
+}
+
/**
* Search for a tunnel by global ID using full PeerIdentities
@@ -2279,6 +2297,9 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
info->size = size;
info->copies = copies;
info->client = t->client->handle;
+ info->timeout_task = GNUNET_SCHEDULER_add_delayed(UNACKNOWLEDGED_WAIT,
+ &client_allow_send,
+ t->client->handle);
info->destination = n->peer;
id = path_get_first_hop(t->tree, n->peer);
info->peer = peer_info_get(id);