Commit 10ff7239 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

initialize the dns worker cache tree whether or not we start

out as a server.


svn:r4785
parent 157f013d
......@@ -432,8 +432,8 @@ options_act(void)
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;
......
......@@ -46,8 +46,7 @@ static void process_pending_task(connection_t *cpuworker);
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. */
......
......@@ -102,8 +102,6 @@ void
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 @@ void
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);
......
......@@ -934,7 +934,7 @@ do_hup(void)
* 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 @@ do_main_loop(void)
{
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 @@ nt_service_install(void)
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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment