diff options
author | Roger Dingledine <arma@torproject.org> | 2004-07-20 23:31:00 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-07-20 23:31:00 +0000 |
commit | 0da256ef976076709f7bbf503e6b6bc50a403380 (patch) | |
tree | 531b978e13bf5925c3cc91ed2f4aea3cd3bed2f0 /src/or/connection.c | |
parent | 18d752e518c41f7190b77dc36d22150e89ffc115 (diff) | |
download | tor-0da256ef976076709f7bbf503e6b6bc50a403380.tar tor-0da256ef976076709f7bbf503e6b6bc50a403380.tar.gz |
when we get a sigint, don't accept new connections/circuits,
but delay 30 seconds until exiting.
if we get a second sigint, exit immediately.
svn:r2070
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index e0455ef95..7cbdff955 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -13,6 +13,7 @@ /********* START VARIABLES **********/ extern or_options_t options; /* command-line and config-file options */ +extern int shutting_down; /* whether we should refuse new connections */ /** Array of strings to make conn-\>type human-readable. */ char *conn_type_to_string[] = { @@ -402,6 +403,13 @@ static int connection_handle_listener_read(connection_t *conn, int new_type) { } log(LOG_INFO,"Connection accepted on socket %d (child of fd %d).",news, conn->s); + if(shutting_down && new_type != CONN_TYPE_DIR) { + /* allow directory connections even while we're shutting down */ + log(LOG_INFO,"But we're shutting down, so closing (type %d).", new_type); + tor_close_socket(news); + return 0; + } + set_socket_nonblocking(news); newconn = connection_new(new_type); |