diff options
author | George Kadianakis <desnacked@riseup.net> | 2014-04-08 17:22:36 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-23 11:05:45 -0400 |
commit | fa0c5da68ba472eed004cd87f198854885cff453 (patch) | |
tree | af251a9c7bd0297f8d218b53f4014d5b7616c6e3 /src | |
parent | bf7cb6acf66abf3a9aa4be6819e6cf160579dab0 (diff) | |
download | tor-fa0c5da68ba472eed004cd87f198854885cff453.tar.gz tor-fa0c5da68ba472eed004cd87f198854885cff453.zip |
Rename the got_hup element of managed proxies.
Since we need to toggle that element in non-SIGHUP situations too where
the config was re-read (like in SETCONF or RESETCONF).
Diffstat (limited to 'src')
-rw-r--r-- | src/or/transports.c | 27 | ||||
-rw-r--r-- | src/or/transports.h | 2 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/or/transports.c b/src/or/transports.c index e1876d678c..6f478bcd9a 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -554,11 +554,12 @@ pt_configure_remaining_proxies(void) tor_assert(mp->conf_state != PT_PROTO_BROKEN && mp->conf_state != PT_PROTO_FAILED_LAUNCH); - if (mp->got_hup) { - mp->got_hup = 0; + if (mp->was_around_before_config_read) { + /* This proxy is marked by a config read. Check whether we need + to restart it. */ + + mp->was_around_before_config_read = 0; - /* This proxy is marked by a SIGHUP. Check whether we need to - restart it. */ if (proxy_needs_restart(mp)) { log_info(LD_GENERAL, "Preparing managed proxy '%s' for restart.", mp->argv[0]); @@ -1363,14 +1364,12 @@ pt_kickstart_proxy(const smartlist_t *transport_list, managed_proxy_create(transport_list, proxy_argv, is_server); } else { /* known proxy. add its transport to its transport list */ - if (mp->got_hup) { - /* If the managed proxy we found is marked by a SIGHUP, it means - that it's not useless and should be kept. If it's marked for - removal, unmark it and increase the unconfigured proxies so - that we try to restart it if we need to. Afterwards, check if - a transport_t for 'transport' used to exist before the SIGHUP - and make sure it doesn't get deleted because we might reuse - it. */ + if (mp->was_around_before_config_read) { + /* If this managed proxy was around even before we read the + config this time, it means that it was already enabled before + and is not useless and should be kept. If it's marked for + removal, unmark it and make sure that we check whether it + needs to be restarted. */ if (mp->marked_for_removal) { mp->marked_for_removal = 0; check_if_restarts_needed = 1; @@ -1424,8 +1423,10 @@ pt_prepare_proxy_list_for_config_read(void) tor_assert(mp->conf_state == PT_PROTO_COMPLETED); + /* Mark all proxies for removal, and also note that they have been + here before the config read. */ mp->marked_for_removal = 1; - mp->got_hup = 1; + mp->was_around_before_config_read = 1; SMARTLIST_FOREACH(mp->transports_to_launch, char *, t, tor_free(t)); smartlist_clear(mp->transports_to_launch); } SMARTLIST_FOREACH_END(mp); diff --git a/src/or/transports.h b/src/or/transports.h index 7b524f2073..1365ead006 100644 --- a/src/or/transports.h +++ b/src/or/transports.h @@ -97,7 +97,7 @@ typedef struct { * this flag to signify that this proxy might need to be restarted * so that it can listen for other transports according to the new * torrc. */ - unsigned int got_hup : 1; + unsigned int was_around_before_config_read : 1; /* transports to-be-launched by this proxy */ smartlist_t *transports_to_launch; |