diff --git a/src/or/or.h b/src/or/or.h index 287591f857..22b1ff9416 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2736,9 +2736,6 @@ connection_t *connection_get_by_type_purpose(int type, int purpose); connection_t *connection_get_by_type_addr_port_purpose(int type, uint32_t addr, uint16_t port, int purpose); connection_t *connection_get_by_type_state(int type, int state); -#if 0 -connection_t *connection_get_by_type_state_lastwritten(int type, int state); -#endif connection_t *connection_get_by_type_state_rendquery(int type, int state, const char *rendquery); @@ -3953,15 +3950,8 @@ void routerlist_assert_ok(routerlist_t *rl); const char *esc_router_info(routerinfo_t *router); void routers_sort_by_identity(smartlist_t *routers); -#if 0 -int hid_serv_have_enough_directories(void); -#endif int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs, const char *id); -#if 0 -routerstatus_t *hid_serv_next_directory(const char *id); -routerstatus_t *hid_serv_previous_directory(const char *id); -#endif int hid_serv_acting_as_directory(void); int hid_serv_responsible_for_desc_id(const char *id); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 46003601e5..6b889dce9d 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -4421,82 +4421,6 @@ routers_sort_by_identity(smartlist_t *routers) smartlist_sort(routers, _compare_routerinfo_by_id_digest); } -#if 0 -/** Return the first router that is acting as hidden service directory and that - * has a greater ID than id; if all routers have smaller IDs than - * id, return the router with the smallest ID; if the router list is - * NULL, or has no elements, return NULL. - */ -routerstatus_t * -hid_serv_next_directory(const char *id) -{ - networkstatus_vote_t *c = networkstatus_get_latest_consensus(); - int idx, i, f; - if (!c || !smartlist_len(c->routerstatus_list)) return NULL; - idx = networkstatus_vote_find_entry_idx(c, id, &f); - if (idx >= smartlist_len(c->routerstatus_list)) - idx = 0; - i = idx; - do { - routerstatus_t *rs = smartlist_get(c->routerstatus_list, i); - if (rs->is_hs_dir) - return rs; - if (++i == smartlist_len(c->routerstatus_list)) - i = 0; - } while (i != idx); - return NULL; -} - -/** Return the first router that is acting as hidden service directory and that - * has a smaller ID than id; if all routers have greater IDs than - * id, return the router with the highest ID; if the router list is - * NULL, or has no elements, return NULL. - */ -routerstatus_t * -hid_serv_previous_directory(const char *id) -{ - networkstatus_vote_t *c = networkstatus_get_latest_consensus(); - int idx, i, f; - if (!c || !smartlist_len(c->routerstatus_list)) return NULL; - idx = networkstatus_vote_find_entry_idx(c, id, &f); - --idx; - if (idx < 0) - idx = smartlist_len(c->routerstatus_list) - 1; - i = idx; - do { - routerstatus_t *rs = smartlist_get(c->routerstatus_list, i); - if (rs->is_hs_dir) - return rs; - if (--i < 0) - i = smartlist_len(c->routerstatus_list) - 1; - } while (i != idx); - return NULL; -} -#endif - -#if 0 -/** Return true, if we are aware of enough hidden service directory to - * usefully perform v2 rend operations on them (publish, fetch, replicate), - * or false otherwise. */ -int -hid_serv_have_enough_directories(void) -{ - int n_hsdirs = 0; - networkstatus_vote_t *c = networkstatus_get_latest_consensus(); - if (!c || !smartlist_len(c->routerstatus_list)) - return 0; - SMARTLIST_FOREACH(c->routerstatus_list, routerstatus_t *, r, - { - if (r->is_hs_dir) - /* XXXX020 In fact, REND_NUMBER_OF_CONSECUTIVE_REPLICAS hs dirs - * are enough. */ - if (++n_hsdirs >= REND_NUMBER_OF_CONSECUTIVE_REPLICAS) - return 1; - }); - return 0; -} -#endif - /** Determine the routers that are responsible for id (binary) and * add pointers to those routers' routerstatus_t to responsible_dirs. * If we don't have a consensus, return -1, else 0. */ @@ -4562,16 +4486,6 @@ hid_serv_acting_as_directory(void) "the consensus, so we won't be one."); return 0; } - -#if 0 - if (smartlist_len(hs_dirs) <= REND_NUMBER_OF_CONSECUTIVE_REPLICAS) { - /* too few HS Dirs -- that won't work */ - log_info(LD_REND, "We are not acting as hidden service directory, " - "because there are too few hidden service " - "directories in the routing table."); - return 0; - } -#endif return 1; }