diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-12-10 22:17:02 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-12-10 22:17:02 +0000 |
commit | 53d3f812bd2f97f4eb2acce73919e217baaf2772 (patch) | |
tree | 5c392e3ebe2b43a00eee5c0ab405933bb02e37ca /src/or/main.c | |
parent | 9aa706e20c3ae91f6cac95964e291076b88ecd48 (diff) | |
download | tor-53d3f812bd2f97f4eb2acce73919e217baaf2772.tar.gz tor-53d3f812bd2f97f4eb2acce73919e217baaf2772.zip |
Add new internal-use-only option for controllers to use to prevent SIGHUP from reloading the configuration. Fixes bug 856.
svn:r17567
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/or/main.c b/src/or/main.c index 7872229f42..3d02d2e871 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1321,7 +1321,8 @@ do_hup(void) dmalloc_log_changed(0, 1, 0, 0); #endif - log_notice(LD_GENERAL,"Received reload signal (hup). Reloading config."); + log_notice(LD_GENERAL,"Received reload signal (hup). Reloading config and " + "resetting internal state."); if (accounting_is_enabled(options)) accounting_record_bandwidth_usage(time(NULL), get_or_state()); @@ -1329,13 +1330,18 @@ do_hup(void) routerlist_reset_warnings(); addressmap_clear_transient(); /* first, reload config variables, in case they've changed */ - /* no need to provide argc/v, they've been cached inside init_from_config */ - if (options_init_from_torrc(0, NULL) < 0) { - log_err(LD_CONFIG,"Reading config failed--see warnings above. " - "For usage, try -h."); - return -1; + if (options->ReloadTorrcOnSIGHUP) { + /* no need to provide argc/v, they've been cached inside init_from_config */ + if (options_init_from_torrc(0, NULL) < 0) { + log_err(LD_CONFIG,"Reading config failed--see warnings above. " + "For usage, try -h."); + return -1; + } + options = get_options(); /* they have changed now */ + } else { + log_notice(LD_GENERAL, "Not reloading config file: the controller told " + "us not to."); } - options = get_options(); /* they have changed now */ if (authdir_mode_handles_descs(options, -1)) { /* reload the approved-routers file */ if (dirserv_load_fingerprint_file() < 0) { |