mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
initialize the dns worker cache tree whether or not we start
out as a server. svn:r4785
This commit is contained in:
parent
157f013d83
commit
10ff723938
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user