diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-08-10 15:04:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-08-10 15:04:36 -0400 |
commit | b76f46c6d8ba5e7b3efa91ae5ef487ba05d3b3c4 (patch) | |
tree | db6f138592b68dbf8f0dfc32a02d266bf956882f /src/or/config.c | |
parent | 333df6006d27fb7e11b504257e3ee22f97c5f04b (diff) | |
parent | 02a735dfa847e9cb7b78b58ef1f69d865e4d21bf (diff) | |
download | tor-b76f46c6d8ba5e7b3efa91ae5ef487ba05d3b3c4.tar.gz tor-b76f46c6d8ba5e7b3efa91ae5ef487ba05d3b3c4.zip |
Merge branch 'bug1692-squashed'
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c index 1f574c8233..e2e5cd3a6b 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -696,6 +696,9 @@ get_options(void) int set_options(or_options_t *new_val, char **msg) { + int i; + smartlist_t *elements; + config_line_t *line; or_options_t *old_options = global_options; global_options = new_val; /* Note that we pass the *old* options below, for comparison. It @@ -710,7 +713,30 @@ set_options(or_options_t *new_val, char **msg) "Acting on config options left us in a broken state. Dying."); exit(1); } - + /* Issues a CONF_CHANGED event to notify controller of the change. If Tor is + * just starting up then the old_options will be undefined. */ + if (old_options) { + elements = smartlist_create(); + for (i=0; options_format.vars[i].name; ++i) { + if (!option_is_same(&options_format, new_val, old_options, + options_format.vars[i].name)) { + line = get_assigned_option(&options_format, new_val, + options_format.vars[i].name, 1); + + if (line) { + for (; line; line = line->next) { + smartlist_add(elements, line->key); + smartlist_add(elements, line->value); + } + } else { + smartlist_add(elements, options_format.vars[i].name); + smartlist_add(elements, NULL); + } + } + } + control_event_conf_changed(elements); + smartlist_free(elements); + } config_free(&options_format, old_options); return 0; |