diff options
author | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-07-30 06:22:40 +0000 |
---|---|---|
committer | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-07-30 06:22:40 +0000 |
commit | 319ff0fa21798013e1fbb6bdd0ce18b1be42fb07 (patch) | |
tree | 39719e4669fa0616eded57a30a7e67539def54a9 /src/social/gnunet-social.c | |
parent | ff1c357933910f707cdf13bb6ef705ef0ae90960 (diff) | |
download | gnunet-319ff0fa21798013e1fbb6bdd0ce18b1be42fb07.tar.gz gnunet-319ff0fa21798013e1fbb6bdd0ce18b1be42fb07.zip |
social: allow multiple calls to disconnect(), rest: handle warnings
Diffstat (limited to 'src/social/gnunet-social.c')
-rw-r--r-- | src/social/gnunet-social.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index 9841e83a6..5aa74c81a 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c | |||
@@ -131,6 +131,9 @@ static int opt_limit; | |||
131 | /** exit code */ | 131 | /** exit code */ |
132 | static int ret = 1; | 132 | static int ret = 1; |
133 | 133 | ||
134 | /** are we waiting for service to close our connection */ | ||
135 | static char is_disconnecting = 0; | ||
136 | |||
134 | /** Task handle for timeout termination. */ | 137 | /** Task handle for timeout termination. */ |
135 | struct GNUNET_SCHEDULER_Task *timeout_task; | 138 | struct GNUNET_SCHEDULER_Task *timeout_task; |
136 | 139 | ||
@@ -199,8 +202,11 @@ app_disconnected (void *cls) | |||
199 | static void | 202 | static void |
200 | disconnect () | 203 | disconnect () |
201 | { | 204 | { |
202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnect()\n"); | 205 | // handle that we get called several times from several places, but should we? |
203 | GNUNET_SOCIAL_app_disconnect (app, app_disconnected, NULL); | 206 | if (!is_disconnecting++) { |
207 | GNUNET_SOCIAL_app_disconnect (app, app_disconnected, NULL); | ||
208 | } | ||
209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnect() called for the #%d time\n", is_disconnecting); | ||
204 | } | 210 | } |
205 | 211 | ||
206 | 212 | ||
@@ -218,21 +224,21 @@ static void | |||
218 | timeout (void *cls) | 224 | timeout (void *cls) |
219 | { | 225 | { |
220 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "timeout()\n"); | 226 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "timeout()\n"); |
221 | //disconnect (); | 227 | disconnect (); |
222 | } | 228 | } |
223 | 229 | ||
224 | static void | 230 | static void |
225 | schedule_success (void *cls) | 231 | schedule_success (void *cls) |
226 | { | 232 | { |
227 | ret = 0; | 233 | ret = 0; |
228 | //disconnect (); | 234 | disconnect (); |
229 | } | 235 | } |
230 | 236 | ||
231 | 237 | ||
232 | static void | 238 | static void |
233 | schedule_fail (void *cls) | 239 | schedule_fail (void *cls) |
234 | { | 240 | { |
235 | //disconnect (); | 241 | disconnect (); |
236 | } | 242 | } |
237 | 243 | ||
238 | 244 | ||