From ed51df7453b51ac5263fcc43f46cea26022d17da Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 21 Sep 2003 06:15:43 +0000 Subject: bugfixes and note missing features deal with content-length headers better when reading http don't assume struct socks4_info is a packed struct fail the socks handshake if destip is zero flesh out conn_state_to_string() for dir conn fix typo (bug) in connection_handle_read() directory get is now called fetch, post is now upload reopen logs on sighup svn:r475 --- src/or/main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/or/main.c') diff --git a/src/or/main.c b/src/or/main.c index 6fc3c1c5cc..92ef44cfc2 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -25,7 +25,7 @@ static int nfds=0; /* number of connections currently active */ #ifndef MS_WINDOWS /* do signal stuff only on unix */ static int please_dumpstats=0; /* whether we should dump stats during the loop */ -static int please_fetch_directory=0; /* whether we should fetch a new directory */ +static int please_reset =0; /* whether we just got a sighup */ static int please_reap_children=0; /* whether we should waitpid for exited children*/ #endif /* signal stuff */ @@ -337,7 +337,7 @@ static int prepare_for_poll(void) { /* NOTE directory servers do not currently fetch directories. * Hope this doesn't bite us later. */ - directory_initiate_command(router_pick_directory_server(), DIR_CONN_STATE_CONNECTING_GET); + directory_initiate_command(router_pick_directory_server(), DIR_CONN_STATE_CONNECTING_FETCH); time_to_fetch_directory = now.tv_sec + options.DirFetchPeriod; } } @@ -488,15 +488,19 @@ static int do_main_loop(void) { dumpstats(); please_dumpstats = 0; } - if(please_fetch_directory) { + if(please_reset) { + /* fetch a new directory */ if(options.DirPort) { if(router_get_list_from_file(options.RouterFile) < 0) { log(LOG_ERR,"Error reloading router list. Continuing with old list."); } } else { - directory_initiate_command(router_pick_directory_server(), DIR_CONN_STATE_CONNECTING_GET); + directory_initiate_command(router_pick_directory_server(), DIR_CONN_STATE_CONNECTING_FETCH); } - please_fetch_directory = 0; + + reset_logs(); /* close and reopen the log files */ + + please_reset = 0; } if(please_reap_children) { while(waitpid(-1,NULL,WNOHANG)) ; /* keep reaping until no more zombies */ @@ -546,7 +550,7 @@ static void catch(int the_signal) { log(LOG_NOTICE,"Catching signal %d, exiting cleanly.", the_signal); exit(0); case SIGHUP: - please_fetch_directory = 1; + please_reset = 1; break; case SIGUSR1: please_dumpstats = 1; -- cgit v1.2.3-54-g00ecf