aboutsummaryrefslogtreecommitdiff
path: root/src/social/gnunet-social.c
diff options
context:
space:
mode:
authorCarlo von lynX <lynX@time.to.get.psyced.org>2016-07-30 06:22:40 +0000
committerCarlo von lynX <lynX@time.to.get.psyced.org>2016-07-30 06:22:40 +0000
commit319ff0fa21798013e1fbb6bdd0ce18b1be42fb07 (patch)
tree39719e4669fa0616eded57a30a7e67539def54a9 /src/social/gnunet-social.c
parentff1c357933910f707cdf13bb6ef705ef0ae90960 (diff)
downloadgnunet-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.c16
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 */
132static int ret = 1; 132static int ret = 1;
133 133
134/** are we waiting for service to close our connection */
135static char is_disconnecting = 0;
136
134/** Task handle for timeout termination. */ 137/** Task handle for timeout termination. */
135struct GNUNET_SCHEDULER_Task *timeout_task; 138struct GNUNET_SCHEDULER_Task *timeout_task;
136 139
@@ -199,8 +202,11 @@ app_disconnected (void *cls)
199static void 202static void
200disconnect () 203disconnect ()
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
218timeout (void *cls) 224timeout (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
224static void 230static void
225schedule_success (void *cls) 231schedule_success (void *cls)
226{ 232{
227 ret = 0; 233 ret = 0;
228 //disconnect (); 234 disconnect ();
229} 235}
230 236
231 237
232static void 238static void
233schedule_fail (void *cls) 239schedule_fail (void *cls)
234{ 240{
235 //disconnect (); 241 disconnect ();
236} 242}
237 243
238 244