diff options
author | Roger Dingledine <arma@torproject.org> | 2004-11-06 05:18:11 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-11-06 05:18:11 +0000 |
commit | 6c61ed4fb5d33a8c51ff342165a26ac70765dd26 (patch) | |
tree | 6a767b637d976bf392a275e99386798bbf094e74 /src/or/routerlist.c | |
parent | f490e5cdb6a60779ddadfba3dd022ba904c00b43 (diff) | |
download | tor-6c61ed4fb5d33a8c51ff342165a26ac70765dd26.tar.gz tor-6c61ed4fb5d33a8c51ff342165a26ac70765dd26.zip |
Make options no longer a global variable.
Now we can try setting an option but back out if it fails to parse, or
if it's disallowed (e.g. changing RunAsDaemon from 1 to 0).
Use parse_line_from_str rather than parse_line_from_file.
svn:r2692
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 2ed8d1b6a8..ffdeb65f65 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -14,10 +14,6 @@ /****************************************************************************/ -extern or_options_t options; /**< command-line and config-file options */ - -/* ********************************************************************** */ - static smartlist_t *trusted_dir_servers = NULL; /* static function prototypes */ @@ -50,9 +46,9 @@ int router_reload_router_list(void) char filename[512]; int is_recent; struct stat st; - if (get_data_directory(&options)) { + if (get_data_directory()) { char *s; - tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options)); + tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory()); if (stat(filename, &st)) { log_fn(LOG_WARN, "Unable to check status for '%s': %s", filename, strerror(errno)); @@ -114,7 +110,7 @@ routerinfo_t *router_pick_directory_server(int requireothers, return choice; log_fn(LOG_INFO,"Still no %s router entries. Reloading and trying again.", - options.FascistFirewall ? "reachable" : "known"); + get_options()->FascistFirewall ? "reachable" : "known"); has_fetched_directory=0; /* reset it */ if(router_reload_router_list()) { return NULL; @@ -141,7 +137,7 @@ trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, return choice; log_fn(LOG_WARN,"Still no dirservers %s. Reloading and trying again.", - options.FascistFirewall ? "reachable" : "known"); + get_options()->FascistFirewall ? "reachable" : "known"); has_fetched_directory=0; /* reset it */ if(router_reload_router_list()) { return NULL; @@ -165,7 +161,7 @@ router_pick_directory_server_impl(int requireothers, int fascistfirewall) if(!routerlist) return NULL; - if(options.HttpProxy) + if(get_options()->HttpProxy) fascistfirewall = 0; /* Find all the running dirservers we know about. */ @@ -178,7 +174,7 @@ router_pick_directory_server_impl(int requireothers, int fascistfirewall) continue; if(fascistfirewall) { tor_snprintf(buf,sizeof(buf),"%d",router->dir_port); - if (!smartlist_string_isin(options.FirewallPorts, buf)) + if (!smartlist_string_isin(get_options()->FirewallPorts, buf)) continue; } smartlist_add(sl, router); @@ -202,7 +198,7 @@ router_pick_trusteddirserver_impl(int requireother, int fascistfirewall) if (!trusted_dir_servers) return NULL; - if(options.HttpProxy) + if(get_options()->HttpProxy) fascistfirewall = 0; SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, d, @@ -213,7 +209,7 @@ router_pick_trusteddirserver_impl(int requireother, int fascistfirewall) continue; if (fascistfirewall) { tor_snprintf(buf,sizeof(buf),"%d",d->dir_port); - if (!smartlist_string_isin(options.FirewallPorts, buf)) + if (!smartlist_string_isin(get_options()->FirewallPorts, buf)) continue; } smartlist_add(sl, d); @@ -276,7 +272,7 @@ void routerlist_add_family(smartlist_t *sl, routerinfo_t *router) { }); - for (cl = options.NodeFamilies; cl; cl = cl->next) { + for (cl = get_options()->NodeFamilies; cl; cl = cl->next) { if (router_nickname_is_in_list(router, cl->value)) { add_nickname_list_to_smartlist(sl, cl->value, 0); } @@ -867,7 +863,7 @@ int router_load_routerlist_from_directory(const char *s, log_fn(LOG_WARN, "Error resolving routerlist"); return -1; } - if (options.AuthoritativeDir) { + if (get_options()->AuthoritativeDir) { /* Learn about the descriptors in the directory. */ dirserv_load_from_directory_string(s); } |