[or-cvs] do not try to download a routerdesc if we would immediately...

Nick Mathewson nickm at seul.org
Fri Oct 7 22:00:11 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv21605/src/or

Modified Files:
	routerlist.c 
Log Message:
do not try to download a routerdesc if we would immediately reject it as obsolete.

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- routerlist.c	6 Oct 2005 22:18:01 -0000	1.333
+++ routerlist.c	7 Oct 2005 22:00:09 -0000	1.334
@@ -2544,7 +2544,8 @@
   time_t now = time(NULL);
   int mirror = server_mode(get_options()) && get_options()->DirPort;
   /* these are just used for logging */
-  int n_not_ready = 0, n_in_progress = 0, n_uptodate = 0, n_skip_old = 0;
+  int n_not_ready = 0, n_in_progress = 0, n_uptodate = 0, n_skip_old = 0,
+    n_obsolete = 0;
 
   if (!routerstatus_list)
     return superseded;
@@ -2555,7 +2556,10 @@
 
   SMARTLIST_FOREACH(routerstatus_list, local_routerstatus_t *, rs,
   {
-    if (rs->next_attempt_at < now) {
+    if (rs->status.published_on + ROUTER_MAX_AGE < now) {
+      rs->should_download = 0;
+      ++n_obsolete;
+    } if (rs->next_attempt_at < now) {
       rs->should_download = 1;
       ++n_downloadable;
     } else {
@@ -2654,8 +2658,10 @@
   log_fn(LOG_INFO, "%d router descriptors are downloadable; "
          "%d are up to date; %d are in progress; "
          "%d are not ready to retry; "
+         "%d are not published recently enough to be worthwhile; "
          "%d are running pre-0.1.1.6 Tors and aren't stale enough to replace.",
-         n_downloadable, n_uptodate, n_in_progress, n_not_ready, n_skip_old);
+         n_downloadable, n_uptodate, n_in_progress, n_not_ready,
+         n_obsolete, n_skip_old);
 
   if (!n_downloadable)
     return superseded;



More information about the tor-commits mailing list