From b11751fa943c1d4659c24e8bf558dc86213f5998 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 17 Nov 2011 14:53:08 +0000 Subject: consider number of retransmissions for delay calculation --- src/fragmentation/fragmentation.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/fragmentation') diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c index c7207cb12..3d8fc50bc 100644 --- a/src/fragmentation/fragmentation.c +++ b/src/fragmentation/fragmentation.c @@ -99,6 +99,11 @@ struct GNUNET_FRAGMENT_Context */ unsigned int next_transmission; + /** + * How many rounds of transmission have we completed so far? + */ + unsigned int num_rounds; + /** * GNUNET_YES if we called 'proc' and are now waiting for 'GNUNET_FRAGMENT_transmission_done' */ @@ -112,7 +117,7 @@ struct GNUNET_FRAGMENT_Context /** * Target fragment size. */ - uint16_t mtu; + uint16_t mtu; }; @@ -207,6 +212,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) delay = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, delay); fc->last_round = GNUNET_TIME_absolute_get (); fc->wack = GNUNET_YES; + fc->num_rounds++; } fc->proc_busy = GNUNET_YES; fc->delay_until = GNUNET_TIME_relative_to_absolute (delay); @@ -330,7 +336,7 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, /* normal ACK, can update running average of delay... */ fc->wack = GNUNET_NO; ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); - fc->delay.rel_value = (ndelay.rel_value + 3 * fc->delay.rel_value) / 4; + fc->delay.rel_value = (ndelay.rel_value * fc->num_rounds + 3 * fc->delay.rel_value) / 4; } GNUNET_STATISTICS_update (fc->stats, _("# fragment acknowledgements received"), 1, -- cgit v1.2.3