aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-03-08 19:21:47 +0000
committerBart Polot <bart@net.in.tum.de>2012-03-08 19:21:47 +0000
commit85e8ba9a21635c055c11ea0bd5bc447149fc84b8 (patch)
tree77af61e96427d195e764bcb8aaaa88d0a6dabdb1 /src/nse
parente6e89c0f0156dda8c382f700ac31ccf1289e590e (diff)
downloadgnunet-85e8ba9a21635c055c11ea0bd5bc447149fc84b8.tar.gz
gnunet-85e8ba9a21635c055c11ea0bd5bc447149fc84b8.zip
- The next_message in the previous round should have the now current_timestamp.
- Check if it's better than our estimate before using.
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 3af9bb7c7..bf78e2371 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -768,8 +768,10 @@ update_flood_message (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
768 estimate_index = (estimate_index + 1) % HISTORY_SIZE; 768 estimate_index = (estimate_index + 1) % HISTORY_SIZE;
769 if (estimate_count < HISTORY_SIZE) 769 if (estimate_count < HISTORY_SIZE)
770 estimate_count++; 770 estimate_count++;
771 if (next_timestamp.abs_value == 771 if ((current_timestamp.abs_value ==
772 GNUNET_TIME_absolute_ntoh (next_message.timestamp).abs_value) 772 GNUNET_TIME_absolute_ntoh (next_message.timestamp).abs_value) &&
773 (get_matching_bits (current_timestamp, &my_identity) >
774 ntohl(next_message.matching_bits)))
773 { 775 {
774 /* we received a message for this round way early, use it! */ 776 /* we received a message for this round way early, use it! */
775 size_estimate_messages[estimate_index] = next_message; 777 size_estimate_messages[estimate_index] = next_message;
@@ -1054,7 +1056,6 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer,
1054#endif 1056#endif
1055 1057
1056 ts = GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp); 1058 ts = GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp);
1057
1058 if (ts.abs_value == current_timestamp.abs_value) 1059 if (ts.abs_value == current_timestamp.abs_value)
1059 idx = estimate_index; 1060 idx = estimate_index;
1060 else if (ts.abs_value == 1061 else if (ts.abs_value ==
@@ -1319,9 +1320,7 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server,
1319 1320
1320 if (server == NULL) 1321 if (server == NULL)
1321 { 1322 {
1322#if DEBUG_NSE 1323 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n");
1323 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connection to core FAILED!\n");
1324#endif
1325 GNUNET_SCHEDULER_shutdown (); 1324 GNUNET_SCHEDULER_shutdown ();
1326 return; 1325 return;
1327 } 1326 }