summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-08-13 17:58:10 +0200
committerChristian Grothoff <christian@grothoff.org>2018-08-13 17:58:10 +0200
commitb8da8b39b97eb830a7c03c79e5e1d8508026987c (patch)
treef7a4d3367393328cba3a3533fb8c1729f870b990 /src
parent0bd93f589ac8cdfdd93f6f427287179c15e149e3 (diff)
do notify client about destroyed channel on MQ error
Diffstat (limited to 'src')
-rw-r--r--src/cadet/cadet_api.c3
-rw-r--r--src/cadet/gnunet-service-cadet_hello.c7
-rw-r--r--src/hostlist/hostlist.conf2
-rw-r--r--src/rps/gnunet-service-rps.c22
-rw-r--r--src/rps/test_rps.conf1
5 files changed, 25 insertions, 10 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index e2ca461a5..23ea46e59 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -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);
}
}
diff --git a/src/cadet/gnunet-service-cadet_hello.c b/src/cadet/gnunet-service-cadet_hello.c
index 61686e5da..0061bddc2 100644
--- a/src/cadet/gnunet-service-cadet_hello.c
+++ b/src/cadet/gnunet-service-cadet_hello.c
@@ -17,13 +17,10 @@
*/
/**
* @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"
diff --git a/src/hostlist/hostlist.conf b/src/hostlist/hostlist.conf
index 59cc351cc..32e5d8320 100644
--- a/src/hostlist/hostlist.conf
+++ b/src/hostlist/hostlist.conf
@@ -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
+
+
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index e0301af6b..41769ca24 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -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);
diff --git a/src/rps/test_rps.conf b/src/rps/test_rps.conf
index 02fbf76a4..e751dafbc 100644
--- a/src/rps/test_rps.conf
+++ b/src/rps/test_rps.conf
@@ -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