diff options
author | Julius Bünger <buenger@mytum.de> | 2019-02-21 16:36:05 +0100 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2019-02-21 16:36:05 +0100 |
commit | 6795812d9db9bc981e62042447bdffbf2ee4a8d9 (patch) | |
tree | e55db4e5246e8a8b60a3ef6efdc8118e10f64daa /src/rps | |
parent | 0dd211d9bac092d71ac7bab3cfc8561f0a7e1cf6 (diff) | |
download | gnunet-6795812d9db9bc981e62042447bdffbf2ee4a8d9.tar.gz gnunet-6795812d9db9bc981e62042447bdffbf2ee4a8d9.zip |
RPS service: Check existence of peer before destruction
This is only a workaround.
What was causing an issue was that, during the removal of a peer (from
all datastructures), the peer was also removed from the peer_map,
causing the final destruction call to fail.
With this workaround the peer is only destroyed if it is still in the
peer_map.
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index a448d17e4..35ed1022f 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -2676,11 +2676,23 @@ static void | |||
2676 | remove_peer (struct Sub *sub, | 2676 | remove_peer (struct Sub *sub, |
2677 | const struct GNUNET_PeerIdentity *peer) | 2677 | const struct GNUNET_PeerIdentity *peer) |
2678 | { | 2678 | { |
2679 | (void) View_remove_peer (sub->view, peer); | 2679 | (void) View_remove_peer (sub->view, |
2680 | CustomPeerMap_remove_peer (sub->pull_map, peer); | 2680 | peer); |
2681 | CustomPeerMap_remove_peer (sub->push_map, peer); | 2681 | CustomPeerMap_remove_peer (sub->pull_map, |
2682 | RPS_sampler_reinitialise_by_value (sub->sampler, peer); | 2682 | peer); |
2683 | destroy_peer (get_peer_ctx (sub->peer_map, peer)); | 2683 | CustomPeerMap_remove_peer (sub->push_map, |
2684 | peer); | ||
2685 | RPS_sampler_reinitialise_by_value (sub->sampler, | ||
2686 | peer); | ||
2687 | /* We want to destroy the peer now. | ||
2688 | * Sometimes, it just seems that it's already been removed from the peer_map, | ||
2689 | * so check the peer_map first. */ | ||
2690 | if (GNUNET_YES == check_peer_known (sub->peer_map, | ||
2691 | peer)) | ||
2692 | { | ||
2693 | destroy_peer (get_peer_ctx (sub->peer_map, | ||
2694 | peer)); | ||
2695 | } | ||
2684 | } | 2696 | } |
2685 | 2697 | ||
2686 | 2698 | ||