struct StatsIterateContext
{
- /**
- * Handle to the statistics service.
- */
- struct GNUNET_STATISTICS_Handle *stats_handle;
-
- /**
- * Handle for getting statistics.
- */
- struct GNUNET_STATISTICS_GetHandle *stats_get_handle;
-
/**
* Continuation to call once all stats information has been retrieved.
*/
struct GNUNET_TESTING_Daemon *daemon;
};
+struct StatsCoreContext
+{
+ void *iter_context;
+ struct GNUNET_TESTING_Daemon *daemon;
+ /**
+ * Handle to the statistics service.
+ */
+ struct GNUNET_STATISTICS_Handle *stats_handle;
+
+ /**
+ * Handle for getting statistics.
+ */
+ struct GNUNET_STATISTICS_GetHandle *stats_get_handle;
+};
+
/**
* Handle to a group of GNUnet peers.
*/
if (hostname != NULL)
{
GNUNET_asprintf(&allowed_hosts, "%s; 127.0.0.1;", hostname);
+ GNUNET_CONFIGURATION_set_value_string(uc.ret, "transport-udp", "BINDTO", hostname);
GNUNET_CONFIGURATION_set_value_string(uc.ret, "transport-tcp", "BINDTO", hostname);
GNUNET_CONFIGURATION_set_value_string(uc.ret, "arm", "ACCEPT_FROM", allowed_hosts);
GNUNET_free(allowed_hosts);
}
else
- GNUNET_CONFIGURATION_set_value_string(uc.ret, "transport-tcp", "BINDTO", "127.0.0.1");
+ {
+ GNUNET_CONFIGURATION_set_value_string(uc.ret, "transport-tcp", "BINDTO", "127.0.0.1");
+ GNUNET_CONFIGURATION_set_value_string(uc.ret, "transport-udp", "BINDTO", "127.0.0.1");
+ }
*port = (uint16_t) uc.nport;
*upnum = uc.upnum;
uint64_t value,
int is_persistent)
{
- struct CoreContext *core_context = cls;
+ struct StatsCoreContext *core_context = cls;
struct StatsIterateContext *stats_context = (struct StatsIterateContext *)core_context->iter_context;
return stats_context->proc(stats_context->cls, &core_context->daemon->id, subsystem, name, value, is_persistent);
*/
static void internal_stats_cont (void *cls, int success)
{
- struct CoreContext *core_context = cls;
+ struct StatsCoreContext *core_context = cls;
struct StatsIterateContext *stats_context = (struct StatsIterateContext *)core_context->iter_context;
stats_context->connected--;
if (stats_context->completed == stats_context->total)
{
stats_context->cont(stats_context->cls, GNUNET_YES);
- if (stats_context->stats_handle != NULL)
- GNUNET_STATISTICS_destroy(stats_context->stats_handle, GNUNET_NO);
GNUNET_free(stats_context);
}
+
+ if (core_context->stats_handle != NULL)
+ GNUNET_STATISTICS_destroy(core_context->stats_handle, GNUNET_NO);
+
GNUNET_free(core_context);
}
static void
schedule_get_statistics(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct CoreContext *core_context = cls;
+ struct StatsCoreContext *core_context = cls;
struct StatsIterateContext *stats_context = (struct StatsIterateContext *)core_context->iter_context;
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
#endif
stats_context->connected++;
- stats_context->stats_handle = GNUNET_STATISTICS_create(core_context->daemon->sched, "testing", core_context->daemon->cfg);
- if (stats_context->stats_handle == NULL)
+ core_context->stats_handle = GNUNET_STATISTICS_create(core_context->daemon->sched, "testing", core_context->daemon->cfg);
+ if (core_context->stats_handle == NULL)
{
internal_stats_cont (core_context, GNUNET_NO);
return;
}
- stats_context->stats_get_handle = GNUNET_STATISTICS_get(stats_context->stats_handle, NULL, NULL, GNUNET_TIME_relative_get_forever(), &internal_stats_cont, &internal_stats_callback, core_context);
- if (stats_context->stats_get_handle == NULL)
- internal_stats_cont (core_context, GNUNET_NO);
+ core_context->stats_get_handle = GNUNET_STATISTICS_get(core_context->stats_handle, NULL, NULL, GNUNET_TIME_relative_get_forever(), &internal_stats_cont, &internal_stats_callback, core_context);
+ if (core_context->stats_get_handle == NULL)
+ internal_stats_cont (core_context, GNUNET_NO);
}
}