[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12950: bugfix on r10612: When we load a bridge descriptor from the (in tor/trunk: . src/or)



Author: arma
Date: 2007-12-24 05:31:39 -0500 (Mon, 24 Dec 2007)
New Revision: 12950

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/circuitbuild.c
   tor/trunk/src/or/or.h
   tor/trunk/src/or/routerlist.c
Log:
bugfix on r10612:
When we load a bridge descriptor from the cache,
and it was previously unreachable, mark it as retriable so we won't
just ignore it. Also, try fetching a new copy immediately.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-12-24 06:53:58 UTC (rev 12949)
+++ tor/trunk/ChangeLog	2007-12-24 10:31:39 UTC (rev 12950)
@@ -1,6 +1,10 @@
 Changes in version 0.2.0.15-alpha - 2008-01-??
   o Minor bugfixes:
     - Fix configure.in logic for cross-compilation.
+    - When we load a bridge descriptor from the cache, and it was
+      previously unreachable, mark it as retriable so we won't just
+      ignore it. Also, try fetching a new copy immediately. Bugfixes
+      on 0.2.0.13-alpha.
 
   o Minor features:
     - Support compilation to target iPhone; patch from cjacker huang.

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2007-12-24 06:53:58 UTC (rev 12949)
+++ tor/trunk/src/or/circuitbuild.c	2007-12-24 10:31:39 UTC (rev 12950)
@@ -2054,8 +2054,10 @@
     router = chosen;
     entry = is_an_entry_guard(router->cache_info.identity_digest);
     if (entry) {
-      if (reset_status)
+      if (reset_status) {
         entry->bad_since = 0;
+        entry->can_retry = 1;
+      }
       return NULL;
     }
   } else {
@@ -3030,7 +3032,7 @@
 /** We just learned a descriptor for a bridge. See if that
  * digest is in our entry guard list, and add it if not. */
 void
-learned_bridge_descriptor(routerinfo_t *ri)
+learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
 {
   tor_assert(ri);
   tor_assert(ri->purpose == ROUTER_PURPOSE_BRIDGE);
@@ -3042,10 +3044,12 @@
 
     if (bridge) { /* if we actually want to use this one */
       /* it's here; schedule its re-fetch for a long time from now. */
-      bridge_fetch_status_arrived(bridge, now);
+      if (!from_cache)
+        bridge_fetch_status_arrived(bridge, now);
 
       add_an_entry_guard(ri, 1);
-      log_notice(LD_DIR, "new bridge descriptor '%s'", ri->nickname);
+      log_notice(LD_DIR, "new bridge descriptor '%s' (%s)", ri->nickname,
+                 from_cache ? "cached" : "fresh");
       if (first)
         routerlist_retry_directory_downloads(now);
     }

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-12-24 06:53:58 UTC (rev 12949)
+++ tor/trunk/src/or/or.h	2007-12-24 10:31:39 UTC (rev 12950)
@@ -2521,7 +2521,7 @@
 void bridge_add_from_config(uint32_t addr, uint16_t port, char *digest);
 void retry_bridge_descriptor_fetch_directly(char *digest);
 void fetch_bridge_descriptors(time_t now);
-void learned_bridge_descriptor(routerinfo_t *ri);
+void learned_bridge_descriptor(routerinfo_t *ri, int from_cache);
 int any_bridge_descriptors_known(void);
 int bridges_known_but_down(void);
 void bridges_retry_all(void);

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-12-24 06:53:58 UTC (rev 12949)
+++ tor/trunk/src/or/routerlist.c	2007-12-24 10:31:39 UTC (rev 12950)
@@ -3053,13 +3053,13 @@
 /** We just added a new set of descriptors. Take whatever extra steps
  * we need. */
 static void
-routerlist_descriptors_added(smartlist_t *sl)
+routerlist_descriptors_added(smartlist_t *sl, int from_cache)
 {
   tor_assert(sl);
   control_event_descriptors_changed(sl);
   SMARTLIST_FOREACH(sl, routerinfo_t *, ri,
     if (ri->purpose == ROUTER_PURPOSE_BRIDGE)
-      learned_bridge_descriptor(ri);
+      learned_bridge_descriptor(ri, from_cache);
   );
 }
 
@@ -3118,7 +3118,7 @@
     smartlist_free(lst);
     return 0;
   } else {
-    routerlist_descriptors_added(lst);
+    routerlist_descriptors_added(lst, 0);
     smartlist_free(lst);
     log_debug(LD_DIR, "Added router to list");
     return 1;
@@ -3182,7 +3182,7 @@
 
     if (router_add_to_routerlist(ri, &msg, from_cache, !from_cache) >= 0) {
       smartlist_add(changed, ri);
-      routerlist_descriptors_added(changed);
+      routerlist_descriptors_added(changed, from_cache);
       smartlist_clear(changed);
     }
   });