aboutsummaryrefslogtreecommitdiff
path: root/src
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
parentff1c357933910f707cdf13bb6ef705ef0ae90960 (diff)
downloadgnunet-319ff0fa21798013e1fbb6bdd0ce18b1be42fb07.tar.gz
gnunet-319ff0fa21798013e1fbb6bdd0ce18b1be42fb07.zip
social: allow multiple calls to disconnect(), rest: handle warnings
Diffstat (limited to 'src')
-rw-r--r--src/multicast/gnunet-service-multicast.c4
-rw-r--r--src/multicast/multicast_api.c6
-rw-r--r--src/social/gnunet-social.c16
-rw-r--r--src/util/socks.c2
4 files changed, 18 insertions, 10 deletions
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index 91cafb707..a14ecd04c 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -877,6 +877,7 @@ cadet_send_children (struct GNUNET_HashCode *pub_key_hash,
877} 877}
878 878
879 879
880#if 0 // unused as yet
880/** 881/**
881 * Send message to all connected parents. 882 * Send message to all connected parents.
882 */ 883 */
@@ -890,6 +891,7 @@ cadet_send_parents (struct GNUNET_HashCode *pub_key_hash,
890 cadet_send_cb, (void *) msg); 891 cadet_send_cb, (void *) msg);
891 return n; 892 return n;
892} 893}
894#endif
893 895
894 896
895/** 897/**
@@ -1778,7 +1780,7 @@ cadet_recv_replay_response (void *cls,
1778 void **ctx, 1780 void **ctx,
1779 const struct GNUNET_MessageHeader *m) 1781 const struct GNUNET_MessageHeader *m)
1780{ 1782{
1781 struct Channel *chn = *ctx; 1783 //struct Channel *chn = *ctx;
1782 1784
1783 /* @todo FIXME: got replay error response, send request to other members */ 1785 /* @todo FIXME: got replay error response, send request to other members */
1784 1786
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c
index f5c8c3d34..e390a621c 100644
--- a/src/multicast/multicast_api.c
+++ b/src/multicast/multicast_api.c
@@ -400,9 +400,9 @@ member_recv_replay_response (void *cls,
400 struct GNUNET_MULTICAST_Member * 400 struct GNUNET_MULTICAST_Member *
401 mem = GNUNET_CLIENT_MANAGER_get_user_context_ (client, sizeof (*grp)); 401 mem = GNUNET_CLIENT_MANAGER_get_user_context_ (client, sizeof (*grp));
402 grp = &mem->grp; 402 grp = &mem->grp;
403 struct MulticastReplayResponseMessage * 403 // FIXME: Something is missing here for the code to make sense
404 res = (struct MulticastReplayResponseMessage *) msg; 404 //struct MulticastReplayResponseMessage *
405 405 // res = (struct MulticastReplayResponseMessage *) msg;
406 if (GNUNET_YES == grp->is_disconnecting) 406 if (GNUNET_YES == grp->is_disconnecting)
407 return; 407 return;
408 408
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
diff --git a/src/util/socks.c b/src/util/socks.c
index 387c2b698..ece79b3e4 100644
--- a/src/util/socks.c
+++ b/src/util/socks.c
@@ -599,7 +599,7 @@ GNUNET_SOCKS_do_connect (const char *service_name,
599 if (GNUNET_OK != 599 if (GNUNET_OK !=
600 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0)) 600 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0))
601 host0 = NULL; /* you don't want to feed a static string to free(), right? */ 601 host0 = NULL; /* you don't want to feed a static string to free(), right? */
602 socks5 = GNUNET_CONNECTION_create_from_connect (cfg, host0 || "127.0.0.1", port0); 602 socks5 = GNUNET_CONNECTION_create_from_connect (cfg, (char*)(host0 || "127.0.0.1"), port0);
603 if (host0) GNUNET_free (host0); 603 if (host0) GNUNET_free (host0);
604 604
605 /* Sets to NULL if they do not exist */ 605 /* Sets to NULL if they do not exist */