diff options
author | George Kadianakis <desnacked@gmail.com> | 2011-09-11 20:57:01 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@gmail.com> | 2011-09-11 20:57:01 +0200 |
commit | 2703e41d8b6ffcad653af68a8261c22b5a1ed26f (patch) | |
tree | 237ba496085c26f6dfe44a1b4219016e861bdae1 /src | |
parent | 0dcf327248d9e971b2bad9fcd498c3b18f2f70c0 (diff) | |
download | tor-2703e41d8b6ffcad653af68a8261c22b5a1ed26f.tar.gz tor-2703e41d8b6ffcad653af68a8261c22b5a1ed26f.zip |
Improve how we access or_state_t.
* Use get_or_state()->VirtualOption instead of relying on
config_find_option(), STRUCT_VAR_P and voodoo.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/or/config.c b/src/or/config.c index 829d5ffdbd..bacdae32ea 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -5513,16 +5513,11 @@ static int validate_transports_in_state(or_state_t *state) { int broken = 0; + config_line_t *line; - config_var_t *var = config_find_option(&state_format,"TransportProxies"); - if (!var) - return 0; - - config_line_t **value = STRUCT_VAR_P(state, var->var_offset); - config_line_t *search = NULL; - - for (search = *value ; search ; search = search->next) { - if (!state_transport_line_is_valid(search->value)<0) + for (line = state->TransportProxies ; line ; line = line->next) { + tor_assert(!strcmp(line->key, "TransportProxy")); + if (!state_transport_line_is_valid(line->value)<0) broken = 1; } @@ -5790,18 +5785,13 @@ or_state_save(time_t now) static config_line_t * get_transport_in_state_by_name(const char *transport) { - config_var_t *var = config_find_option(&state_format,"TransportProxies"); - if (!var) - return NULL; - - config_line_t **value = STRUCT_VAR_P(get_or_state(), var->var_offset); - config_line_t *search = *value; - - while (search) { - if (!strcmpstart(search->value, transport)) - return search; + or_state_t *or_state = get_or_state(); + config_line_t *line; - search = search->next; + for (line = or_state->TransportProxies ; line ; line = line->next) { + tor_assert(!strcmp(line->key, "TransportProxy")); + if (!strcmpstart(line->value, transport)) + return line; } return NULL; } |