diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-05 11:25:09 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-05 11:25:09 +0000 |
commit | 6deed95ec80ae2676066cc931e59b8b00dc56908 (patch) | |
tree | 497d8979f3d5a1c73a6fe03250e68611d3711c71 /src/ats/ats_api.c | |
parent | 1457e1db3fca49f1810ab831385992e56ee44c01 (diff) | |
download | gnunet-6deed95ec80ae2676066cc931e59b8b00dc56908.tar.gz gnunet-6deed95ec80ae2676066cc931e59b8b00dc56908.zip |
fixing floating point execption
Diffstat (limited to 'src/ats/ats_api.c')
-rw-r--r-- | src/ats/ats_api.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ats/ats_api.c b/src/ats/ats_api.c index 8a5f23247..08c5fda1f 100644 --- a/src/ats/ats_api.c +++ b/src/ats/ats_api.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include "platform.h" | 33 | #include "platform.h" |
34 | #include "gnunet_ats_service.h" | 34 | #include "gnunet_ats_service.h" |
35 | 35 | ||
36 | #define DEBUG_ATS GNUNET_YES | ||
37 | |||
36 | // NOTE: this implementation is simply supposed | 38 | // NOTE: this implementation is simply supposed |
37 | // to implement a simplistic strategy in-process; | 39 | // to implement a simplistic strategy in-process; |
38 | // in the future, we plan to replace it with a real | 40 | // in the future, we plan to replace it with a real |
@@ -241,13 +243,16 @@ static void | |||
241 | update_bandwidth_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 243 | update_bandwidth_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
242 | { | 244 | { |
243 | struct GNUNET_ATS_Handle *atc = cls; | 245 | struct GNUNET_ATS_Handle *atc = cls; |
244 | unsigned int ac; | 246 | unsigned int ac = 0; |
245 | struct SetBandwidthContext bwc; | 247 | struct SetBandwidthContext bwc; |
246 | 248 | ||
247 | atc->ba_task = GNUNET_SCHEDULER_NO_TASK; | 249 | atc->ba_task = GNUNET_SCHEDULER_NO_TASK; |
248 | /* FIXME: update calculations NICELY; what follows is a naive version */ | 250 | /* FIXME: update calculations NICELY; what follows is a naive version */ |
249 | GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &count_connections, &ac); | 251 | GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &count_connections, &ac); |
250 | bwc.atc = atc; | 252 | bwc.atc = atc; |
253 | if (ac == 0) | ||
254 | ac++; | ||
255 | GNUNET_assert (ac > 0); | ||
251 | bwc.bw = GNUNET_BANDWIDTH_value_init (atc->total_bps / ac); | 256 | bwc.bw = GNUNET_BANDWIDTH_value_init (atc->total_bps / ac); |
252 | GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &set_bw_connections, &bwc); | 257 | GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &set_bw_connections, &bwc); |
253 | } | 258 | } |
@@ -729,6 +734,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc, | |||
729 | destroy_allocation_record (NULL, &peer->hashPubKey, ar); | 734 | destroy_allocation_record (NULL, &peer->hashPubKey, ar); |
730 | return; | 735 | return; |
731 | } | 736 | } |
737 | |||
732 | GNUNET_assert (GNUNET_OK == | 738 | GNUNET_assert (GNUNET_OK == |
733 | GNUNET_CONTAINER_multihashmap_put (atc->peers, | 739 | GNUNET_CONTAINER_multihashmap_put (atc->peers, |
734 | &peer->hashPubKey, ar, | 740 | &peer->hashPubKey, ar, |