[or-cvs] initialize the dns worker cache tree whether or not we start

arma at seul.org arma at seul.org
Mon Aug 15 10:27:40 UTC 2005


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

Modified Files:
	config.c cpuworker.c dns.c main.c 
Log Message:
initialize the dns worker cache tree whether or not we start
out as a server.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.389
retrieving revision 1.390
diff -u -d -r1.389 -r1.390
--- config.c	15 Aug 2005 09:19:55 -0000	1.389
+++ config.c	15 Aug 2005 10:27:37 -0000	1.390
@@ -432,8 +432,8 @@
     return -1;
   }
 
-  /* Bail out at this point if we're not going to be a server: we want
-   * to not fork, and to log stuff to stderr. */
+  /* Bail out at this point if we're not going to be a client or server:
+   * we want to not fork, and to log stuff to stderr. */
   if (options->command != CMD_RUN_TOR)
     return 0;
 

Index: cpuworker.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- cpuworker.c	30 Jun 2005 07:17:38 -0000	1.84
+++ cpuworker.c	15 Aug 2005 10:27:37 -0000	1.85
@@ -46,8 +46,7 @@
 void
 cpu_init(void)
 {
-  last_rotation_time=time(NULL);
-  spawn_enough_cpuworkers();
+  cpuworkers_rotate();
 }
 
 /** Called when we're done sending a request to a cpuworker. */

Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- dns.c	13 Aug 2005 00:22:06 -0000	1.163
+++ dns.c	15 Aug 2005 10:27:37 -0000	1.164
@@ -102,8 +102,6 @@
 dns_init(void)
 {
   init_cache_tree();
-  last_rotation_time=time(NULL);
-  spawn_enough_dnsworkers();
 }
 
 /** Helper: free storage held by an entry in the DNS cache. */
@@ -718,7 +716,6 @@
 dnsworkers_rotate(void)
 {
   connection_t *dnsconn;
-  log_fn(LOG_INFO, "Rotating DNS workers.");
   while ((dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER,
                                                  DNSWORKER_STATE_IDLE))) {
     connection_mark_for_close(dnsconn);

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.533
retrieving revision 1.534
diff -u -d -r1.533 -r1.534
--- main.c	28 Jul 2005 19:01:48 -0000	1.533
+++ main.c	15 Aug 2005 10:27:37 -0000	1.534
@@ -934,7 +934,7 @@
      * configuration options. */
     cpuworkers_rotate();
     dnsworkers_rotate();
-    /* Rebuild fresh descriptor, but leave old one on failure. */
+    /* Write out a fresh descriptor, but leave old one on failure. */
     router_rebuild_descriptor(1);
     descriptor = router_get_my_descriptor();
     if (!descriptor) {
@@ -957,9 +957,10 @@
 {
   int loop_result;
 
+  dns_init(); /* initialize the dns resolve tree */
   /* only spawn dns handlers if we're a router */
   if (server_mode(get_options())) {
-    dns_init(); /* initialize the dns resolve tree, and spawn workers */
+    dnsworkers_rotate();
   }
 
   handle_signals(1);
@@ -1750,7 +1751,7 @@
   if (tor_snprintf(command, len, "\"%s\" --nt-service -f \"%s%storrc\"",
                    szPath,  szDrive, szDir)<0) {
     printf("Failed: tor_snprinf()\n");
-    free(command);
+    tor_free(command);
     return 0;
   }
 



More information about the tor-commits mailing list