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

[or-cvs] when building v2 statuses or v1 running-routers, don"t admi...



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	dirserv.c 
Log Message:
when building v2 statuses or v1 running-routers, don't admit the
existence of descriptors older than a day.

we still cache them in case anybody asks, but we don't actively
mention them.


Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -p -d -r1.294 -r1.295
--- dirserv.c	24 Jan 2006 04:01:13 -0000	1.294
+++ dirserv.c	5 Feb 2006 02:33:40 -0000	1.295
@@ -737,6 +737,7 @@ list_server_status(smartlist_t *routers,
    * equals-suffixed nickname, then a dollar-prefixed hexdigest. */
   smartlist_t *rs_entries;
   time_t now = time(NULL);
+  time_t cutoff = now - ROUTER_MAX_AGE;
   int authdir_mode = get_options()->AuthoritativeDir;
   tor_assert(router_status_out);
 
@@ -748,7 +749,8 @@ list_server_status(smartlist_t *routers,
       /* Update router status in routerinfo_t. */
       ri->is_running = dirserv_thinks_router_is_reachable(ri, now);
     }
-    smartlist_add(rs_entries, list_single_server_status(ri, ri->is_running));
+    if (ri->cache_info.published_on >= cutoff)
+      smartlist_add(rs_entries, list_single_server_status(ri, ri->is_running));
   });
 
   *router_status_out = smartlist_join_strings(rs_entries, " ", 0, NULL);
@@ -883,8 +885,7 @@ dirserv_dump_directory_to_string(char **
   *cp = '\0';
 
   /* These multiple strlcat calls are inefficient, but dwarfed by the RSA
-     signature.
-  */
+     signature. */
   if (strlcat(buf, "directory-signature ", buf_len) >= buf_len)
     goto truncated;
   if (strlcat(buf, get_options()->Nickname, buf_len) >= buf_len)
@@ -1345,6 +1346,7 @@ generate_v2_networkstatus(void)
   crypto_pk_env_t *private_key = get_identity_key();
   routerlist_t *rl = router_get_routerlist();
   time_t now = time(NULL);
+  time_t cutoff = now - ROUTER_MAX_AGE;
   int naming = options->NamingAuthoritativeDir;
   int versioning = options->VersioningAuthoritativeDir;
   const char *contact;
@@ -1412,6 +1414,7 @@ generate_v2_networkstatus(void)
   dirserv_compute_stable_uptime(rl);
 
   SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
+    if (ri->cache_info.published_on >= cutoff) {
       int f_exit = router_is_general_exit(ri);
       int f_stable = ri->is_stable =
                      !dirserv_thinks_router_is_unreliable(ri, 1, 0);
@@ -1461,7 +1464,8 @@ generate_v2_networkstatus(void)
         goto done;
       }
       outp += strlen(outp);
-    });
+    }
+  });
 
   if (tor_snprintf(outp, endp-outp, "directory-signature %s\n",
                    get_options()->Nickname)<0) {