From ec817d5981e88f06f9f153cd423d13860fba4b57 Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Tue, 7 Jun 2016 12:55:00 +0000 Subject: social cli: fix shutdown --- src/social/gnunet-social.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/social') diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index 3092792d4..7c36a96d4 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c @@ -204,6 +204,13 @@ disconnect () } +static void +scheduler_shutdown (void *cls) +{ + disconnect (); +} + + /** * Callback called when the program failed to finish the requested operation in time. */ @@ -1106,10 +1113,6 @@ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { -// GNUNET_SIGNAL_handler_install (SIGINT, disconnect); -// GNUNET_SIGNAL_handler_install (SIGTERM, disconnect); -// GNUNET_SIGNAL_handler_install (SIGKILL, disconnect); - cfg = c; if (!opt_method) @@ -1130,6 +1133,7 @@ run (void *cls, char *const *args, const char *cfgfile, op_status = 1; } + GNUNET_SCHEDULER_add_shutdown (scheduler_shutdown, NULL); if (!opt_follow) { timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, timeout, NULL); @@ -1153,10 +1157,9 @@ run (void *cls, char *const *args, const char *cfgfile, if (opt_ego) { - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego, - strlen (opt_ego), - &ego_pub_key)); + GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego, + strlen (opt_ego), + &ego_pub_key); } core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL, -- cgit v1.2.3