mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
change SHUTDOWN_WAIT_LENGTH from a fixed 30 secs to a config option
svn:r3752
This commit is contained in:
parent
115271f65e
commit
fe768d1d2a
@ -165,6 +165,7 @@ static config_var_t config_vars[] = {
|
|||||||
VAR("RecommendedVersions", LINELIST, RecommendedVersions, NULL),
|
VAR("RecommendedVersions", LINELIST, RecommendedVersions, NULL),
|
||||||
VAR("RendNodes", STRING, RendNodes, NULL),
|
VAR("RendNodes", STRING, RendNodes, NULL),
|
||||||
VAR("RendExcludeNodes", STRING, RendExcludeNodes, NULL),
|
VAR("RendExcludeNodes", STRING, RendExcludeNodes, NULL),
|
||||||
|
VAR("ShutdownWaitLength", UINT, ShutdownWaitLength, "30"),
|
||||||
VAR("SocksPort", UINT, SocksPort, "9050"),
|
VAR("SocksPort", UINT, SocksPort, "9050"),
|
||||||
VAR("SocksBindAddress", LINELIST, SocksBindAddress, NULL),
|
VAR("SocksBindAddress", LINELIST, SocksBindAddress, NULL),
|
||||||
VAR("SocksPolicy", LINELIST, SocksPolicy, NULL),
|
VAR("SocksPolicy", LINELIST, SocksPolicy, NULL),
|
||||||
|
@ -29,8 +29,6 @@ hibernating, phase 2:
|
|||||||
#define HIBERNATE_STATE_LOWBANDWIDTH 3
|
#define HIBERNATE_STATE_LOWBANDWIDTH 3
|
||||||
#define HIBERNATE_STATE_DORMANT 4
|
#define HIBERNATE_STATE_DORMANT 4
|
||||||
|
|
||||||
#define SHUTDOWN_WAIT_LENGTH 30 /* seconds */
|
|
||||||
|
|
||||||
extern long stats_n_seconds_working; /* published uptime */
|
extern long stats_n_seconds_working; /* published uptime */
|
||||||
|
|
||||||
static int hibernate_state = HIBERNATE_STATE_LIVE;
|
static int hibernate_state = HIBERNATE_STATE_LIVE;
|
||||||
@ -656,6 +654,7 @@ static int hibernate_soft_limit_reached(void)
|
|||||||
* connections, but we continue handling old ones. */
|
* connections, but we continue handling old ones. */
|
||||||
static void hibernate_begin(int new_state, time_t now) {
|
static void hibernate_begin(int new_state, time_t now) {
|
||||||
connection_t *conn;
|
connection_t *conn;
|
||||||
|
or_options_t *options = get_options();
|
||||||
|
|
||||||
if (new_state == HIBERNATE_STATE_EXITING &&
|
if (new_state == HIBERNATE_STATE_EXITING &&
|
||||||
hibernate_state != HIBERNATE_STATE_LIVE) {
|
hibernate_state != HIBERNATE_STATE_LIVE) {
|
||||||
@ -678,8 +677,8 @@ static void hibernate_begin(int new_state, time_t now) {
|
|||||||
/* XXX upload rendezvous service descriptors with no intro points */
|
/* XXX upload rendezvous service descriptors with no intro points */
|
||||||
|
|
||||||
if (new_state == HIBERNATE_STATE_EXITING) {
|
if (new_state == HIBERNATE_STATE_EXITING) {
|
||||||
log(LOG_NOTICE,"Interrupt: will shut down in %d seconds. Interrupt again to exit now.", SHUTDOWN_WAIT_LENGTH);
|
log(LOG_NOTICE,"Interrupt: will shut down in %d seconds. Interrupt again to exit now.", options->ShutdownWaitLength);
|
||||||
hibernate_end_time = time(NULL) + SHUTDOWN_WAIT_LENGTH;
|
hibernate_end_time = time(NULL) + options->ShutdownWaitLength;
|
||||||
} else { /* soft limit reached */
|
} else { /* soft limit reached */
|
||||||
hibernate_end_time = interval_end_time;
|
hibernate_end_time = interval_end_time;
|
||||||
}
|
}
|
||||||
|
@ -1059,6 +1059,8 @@ typedef struct {
|
|||||||
int ManageConnections; /**< Boolean: Does Tor attach new connections to
|
int ManageConnections; /**< Boolean: Does Tor attach new connections to
|
||||||
* circuits itself (1), or does it let the controller
|
* circuits itself (1), or does it let the controller
|
||||||
* deal? (0) */
|
* deal? (0) */
|
||||||
|
int ShutdownWaitLength; /**< When we get a SIGINT and we're a server, how
|
||||||
|
* long do we wait before exiting? */
|
||||||
} or_options_t;
|
} or_options_t;
|
||||||
|
|
||||||
#define MAX_SOCKS_REPLY_LEN 1024
|
#define MAX_SOCKS_REPLY_LEN 1024
|
||||||
|
Loading…
Reference in New Issue
Block a user