diff options
author | Gabor X Toth <*@tg-x.net> | 2016-06-07 12:55:00 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2016-06-07 12:55:00 +0000 |
commit | ec817d5981e88f06f9f153cd423d13860fba4b57 (patch) | |
tree | f30946eb20137032a34492543f472c5087a4891f /src | |
parent | e8afa1442263e0c5608f7f2a71e8c864d776986b (diff) | |
download | gnunet-ec817d5981e88f06f9f153cd423d13860fba4b57.tar.gz gnunet-ec817d5981e88f06f9f153cd423d13860fba4b57.zip |
social cli: fix shutdown
Diffstat (limited to 'src')
-rw-r--r-- | src/social/gnunet-social.c | 19 |
1 files changed, 11 insertions, 8 deletions
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 () | |||
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | static void | ||
208 | scheduler_shutdown (void *cls) | ||
209 | { | ||
210 | disconnect (); | ||
211 | } | ||
212 | |||
213 | |||
207 | /** | 214 | /** |
208 | * Callback called when the program failed to finish the requested operation in time. | 215 | * Callback called when the program failed to finish the requested operation in time. |
209 | */ | 216 | */ |
@@ -1106,10 +1113,6 @@ static void | |||
1106 | run (void *cls, char *const *args, const char *cfgfile, | 1113 | run (void *cls, char *const *args, const char *cfgfile, |
1107 | const struct GNUNET_CONFIGURATION_Handle *c) | 1114 | const struct GNUNET_CONFIGURATION_Handle *c) |
1108 | { | 1115 | { |
1109 | // GNUNET_SIGNAL_handler_install (SIGINT, disconnect); | ||
1110 | // GNUNET_SIGNAL_handler_install (SIGTERM, disconnect); | ||
1111 | // GNUNET_SIGNAL_handler_install (SIGKILL, disconnect); | ||
1112 | |||
1113 | cfg = c; | 1116 | cfg = c; |
1114 | 1117 | ||
1115 | if (!opt_method) | 1118 | if (!opt_method) |
@@ -1130,6 +1133,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1130 | op_status = 1; | 1133 | op_status = 1; |
1131 | } | 1134 | } |
1132 | 1135 | ||
1136 | GNUNET_SCHEDULER_add_shutdown (scheduler_shutdown, NULL); | ||
1133 | if (!opt_follow) | 1137 | if (!opt_follow) |
1134 | { | 1138 | { |
1135 | timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, timeout, NULL); | 1139 | timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, timeout, NULL); |
@@ -1153,10 +1157,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1153 | 1157 | ||
1154 | if (opt_ego) | 1158 | if (opt_ego) |
1155 | { | 1159 | { |
1156 | GNUNET_assert (GNUNET_OK == | 1160 | GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego, |
1157 | GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego, | 1161 | strlen (opt_ego), |
1158 | strlen (opt_ego), | 1162 | &ego_pub_key); |
1159 | &ego_pub_key)); | ||
1160 | } | 1163 | } |
1161 | 1164 | ||
1162 | core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL, | 1165 | core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL, |