diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-11-17 14:53:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-11-17 14:53:08 +0000 |
commit | b11751fa943c1d4659c24e8bf558dc86213f5998 (patch) | |
tree | 9766afc1a83ac2818304894eee322a53d429db82 /src/fragmentation/fragmentation.c | |
parent | deb59bbfa36a8fb3b825abab00b0c92a60015e87 (diff) | |
download | gnunet-b11751fa943c1d4659c24e8bf558dc86213f5998.tar.gz gnunet-b11751fa943c1d4659c24e8bf558dc86213f5998.zip |
consider number of retransmissions for delay calculation
Diffstat (limited to 'src/fragmentation/fragmentation.c')
-rw-r--r-- | src/fragmentation/fragmentation.c | 10 |
1 files changed, 8 insertions, 2 deletions
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 | |||
@@ -100,6 +100,11 @@ struct GNUNET_FRAGMENT_Context | |||
100 | unsigned int next_transmission; | 100 | unsigned int next_transmission; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * How many rounds of transmission have we completed so far? | ||
104 | */ | ||
105 | unsigned int num_rounds; | ||
106 | |||
107 | /** | ||
103 | * GNUNET_YES if we called 'proc' and are now waiting for 'GNUNET_FRAGMENT_transmission_done' | 108 | * GNUNET_YES if we called 'proc' and are now waiting for 'GNUNET_FRAGMENT_transmission_done' |
104 | */ | 109 | */ |
105 | int8_t proc_busy; | 110 | int8_t proc_busy; |
@@ -112,7 +117,7 @@ struct GNUNET_FRAGMENT_Context | |||
112 | /** | 117 | /** |
113 | * Target fragment size. | 118 | * Target fragment size. |
114 | */ | 119 | */ |
115 | uint16_t mtu; | 120 | uint16_t mtu; |
116 | 121 | ||
117 | }; | 122 | }; |
118 | 123 | ||
@@ -207,6 +212,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
207 | delay = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, delay); | 212 | delay = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, delay); |
208 | fc->last_round = GNUNET_TIME_absolute_get (); | 213 | fc->last_round = GNUNET_TIME_absolute_get (); |
209 | fc->wack = GNUNET_YES; | 214 | fc->wack = GNUNET_YES; |
215 | fc->num_rounds++; | ||
210 | } | 216 | } |
211 | fc->proc_busy = GNUNET_YES; | 217 | fc->proc_busy = GNUNET_YES; |
212 | fc->delay_until = GNUNET_TIME_relative_to_absolute (delay); | 218 | fc->delay_until = GNUNET_TIME_relative_to_absolute (delay); |
@@ -330,7 +336,7 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | |||
330 | /* normal ACK, can update running average of delay... */ | 336 | /* normal ACK, can update running average of delay... */ |
331 | fc->wack = GNUNET_NO; | 337 | fc->wack = GNUNET_NO; |
332 | ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); | 338 | ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); |
333 | fc->delay.rel_value = (ndelay.rel_value + 3 * fc->delay.rel_value) / 4; | 339 | fc->delay.rel_value = (ndelay.rel_value * fc->num_rounds + 3 * fc->delay.rel_value) / 4; |
334 | } | 340 | } |
335 | GNUNET_STATISTICS_update (fc->stats, | 341 | GNUNET_STATISTICS_update (fc->stats, |
336 | _("# fragment acknowledgements received"), 1, | 342 | _("# fragment acknowledgements received"), 1, |