[or-cvs] change SHUTDOWN_WAIT_LENGTH from a fixed 30 secs to a confi...

Roger Dingledine arma at seul.org
Sat Mar 12 20:13:40 UTC 2005


Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	config.c hibernate.c or.h 
Log Message:
change SHUTDOWN_WAIT_LENGTH from a fixed 30 secs to a config option


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.321
retrieving revision 1.322
diff -u -d -r1.321 -r1.322
--- config.c	12 Mar 2005 04:22:00 -0000	1.321
+++ config.c	12 Mar 2005 20:13:38 -0000	1.322
@@ -165,6 +165,7 @@
   VAR("RecommendedVersions", LINELIST, RecommendedVersions,  NULL),
   VAR("RendNodes",           STRING,   RendNodes,            NULL),
   VAR("RendExcludeNodes",    STRING,   RendExcludeNodes,     NULL),
+  VAR("ShutdownWaitLength",  UINT,     ShutdownWaitLength,   "30"),
   VAR("SocksPort",           UINT,     SocksPort,            "9050"),
   VAR("SocksBindAddress",    LINELIST, SocksBindAddress,     NULL),
   VAR("SocksPolicy",         LINELIST, SocksPolicy,          NULL),

Index: hibernate.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/hibernate.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- hibernate.c	1 Mar 2005 22:42:31 -0000	1.47
+++ hibernate.c	12 Mar 2005 20:13:38 -0000	1.48
@@ -29,8 +29,6 @@
 #define HIBERNATE_STATE_LOWBANDWIDTH 3
 #define HIBERNATE_STATE_DORMANT 4
 
-#define SHUTDOWN_WAIT_LENGTH 30 /* seconds */
-
 extern long stats_n_seconds_working; /* published uptime */
 
 static int hibernate_state = HIBERNATE_STATE_LIVE;
@@ -656,6 +654,7 @@
  * connections, but we continue handling old ones. */
 static void hibernate_begin(int new_state, time_t now) {
   connection_t *conn;
+  or_options_t *options = get_options();
 
   if (new_state == HIBERNATE_STATE_EXITING &&
       hibernate_state != HIBERNATE_STATE_LIVE) {
@@ -678,8 +677,8 @@
   /* XXX upload rendezvous service descriptors with no intro points */
 
   if (new_state == HIBERNATE_STATE_EXITING) {
-    log(LOG_NOTICE,"Interrupt: will shut down in %d seconds. Interrupt again to exit now.", SHUTDOWN_WAIT_LENGTH);
-    hibernate_end_time = time(NULL) + 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) + options->ShutdownWaitLength;
   } else { /* soft limit reached */
     hibernate_end_time = interval_end_time;
   }

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.555
retrieving revision 1.556
diff -u -d -r1.555 -r1.556
--- or.h	12 Mar 2005 04:22:01 -0000	1.555
+++ or.h	12 Mar 2005 20:13:38 -0000	1.556
@@ -1059,6 +1059,8 @@
   int ManageConnections; /**< Boolean: Does Tor attach new connections to
                           * circuits itself (1), or does it let the controller
                           * deal? (0) */
+  int ShutdownWaitLength; /**< When we get a SIGINT and we're a server, how
+                           * long do we wait before exiting? */
 } or_options_t;
 
 #define MAX_SOCKS_REPLY_LEN 1024



More information about the tor-commits mailing list