aboutsummaryrefslogtreecommitdiff
path: root/src/util/program.c
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2017-08-12 17:39:21 +0200
committerlurchi <lurchi@strangeplace.net>2017-08-12 17:39:21 +0200
commit6ee6dbd04d1e3d0e8c0cb5701e381eb4c22287c1 (patch)
treecb77fc0aed3330e2062d3c6a79adcffb22672b14 /src/util/program.c
parent7289071d2aa0e5795e78d3dd0433f82dde7d90ac (diff)
downloadgnunet-6ee6dbd04d1e3d0e8c0cb5701e381eb4c22287c1.tar.gz
gnunet-6ee6dbd04d1e3d0e8c0cb5701e381eb4c22287c1.zip
init_fd_info now completely initializes fd information; Allow calling add/cancel functions only when the scheduler is running
Diffstat (limited to 'src/util/program.c')
-rw-r--r--src/util/program.c12
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 */
74static void
75shutdown_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);