summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-01-28 18:56:03 +0000
committerBart Polot <bart@net.in.tum.de>2015-01-28 18:56:03 +0000
commit6100f5e385506103d15bbd2055eaa1865aacb6c3 (patch)
tree1efd695d8ae3c2ce49b2a3ac35857ae458c12fa5 /src
parent030d48dc4c86aa4b0954c03515d38fec20762def (diff)
- avoid chain-calling the destroy handler to destroy the channel currently being destroyed
Diffstat (limited to 'src')
-rw-r--r--src/rps/gnunet-service-rps.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 34acba2fc..fe5db5e6f 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1388,6 +1388,7 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
struct PeerContext *peer_ctx;
const struct GNUNET_CADET_Channel *ch = (const struct GNUNET_CADET_Channel *) cls;
+ struct GNUNET_CADET_Channel *destroy;
peer_ctx = (struct PeerContext *) value;
@@ -1402,11 +1403,19 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
if (NULL != peer_ctx->send_channel
&& ch != peer_ctx->send_channel)
- GNUNET_CADET_channel_destroy (peer_ctx->send_channel);
+ {
+ destroy = peer_ctx->send_channel;
+ peer_ctx->send_channel = NULL;
+ GNUNET_CADET_channel_destroy (destroy);
+ }
if (NULL != peer_ctx->recv_channel
&& ch != peer_ctx->recv_channel)
- GNUNET_CADET_channel_destroy (peer_ctx->recv_channel);
+ {
+ destroy = peer_ctx->recv_channel;
+ peer_ctx->recv_channel = NULL;
+ GNUNET_CADET_channel_destroy (destroy);
+ }
if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_remove_all (peer_map, key))
LOG (GNUNET_ERROR_TYPE_WARNING, "removing peer from peer_map failed\n");