social: allow multiple calls to disconnect(), rest: handle warnings
authorCarlo von lynX <lynX@time.to.get.psyced.org>
Sat, 30 Jul 2016 06:22:40 +0000 (06:22 +0000)
committerCarlo von lynX <lynX@time.to.get.psyced.org>
Sat, 30 Jul 2016 06:22:40 +0000 (06:22 +0000)
src/multicast/gnunet-service-multicast.c
src/multicast/multicast_api.c
src/social/gnunet-social.c
src/util/socks.c

index 91cafb707421daf85ad402bb137bc111fcc59780..a14ecd04c2e8a84087d1dbfb65c15ceba1289720 100644 (file)
@@ -877,6 +877,7 @@ cadet_send_children (struct GNUNET_HashCode *pub_key_hash,
 }
 
 
+#if 0      // unused as yet
 /**
  * Send message to all connected parents.
  */
@@ -890,6 +891,7 @@ cadet_send_parents (struct GNUNET_HashCode *pub_key_hash,
                                                      cadet_send_cb, (void *) msg);
   return n;
 }
+#endif
 
 
 /**
@@ -1778,7 +1780,7 @@ cadet_recv_replay_response (void *cls,
                             void **ctx,
                             const struct GNUNET_MessageHeader *m)
 {
-  struct Channel *chn = *ctx;
+  //struct Channel *chn = *ctx;
 
   /* @todo FIXME: got replay error response, send request to other members */
 
index f5c8c3d34b13c85402ce65c3ab0f9641d255525b..e390a621cb9e573575aeaf5c1c3e107d3d901c27 100644 (file)
@@ -400,9 +400,9 @@ member_recv_replay_response (void *cls,
   struct GNUNET_MULTICAST_Member *
     mem = GNUNET_CLIENT_MANAGER_get_user_context_ (client, sizeof (*grp));
   grp = &mem->grp;
-  struct MulticastReplayResponseMessage *
-    res = (struct MulticastReplayResponseMessage *) msg;
-
+  // FIXME: Something is missing here for the code to make sense
+  //struct MulticastReplayResponseMessage *
+  //  res = (struct MulticastReplayResponseMessage *) msg;
   if (GNUNET_YES == grp->is_disconnecting)
     return;
 
index 9841e83a680ae5bd38fd4c02adec546e4546d917..5aa74c81a820c48a297ecf0e6b0ae0dd85e3ab24 100644 (file)
@@ -131,6 +131,9 @@ static int opt_limit;
 /** exit code */
 static int ret = 1;
 
+/** are we waiting for service to close our connection */
+static char is_disconnecting = 0;
+
 /** Task handle for timeout termination. */
 struct GNUNET_SCHEDULER_Task *timeout_task;
 
@@ -199,8 +202,11 @@ app_disconnected (void *cls)
 static void
 disconnect ()
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnect()\n");
-  GNUNET_SOCIAL_app_disconnect (app, app_disconnected, NULL);
+  // handle that we get called several times from several places, but should we?
+  if (!is_disconnecting++) {
+    GNUNET_SOCIAL_app_disconnect (app, app_disconnected, NULL);
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnect() called for the #%d time\n", is_disconnecting);
 }
 
 
@@ -218,21 +224,21 @@ static void
 timeout (void *cls)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "timeout()\n");
-  //disconnect ();
+  disconnect ();
 }
 
 static void
 schedule_success (void *cls)
 {
   ret = 0;
-  //disconnect ();
+  disconnect ();
 }
 
 
 static void
 schedule_fail (void *cls)
 {
-  //disconnect ();
+  disconnect ();
 }
 
 
index 387c2b69802755e5b50db2c5d5de0ce604bc378f..ece79b3e4842f547f0ccb97fff73c4490830b9b4 100644 (file)
@@ -599,7 +599,7 @@ GNUNET_SOCKS_do_connect (const char *service_name,
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0))
     host0 = NULL; /* you don't want to feed a static string to free(), right? */
-  socks5 = GNUNET_CONNECTION_create_from_connect (cfg, host0 || "127.0.0.1", port0);
+  socks5 = GNUNET_CONNECTION_create_from_connect (cfg, (char*)(host0 || "127.0.0.1"), port0);
   if (host0) GNUNET_free (host0);
 
   /* Sets to NULL if they do not exist */