diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-09 08:04:33 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-09 08:04:33 +0000 |
commit | b1401f65b7b0f6df6b587d80408457f863d8f78e (patch) | |
tree | 78c0d8a2ede48fc56c5985f9e6fe4cc14f70434a | |
parent | 4d37bf113ef8e56aa9b50d6b140b0488a5ae6717 (diff) |
applying LRN's patch to fix startup issue
-rw-r--r-- | src/ats/test_ats_api_scheduling_init.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/ats/test_ats_api_scheduling_init.c b/src/ats/test_ats_api_scheduling_init.c index aab5f23731..3a75a78025 100644 --- a/src/ats/test_ats_api_scheduling_init.c +++ b/src/ats/test_ats_api_scheduling_init.c @@ -35,6 +35,11 @@ static GNUNET_SCHEDULER_TaskIdentifier die_task; /** + * Initial statistics get request handle + */ +struct GNUNET_STATISTICS_GetHandle *initial_get; + +/** * Statistics handle */ struct GNUNET_STATISTICS_Handle *stats; @@ -67,6 +72,14 @@ stat_cb(void *cls, const char *subsystem, return GNUNET_OK; } +static int +dummy_stat (void *cls, const char *subsystem, const char *name, uint64_t value, + int is_persistent) +{ + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got dummy stat %s%s:%s = %llu\n", + is_persistent ? "!" : " ", subsystem, name, value); + return GNUNET_OK; +} static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -115,18 +128,16 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, return; } - static void -run (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg, - struct GNUNET_TESTING_Peer *peer) +got_initial_value (void *cls, int success) { - die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); - stats = GNUNET_STATISTICS_create ("ats", cfg); - GNUNET_STATISTICS_watch (stats, "ats", "# addresses", &stat_cb, NULL); + struct GNUNET_CONFIGURATION_Handle *cfg = cls; + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got initial value\n"); /* Connect to ATS scheduling */ sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); + GNUNET_CONFIGURATION_destroy (cfg); if (sched_ats == NULL) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS scheduling!\n"); @@ -135,6 +146,20 @@ run (void *cls, } } +static void +run (void *cls, + const struct GNUNET_CONFIGURATION_Handle *cfg, + struct GNUNET_TESTING_Peer *peer) +{ + die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); + stats = GNUNET_STATISTICS_create ("ats", cfg); + GNUNET_STATISTICS_watch (stats, "ats", "# addresses", &stat_cb, NULL); + + initial_get = GNUNET_STATISTICS_get (stats, "ats", "# addresses", TIMEOUT, + &got_initial_value, &dummy_stat, + GNUNET_CONFIGURATION_dup (cfg)); +} + int main (int argc, char *argv[]) |