aboutsummaryrefslogtreecommitdiff
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)
downloadgnunet-b8da8b39b97eb830a7c03c79e5e1d8508026987c.tar.gz
gnunet-b8da8b39b97eb830a7c03c79e5e1d8508026987c.zip
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,
549 else 549 else
550 { 550 {
551 GNUNET_break (0); 551 GNUNET_break (0);
552 if (NULL != ch->disconnects)
553 ch->disconnects (ch->ctx,
554 ch);
552 GNUNET_CADET_channel_destroy (ch); 555 GNUNET_CADET_channel_destroy (ch);
553 } 556 }
554} 557}
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 @@
17*/ 17*/
18/** 18/**
19 * @file cadet/gnunet-service-cadet_hello.c 19 * @file cadet/gnunet-service-cadet_hello.c
20 * @brief spread knowledge about how to contact other peers from PEERINFO 20 * @brief spread knowledge about how to contact us (get HELLO from peerinfo),
21 * and remember HELLOs of other peers we have an interest in
21 * @author Bartlomiej Polot 22 * @author Bartlomiej Polot
22 * @author Christian Grothoff 23 * @author Christian Grothoff
23 *
24 * TODO:
25 * - is most of this necessary/helpful?
26 * - should we not simply restrict this to OUR hello?
27 */ 24 */
28#include "platform.h" 25#include "platform.h"
29#include "gnunet_util_lib.h" 26#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
41# Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME 41# Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
42# Default: HTTP 42# Default: HTTP
43# PROXY_TYPE = HTTP 43# PROXY_TYPE = HTTP
44
45
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)
701 &port, 701 &port,
702 GNUNET_CADET_OPTION_RELIABLE, 702 GNUNET_CADET_OPTION_RELIABLE,
703 NULL, /* WindowSize handler */ 703 NULL, /* WindowSize handler */
704 cleanup_destroyed_channel, /* Disconnect handler */ 704 &cleanup_destroyed_channel, /* Disconnect handler */
705 cadet_handlers); 705 cadet_handlers);
706 } 706 }
707 GNUNET_assert (NULL != peer_ctx->send_channel_ctx); 707 GNUNET_assert (NULL != peer_ctx->send_channel_ctx);
@@ -860,6 +860,7 @@ check_operation_scheduled (const struct GNUNET_PeerIdentity *peer,
860 return GNUNET_NO; 860 return GNUNET_NO;
861} 861}
862 862
863
863/** 864/**
864 * @brief Callback for scheduler to destroy a channel 865 * @brief Callback for scheduler to destroy a channel
865 * 866 *
@@ -869,17 +870,20 @@ static void
869destroy_channel (struct ChannelCtx *channel_ctx) 870destroy_channel (struct ChannelCtx *channel_ctx)
870{ 871{
871 struct PeerContext *peer_ctx = channel_ctx->peer_ctx; 872 struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
872 873 struct GNUNET_CADET_Channel *channel;
874
873 if (NULL != channel_ctx->destruction_task) 875 if (NULL != channel_ctx->destruction_task)
874 { 876 {
875 GNUNET_SCHEDULER_cancel (channel_ctx->destruction_task); 877 GNUNET_SCHEDULER_cancel (channel_ctx->destruction_task);
876 channel_ctx->destruction_task = NULL; 878 channel_ctx->destruction_task = NULL;
877 } 879 }
878 GNUNET_CADET_channel_destroy (channel_ctx->channel); 880 channel = channel_ctx->channel;
879 channel_ctx->channel = NULL; 881 channel_ctx->channel = NULL;
882 GNUNET_CADET_channel_destroy (channel);
880 remove_channel_ctx (channel_ctx); 883 remove_channel_ctx (channel_ctx);
881} 884}
882 885
886
883/** 887/**
884 * @brief Destroy a cadet channel. 888 * @brief Destroy a cadet channel.
885 * 889 *
@@ -891,10 +895,12 @@ static void
891destroy_channel_cb (void *cls) 895destroy_channel_cb (void *cls)
892{ 896{
893 struct ChannelCtx *channel_ctx = cls; 897 struct ChannelCtx *channel_ctx = cls;
898
894 channel_ctx->destruction_task = NULL; 899 channel_ctx->destruction_task = NULL;
895 destroy_channel (channel_ctx); 900 destroy_channel (channel_ctx);
896} 901}
897 902
903
898/** 904/**
899 * @brief Schedule the destruction of a channel for immediately afterwards. 905 * @brief Schedule the destruction of a channel for immediately afterwards.
900 * 906 *
@@ -908,10 +914,16 @@ destroy_channel_cb (void *cls)
908static void 914static void
909schedule_channel_destruction (struct ChannelCtx *channel_ctx) 915schedule_channel_destruction (struct ChannelCtx *channel_ctx)
910{ 916{
917 GNUNET_assert (NULL ==
918 channel_ctx->destruction_task);
919 GNUNET_assert (NULL !=
920 channel_ctx->channel);
911 channel_ctx->destruction_task = 921 channel_ctx->destruction_task =
912 GNUNET_SCHEDULER_add_now (destroy_channel_cb, channel_ctx); 922 GNUNET_SCHEDULER_add_now (&destroy_channel_cb,
923 channel_ctx);
913} 924}
914 925
926
915/** 927/**
916 * @brief Remove peer 928 * @brief Remove peer
917 * 929 *
@@ -2530,7 +2542,7 @@ cleanup_destroyed_channel (void *cls,
2530 // * cleanup everything related to the channel 2542 // * cleanup everything related to the channel
2531 // * memory 2543 // * memory
2532 // * remove peer if necessary 2544 // * remove peer if necessary
2533 2545 channel_ctx->channel = NULL;
2534 if (peer_ctx->recv_channel_ctx == channel_ctx) 2546 if (peer_ctx->recv_channel_ctx == channel_ctx)
2535 { 2547 {
2536 remove_channel_ctx (channel_ctx); 2548 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 @@
1[rps] 1[rps]
2#PREFIX = valgrind --leak-check=full --show-leak-kinds=all --log-file=/tmp/rps/valgrind!gnunet-service-rps!%p 2#PREFIX = valgrind --leak-check=full --show-leak-kinds=all --log-file=/tmp/rps/valgrind!gnunet-service-rps!%p
3#PREFIX = valgrind --log-file=/tmp/rps/valgrind!gnunet-service-rps!%p 3#PREFIX = valgrind --log-file=/tmp/rps/valgrind!gnunet-service-rps!%p
4#PREFIX = valgrind
4#BINARY = gnunet-service-rps 5#BINARY = gnunet-service-rps
5UNIXPATH = $GNUNET_TMP/gnunet-service-rps.sock 6UNIXPATH = $GNUNET_TMP/gnunet-service-rps.sock
6HOME = $SERVICEHOME 7HOME = $SERVICEHOME