do notify client about destroyed channel on MQ error
authorChristian Grothoff <christian@grothoff.org>
Mon, 13 Aug 2018 15:58:10 +0000 (17:58 +0200)
committerChristian Grothoff <christian@grothoff.org>
Mon, 13 Aug 2018 15:58:10 +0000 (17:58 +0200)
src/cadet/cadet_api.c
src/cadet/gnunet-service-cadet_hello.c
src/hostlist/hostlist.conf
src/rps/gnunet-service-rps.c
src/rps/test_rps.conf

index e2ca461a536280d8336dcfe8670ee8c1c8c0a301..23ea46e59758a7d65f1e716c1105b7629d75dc2a 100644 (file)
@@ -549,6 +549,9 @@ cadet_mq_error_handler (void *cls,
   else
   {
     GNUNET_break (0);
+    if (NULL != ch->disconnects)
+      ch->disconnects (ch->ctx,
+                      ch);
     GNUNET_CADET_channel_destroy (ch);
   }
 }
index 61686e5dace637a06d1adbff9a14e3f586c455fb..0061bddc21193eb19f352739570aea8a080ee7fb 100644 (file)
 */
 /**
  * @file cadet/gnunet-service-cadet_hello.c
- * @brief spread knowledge about how to contact other peers from PEERINFO
+ * @brief spread knowledge about how to contact us (get HELLO from peerinfo),
+ *         and remember HELLOs of other peers we have an interest in
  * @author Bartlomiej Polot
  * @author Christian Grothoff
- *
- * TODO:
- * - is most of this necessary/helpful?
- * - should we not simply restrict this to OUR hello?
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
index 59cc351cc1ae5a46e69cc404964f6b31b178a8a5..32e5d83200a374730e900b8294fd5276e4027fc7 100644 (file)
@@ -41,3 +41,5 @@ SERVERS = http://v10.gnunet.org/hostlist https://gnunet.io/hostlist
 # Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
 # Default: HTTP
 # PROXY_TYPE = HTTP
+
+
index e0301af6b008463423705a86f4478090b5eb6c55..41769ca249cb6928620da5a0f499b1f7482b56b7 100644 (file)
@@ -701,7 +701,7 @@ get_channel (const struct GNUNET_PeerIdentity *peer)
                                    &port,
                                    GNUNET_CADET_OPTION_RELIABLE,
                                    NULL, /* WindowSize handler */
-                                   cleanup_destroyed_channel, /* Disconnect handler */
+                                   &cleanup_destroyed_channel, /* Disconnect handler */
                                    cadet_handlers);
   }
   GNUNET_assert (NULL != peer_ctx->send_channel_ctx);
@@ -860,6 +860,7 @@ check_operation_scheduled (const struct GNUNET_PeerIdentity *peer,
   return GNUNET_NO;
 }
 
+
 /**
  * @brief Callback for scheduler to destroy a channel
  *
@@ -869,17 +870,20 @@ static void
 destroy_channel (struct ChannelCtx *channel_ctx)
 {
   struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
-
+  struct GNUNET_CADET_Channel *channel;
+  
   if (NULL != channel_ctx->destruction_task)
   {
     GNUNET_SCHEDULER_cancel (channel_ctx->destruction_task);
     channel_ctx->destruction_task = NULL;
   }
-  GNUNET_CADET_channel_destroy (channel_ctx->channel);
+  channel = channel_ctx->channel;
   channel_ctx->channel = NULL;
+  GNUNET_CADET_channel_destroy (channel);
   remove_channel_ctx (channel_ctx);
 }
 
+
 /**
  * @brief Destroy a cadet channel.
  *
@@ -891,10 +895,12 @@ static void
 destroy_channel_cb (void *cls)
 {
   struct ChannelCtx *channel_ctx = cls;
+
   channel_ctx->destruction_task = NULL;
   destroy_channel (channel_ctx);
 }
 
+
 /**
  * @brief Schedule the destruction of a channel for immediately afterwards.
  *
@@ -908,10 +914,16 @@ destroy_channel_cb (void *cls)
 static void
 schedule_channel_destruction (struct ChannelCtx *channel_ctx)
 {
+  GNUNET_assert (NULL ==
+                channel_ctx->destruction_task);
+  GNUNET_assert (NULL !=
+                channel_ctx->channel);
   channel_ctx->destruction_task =
-    GNUNET_SCHEDULER_add_now (destroy_channel_cb, channel_ctx);
+    GNUNET_SCHEDULER_add_now (&destroy_channel_cb,
+                             channel_ctx);
 }
 
+
 /**
  * @brief Remove peer
  *
@@ -2530,7 +2542,7 @@ cleanup_destroyed_channel (void *cls,
   //  * cleanup everything related to the channel
   //    * memory
   //  * remove peer if necessary
-
+  channel_ctx->channel = NULL;
   if (peer_ctx->recv_channel_ctx == channel_ctx)
   {
     remove_channel_ctx (channel_ctx);
index 02fbf76a406b35962f55f47ea57c8009a2c828c9..e751dafbc34d09735b2658ef4057ef94518fa4cf 100644 (file)
@@ -1,6 +1,7 @@
 [rps]
 #PREFIX = valgrind --leak-check=full --show-leak-kinds=all --log-file=/tmp/rps/valgrind!gnunet-service-rps!%p
 #PREFIX = valgrind --log-file=/tmp/rps/valgrind!gnunet-service-rps!%p
+#PREFIX = valgrind 
 #BINARY = gnunet-service-rps
 UNIXPATH = $GNUNET_TMP/gnunet-service-rps.sock
 HOME = $SERVICEHOME