* How many extra messages per edge (corrections) have been received.
*/
unsigned long long total_nse_extra;
+
+ /**
+ * How many messages have been discarded.
+ */
+ unsigned long long total_discarded;
};
struct NSEPeer *pos;
#if VERBOSE
- fprintf (stderr, "Ending test.\n");
+ FPRINTF (stderr, "%s", "Ending test.\n");
#endif
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
if (pos->nse_handle != NULL)
GNUNET_NSE_disconnect (pos->nse_handle);
GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, pos);
+ if (GNUNET_SCHEDULER_NO_TASK != pos->stats_task)
+ {
+ GNUNET_SCHEDULER_cancel (pos->stats_task);
+ if (NULL != pos->stats)
+ GNUNET_STATISTICS_destroy(pos->stats, GNUNET_NO);
+ }
GNUNET_free (pos);
}
GNUNET_free (output_buffer);
}
else
- fprintf (stderr,
+ FPRINTF (stderr,
"Received network size estimate from peer %s. Size: %f std.dev. %f\n",
GNUNET_i2s (&peer->daemon->id), estimate, std_dev);
core_get_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct NSEPeer *peer = cls;
-
- peer->stats_task = GNUNET_SCHEDULER_NO_TASK;
+
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
{
GNUNET_STATISTICS_destroy(peer->stats, GNUNET_NO);
peer->stats = NULL;
+ return;
}
else
{
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, &core_stats_iterator, peer);
}
+ peer->stats_task = GNUNET_SCHEDULER_NO_TASK;
}
/**
}
GNUNET_free_non_null (buf);
+ buf = NULL;
+ buf_len =
+ GNUNET_asprintf (&buf, "TOTAL_NSE_DISCARDED_%d: %u \n",
+ stats_context->shutdown,
+ stats_context->total_discarded);
+ if (buf_len > 0)
+ {
+ GNUNET_DISK_file_write (data_file, buf, buf_len);
+ }
+ GNUNET_free_non_null (buf);
+
}
if (GNUNET_YES == stats_context->shutdown)
{
stats_context->total_nse_extra += value;
}
+ if (0 == strcmp (name, "# flood messages discarded (clock skew too large)"))
+ {
+ stats_context->total_discarded += value;
+ }
}
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnecting nse service of peers\n");
disconnect_task = GNUNET_SCHEDULER_NO_TASK;
- pos = peer_head;
while (NULL != (pos = peer_head))
{
if (pos->nse_handle != NULL)