diff options
author | Roger Dingledine <arma@torproject.org> | 2005-09-14 02:07:35 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-09-14 02:07:35 +0000 |
commit | 1f930a9a70ab5b93b5cb7a076743c6b8fc9cc4fb (patch) | |
tree | 65cbad001195fc4311a55b428330c1783e07f191 /src/or/control.c | |
parent | f08bccc46096e732a11dae94951d92f7cc8951bb (diff) | |
download | tor-1f930a9a70ab5b93b5cb7a076743c6b8fc9cc4fb.tar.gz tor-1f930a9a70ab5b93b5cb7a076743c6b8fc9cc4fb.zip |
checkpoint: clean up and document the three ways to call config_assign()
and reduce code duplication in config_free() and option_is_same().
svn:r5040
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/or/control.c b/src/or/control.c index 2e19069b7c..6ba291d5fa 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -605,10 +605,11 @@ get_stream(const char *id) } /** Helper for setconf and resetconf. Acts like setconf, except - * it passes <b>reset</b> on to options_trial_assign(). + * it passes <b>use_defaults</b> on to options_trial_assign(). */ static int -control_setconf_helper(connection_t *conn, uint32_t len, char *body, int reset) +control_setconf_helper(connection_t *conn, uint32_t len, char *body, + int use_defaults, int clear_first) { int r; config_line_t *lines=NULL; @@ -666,7 +667,7 @@ control_setconf_helper(connection_t *conn, uint32_t len, char *body, int reset) } } - if ((r=options_trial_assign(lines, reset)) < 0) { + if ((r=options_trial_assign(lines, use_defaults, clear_first)) < 0) { log_fn(LOG_WARN,"Controller gave us config lines that didn't validate."); if (r==-1) { if (v0) @@ -693,7 +694,7 @@ control_setconf_helper(connection_t *conn, uint32_t len, char *body, int reset) static int handle_control_setconf(connection_t *conn, uint32_t len, char *body) { - return control_setconf_helper(conn, len, body, 0); + return control_setconf_helper(conn, len, body, 0, 1); } /** Called when we receive a RESETCONF message: parse the body and try @@ -703,7 +704,7 @@ handle_control_resetconf(connection_t *conn, uint32_t len, char *body) { int v0 = STATE_IS_V0(conn->state); tor_assert(!v0); - return control_setconf_helper(conn, len, body, 1); + return control_setconf_helper(conn, len, body, 1, 1); } /** Called when we receive a GETCONF message. Parse the request, and |