diff options
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 21 |
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 @@ | |||
66 | GNUNET_TIME_UNIT_SECONDS,\ | 66 | GNUNET_TIME_UNIT_SECONDS,\ |
67 | 5) | 67 | 5) |
68 | 68 | ||
69 | #define UNACKNOWLEDGED_WAIT GNUNET_TIME_relative_multiply(\ | ||
70 | GNUNET_TIME_UNIT_SECONDS,\ | ||
71 | 2) | ||
72 | |||
69 | /******************************************************************************/ | 73 | /******************************************************************************/ |
70 | /************************ DATA STRUCTURES ****************************/ | 74 | /************************ DATA STRUCTURES ****************************/ |
71 | /******************************************************************************/ | 75 | /******************************************************************************/ |
@@ -103,6 +107,9 @@ struct MeshDataDescriptor | |||
103 | /** Size of the data */ | 107 | /** Size of the data */ |
104 | size_t size; | 108 | size_t size; |
105 | 109 | ||
110 | /** Used to allow a client send more traffic to the service after a | ||
111 | * previous packet was tried to be sent to a neighbor and couldn't */ | ||
112 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; | ||
106 | }; | 113 | }; |
107 | 114 | ||
108 | 115 | ||
@@ -674,6 +681,17 @@ client_is_subscribed (uint16_t message_type, struct MeshClient *c) | |||
674 | return GNUNET_CONTAINER_multihashmap_contains (c->types, &hc); | 681 | return GNUNET_CONTAINER_multihashmap_contains (c->types, &hc); |
675 | } | 682 | } |
676 | 683 | ||
684 | static void | ||
685 | client_allow_send(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
686 | { | ||
687 | struct MeshDataDescriptor *info = cls; | ||
688 | |||
689 | if (GNUNET_SCHEDULER_REASON_SHUTDOWN == tc->reason) | ||
690 | return; | ||
691 | info->timeout_task = GNUNET_SCHEDULER_NO_TASK; | ||
692 | GNUNET_SERVER_receive_done(info->client, GNUNET_OK); | ||
693 | } | ||
694 | |||
677 | 695 | ||
678 | /** | 696 | /** |
679 | * Search for a tunnel by global ID using full PeerIdentities | 697 | * 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, | |||
2279 | info->size = size; | 2297 | info->size = size; |
2280 | info->copies = copies; | 2298 | info->copies = copies; |
2281 | info->client = t->client->handle; | 2299 | info->client = t->client->handle; |
2300 | info->timeout_task = GNUNET_SCHEDULER_add_delayed(UNACKNOWLEDGED_WAIT, | ||
2301 | &client_allow_send, | ||
2302 | t->client->handle); | ||
2282 | info->destination = n->peer; | 2303 | info->destination = n->peer; |
2283 | id = path_get_first_hop(t->tree, n->peer); | 2304 | id = path_get_first_hop(t->tree, n->peer); |
2284 | info->peer = peer_info_get(id); | 2305 | info->peer = peer_info_get(id); |