gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r34585 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r34585 - gnunet/src/cadet
Date: Mon, 15 Dec 2014 08:17:46 +0100

Author: bartpolot
Date: 2014-12-15 08:17:46 +0100 (Mon, 15 Dec 2014)
New Revision: 34585

Modified:
   gnunet/src/cadet/cadet_path.c
   gnunet/src/cadet/gnunet-service-cadet_peer.c
Log:
Never invalidate a direct path. (Like after getting a CONNECTION_BROKEN on a 
direct connection)

Modified: gnunet/src/cadet/cadet_path.c
===================================================================
--- gnunet/src/cadet/cadet_path.c       2014-12-15 07:17:45 UTC (rev 34584)
+++ gnunet/src/cadet/cadet_path.c       2014-12-15 07:17:46 UTC (rev 34585)
@@ -36,6 +36,8 @@
  *
  * If the path is returned from DHT again after a while, try again.
  *
+ * Removes the path from the peer (except for direct paths).
+ *
  * @param cls Closure (path to destroy).
  * @param tc Task context.
  */
@@ -45,9 +47,13 @@
   struct CadetPeerPath *path = cls;
   struct CadetPeer *peer;
 
+  LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, 
path->length);
   path->path_delete = GNUNET_SCHEDULER_NO_TASK;
   peer = GCP_get_short (path->peers[path->length - 1]);
-  GCP_remove_path (peer, path);
+  if (2 < path->length)
+    GCP_remove_path (peer, path);
+  else
+    path_destroy (path);
 }
 
 
@@ -133,9 +139,12 @@
 /**
  * Mark path as invalid: keep it aroud for a while to avoid trying it in a 
loop.
  *
- * DHT_get sometimes returns bad cached results, for instance, on a locally
- * cached result where the PUT followed a path that is no longer current.
+ * Never invalidates a two-hop (direct) path, only a core handler can do that.
  *
+ * Rationale: DHT_get sometimes returns bad cached results, for instance,
+ * on a locally cached result where the PUT followed a path that is no longer
+ * current. The path must remain "known and marked as invalid" for a while.
+ *
  * @param p Path to invalidate.
  */
 void
@@ -144,6 +153,7 @@
   if (GNUNET_SCHEDULER_NO_TASK != p->path_delete)
     return;
 
+  LOG (GNUNET_ERROR_TYPE_INFO, "Invalidating path %p (%u)\n", p, p->length);
   p->path_delete = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
                                                  &path_destroy_delayed, p);
 }
@@ -240,6 +250,7 @@
   if (NULL == p)
     return GNUNET_OK;
 
+  LOG (GNUNET_ERROR_TYPE_INFO, "destroying path %p (%u)\n", p, p->length);
   GNUNET_PEER_decrement_rcs (p->peers, p->length);
   GNUNET_free_non_null (p->peers);
   if (GNUNET_SCHEDULER_NO_TASK != p->path_delete)

Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c        2014-12-15 07:17:45 UTC 
(rev 34584)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c        2014-12-15 07:17:46 UTC 
(rev 34585)
@@ -2008,8 +2008,8 @@
   GNUNET_assert (myid == path->peers[0]);
   GNUNET_assert (peer->id == path->peers[path->length - 1]);
 
-  LOG(GNUNET_ERROR_TYPE_INFO, "*** Removing path l(%u) from %s\n",
-      path->length, GCP_2s (peer));
+  LOG (GNUNET_ERROR_TYPE_INFO, "Removing path %p (%u) from %s\n",
+       path, path->length, GCP_2s (peer));
 
   for (iter = peer->path_head; NULL != iter; iter = next)
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]