Add new internal-use-only option for controllers to use to prevent SIGHUP from reloading the configuration. Fixes bug 856.

svn:r17567
This commit is contained in:
Nick Mathewson
2008-12-10 22:17:02 +00:00
parent 9aa706e20c
commit 53d3f812bd
5 changed files with 30 additions and 7 deletions
+1
View File
@@ -333,6 +333,7 @@ static config_var_t _option_vars[] = {
VAR("VersioningAuthoritativeDirectory",BOOL,VersioningAuthoritativeDir, "0"),
V(VirtualAddrNetwork, STRING, "127.192.0.0/10"),
V(WarnPlaintextPorts, CSV, "23,109,110,143"),
VAR("__ReloadTorrcOnSIGHUP", BOOL, ReloadTorrcOnSIGHUP, "1"),
VAR("__AllDirActionsPrivate", BOOL, AllDirActionsPrivate, "0"),
VAR("__DisablePredictedCircuits",BOOL,DisablePredictedCircuits, "0"),
VAR("__LeaveStreamsUnattached",BOOL, LeaveStreamsUnattached, "0"),
+13 -7
View File
@@ -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) {
+4
View File
@@ -2496,6 +2496,10 @@ typedef struct {
/** Optionally, a file with GeoIP data. */
char *GeoIPFile;
/** If true, SIGHUP should reload the torrc. Sometimes controllers want
* to make this false. */
int ReloadTorrcOnSIGHUP;
} or_options_t;
/** Persistent state for an onion router, as saved to disk. */