aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-07-12 23:01:17 +0000
committerBart Polot <bart@net.in.tum.de>2013-07-12 23:01:17 +0000
commit581fa8973a09190bc59f62e5da7eb69983f39228 (patch)
treed38cd74d2f324e57a500066c4fc4da79a5fd5422 /src/mesh/gnunet-service-mesh.c
parent23527d2b7ba960e5e02d93a942fdcb4b89696fc2 (diff)
downloadgnunet-581fa8973a09190bc59f62e5da7eb69983f39228.tar.gz
gnunet-581fa8973a09190bc59f62e5da7eb69983f39228.zip
- limit retransmission buffer size
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 42cead824..169b30087 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -328,29 +328,34 @@ struct MeshTunnelReliability
328 /** 328 /**
329 * DLL of messages sent and not yet ACK'd. 329 * DLL of messages sent and not yet ACK'd.
330 */ 330 */
331 struct MeshReliableMessage *head_sent; 331 struct MeshReliableMessage *head_sent;
332 struct MeshReliableMessage *tail_sent; 332 struct MeshReliableMessage *tail_sent;
333
334 /**
335 * Messages pending
336 */
337 unsigned int n_sent;
333 338
334 /** 339 /**
335 * DLL of messages received out of order. 340 * DLL of messages received out of order.
336 */ 341 */
337 struct MeshReliableMessage *head_recv; 342 struct MeshReliableMessage *head_recv;
338 struct MeshReliableMessage *tail_recv; 343 struct MeshReliableMessage *tail_recv;
339 344
340 /** 345 /**
341 * Task to resend/poll in case no ACK is received. 346 * Task to resend/poll in case no ACK is received.
342 */ 347 */
343 GNUNET_SCHEDULER_TaskIdentifier retry_task; 348 GNUNET_SCHEDULER_TaskIdentifier retry_task;
344 349
345 /** 350 /**
346 * Counter for exponential backoff. 351 * Counter for exponential backoff.
347 */ 352 */
348 struct GNUNET_TIME_Relative retry_timer; 353 struct GNUNET_TIME_Relative retry_timer;
349 354
350 /** 355 /**
351 * How long does it usually take to get an ACK. FIXME update with traffic 356 * How long does it usually take to get an ACK. FIXME update with traffic
352 */ 357 */
353 struct GNUNET_TIME_Relative expected_delay; 358 struct GNUNET_TIME_Relative expected_delay;
354}; 359};
355 360
356 361
@@ -2109,6 +2114,9 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2109 } 2114 }
2110 if (GNUNET_YES == t->reliable && NULL != t->client) 2115 if (GNUNET_YES == t->reliable && NULL != t->client)
2111 tunnel_send_fwd_data_ack (t); 2116 tunnel_send_fwd_data_ack (t);
2117 if (GNUNET_YES == t->reliable && NULL != t->owner)
2118 if (t->fwd_rel->n_sent > 10)
2119 return;
2112 break; 2120 break;
2113 case GNUNET_MESSAGE_TYPE_MESH_ACK: 2121 case GNUNET_MESSAGE_TYPE_MESH_ACK:
2114 if (NULL != t->owner && GNUNET_YES == t->reliable) 2122 if (NULL != t->owner && GNUNET_YES == t->reliable)
@@ -4015,6 +4023,7 @@ handle_mesh_data_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
4015 time = GNUNET_TIME_absolute_get_duration (copy->timestamp); 4023 time = GNUNET_TIME_absolute_get_duration (copy->timestamp);
4016 rel->expected_delay.rel_value += time.rel_value; 4024 rel->expected_delay.rel_value += time.rel_value;
4017 rel->expected_delay.rel_value /= 2; 4025 rel->expected_delay.rel_value /= 2;
4026 rel->n_sent--;
4018 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! new expected delay %s\n", 4027 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! new expected delay %s\n",
4019 GNUNET_STRINGS_relative_time_to_string (rel->expected_delay, 4028 GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
4020 GNUNET_NO)); 4029 GNUNET_NO));
@@ -4782,6 +4791,7 @@ handle_local_data (void *cls, struct GNUNET_SERVER_Client *client,
4782 copy->timestamp = GNUNET_TIME_absolute_get (); 4791 copy->timestamp = GNUNET_TIME_absolute_get ();
4783 rel = (tid < GNUNET_MESH_LOCAL_TUNNEL_ID_SERV) ? t->fwd_rel : t->bck_rel; 4792 rel = (tid < GNUNET_MESH_LOCAL_TUNNEL_ID_SERV) ? t->fwd_rel : t->bck_rel;
4784 copy->rel = rel; 4793 copy->rel = rel;
4794 rel->n_sent++;
4785 GNUNET_CONTAINER_DLL_insert_tail (rel->head_sent, rel->tail_sent, copy); 4795 GNUNET_CONTAINER_DLL_insert_tail (rel->head_sent, rel->tail_sent, copy);
4786 if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task) 4796 if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task)
4787 { 4797 {