- if (peer_entry->previous_round == GNUNET_YES)
- {
- idx = (idx + HISTORY_SIZE -1) % HISTORY_SIZE;
- peer_entry->previous_round = GNUNET_NO;
- peer_entry->transmit_task = 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) )
- {
- GNUNET_STATISTICS_update (stats,
- "# flood messages not generated (no proof yet)",
- 1,
- GNUNET_NO);
- return 0;
- }
- if (ntohl (size_estimate_messages[idx].hop_count) == 0)
- GNUNET_STATISTICS_update (stats,
- "# flood messages started",
- 1,
- GNUNET_NO);
- GNUNET_STATISTICS_update (stats,
- "# flood messages transmitted",
- 1,
- GNUNET_NO);
- memcpy (buf,
- &size_estimate_messages[idx],
- sizeof (struct GNUNET_NSE_FloodMessage));
- GNUNET_STATISTICS_update (stats,
- "# flood messages sent",
- 1,
- GNUNET_NO);
+ if (GNUNET_NO == peer_entry->previous_round)
+ {
+ idx = (idx + HISTORY_SIZE - 1) % HISTORY_SIZE;
+ peer_entry->previous_round = GNUNET_YES;
+ peer_entry->transmit_task =
+ GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), &transmit_task_cb,
+ peer_entry);
+ }
+ if ((0 == ntohl (size_estimate_messages[idx].hop_count)) &&
+ (GNUNET_SCHEDULER_NO_TASK != proof_task))
+ {
+ GNUNET_STATISTICS_update (stats,
+ "# flood messages not generated (no proof yet)",
+ 1, GNUNET_NO);
+ return 0;
+ }
+ if (0 == ntohs (size_estimate_messages[idx].header.size))
+ {
+ GNUNET_STATISTICS_update (stats,
+ "# flood messages not generated (lack of history)",
+ 1, GNUNET_NO);
+ return 0;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "In round %llu, sending to `%s' estimate with %u bits\n",
+ (unsigned long long)
+ GNUNET_TIME_absolute_ntoh (size_estimate_messages[idx].
+ timestamp).abs_value,
+ GNUNET_i2s (&peer_entry->id),
+ (unsigned int) ntohl (size_estimate_messages[idx].matching_bits));
+ if (ntohl (size_estimate_messages[idx].hop_count) == 0)
+ GNUNET_STATISTICS_update (stats, "# flood messages started", 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (stats, "# flood messages transmitted", 1,
+ GNUNET_NO);
+#if ENABLE_HISTOGRAM
+ peer_entry->transmitted_messages++;
+ peer_entry->last_transmitted_size =
+ ntohl(size_estimate_messages[idx].matching_bits);
+#endif
+ memcpy (buf, &size_estimate_messages[idx],
+ sizeof (struct GNUNET_NSE_FloodMessage));