summaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-12 06:56:42 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-12 06:56:42 +0000
commit3dc5e77b5867815244e9f37beba56dc995a2fe2b (patch)
tree412299f73e6a108fcd8cfe1f4a5df35e4dd6e7ce /src/or/routerparse.c
parente4272f197839c2a9cc81e29ed28a0b3ce2ce253b (diff)
downloadtor-3dc5e77b5867815244e9f37beba56dc995a2fe2b.tar.gz
tor-3dc5e77b5867815244e9f37beba56dc995a2fe2b.zip
Numerous changes to move towards client-side v2 directories.
connection.c: - Add some more connection accessor functions to make directory download redundancy checking work. directory.c, or.h, router.c, routerlist.c: - Start on logic to note when networkstatus downloads fail. dirserv.c, routerlist.c, routerparse.c: - Start maintaining an is_named field in routerstatus_t. Don't actually look at it yet. dirserv.c, routerlist.c: - Remove expired networkstatus objects. or.h: - Make some booleans into bitfields - Add prototypes routerlist.c: - Sort networkstatus list by publication time - Function to remove old (older than 10 days) networkstatus objects. - Function to set a list of routerinfo_ts' status info from the current set of networkstatus objects. - Function to tell which routerinfos we need to download based no the current set of networkstatus objects. - Do not launch a networkstatus download if a redundant one is in progress. routerparse.c: - Keep router entries in networkstatus sorted by digest. svn:r5012
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 5befbd96dc..e7c9ca3535 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -849,7 +849,7 @@ router_parse_list_from_string(const char **s, routerlist_t **dest,
if (!good_nickname_list) {
router->is_running = 1; /* start out assuming all dirservers are up */
- router->is_verified = 1;
+ router->is_verified = router->is_named = 1;
router->status_set_at = time(NULL);
}
smartlist_add(routers, router);
@@ -1245,6 +1245,14 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
return rs;
}
+/** Helper to sort a smartlist of pointers to routerstatus_t */
+static int
+_compare_routerstatus_entries(const void **_a, const void **_b)
+{
+ const routerstatus_t *a = *_a, *b = *_b;
+ return memcmp(a->identity_digest, b->identity_digest, DIGEST_LEN);
+}
+
/** Given a versioned (v2 or later) network-status object in <b>s</b>, try to
* parse it and return the result. Return NULL on failure. Check the
* signature of the network status, but do not (yet) check the signing key for
@@ -1387,6 +1395,7 @@ networkstatus_parse_from_string(const char *s)
if ((rs = routerstatus_parse_entry_from_string(&s, tokens)))
smartlist_add(ns->entries, rs);
}
+ smartlist_sort(ns->entries, _compare_routerstatus_entries);
if (tokenize_string(s, NULL, tokens, NETSTATUS)) {
log_fn(LOG_WARN, "Error tokenizing network-status footer.");