[or-cvs] dump a new router.desc on hup

Roger Dingledine arma at seul.org
Thu Feb 26 22:20:02 UTC 2004


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

Modified Files:
	main.c 
Log Message:
dump a new router.desc on hup


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -d -r1.169 -r1.170
--- main.c	26 Feb 2004 21:25:50 -0000	1.169
+++ main.c	26 Feb 2004 22:20:00 -0000	1.170
@@ -487,10 +487,11 @@
       please_dumpstats = 0;
     }
     if(please_reset) {
+      char keydir[512];
       log_fn(LOG_WARN,"Received sighup. Reloading config.");
       /* first, reload config variables, in case they've changed */
+      /* no need to provide argc/v, they've been cached inside init_from_config */
       if (init_from_config(0, NULL) < 0) {
-        /* no need to provide argc/v, they've been cached inside init_from_config */
         exit(1);
       }
       if(retry_all_connections() < 0) {
@@ -499,7 +500,6 @@
       }
       if(options.DirPort) {
         /* reload the approved-routers file */
-        char keydir[512];
         sprintf(keydir,"%s/approved-routers", options.DataDirectory);
         log_fn(LOG_INFO,"Reloading approved fingerprints from %s...",keydir);
         if(dirserv_parse_fingerprint_file(keydir) < 0) {
@@ -509,6 +509,13 @@
         /* fetch a new directory */
         directory_initiate_command(router_pick_directory_server(), DIR_CONN_STATE_CONNECTING_FETCH);
       }
+      if(options.ORPort) {
+        router_rebuild_descriptor();
+        sprintf(keydir,"%s/router.desc", options.DataDirectory);
+        log_fn(LOG_INFO,"Dumping descriptor to %s...",keydir);
+        if (write_str_to_file(keydir, router_get_my_descriptor())) {
+          return -1;
+        }
 
       please_reset = 0;
     }



More information about the tor-commits mailing list