gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit 935e4ca3e1fefd074a3c48867757d677240255e3
parent 7ce636d8726a6d4b3382aa84bc513272cdc6c0cb
Author: Bart Polot <bart@net.in.tum.de>
Date:   Tue, 25 Jun 2013 13:00:36 +0000

- make sure not to leak rc on shutdown

Diffstat:
Msrc/mesh/gnunet-service-mesh-new.c | 20+++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c @@ -2351,7 +2351,13 @@ tunnel_destroy (struct MeshTunnel *t) peer_cancel_queues (t->next_hop, t); GNUNET_PEER_change_rc (t->next_hop, -1); } - GNUNET_PEER_change_rc (t->dest, -1); + if (0 != t->dest) { + struct MeshPeerInfo *pi; + + pi = peer_get_short (t->dest); + peer_info_remove_tunnel (pi, t); + GNUNET_PEER_change_rc (t->dest, -1); + } if (GNUNET_SCHEDULER_NO_TASK != t->maintenance_task) GNUNET_SCHEDULER_cancel (t->maintenance_task); @@ -2501,16 +2507,20 @@ tunnel_destroy_iterator (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is destination.\n", c->id); t->client = NULL; - GNUNET_PEER_change_rc (t->next_hop, -1); - t->next_hop = 0; + if (0 != t->next_hop) { /* destroy could come before a path is used */ + GNUNET_PEER_change_rc (t->next_hop, -1); + t->next_hop = 0; + } } else if (c == t->owner) { struct MeshPeerInfo *p; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is owner.\n", c->id); t->owner = NULL; - GNUNET_PEER_change_rc (t->prev_hop, -1); - t->prev_hop = 0; + if (0 != t->prev_hop) { /* destroy could come before a path is used */ + GNUNET_PEER_change_rc (t->prev_hop, -1); + t->prev_hop = 0; + } p = peer_get_short (t->dest); peer_info_remove_tunnel (p, t); }