diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-10-02 03:37:42 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-10-02 03:37:42 +0000 |
commit | 341704937b8b07b415376f8f0bd13bbc7d26d44c (patch) | |
tree | ba9be1884b709e99aa481d54c62238ac7d0138c4 /src/cadet/gnunet-service-cadet_peer.c | |
parent | 7df0c2bc1d40a7d98d590dc796f5b429455a23a7 (diff) | |
download | gnunet-341704937b8b07b415376f8f0bd13bbc7d26d44c.tar.gz gnunet-341704937b8b07b415376f8f0bd13bbc7d26d44c.zip |
Fixed usage of known broken paths. If a connection was destroyed
while handling a neighbor disconnection, cadet tried to reconnect
to peers using paths containing the disconnecting peer.
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index d60858321..9d80336bd 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -358,9 +358,8 @@ notify_broken (void *cls, | |||
358 | struct CadetConnection *c = value; | 358 | struct CadetConnection *c = value; |
359 | 359 | ||
360 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 360 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
361 | "Notifying %s due to %s\n", | 361 | "Notifying %s due to %s disconnect\n", |
362 | GCC_2s (c), | 362 | GCC_2s (c), GCP_2s (peer)); |
363 | GCP_2s (peer)); | ||
364 | GCC_neighbor_disconnected (c, peer); | 363 | GCC_neighbor_disconnected (c, peer); |
365 | return GNUNET_YES; | 364 | return GNUNET_YES; |
366 | } | 365 | } |
@@ -1016,8 +1015,8 @@ peer_get_first_message (const struct CadetPeer *peer) | |||
1016 | * paths form the initial tunnel, which can be optimized later. | 1015 | * paths form the initial tunnel, which can be optimized later. |
1017 | * Called on each result obtained for the DHT search. | 1016 | * Called on each result obtained for the DHT search. |
1018 | * | 1017 | * |
1019 | * @param cls closure | 1018 | * @param cls Closure (peer towards a path has been found). |
1020 | * @param path | 1019 | * @param path Path created from the DHT query. Will be freed afterwards. |
1021 | */ | 1020 | */ |
1022 | static void | 1021 | static void |
1023 | search_handler (void *cls, const struct CadetPeerPath *path) | 1022 | search_handler (void *cls, const struct CadetPeerPath *path) |
@@ -1537,7 +1536,7 @@ GCP_queue_cancel (struct CadetPeer *peer, | |||
1537 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1536 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1538 | "GMP queue cancel %s\n", | 1537 | "GMP queue cancel %s\n", |
1539 | GC_m2s (q->type)); | 1538 | GC_m2s (q->type)); |
1540 | GNUNET_break (GNUNET_NO == connection_destroyed); | 1539 | GNUNET_assert (GNUNET_NO == connection_destroyed); |
1541 | if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY == q->type) | 1540 | if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY == q->type) |
1542 | { | 1541 | { |
1543 | q->c = NULL; | 1542 | q->c = NULL; |
@@ -2066,7 +2065,7 @@ GCP_add_connection (struct CadetPeer *peer, | |||
2066 | * is the shortest. | 2065 | * is the shortest. |
2067 | * | 2066 | * |
2068 | * @param peer Destination peer to add the path to. | 2067 | * @param peer Destination peer to add the path to. |
2069 | * @param path New path to add. Last peer must be the peer in arg 1. | 2068 | * @param path New path to add. Last peer must be @c peer. |
2070 | * Path will be either used of freed if already known. | 2069 | * Path will be either used of freed if already known. |
2071 | * @param trusted Do we trust that this path is real? | 2070 | * @param trusted Do we trust that this path is real? |
2072 | * | 2071 | * |
@@ -2206,13 +2205,13 @@ GCP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) | |||
2206 | for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ; | 2205 | for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ; |
2207 | for (i++; i < p->length; i++) | 2206 | for (i++; i < p->length; i++) |
2208 | { | 2207 | { |
2209 | struct CadetPeer *aux; | 2208 | struct CadetPeer *peer; |
2210 | struct CadetPeerPath *copy; | 2209 | struct CadetPeerPath *copy; |
2211 | 2210 | ||
2212 | aux = GCP_get_short (p->peers[i], GNUNET_YES); | 2211 | peer = GCP_get_short (p->peers[i], GNUNET_YES); |
2213 | copy = path_duplicate (p); | 2212 | copy = path_duplicate (p); |
2214 | copy->length = i + 1; | 2213 | copy->length = i + 1; |
2215 | GCP_add_path (aux, copy, p->length < 3 ? GNUNET_NO : confirmed); | 2214 | GCP_add_path (peer, copy, 3 > p->length ? GNUNET_NO : confirmed); |
2216 | } | 2215 | } |
2217 | GCC_check_connections (); | 2216 | GCC_check_connections (); |
2218 | } | 2217 | } |
@@ -2531,8 +2530,8 @@ GCP_try_connect (struct CadetPeer *peer) | |||
2531 | */ | 2530 | */ |
2532 | void | 2531 | void |
2533 | GCP_notify_broken_link (struct CadetPeer *peer, | 2532 | GCP_notify_broken_link (struct CadetPeer *peer, |
2534 | struct GNUNET_PeerIdentity *peer1, | 2533 | const struct GNUNET_PeerIdentity *peer1, |
2535 | struct GNUNET_PeerIdentity *peer2) | 2534 | const struct GNUNET_PeerIdentity *peer2) |
2536 | { | 2535 | { |
2537 | struct CadetPeerPath *iter; | 2536 | struct CadetPeerPath *iter; |
2538 | struct CadetPeerPath *next; | 2537 | struct CadetPeerPath *next; |