aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-12-15 07:17:46 +0000
committerBart Polot <bart@net.in.tum.de>2014-12-15 07:17:46 +0000
commit5b4cc3b00e086a34f8dbcbf00f878f4a5850ea51 (patch)
tree033e97795701ddd89220375f9688c80ac28cd67c
parent2818cc5fd7709735ae4e04263b2dcbdad1b6522f (diff)
downloadgnunet-5b4cc3b00e086a34f8dbcbf00f878f4a5850ea51.tar.gz
gnunet-5b4cc3b00e086a34f8dbcbf00f878f4a5850ea51.zip
Never invalidate a direct path. (Like after getting a CONNECTION_BROKEN on a direct connection)
-rw-r--r--src/cadet/cadet_path.c17
-rw-r--r--src/cadet/gnunet-service-cadet_peer.c4
2 files changed, 16 insertions, 5 deletions
diff --git a/src/cadet/cadet_path.c b/src/cadet/cadet_path.c
index 7e950a5ce..1b2d377f5 100644
--- a/src/cadet/cadet_path.c
+++ b/src/cadet/cadet_path.c
@@ -36,6 +36,8 @@
36 * 36 *
37 * If the path is returned from DHT again after a while, try again. 37 * If the path is returned from DHT again after a while, try again.
38 * 38 *
39 * Removes the path from the peer (except for direct paths).
40 *
39 * @param cls Closure (path to destroy). 41 * @param cls Closure (path to destroy).
40 * @param tc Task context. 42 * @param tc Task context.
41 */ 43 */
@@ -45,9 +47,13 @@ path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
45 struct CadetPeerPath *path = cls; 47 struct CadetPeerPath *path = cls;
46 struct CadetPeer *peer; 48 struct CadetPeer *peer;
47 49
50 LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, path->length);
48 path->path_delete = GNUNET_SCHEDULER_NO_TASK; 51 path->path_delete = GNUNET_SCHEDULER_NO_TASK;
49 peer = GCP_get_short (path->peers[path->length - 1]); 52 peer = GCP_get_short (path->peers[path->length - 1]);
50 GCP_remove_path (peer, path); 53 if (2 < path->length)
54 GCP_remove_path (peer, path);
55 else
56 path_destroy (path);
51} 57}
52 58
53 59
@@ -133,8 +139,11 @@ path_get_length (struct CadetPeerPath *path)
133/** 139/**
134 * Mark path as invalid: keep it aroud for a while to avoid trying it in a loop. 140 * Mark path as invalid: keep it aroud for a while to avoid trying it in a loop.
135 * 141 *
136 * DHT_get sometimes returns bad cached results, for instance, on a locally 142 * Never invalidates a two-hop (direct) path, only a core handler can do that.
137 * cached result where the PUT followed a path that is no longer current. 143 *
144 * Rationale: DHT_get sometimes returns bad cached results, for instance,
145 * on a locally cached result where the PUT followed a path that is no longer
146 * current. The path must remain "known and marked as invalid" for a while.
138 * 147 *
139 * @param p Path to invalidate. 148 * @param p Path to invalidate.
140 */ 149 */
@@ -144,6 +153,7 @@ path_invalidate (struct CadetPeerPath *p)
144 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete) 153 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete)
145 return; 154 return;
146 155
156 LOG (GNUNET_ERROR_TYPE_INFO, "Invalidating path %p (%u)\n", p, p->length);
147 p->path_delete = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 157 p->path_delete = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
148 &path_destroy_delayed, p); 158 &path_destroy_delayed, p);
149} 159}
@@ -240,6 +250,7 @@ path_destroy (struct CadetPeerPath *p)
240 if (NULL == p) 250 if (NULL == p)
241 return GNUNET_OK; 251 return GNUNET_OK;
242 252
253 LOG (GNUNET_ERROR_TYPE_INFO, "destroying path %p (%u)\n", p, p->length);
243 GNUNET_PEER_decrement_rcs (p->peers, p->length); 254 GNUNET_PEER_decrement_rcs (p->peers, p->length);
244 GNUNET_free_non_null (p->peers); 255 GNUNET_free_non_null (p->peers);
245 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete) 256 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete)
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
index 7908cd42c..b57c77e11 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -2008,8 +2008,8 @@ GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path)
2008 GNUNET_assert (myid == path->peers[0]); 2008 GNUNET_assert (myid == path->peers[0]);
2009 GNUNET_assert (peer->id == path->peers[path->length - 1]); 2009 GNUNET_assert (peer->id == path->peers[path->length - 1]);
2010 2010
2011 LOG(GNUNET_ERROR_TYPE_INFO, "*** Removing path l(%u) from %s\n", 2011 LOG (GNUNET_ERROR_TYPE_INFO, "Removing path %p (%u) from %s\n",
2012 path->length, GCP_2s (peer)); 2012 path, path->length, GCP_2s (peer));
2013 2013
2014 for (iter = peer->path_head; NULL != iter; iter = next) 2014 for (iter = peer->path_head; NULL != iter; iter = next)
2015 { 2015 {