aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-28 18:27:26 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-28 18:27:26 +0000
commit21749186996b25e4a5de0422be04a40322dfe35d (patch)
tree4e03bff4c39a925ead575adaca740dd79d6b7d32
parent34298120a3b660139b08a449ed56ab38c7dbe719 (diff)
downloadgnunet-21749186996b25e4a5de0422be04a40322dfe35d.tar.gz
gnunet-21749186996b25e4a5de0422be04a40322dfe35d.zip
-do not send previous round messages if we are just going online and did not setup those messages yet
-rw-r--r--src/nse/gnunet-service-nse.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 163c40f6e..23144b346 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -356,8 +356,10 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
356 variance = (vsq - mean * sum) / (estimate_count - 1.0); // terrible for numerical stability... 356 variance = (vsq - mean * sum) / (estimate_count - 1.0); // terrible for numerical stability...
357 } 357 }
358#endif 358#endif
359 GNUNET_assert (variance >= 0); 359 if (variance >= 0)
360 std_dev = sqrt (variance); 360 std_dev = sqrt (variance);
361 else
362 std_dev = variance; /* must be infinity due to estimate_count == 0 */
361 current_std_dev = std_dev; 363 current_std_dev = std_dev;
362 current_size_estimate = mean; 364 current_size_estimate = mean;
363 365
@@ -562,14 +564,21 @@ transmit_ready (void *cls, size_t size, void *buf)
562 GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), &transmit_task, 564 GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), &transmit_task,
563 peer_entry); 565 peer_entry);
564 } 566 }
565 if ((ntohl (size_estimate_messages[idx].hop_count) == 0) && 567 if ( (ntohl (size_estimate_messages[idx].hop_count) == 0) &&
566 (GNUNET_SCHEDULER_NO_TASK != proof_task)) 568 (GNUNET_SCHEDULER_NO_TASK != proof_task) )
567 { 569 {
568 GNUNET_STATISTICS_update (stats, 570 GNUNET_STATISTICS_update (stats,
569 "# flood messages not generated (no proof yet)", 571 "# flood messages not generated (no proof yet)",
570 1, GNUNET_NO); 572 1, GNUNET_NO);
571 return 0; 573 return 0;
572 } 574 }
575 if (ntohs (size_estimate_messages[idx].header.size) == 0)
576 {
577 GNUNET_STATISTICS_update (stats,
578 "# flood messages not generated (lack of history)",
579 1, GNUNET_NO);
580 return 0;
581 }
573#if DEBUG_NSE 582#if DEBUG_NSE
574 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 583 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
575 "In round %llu, sending to `%s' estimate with %u bits\n", 584 "In round %llu, sending to `%s' estimate with %u bits\n",