diff --git a/src/or/directory.c b/src/or/directory.c index 4212f9b823..031828be8d 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -905,15 +905,6 @@ connection_dir_client_reached_eof(connection_t *conn) if (router_parse_directory(body) < 0) { log_fn(LOG_NOTICE,"I failed to parse the directory I fetched from '%s:%d'. Ignoring.", conn->address, conn->port); } -#if 0 - if (router_load_routerlist_from_directory(body, NULL, !skewed, 0) < 0) { - log_fn(LOG_NOTICE,"I failed to parse the directory I fetched from '%s:%d'. Ignoring.", conn->address, conn->port); - tor_free(body); tor_free(headers); tor_free(reason); - return -1; - } - /* do things we've been waiting to do */ - directory_has_arrived(time(NULL), conn->identity_digest); -#endif } if (conn->purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) { @@ -931,21 +922,6 @@ connection_dir_client_reached_eof(connection_t *conn) tor_free(body); tor_free(headers); tor_free(reason); return -1; } -#if 0 - if (!(rrs = router_parse_runningrouters(body, 1))) { - log_fn(LOG_WARN, "Can't parse runningrouters list (server '%s:%d')", - conn->address, conn->port); - tor_free(body); tor_free(headers); tor_free(reason); - return -1; - } - router_get_routerlist(&rl); - if (rl) { - routerlist_set_runningrouters(rl,rrs); - helper_nodes_set_status_from_directory(); - } else { - running_routers_free(rrs); - } -#endif } if (conn->purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) { diff --git a/src/or/or.h b/src/or/or.h index 209653ac1d..168b8173b4 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -783,15 +783,6 @@ typedef struct { int num_unreachable_notifications; } routerinfo_t; -#if 0 -/** Contents of a running-routers list */ -typedef struct running_routers_t { - time_t published_on; /**< When was the list marked as published? */ - /** Which ORs are on the list? Entries may be prefixed with ! and $. */ - smartlist_t *running_routers; -} running_routers_t; -#endif - /** Contents of a single per-router entry in a network status object. */ typedef struct routerstatus_t { @@ -848,13 +839,6 @@ typedef struct { /* XXXX011 NM This field is only used in moribund code; remove it * once the moribund code is dead. */ time_t published_on_xx; -#if 0 - /** Which versions of tor are recommended by this directory? */ - char *software_versions; - time_t running_routers_updated_on; - /** What is the most recently received running_routers structure? */ - running_routers_t *running_routers; -#endif } routerlist_t; /** Information on router used when extending a circuit. (We don't need a @@ -2088,9 +2072,6 @@ routerinfo_t *router_get_by_hexdigest(const char *hexdigest); routerinfo_t *router_get_by_digest(const char *digest); int router_digest_is_trusted_dir(const char *digest); void router_get_routerlist(routerlist_t **prouterlist); -#if 0 -time_t routerlist_get_published_time(void); -#endif void routerlist_free(routerlist_t *routerlist); void routerinfo_free(routerinfo_t *router); void routerstatus_free(routerstatus_t *routerstatus); @@ -2105,10 +2086,6 @@ int router_add_to_routerlist(routerinfo_t *router, const char **msg, int router_load_single_router(const char *s, const char **msg); void router_load_routers_from_string(const char *s, int from_cache, smartlist_t *requested_fingerprints); -#if 0 -int router_load_routerlist_from_directory(const char *s,crypto_pk_env_t *pkey, - int dir_is_recent, int dir_is_cached); -#endif typedef enum { NS_FROM_CACHE, NS_FROM_DIR, NS_GENERATED} networkstatus_source_t; int router_set_networkstatus(const char *s, time_t arrived_at, networkstatus_source_t source, @@ -2120,16 +2097,6 @@ int router_exit_policy_all_routers_reject(uint32_t addr, uint16_t port, int need_uptime); int router_exit_policy_rejects_all(routerinfo_t *router); -#if 0 -void running_routers_free(running_routers_t *rr); -void routerlist_set_runningrouters(routerlist_t *list, running_routers_t *rr); -int routers_update_status_from_entry(smartlist_t *routers, - time_t list_time, - const char *s); -int router_update_status_from_smartlist(routerinfo_t *r, - time_t list_time, - smartlist_t *running_list); -#endif void add_trusted_dir_server(const char *addr, uint16_t port, const char *digest, int supports_v1); void clear_trusted_dir_servers(void); @@ -2183,9 +2150,6 @@ routerinfo_t *router_parse_entry_from_string(const char *s, const char *end); int router_add_exit_policy_from_string(routerinfo_t *router, const char *s); addr_policy_t *router_parse_addr_policy_from_string(const char *s, int assume_action); -#if 0 -int check_software_version_against_directory(const char *directory); -#endif int tor_version_parse(const char *s, tor_version_t *out); int tor_version_as_new_as(const char *platform, const char *cutoff); int tor_version_compare(tor_version_t *a, tor_version_t *b); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 1cfec6ff54..9b60066943 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -923,16 +923,6 @@ router_get_routerlist(routerlist_t **prouterlist) *prouterlist = routerlist; } -#if 0 -/** Return the publication time on the current routerlist, or 0 if we have no - * routerlist. */ -time_t -routerlist_get_published_time(void) -{ - return routerlist ? routerlist->published_on : 0; -} -#endif - /** Free all storage held by router. */ void routerinfo_free(routerinfo_t *router) @@ -1262,14 +1252,6 @@ router_load_single_router(const char *s, const char **msg) routerinfo_free(ri); return 0; } -#if 0 - if (routerlist && routerlist->running_routers) { - running_routers_t *rr = routerlist->running_routers; - router_update_status_from_smartlist(ri, - rr->published_on, - rr->running_routers); - } -#endif /* XXXX011 update router status from networkstatus!! */ if (router_add_to_routerlist(ri, msg, 0)<0) { @@ -1337,55 +1319,6 @@ router_load_routers_from_string(const char *s, int from_cache, smartlist_free(changed); } -#if 0 -/** Add to the current routerlist each router stored in the - * signed directory s. If pkey is provided, check the signature - * against pkey; else check against the pkey of the signing directory - * server. - * - * If dir_is_recent is non-zero, then examine the - * Recommended-versions line and take appropriate action. - * - * If dir_is_cached is non-zero, then we're reading it - * from the cache so don't bother to re-write it to the cache. - */ -int -router_load_routerlist_from_directory(const char *s, - crypto_pk_env_t *pkey, - int dir_is_recent, - int dir_is_cached) -{ - routerlist_t *new_list = NULL; - if (router_parse_routerlist_from_directory(s, &new_list, pkey, - dir_is_recent, - !dir_is_cached)) { - log_fn(LOG_WARN, "Couldn't parse directory."); - return -1; - } - if (routerlist) { - /* Merge the new_list into routerlist, then free new_list. Also - * keep a list of changed descriptors to inform controllers. */ - smartlist_t *changed = smartlist_create(); - SMARTLIST_FOREACH(new_list->routers, routerinfo_t *, r, - { - const char *msg; - if (router_add_to_routerlist(r,&msg,0)>=0) - smartlist_add(changed, r); - }); - smartlist_clear(new_list->routers); - routerlist->published_on_xx = new_list->published_on_xx; - routerlist_free(new_list); - control_event_descriptors_changed(changed); - smartlist_free(changed); - } else { - routerlist = new_list; - control_event_descriptors_changed(routerlist->routers); - } - router_normalize_routerlist(routerlist); - return 0; -} -#endif - /** Helper: return a newly allocated string containing the name of the filename * where we plan to cache ns. */ static char * @@ -1964,196 +1897,6 @@ router_exit_policy_rejects_all(routerinfo_t *router) == ADDR_POLICY_REJECTED; } -#if 0 -/** Release all space held in rr. */ -void -running_routers_free(running_routers_t *rr) -{ - if (!rr) - return; - if (rr->running_routers) { - SMARTLIST_FOREACH(rr->running_routers, char *, s, tor_free(s)); - smartlist_free(rr->running_routers); - } - tor_free(rr); -} - -/** Update the running/not-running status of every router in list, based - * on the contents of rr. */ -static void -routerlist_update_from_runningrouters(routerlist_t *list, - running_routers_t *rr) -{ - routerinfo_t *me = router_get_my_routerinfo(); - smartlist_t *all_routers; - if (!list) - return; - if (list->published_on >= rr->published_on) - return; - if (list->running_routers_updated_on >= rr->published_on) - return; - - all_routers = smartlist_create(); - if (me) /* learn if the dirservers think I'm verified */ - smartlist_add(all_routers, me); - - smartlist_add_all(all_routers,list->routers); - SMARTLIST_FOREACH(rr->running_routers, const char *, cp, - routers_update_status_from_entry(all_routers, rr->published_on, - cp)); - smartlist_free(all_routers); - list->running_routers_updated_on = rr->published_on; -} - -/** We've just got a running routers list in rr; update the - * status of the routers in list, and cache rr */ -void -routerlist_set_runningrouters(routerlist_t *list, running_routers_t *rr) -{ - routerlist_update_from_runningrouters(list,rr); - if (list->running_routers != rr) { - running_routers_free(list->running_routers); - list->running_routers = rr; - } -} - -/** Update the is_running and is_verified fields of the router router, - * based in its status in the list of strings stored in running_list. - * All entries in running_list follow one of these formats: - *