[or-cvs] Change a dumb interface. Also, increment trusted_dir_serve...
Nick Mathewson
nickm at seul.org
Mon Apr 10 01:35:58 UTC 2006
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv10147/src/or
Modified Files:
directory.c dirserv.c or.h routerlist.c
Log Message:
Change a dumb interface. Also, increment trusted_dir_server_t.n_networkstatus_failures when an all.z download fails entirely or partially.
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.369
retrieving revision 1.370
diff -u -p -d -r1.369 -r1.370
--- directory.c 9 Apr 2006 10:43:03 -0000 1.369
+++ directory.c 10 Apr 2006 01:35:56 -0000 1.370
@@ -89,7 +89,7 @@ directory_post_to_dirservers(uint8_t pur
int post_via_tor;
int post_to_v1_only;
- router_get_trusted_dir_servers(&dirservers);
+ dirservers = router_get_trusted_dir_servers();
tor_assert(dirservers);
/* Only old dirservers handle rendezvous descriptor publishing. */
post_to_v1_only = (purpose == DIR_PURPOSE_UPLOAD_RENDDESC);
@@ -296,6 +296,9 @@ connection_dir_download_networkstatus_fa
}
if (!strcmpstart(conn->requested_resource, "all")) {
/* We're a non-authoritative directory cache; try again. */
+ smartlist_t *trusted_dirs = router_get_trusted_dir_servers();
+ SMARTLIST_FOREACH(trusted_dirs, trusted_dir_server_t *, ds,
+ ++ds->n_networkstatus_failures);
directory_get_from_dirserver(conn->purpose, "all.z",
0 /* don't retry_if_no_servers */);
} else if (!strcmpstart(conn->requested_resource, "fp/")) {
@@ -993,6 +996,16 @@ connection_dir_client_reached_eof(connec
which = smartlist_create();
dir_split_resource_into_fingerprints(conn->requested_resource+3,
which, NULL, 0);
+ } else if (conn->requested_resource &&
+ !strcmpstart(conn->requested_resource, "all")) {
+ which = smartlist_create();
+ SMARTLIST_FOREACH(router_get_trusted_dir_servers(),
+ trusted_dir_server_t *, ds,
+ {
+ char *cp = tor_malloc(HEX_DIGEST_LEN+1);
+ base16_encode(cp, HEX_DIGEST_LEN+1, ds->digest, DIGEST_LEN);
+ smartlist_add(which, cp);
+ });
}
cp = body;
while (*cp) {
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -p -d -r1.327 -r1.328
--- dirserv.c 9 Apr 2006 01:00:24 -0000 1.327
+++ dirserv.c 10 Apr 2006 01:35:56 -0000 1.328
@@ -969,7 +969,7 @@ dirserv_set_cached_networkstatus_v2(cons
digestmap_remove(cached_v2_networkstatus, identity);
}
- router_get_trusted_dir_servers(&trusted_dirs);
+ trusted_dirs = router_get_trusted_dir_servers();
if (digestmap_size(cached_v2_networkstatus) >
smartlist_len(trusted_dirs) + MAX_UNTRUSTED_NETWORKSTATUSES) {
/* We need to remove the oldest untrusted networkstatus. */
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.823
retrieving revision 1.824
diff -u -p -d -r1.823 -r1.824
--- or.h 8 Apr 2006 21:48:14 -0000 1.823
+++ or.h 10 Apr 2006 01:35:56 -0000 1.824
@@ -2290,7 +2290,7 @@ typedef struct trusted_dir_server_t {
int router_reload_router_list(void);
int router_reload_networkstatus(void);
-void router_get_trusted_dir_servers(smartlist_t **outp);
+smartlist_t *router_get_trusted_dir_servers(void);
routerstatus_t *router_pick_directory_server(int requireother,
int fascistfirewall,
int for_v2_directory,
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.493
retrieving revision 1.494
diff -u -p -d -r1.493 -r1.494
--- routerlist.c 9 Apr 2006 20:19:56 -0000 1.493
+++ routerlist.c 10 Apr 2006 01:35:56 -0000 1.494
@@ -306,17 +306,17 @@ router_reload_router_list(void)
return 0;
}
-/** Set *<b>outp</b> to a smartlist containing a list of
- * trusted_dir_server_t * for all known trusted dirservers. Callers
- * must not modify the list or its contents.
+/** Return a smartlist containing a list of trusted_dir_server_t * for all
+ * known trusted dirservers. Callers must not modify the list or its
+ * contents.
*/
-void
-router_get_trusted_dir_servers(smartlist_t **outp)
+smartlist_t *
+router_get_trusted_dir_servers(void)
{
if (!trusted_dir_servers)
trusted_dir_servers = smartlist_create();
- *outp = trusted_dir_servers;
+ return trusted_dir_servers;
}
/** Try to find a running dirserver. If there are no running dirservers
More information about the tor-commits
mailing list