summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-09-21 06:15:43 +0000
committerRoger Dingledine <arma@torproject.org>2003-09-21 06:15:43 +0000
commited51df7453b51ac5263fcc43f46cea26022d17da (patch)
tree8a1b76a63a28375b310077c564c9ca01c85a72ab /src/or/main.c
parent7afe2adbaf09a3743ff6ce05d2c6ccdb19dca50c (diff)
downloadtor-ed51df7453b51ac5263fcc43f46cea26022d17da.tar.gz
tor-ed51df7453b51ac5263fcc43f46cea26022d17da.zip
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
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c16
1 files changed, 10 insertions, 6 deletions
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;