diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-30 08:17:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-30 08:17:37 +0000 |
commit | 95f9076a2139f5fb042b944a0658b6cda2fa35db (patch) | |
tree | b0826a2a1dcf812e6b4450fe6b05d47cd53ae49d /src/cadet/gnunet-service-cadet_peer.c | |
parent | 7746f68db77b9ca3c4aaca24ab2ce5253461240b (diff) | |
download | gnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.tar.gz gnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.zip |
implementing new scheduler shutdown semantics
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 51af04527..46961250b 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -387,7 +387,6 @@ notify_broken (void *cls, | |||
387 | * Remove the direct path to the peer. | 387 | * Remove the direct path to the peer. |
388 | * | 388 | * |
389 | * @param peer Peer to remove the direct path from. | 389 | * @param peer Peer to remove the direct path from. |
390 | * | ||
391 | */ | 390 | */ |
392 | static struct CadetPeerPath * | 391 | static struct CadetPeerPath * |
393 | pop_direct_path (struct CadetPeer *peer) | 392 | pop_direct_path (struct CadetPeer *peer) |
@@ -398,7 +397,9 @@ pop_direct_path (struct CadetPeer *peer) | |||
398 | { | 397 | { |
399 | if (2 >= iter->length) | 398 | if (2 >= iter->length) |
400 | { | 399 | { |
401 | GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, iter); | 400 | GNUNET_CONTAINER_DLL_remove (peer->path_head, |
401 | peer->path_tail, | ||
402 | iter); | ||
402 | return iter; | 403 | return iter; |
403 | } | 404 | } |
404 | } | 405 | } |
@@ -750,7 +751,8 @@ peer_destroy (struct CadetPeer *peer) | |||
750 | "destroying peer %s\n", | 751 | "destroying peer %s\n", |
751 | GNUNET_i2s (&id)); | 752 | GNUNET_i2s (&id)); |
752 | 753 | ||
753 | if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer)) | 754 | if (GNUNET_YES != |
755 | GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer)) | ||
754 | { | 756 | { |
755 | GNUNET_break (0); | 757 | GNUNET_break (0); |
756 | LOG (GNUNET_ERROR_TYPE_WARNING, " peer not in peermap!!\n"); | 758 | LOG (GNUNET_ERROR_TYPE_WARNING, " peer not in peermap!!\n"); |
@@ -846,12 +848,8 @@ static void | |||
846 | delayed_search (void *cls) | 848 | delayed_search (void *cls) |
847 | { | 849 | { |
848 | struct CadetPeer *peer = cls; | 850 | struct CadetPeer *peer = cls; |
849 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
850 | 851 | ||
851 | peer->search_delayed = NULL; | 852 | peer->search_delayed = NULL; |
852 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
853 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | ||
854 | return; | ||
855 | GCC_check_connections (); | 853 | GCC_check_connections (); |
856 | GCP_start_search (peer); | 854 | GCP_start_search (peer); |
857 | GCC_check_connections (); | 855 | GCC_check_connections (); |
@@ -1934,8 +1932,9 @@ GCP_get (const struct GNUNET_PeerIdentity *peer_id, int create) | |||
1934 | 1932 | ||
1935 | 1933 | ||
1936 | /** | 1934 | /** |
1937 | * Retrieve the CadetPeer stucture associated with the peer. Optionally create | 1935 | * Retrieve the CadetPeer stucture associated with the |
1938 | * one and insert it in the appropriate structures if the peer is not known yet. | 1936 | * peer. Optionally create one and insert it in the appropriate |
1937 | * structures if the peer is not known yet. | ||
1939 | * | 1938 | * |
1940 | * @param peer Short identity of the peer. | 1939 | * @param peer Short identity of the peer. |
1941 | * @param create #GNUNET_YES if a new peer should be created if unknown. | 1940 | * @param create #GNUNET_YES if a new peer should be created if unknown. |
@@ -2223,7 +2222,8 @@ GCP_add_path (struct CadetPeer *peer, | |||
2223 | } | 2222 | } |
2224 | } | 2223 | } |
2225 | } | 2224 | } |
2226 | GNUNET_CONTAINER_DLL_insert_tail (peer->path_head, peer->path_tail, | 2225 | GNUNET_CONTAINER_DLL_insert_tail (peer->path_head, |
2226 | peer->path_tail, | ||
2227 | path); | 2227 | path); |
2228 | LOG (GNUNET_ERROR_TYPE_DEBUG, " added last\n"); | 2228 | LOG (GNUNET_ERROR_TYPE_DEBUG, " added last\n"); |
2229 | 2229 | ||
@@ -2300,7 +2300,8 @@ GCP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) | |||
2300 | * @param path Path to remove. Is always destroyed . | 2300 | * @param path Path to remove. Is always destroyed . |
2301 | */ | 2301 | */ |
2302 | void | 2302 | void |
2303 | GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) | 2303 | GCP_remove_path (struct CadetPeer *peer, |
2304 | struct CadetPeerPath *path) | ||
2304 | { | 2305 | { |
2305 | struct CadetPeerPath *iter; | 2306 | struct CadetPeerPath *iter; |
2306 | struct CadetPeerPath *next; | 2307 | struct CadetPeerPath *next; |
@@ -2309,7 +2310,8 @@ GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) | |||
2309 | GNUNET_assert (myid == path->peers[0]); | 2310 | GNUNET_assert (myid == path->peers[0]); |
2310 | GNUNET_assert (peer->id == path->peers[path->length - 1]); | 2311 | GNUNET_assert (peer->id == path->peers[path->length - 1]); |
2311 | 2312 | ||
2312 | LOG (GNUNET_ERROR_TYPE_INFO, "Removing path %p (%u) from %s\n", | 2313 | LOG (GNUNET_ERROR_TYPE_INFO, |
2314 | "Removing path %p (%u) from %s\n", | ||
2313 | path, path->length, GCP_2s (peer)); | 2315 | path, path->length, GCP_2s (peer)); |
2314 | 2316 | ||
2315 | for (iter = peer->path_head; NULL != iter; iter = next) | 2317 | for (iter = peer->path_head; NULL != iter; iter = next) |
@@ -2317,7 +2319,9 @@ GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) | |||
2317 | next = iter->next; | 2319 | next = iter->next; |
2318 | if (0 == path_cmp (path, iter)) | 2320 | if (0 == path_cmp (path, iter)) |
2319 | { | 2321 | { |
2320 | GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, iter); | 2322 | GNUNET_CONTAINER_DLL_remove (peer->path_head, |
2323 | peer->path_tail, | ||
2324 | iter); | ||
2321 | if (iter != path) | 2325 | if (iter != path) |
2322 | path_destroy (iter); | 2326 | path_destroy (iter); |
2323 | } | 2327 | } |
@@ -2512,7 +2516,8 @@ GCP_get_tunnel (const struct CadetPeer *peer) | |||
2512 | * @param hello Hello message. | 2516 | * @param hello Hello message. |
2513 | */ | 2517 | */ |
2514 | void | 2518 | void |
2515 | GCP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) | 2519 | GCP_set_hello (struct CadetPeer *peer, |
2520 | const struct GNUNET_HELLO_Message *hello) | ||
2516 | { | 2521 | { |
2517 | struct GNUNET_HELLO_Message *old; | 2522 | struct GNUNET_HELLO_Message *old; |
2518 | size_t size; | 2523 | size_t size; |