gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r18366 - gnunet/src/nse


From: gnunet
Subject: [GNUnet-SVN] r18366 - gnunet/src/nse
Date: Mon, 28 Nov 2011 19:27:26 +0100

Author: grothoff
Date: 2011-11-28 19:27:26 +0100 (Mon, 28 Nov 2011)
New Revision: 18366

Modified:
   gnunet/src/nse/gnunet-service-nse.c
Log:
-do not send previous round messages if we are just going online and did not 
setup those messages yet

Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2011-11-28 18:27:23 UTC (rev 18365)
+++ gnunet/src/nse/gnunet-service-nse.c 2011-11-28 18:27:26 UTC (rev 18366)
@@ -356,8 +356,10 @@
     variance = (vsq - mean * sum) / (estimate_count - 1.0); // terrible for 
numerical stability...
   }
 #endif
-  GNUNET_assert (variance >= 0);
-  std_dev = sqrt (variance);
+  if (variance >= 0)
+    std_dev = sqrt (variance);
+  else
+    std_dev = variance; /* must be infinity due to estimate_count == 0 */
   current_std_dev = std_dev;
   current_size_estimate = mean;
 
@@ -562,14 +564,21 @@
         GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), &transmit_task,
                                       peer_entry);
   }
-  if ((ntohl (size_estimate_messages[idx].hop_count) == 0) &&
-      (GNUNET_SCHEDULER_NO_TASK != proof_task))
+  if ( (ntohl (size_estimate_messages[idx].hop_count) == 0) &&
+       (GNUNET_SCHEDULER_NO_TASK != proof_task) )
   {
     GNUNET_STATISTICS_update (stats,
                               "# flood messages not generated (no proof yet)",
                               1, GNUNET_NO);
     return 0;
   }
+  if (ntohs (size_estimate_messages[idx].header.size) == 0)
+  {
+    GNUNET_STATISTICS_update (stats,
+                              "# flood messages not generated (lack of 
history)",
+                              1, GNUNET_NO);
+    return 0;
+  }
 #if DEBUG_NSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "In round %llu, sending to `%s' estimate with %u bits\n",




reply via email to

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