gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30934 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r30934 - gnunet/src/transport
Date: Thu, 28 Nov 2013 14:53:40 +0100

Author: wachs
Date: 2013-11-28 14:53:39 +0100 (Thu, 28 Nov 2013)
New Revision: 30934

Modified:
   gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
fix div by zero


Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-11-28 
13:01:24 UTC (rev 30933)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-11-28 
13:53:39 UTC (rev 30934)
@@ -2394,19 +2394,20 @@
   delta = GNUNET_TIME_absolute_get_difference(n->last_util_transmission, 
GNUNET_TIME_absolute_get());
 
   bps_pl_in = 0;
-  if (0 != n->util_payload_bytes_recv)
+
+  if ((0 != n->util_payload_bytes_recv) && (0 != delta.rel_value_us))
     bps_pl_in =  (1000LL * 1000LL *  n->util_payload_bytes_recv) / 
(delta.rel_value_us);
   bps_pl_out = 0;
-  if (0 != n->util_payload_bytes_sent)
+  if ((0 != n->util_payload_bytes_sent) && (0 != delta.rel_value_us))
     bps_pl_out = (1000LL * 1000LL * n->util_payload_bytes_sent) / 
delta.rel_value_us;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "`%s' payload: received %u Bytes/s, 
sent %u Bytes/s  \n",
       GNUNET_i2s (key), bps_pl_in, bps_pl_out);
 
   bps_in = 0;
-  if (0 != n->util_total_bytes_recv)
+  if ((0 != n->util_total_bytes_recv) && (0 != delta.rel_value_us))
     bps_in =  (1000LL * 1000LL *  n->util_total_bytes_recv) / 
(delta.rel_value_us);
   bps_out = 0;
-  if (0 != n->util_total_bytes_sent)
+  if ((0 != n->util_total_bytes_sent) && (0 != delta.rel_value_us))
     bps_out = (1000LL * 1000LL * n->util_total_bytes_sent) / 
delta.rel_value_us;
 
 




reply via email to

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