mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
now assume all routers support rendezvous cells
svn:r1699
This commit is contained in:
parent
db814b1276
commit
28f034e10a
@ -348,16 +348,12 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
|
||||
|
||||
static routerinfo_t *choose_good_exit_server(uint8_t purpose, routerlist_t *dir)
|
||||
{
|
||||
smartlist_t *obsolete_routers;
|
||||
routerinfo_t *r;
|
||||
switch(purpose) {
|
||||
case CIRCUIT_PURPOSE_C_GENERAL:
|
||||
return choose_good_exit_server_general(dir);
|
||||
case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
|
||||
obsolete_routers = smartlist_create();
|
||||
router_add_nonrendezvous_to_list(obsolete_routers);
|
||||
r = router_choose_random_node(dir, options.RendNodes, options.RendExcludeNodes, obsolete_routers);
|
||||
smartlist_free(obsolete_routers);
|
||||
r = router_choose_random_node(dir, options.RendNodes, options.RendExcludeNodes, NULL);
|
||||
return r;
|
||||
default:
|
||||
log_fn(LOG_WARN,"unhandled purpose %d", purpose);
|
||||
|
@ -999,8 +999,6 @@ routerinfo_t *router_get_by_nickname(char *nickname);
|
||||
void router_get_routerlist(routerlist_t **prouterlist);
|
||||
void routerinfo_free(routerinfo_t *router);
|
||||
routerinfo_t *routerinfo_copy(const routerinfo_t *router);
|
||||
int router_version_supports_rendezvous(routerinfo_t *router);
|
||||
void router_add_nonrendezvous_to_list(smartlist_t *sl);
|
||||
void router_mark_as_down(char *nickname);
|
||||
int router_set_routerlist_from_file(char *routerfile);
|
||||
int router_set_routerlist_from_string(const char *s);
|
||||
|
@ -752,13 +752,10 @@ void rend_services_introduce(void) {
|
||||
char *intro;
|
||||
int changed, prev_intro_nodes;
|
||||
smartlist_t *intro_routers, *exclude_routers;
|
||||
int n_old_routers;
|
||||
|
||||
router_get_routerlist(&rl);
|
||||
intro_routers = smartlist_create();
|
||||
exclude_routers = smartlist_create();
|
||||
router_add_nonrendezvous_to_list(exclude_routers);
|
||||
n_old_routers = smartlist_len(exclude_routers);
|
||||
|
||||
for (i=0; i< smartlist_len(rend_service_list); ++i) {
|
||||
smartlist_clear(intro_routers);
|
||||
@ -809,9 +806,8 @@ void rend_services_introduce(void) {
|
||||
service->service_id);
|
||||
}
|
||||
|
||||
/* Reset exclude_routers to include obsolete routers only for the next
|
||||
* time around the loop. */
|
||||
smartlist_truncate(exclude_routers, n_old_routers);
|
||||
/* Reset exclude_routers, for the next time around the loop. */
|
||||
smartlist_clear(exclude_routers);
|
||||
|
||||
/* If there's no need to launch new circuits, stop here. */
|
||||
if (!changed)
|
||||
|
@ -236,24 +236,6 @@ void router_add_running_routers_to_smartlist(smartlist_t *sl) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Return 0 if router is running a version of Tor too old to be a
|
||||
* rendezvous/introduction point. Return 1 otherwise.
|
||||
*/
|
||||
int router_version_supports_rendezvous(routerinfo_t *router)
|
||||
{
|
||||
return (router->platform && 0!=strncasecmp(router->platform,"Tor 0.0.5",9));
|
||||
}
|
||||
|
||||
/* Add every router running a version of Tor too old for rend/intro
|
||||
points to sl.
|
||||
*/
|
||||
void router_add_nonrendezvous_to_list(smartlist_t *sl)
|
||||
{
|
||||
SMARTLIST_FOREACH(routerlist->routers, routerinfo_t *, r,
|
||||
if (!router_version_supports_rendezvous(r))
|
||||
smartlist_add(sl,r));
|
||||
}
|
||||
|
||||
/* Pick a random node from preferred if possible, else from all of dir.
|
||||
* Never pick a node in excluded.
|
||||
* If excludedsmartlist is defined, never pick a node in it either.
|
||||
|
Loading…
Reference in New Issue
Block a user