diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-06-03 11:17:15 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-06-03 11:17:15 -0400 |
commit | 14c0251d95d9d86f4dba1d7d2da16661f1a87012 (patch) | |
tree | 9099b8723962966069d6f27957339d379f029e5e | |
parent | 13ec1bf5c2d5195789eaa0a002d021c9693a3b71 (diff) | |
download | tor-14c0251d95d9d86f4dba1d7d2da16661f1a87012.tar.gz tor-14c0251d95d9d86f4dba1d7d2da16661f1a87012.zip |
Use an autobool for UseBridges_
-rw-r--r-- | src/or/config.c | 11 | ||||
-rw-r--r-- | src/or/or.h | 11 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/or/config.c b/src/or/config.c index 124dcb97d9..d663336796 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -387,7 +387,7 @@ static config_var_t _option_vars[] = { V(TransPort, PORT, "0"), V(TunnelDirConns, BOOL, "1"), V(UpdateBridgesFromAuthority, BOOL, "0"), - VAR("UseBridges", STRING, UseBridges_, "auto"), + VAR("UseBridges", AUTOBOOL, UseBridges_, "auto"), V(UseEntryGuards, BOOL, "1"), V(UseMicrodescriptors, AUTOBOOL, "0"), V(User, STRING, NULL), @@ -3308,17 +3308,12 @@ options_validate(or_options_t *old_options, or_options_t *options, "of the Internet, so they must not set Reachable*Addresses " "or FascistFirewall."); - /* XXX023 use autobool instead. */ - if (!strcmp(options->UseBridges_, "auto")) { + if (options->UseBridges_ == -1) { options->UseBridges = (options->Bridges && !server_mode(options) && !options->EntryNodes); - } else if (!strcmp(options->UseBridges_, "0")) { - options->UseBridges = 0; - } else if (!strcmp(options->UseBridges_, "1")) { - options->UseBridges = 1; } else { - REJECT("UseBridges must be 0, 1, or auto"); + options->UseBridges = options->UseBridges_; } if (options->UseBridges && diff --git a/src/or/or.h b/src/or/or.h index 1b4cdb8a53..b4000add81 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2646,11 +2646,12 @@ typedef struct { * when doing so. */ char *BridgePassword; - /** Whether we should start all circuits with a bridge. "1" means strictly - * yes, "0" means strictly no, and "auto" means that we do iff any bridges - * are configured, we are not running a server and have not specified a list - * of entry nodes. */ - char *UseBridges_; + /** Whether we should start all circuits with a bridge. This is an + * "autobool": 1 means strictly yes, 0 means strictly no, and -1 means that + * we do iff any bridges are configured, we are not running a server and + * have not specified a list of entry nodes. Don't use this value directly; + * use <b>UseBridges</b> instead. */ + int UseBridges_; /** Effective value of UseBridges. Will be set equally for UseBridges set to * 1 or 0, but for 'auto' it will be set to 1 iff any bridges are * configured, we are not running a server and have not specified a list of |