diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-22 16:33:01 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-22 16:33:01 +0100 |
commit | f74bc79fcea9c0ecb5dc0af8e49764fd31e34d4d (patch) | |
tree | c5f0e066abaee41b47f1d682e38449d4f65168c9 /src/cadet/gnunet-service-cadet-new.c | |
parent | ceb48e10d23bd38df68d6487d0d0b1d85c7f9ba7 (diff) | |
download | gnunet-f74bc79fcea9c0ecb5dc0af8e49764fd31e34d4d.tar.gz gnunet-f74bc79fcea9c0ecb5dc0af8e49764fd31e34d4d.zip |
fix shutdown logic
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet-new.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index b0d8fc32d..2e431c034 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c | |||
@@ -335,6 +335,27 @@ destroy_tunnels_now (void *cls, | |||
335 | 335 | ||
336 | 336 | ||
337 | /** | 337 | /** |
338 | * Callback invoked on all peers to destroy all tunnels | ||
339 | * that may still exist. | ||
340 | * | ||
341 | * @param cls NULL | ||
342 | * @param pid identify of a peer | ||
343 | * @param value a `struct CadetPeer` that may still have a tunnel | ||
344 | * @return #GNUNET_OK (iterate over all entries) | ||
345 | */ | ||
346 | static int | ||
347 | destroy_paths_now (void *cls, | ||
348 | const struct GNUNET_PeerIdentity *pid, | ||
349 | void *value) | ||
350 | { | ||
351 | struct CadetPeer *cp = value; | ||
352 | |||
353 | GCP_drop_owned_paths (cp); | ||
354 | return GNUNET_OK; | ||
355 | } | ||
356 | |||
357 | |||
358 | /** | ||
338 | * Task run during shutdown. | 359 | * Task run during shutdown. |
339 | * | 360 | * |
340 | * @param cls unused | 361 | * @param cls unused |
@@ -366,6 +387,9 @@ shutdown_task (void *cls) | |||
366 | GCP_iterate_all (&destroy_tunnels_now, | 387 | GCP_iterate_all (&destroy_tunnels_now, |
367 | NULL); | 388 | NULL); |
368 | /* All tunnels, channels, connections and CORE must be down before this point. */ | 389 | /* All tunnels, channels, connections and CORE must be down before this point. */ |
390 | GCP_iterate_all (&destroy_paths_now, | ||
391 | NULL); | ||
392 | /* All paths, tunnels, channels, connections and CORE must be down before this point. */ | ||
369 | GCP_destroy_all_peers (); | 393 | GCP_destroy_all_peers (); |
370 | if (NULL != peers) | 394 | if (NULL != peers) |
371 | { | 395 | { |