diff options
Diffstat (limited to 'src/util/program.c')
-rw-r--r-- | src/util/program.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/program.c b/src/util/program.c index 92a9750f3..233792387 100644 --- a/src/util/program.c +++ b/src/util/program.c | |||
@@ -69,6 +69,16 @@ struct CommandContext | |||
69 | 69 | ||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * task run when the scheduler shuts down | ||
73 | */ | ||
74 | static void | ||
75 | shutdown_task (void *cls) | ||
76 | { | ||
77 | GNUNET_SPEEDUP_stop_ (); | ||
78 | } | ||
79 | |||
80 | |||
81 | /** | ||
72 | * Initial task called by the scheduler for each | 82 | * Initial task called by the scheduler for each |
73 | * program. Runs the program-specific main task. | 83 | * program. Runs the program-specific main task. |
74 | */ | 84 | */ |
@@ -78,6 +88,7 @@ program_main (void *cls) | |||
78 | struct CommandContext *cc = cls; | 88 | struct CommandContext *cc = cls; |
79 | 89 | ||
80 | GNUNET_SPEEDUP_start_(cc->cfg); | 90 | GNUNET_SPEEDUP_start_(cc->cfg); |
91 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | ||
81 | GNUNET_RESOLVER_connect (cc->cfg); | 92 | GNUNET_RESOLVER_connect (cc->cfg); |
82 | cc->task (cc->task_cls, cc->args, cc->cfgfile, cc->cfg); | 93 | cc->task (cc->task_cls, cc->args, cc->cfgfile, cc->cfg); |
83 | } | 94 | } |
@@ -306,7 +317,6 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName, | |||
306 | } | 317 | } |
307 | ret = GNUNET_OK; | 318 | ret = GNUNET_OK; |
308 | cleanup: | 319 | cleanup: |
309 | GNUNET_SPEEDUP_stop_ (); | ||
310 | GNUNET_CONFIGURATION_destroy (cfg); | 320 | GNUNET_CONFIGURATION_destroy (cfg); |
311 | GNUNET_free_non_null (cc.cfgfile); | 321 | GNUNET_free_non_null (cc.cfgfile); |
312 | GNUNET_free (cfg_fn); | 322 | GNUNET_free (cfg_fn); |