* production). The associated code should also probably be removed
* once we're done with experiments.
*/
-#define ENABLE_HISTOGRAM GNUNET_NO
+#define ENABLE_HISTOGRAM GNUNET_YES
/**
* Over how many values do we calculate the weighted average?
*/
int previous_round;
- /**
- * Where a variable has been modified to cause a bug.
- * FIXME DELETE AFTER DEBUG
- */
- const char *where;
-
#if ENABLE_HISTOGRAM
/**
unsigned int idx;
peer_entry->th = NULL;
- if (buf == NULL)
+ if (NULL == buf)
{
/* client disconnected */
return 0;
}
GNUNET_assert (size >= sizeof (struct GNUNET_NSE_FloodMessage));
idx = estimate_index;
- if (peer_entry->previous_round == GNUNET_NO)
+ if (GNUNET_NO == peer_entry->previous_round)
{
idx = (idx + HISTORY_SIZE - 1) % HISTORY_SIZE;
peer_entry->previous_round = GNUNET_YES;
GNUNET_STATISTICS_update (stats,
"# flood messages not generated (lack of history)",
1, GNUNET_NO);
- return 0; // FIXME necessary?
+ return 0;
}
#if DEBUG_NSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
struct NSEPeerEntry *peer_entry = cls;
peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
+
GNUNET_assert (NULL == peer_entry->th);
peer_entry->th =
GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_NO, NSE_PRIORITY,
if (NULL != peer_entry->th)
{
peer_entry->previous_round = GNUNET_NO;
- peer_entry->where = __FUNCTION__;
return GNUNET_OK;
}
if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task)
{
GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
peer_entry->previous_round = GNUNET_NO;
- peer_entry->where = __FUNCTION__;
}
#if ENABLE_HISTOGRAM
if (peer_entry->received_messages > 1)
{
/* still stuck in previous round, no point to update, check that
* we are active here though... */
- GNUNET_break (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task ||
- NULL != peer_entry->th);
+ if (GNUNET_SCHEDULER_NO_TASK == peer_entry->transmit_task &&
+ NULL == peer_entry->th)
+ {
+ GNUNET_break (0);
+ }
return GNUNET_OK;
}
if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK)
{
if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES)) {
peer_entry->previous_round = GNUNET_NO;
- peer_entry->where = __FUNCTION__ ;
}
/* push back our result now, that peer is spreading bad information... */
if (NULL == peer_entry->th)
/* cancel transmission from us to this peer for this round */
if (idx == estimate_index)
{
+ /* Cancel transmission in the other direction, as this peer clearly has
+ up-to-date information already. Even if we didn't talk to this peer in
+ the previous round, we should no longer send it stale information as it
+ told us about the current round! */
+ peer_entry->previous_round = GNUNET_YES;
/* cancel any activity for current round */
if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK)
{
peer_entry->transmit_task =
GNUNET_SCHEDULER_add_delayed (get_transmit_delay (-1), &transmit_task_cb,
peer_entry);
- peer_entry->where = "core connect";
GNUNET_STATISTICS_update (stats, "# peers", 1, GNUNET_NO);
}
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute prev_time;
- if (server == NULL)
+ if (NULL == server)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n");
GNUNET_SCHEDULER_shutdown ();
estimate_count = 0;
if (GNUNET_YES == check_proof_of_work (&my_public_key, my_proof))
{
+ int idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE;
prev_time.abs_value =
current_timestamp.abs_value - gnunet_nse_interval.rel_value;
- setup_flood_message (estimate_index, prev_time);
+ setup_flood_message (idx, prev_time);
+ setup_flood_message (estimate_index, current_timestamp);
estimate_count++;
}
flood_task =