aboutsummaryrefslogtreecommitdiff
path: root/src/or/onion.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-02 22:23:15 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-02 22:23:15 +0000
commitf34e6da3e75ad5b681c68e6c0a50d65d4566f9cf (patch)
tree7605e90bef7b67ea957030cc7404161bd723b738 /src/or/onion.c
parent4cb21bab4811090ca7f39bd422eed5184c58e5bf (diff)
downloadtor-f34e6da3e75ad5b681c68e6c0a50d65d4566f9cf.tar.gz
tor-f34e6da3e75ad5b681c68e6c0a50d65d4566f9cf.zip
now circuit_get_newest returns an appropriate circ for your purpose
connection_ap_handshake_attach_circuit attaches to a circ of the right purpose add a skeletal rendclient.c svn:r1441
Diffstat (limited to 'src/or/onion.c')
-rw-r--r--src/or/onion.c56
1 files changed, 2 insertions, 54 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index 2b68cc17c4..36f76415a6 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -8,6 +8,7 @@
* they're here to prevent precedence issues with the .h files
*/
void router_add_running_routers_to_smartlist(smartlist_t *sl);
+void add_nickname_list_to_smartlist(smartlist_t *sl, char *list);
extern or_options_t options; /* command-line and config-file options */
@@ -166,32 +167,6 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key
extern int has_fetched_directory;
-static void add_nickname_list_to_smartlist(smartlist_t *sl, char *list) {
- char *start,*end;
- char nick[MAX_NICKNAME_LEN];
- routerinfo_t *router;
-
- while(isspace((int)*list) || *list==',') list++;
-
- start = list;
- while(*start) {
- end=start; while(*end && !isspace((int)*end) && *end != ',') end++;
- memcpy(nick,start,end-start);
- nick[end-start] = 0; /* null terminate it */
- router = router_get_by_nickname(nick);
- if (router) {
- if (router->is_running)
- smartlist_add(sl,router);
- else
- log_fn(LOG_INFO,"Nickname list includes '%s' which is known but down.",nick);
- } else
- log_fn(has_fetched_directory ? LOG_WARN : LOG_INFO,
- "Nickname list includes '%s' which isn't a known router.",nick);
- while(isspace((int)*end) || *end==',') end++;
- start = end;
- }
-}
-
static int new_route_len(double cw, routerinfo_t **rarray, int rarray_len) {
int num_acceptable_routers;
int routelen;
@@ -227,33 +202,6 @@ static int new_route_len(double cw, routerinfo_t **rarray, int rarray_len) {
return routelen;
}
-static routerinfo_t *choose_good_exit_server_rend(routerlist_t *dir)
-{
- smartlist_t *sl, *excludednodes;
- routerinfo_t *choice;
-
- excludednodes = smartlist_create();
- add_nickname_list_to_smartlist(excludednodes,options.RendExcludeNodes);
-
- /* try the nodes in RendNodes first */
- sl = smartlist_create();
- add_nickname_list_to_smartlist(sl,options.RendNodes);
- smartlist_subtract(sl,excludednodes);
- choice = smartlist_choose(sl);
- smartlist_free(sl);
- if(!choice) {
- sl = smartlist_create();
- router_add_running_routers_to_smartlist(sl);
- smartlist_subtract(sl,excludednodes);
- choice = smartlist_choose(sl);
- smartlist_free(sl);
- }
- smartlist_free(excludednodes);
- if(!choice)
- log_fn(LOG_WARN,"No available nodes when trying to choose rendezvous point. Failing.");
- return choice;
-}
-
static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
{
int *n_supported;
@@ -386,7 +334,7 @@ static routerinfo_t *choose_good_exit_server(uint8_t purpose, routerlist_t *dir)
if(purpose == CIRCUIT_PURPOSE_C_GENERAL)
return choose_good_exit_server_general(dir);
else
- return choose_good_exit_server_rend(dir);
+ return router_choose_random_node(dir, options.RendNodes, options.RendExcludeNodes);
}
cpath_build_state_t *onion_new_cpath_build_state(uint8_t purpose,