gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16698 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r16698 - gnunet/src/ats
Date: Mon, 5 Sep 2011 13:25:09 +0200

Author: wachs
Date: 2011-09-05 13:25:09 +0200 (Mon, 05 Sep 2011)
New Revision: 16698

Modified:
   gnunet/src/ats/ats_api.c
Log:
fixing floating point execption


Modified: gnunet/src/ats/ats_api.c
===================================================================
--- gnunet/src/ats/ats_api.c    2011-09-04 09:24:50 UTC (rev 16697)
+++ gnunet/src/ats/ats_api.c    2011-09-05 11:25:09 UTC (rev 16698)
@@ -33,6 +33,8 @@
 #include "platform.h"
 #include "gnunet_ats_service.h"
 
+#define DEBUG_ATS GNUNET_YES
+
 // NOTE: this implementation is simply supposed
 // to implement a simplistic strategy in-process;
 // in the future, we plan to replace it with a real
@@ -241,13 +243,16 @@
 update_bandwidth_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext 
*tc)
 {
   struct GNUNET_ATS_Handle *atc = cls;
-  unsigned int ac;
+  unsigned int ac = 0;
   struct SetBandwidthContext bwc;
 
   atc->ba_task = GNUNET_SCHEDULER_NO_TASK;
   /* FIXME: update calculations NICELY; what follows is a naive version */
   GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &count_connections, &ac);
   bwc.atc = atc;
+  if (ac == 0)
+    ac++;
+  GNUNET_assert (ac > 0);
   bwc.bw = GNUNET_BANDWIDTH_value_init (atc->total_bps / ac);
   GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &set_bw_connections, 
&bwc);
 }
@@ -729,6 +734,7 @@
     destroy_allocation_record (NULL, &peer->hashPubKey, ar);
     return;
   }
+
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONTAINER_multihashmap_put (atc->peers,
                                                     &peer->hashPubKey, ar,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]