From 86ba6d5b16f7741768e801ea11bbdc492a1ceeb6 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 25 Jun 2015 03:47:36 +0000 Subject: - don't try to retrive a peer during a shutdown task --- src/cadet/cadet_path.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/cadet/cadet_path.c b/src/cadet/cadet_path.c index 1118f0e22..fc9f9c453 100644 --- a/src/cadet/cadet_path.c +++ b/src/cadet/cadet_path.c @@ -48,12 +48,14 @@ path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct CadetPeer *peer; LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, path->length); - if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) - return; path->path_delete = NULL; - peer = GCP_get_short (path->peers[path->length - 1]); - if (2 < path->length) + + if (2 < path->length && (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) == 0) + { + /* During shutdown, the peers peermap might not exist anymore. */ + peer = GCP_get_short (path->peers[path->length - 1]); GCP_remove_path (peer, path); + } else path_destroy (path); } -- cgit v1.2.3