mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
start the cpuworkers always, even for clients
prepares the way for client-side pow cpuworkers also happens to resolve bug https://bugs.torproject.org/tpo/core/tor/40617 (which went into 0.4.7.4-alpha) because now we survive initing the cpuworker subsystem when we're not a relay.
This commit is contained in:
parent
0716cd7cb2
commit
a5b0c7b404
@ -1237,10 +1237,10 @@ run_tor_main_loop(void)
|
||||
const time_t now = time(NULL);
|
||||
directory_info_has_arrived(now, 1, 0);
|
||||
|
||||
if (server_mode(get_options()) || dir_server_mode(get_options())) {
|
||||
/* launch cpuworkers. Need to do this *after* we've read the onion key. */
|
||||
cpu_init();
|
||||
}
|
||||
/* launch cpuworkers. Need to do this *after* we've read the onion key. */
|
||||
/* launch them always for all tors, now that clients can solve onion PoWs. */
|
||||
cpuworker_init();
|
||||
|
||||
consdiffmgr_enable_background_compression();
|
||||
|
||||
/* Setup shared random protocol subsystem. */
|
||||
|
@ -64,6 +64,9 @@ static const size_t NTOR3_CIRC_VERIFICATION_LEN = 14;
|
||||
server_onion_keys_t *
|
||||
server_onion_keys_new(void)
|
||||
{
|
||||
if (!get_master_identity_key())
|
||||
return NULL;
|
||||
|
||||
server_onion_keys_t *keys = tor_malloc_zero(sizeof(server_onion_keys_t));
|
||||
memcpy(keys->my_identity, router_get_my_id_digest(), DIGEST_LEN);
|
||||
ed25519_pubkey_copy(&keys->my_ed_identity, get_master_identity_key());
|
||||
|
@ -117,7 +117,7 @@ cpuworker_consensus_has_changed(const networkstatus_t *ns)
|
||||
* during Tor's lifetime.
|
||||
*/
|
||||
void
|
||||
cpu_init(void)
|
||||
cpuworker_init(void)
|
||||
{
|
||||
if (!replyqueue) {
|
||||
replyqueue = replyqueue_new(0);
|
||||
|
@ -12,9 +12,7 @@
|
||||
#ifndef TOR_CPUWORKER_H
|
||||
#define TOR_CPUWORKER_H
|
||||
|
||||
#include "feature/nodelist/networkstatus_st.h"
|
||||
|
||||
void cpu_init(void);
|
||||
void cpuworker_init(void);
|
||||
void cpuworkers_rotate_keyinfo(void);
|
||||
|
||||
void cpuworker_consensus_has_changed(const networkstatus_t *ns);
|
||||
|
@ -1327,12 +1327,6 @@ options_act_relay(const or_options_t *old_options)
|
||||
"Worker-related options changed. Rotating workers.");
|
||||
const int server_mode_turned_on =
|
||||
server_mode(options) && !server_mode(old_options);
|
||||
const int dir_server_mode_turned_on =
|
||||
dir_server_mode(options) && !dir_server_mode(old_options);
|
||||
|
||||
if (server_mode_turned_on || dir_server_mode_turned_on) {
|
||||
cpu_init();
|
||||
}
|
||||
|
||||
if (server_mode_turned_on) {
|
||||
ip_address_changed(0);
|
||||
|
Loading…
Reference in New Issue
Block a user