Split main.c into main.c and mainloop.c

The main.c code is responsible for initialization and shutdown;
the mainloop.c code is responsible for running the main loop of Tor.

Splitting the "generic event loop" part of mainloop.c from the
event-loop-specific part is not done as part of this patch.
This commit is contained in:
Nick Mathewson 2018-09-20 15:19:43 -04:00
parent 98ef3e82e4
commit c7ce6b9821
55 changed files with 1669 additions and 1558 deletions

View File

@ -1,4 +1,3 @@
/* Copyright (c) 2001 Matej Pfajfar. /* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
@ -96,7 +95,8 @@
#include "lib/log/git_revision.h" #include "lib/log/git_revision.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h" #include "app/main/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/policies.h" #include "core/or/policies.h"

View File

@ -33,11 +33,11 @@
#include "core/or/circuitstats.h" #include "core/or/circuitstats.h"
#include "app/config/config.h" #include "app/config/config.h"
#include "app/config/confparse.h" #include "app/config/confparse.h"
#include "core/mainloop/mainloop.h"
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "feature/control/control.h" #include "feature/control/control.h"
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h"
#include "feature/stats/rephist.h" #include "feature/stats/rephist.h"
#include "feature/relay/router.h" #include "feature/relay/router.h"
#include "lib/sandbox/sandbox.h" #include "lib/sandbox/sandbox.h"

1515
src/app/main/main.c Normal file

File diff suppressed because it is too large Load Diff

29
src/app/main/main.h Normal file
View File

@ -0,0 +1,29 @@
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* \file main.h
* \brief Header file for main.c.
**/
#ifndef TOR_MAIN_H
#define TOR_MAIN_H
void handle_signals(void);
void activate_signal(int signal_num);
int try_locking(const or_options_t *options, int err_if_locked);
int have_lockfile(void);
void release_lockfile(void);
void tor_remove_file(const char *filename);
void tor_cleanup(void);
void tor_free_all(int postfork);
int tor_init(int argc, char **argv);
#endif /* !defined(TOR_MAIN_H) */

View File

@ -21,7 +21,7 @@
#include "core/or/or.h" #include "core/or/or.h"
#include "app/config/config.h" #include "app/config/config.h"
#include "core/mainloop/main.h" #include "app/main/main.h"
#include "app/main/ntmain.h" #include "app/main/ntmain.h"
#include "lib/log/win32err.h" #include "lib/log/win32err.h"
#include "lib/fs/winlib.h" #include "lib/fs/winlib.h"

View File

@ -10,6 +10,7 @@ LIBTOR_APP_A_SOURCES = \
src/app/config/config.c \ src/app/config/config.c \
src/app/config/confparse.c \ src/app/config/confparse.c \
src/app/config/statefile.c \ src/app/config/statefile.c \
src/app/main/main.c \
src/core/crypto/hs_ntor.c \ src/core/crypto/hs_ntor.c \
src/core/crypto/onion_crypto.c \ src/core/crypto/onion_crypto.c \
src/core/crypto/onion_fast.c \ src/core/crypto/onion_fast.c \
@ -18,7 +19,7 @@ LIBTOR_APP_A_SOURCES = \
src/core/crypto/relay_crypto.c \ src/core/crypto/relay_crypto.c \
src/core/mainloop/connection.c \ src/core/mainloop/connection.c \
src/core/mainloop/cpuworker.c \ src/core/mainloop/cpuworker.c \
src/core/mainloop/main.c \ src/core/mainloop/mainloop.c \
src/core/mainloop/periodic.c \ src/core/mainloop/periodic.c \
src/core/or/address_set.c \ src/core/or/address_set.c \
src/core/or/channel.c \ src/core/or/channel.c \
@ -164,6 +165,7 @@ noinst_HEADERS += \
src/app/config/or_options_st.h \ src/app/config/or_options_st.h \
src/app/config/or_state_st.h \ src/app/config/or_state_st.h \
src/app/config/statefile.h \ src/app/config/statefile.h \
src/app/main/main.h \
src/app/main/ntmain.h \ src/app/main/ntmain.h \
src/core/crypto/hs_ntor.h \ src/core/crypto/hs_ntor.h \
src/core/crypto/onion_crypto.h \ src/core/crypto/onion_crypto.h \
@ -173,7 +175,7 @@ noinst_HEADERS += \
src/core/crypto/relay_crypto.h \ src/core/crypto/relay_crypto.h \
src/core/mainloop/connection.h \ src/core/mainloop/connection.h \
src/core/mainloop/cpuworker.h \ src/core/mainloop/cpuworker.h \
src/core/mainloop/main.h \ src/core/mainloop/mainloop.h \
src/core/mainloop/periodic.h \ src/core/mainloop/periodic.h \
src/core/or/addr_policy_st.h \ src/core/or/addr_policy_st.h \
src/core/or/address_set.h \ src/core/or/address_set.h \

View File

@ -85,7 +85,7 @@
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "feature/relay/ext_orport.h" #include "feature/relay/ext_orport.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "feature/hs/hs_common.h" #include "feature/hs/hs_common.h"
#include "feature/hs/hs_ident.h" #include "feature/hs/hs_ident.h"

View File

@ -26,7 +26,6 @@
#include "core/mainloop/cpuworker.h" #include "core/mainloop/cpuworker.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h" #include "lib/crypt_ops/crypto_util.h"
#include "core/mainloop/main.h"
#include "core/or/onion.h" #include "core/or/onion.h"
#include "feature/relay/onion_queue.h" #include "feature/relay/onion_queue.h"
#include "feature/stats/rephist.h" #include "feature/stats/rephist.h"

File diff suppressed because it is too large Load Diff

View File

@ -5,12 +5,12 @@
/* See LICENSE for licensing information */ /* See LICENSE for licensing information */
/** /**
* \file main.h * \file mainloop.h
* \brief Header file for main.c. * \brief Header file for mainloop.c.
**/ **/
#ifndef TOR_MAIN_H #ifndef TOR_MAINLOOP_H
#define TOR_MAIN_H #define TOR_MAINLOOP_H
int have_completed_a_circuit(void); int have_completed_a_circuit(void);
void note_that_we_completed_a_circuit(void); void note_that_we_completed_a_circuit(void);
@ -73,20 +73,7 @@ MOCK_DECL(void,reset_uptime,(void));
unsigned get_signewnym_epoch(void); unsigned get_signewnym_epoch(void);
void handle_signals(void);
void activate_signal(int signal_num);
int try_locking(const or_options_t *options, int err_if_locked);
int have_lockfile(void);
void release_lockfile(void);
void tor_remove_file(const char *filename);
void tor_cleanup(void);
void tor_free_all(int postfork);
int do_main_loop(void); int do_main_loop(void);
int tor_init(int argc, char **argv);
void reset_main_loop_counters(void); void reset_main_loop_counters(void);
uint64_t get_main_loop_success_count(void); uint64_t get_main_loop_success_count(void);
@ -96,6 +83,12 @@ uint64_t get_main_loop_idle_count(void);
void periodic_events_on_new_options(const or_options_t *options); void periodic_events_on_new_options(const or_options_t *options);
void reschedule_per_second_timer(void); void reschedule_per_second_timer(void);
void do_signewnym(time_t);
time_t get_last_signewnym_time(void);
void tor_init_connection_lists(void);
void tor_mainloop_free_all(void);
struct token_bucket_rw_t; struct token_bucket_rw_t;
extern time_t time_of_process_start; extern time_t time_of_process_start;
@ -103,13 +96,12 @@ extern int quiet_level;
extern struct token_bucket_rw_t global_bucket; extern struct token_bucket_rw_t global_bucket;
extern struct token_bucket_rw_t global_relayed_bucket; extern struct token_bucket_rw_t global_relayed_bucket;
#ifdef MAIN_PRIVATE #ifdef MAINLOOP_PRIVATE
STATIC void init_connection_lists(void);
STATIC void initialize_mainloop_events(void); STATIC void initialize_mainloop_events(void);
STATIC void close_closeable_connections(void); STATIC void close_closeable_connections(void);
STATIC void initialize_periodic_events(void); STATIC void initialize_periodic_events(void);
STATIC void teardown_periodic_events(void); STATIC void teardown_periodic_events(void);
STATIC int get_my_roles(const or_options_t *options); STATIC int get_my_roles(const or_options_t *);
#ifdef TOR_UNIT_TESTS #ifdef TOR_UNIT_TESTS
extern smartlist_t *connection_array; extern smartlist_t *connection_array;
@ -119,4 +111,4 @@ extern periodic_event_item_t periodic_events[];
#endif #endif
#endif /* defined(MAIN_PRIVATE) */ #endif /* defined(MAIN_PRIVATE) */
#endif /* !defined(TOR_MAIN_H) */ #endif

View File

@ -14,7 +14,7 @@
#include "core/or/or.h" #include "core/or/or.h"
#include "lib/evloop/compat_libevent.h" #include "lib/evloop/compat_libevent.h"
#include "app/config/config.h" #include "app/config/config.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/mainloop/periodic.h" #include "core/mainloop/periodic.h"
#include "lib/evloop/compat_libevent.h" #include "lib/evloop/compat_libevent.h"

View File

@ -69,7 +69,7 @@
#include "core/or/circuitmux.h" #include "core/or/circuitmux.h"
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/relay.h" #include "core/or/relay.h"
#include "feature/stats/rephist.h" #include "feature/stats/rephist.h"

View File

@ -17,7 +17,7 @@
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "core/or/connection_or.h" #include "core/or/connection_or.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/stats/rephist.h" #include "feature/stats/rephist.h"
#include "feature/relay/router.h" #include "feature/relay/router.h"
#include "lib/time/compat_time.h" #include "lib/time/compat_time.h"

View File

@ -47,7 +47,7 @@
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "core/crypto/hs_ntor.h" #include "core/crypto/hs_ntor.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"

View File

@ -71,7 +71,7 @@
#include "lib/crypt_ops/crypto_dh.h" #include "lib/crypt_ops/crypto_dh.h"
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/hs/hs_circuit.h" #include "feature/hs/hs_circuit.h"
#include "feature/hs/hs_circuitmap.h" #include "feature/hs/hs_circuitmap.h"
#include "feature/hs/hs_ident.h" #include "feature/hs/hs_ident.h"

View File

@ -32,7 +32,7 @@
#include "app/config/confparse.h" #include "app/config/confparse.h"
#include "feature/control/control.h" #include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/rend/rendclient.h" #include "feature/rend/rendclient.h"
#include "feature/rend/rendservice.h" #include "feature/rend/rendservice.h"

View File

@ -80,7 +80,7 @@
#include "feature/hs/hs_cache.h" #include "feature/hs/hs_cache.h"
#include "feature/hs/hs_client.h" #include "feature/hs/hs_client.h"
#include "feature/hs/hs_circuit.h" #include "feature/hs/hs_circuit.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/policies.h" #include "core/or/policies.h"

View File

@ -44,7 +44,7 @@
#include "feature/dirauth/reachability.h" #include "feature/dirauth/reachability.h"
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "trunnel/link_handshake.h" #include "trunnel/link_handshake.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"

View File

@ -15,7 +15,7 @@
#include "core/or/connection_or.h" #include "core/or/connection_or.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/relay.h" #include "core/or/relay.h"

View File

@ -67,7 +67,7 @@
#include "feature/relay/dns.h" #include "feature/relay/dns.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "feature/hs/hs_cache.h" #include "feature/hs/hs_cache.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/onion.h" #include "core/or/onion.h"

View File

@ -8,7 +8,7 @@
#define SCHEDULER_PRIVATE_ #define SCHEDULER_PRIVATE_
#define SCHEDULER_KIST_PRIVATE #define SCHEDULER_KIST_PRIVATE
#include "core/or/scheduler.h" #include "core/or/scheduler.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "lib/container/buffers.h" #include "lib/container/buffers.h"
#define TOR_CHANNEL_INTERNAL_ #define TOR_CHANNEL_INTERNAL_
#include "core/or/channeltls.h" #include "core/or/channeltls.h"

View File

@ -22,7 +22,7 @@
#include "core/or/relay.h" #include "core/or/relay.h"
#include "feature/relay/router.h" #include "feature/relay/router.h"
#include "core/or/circuitlist.h" #include "core/or/circuitlist.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/stats/rephist.h" #include "feature/stats/rephist.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "app/config/statefile.h" #include "app/config/statefile.h"

View File

@ -27,7 +27,7 @@
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "core/or/connection_edge.h" #include "core/or/connection_edge.h"
#include "feature/control/control.h" #include "feature/control/control.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/or/policies.h" #include "core/or/policies.h"
#include "feature/control/control_connection_st.h" #include "feature/control/control_connection_st.h"

View File

@ -127,7 +127,7 @@
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"

View File

@ -65,7 +65,8 @@
#include "feature/hs/hs_cache.h" #include "feature/hs/hs_cache.h"
#include "feature/hs/hs_common.h" #include "feature/hs/hs_common.h"
#include "feature/hs/hs_control.h" #include "feature/hs/hs_control.h"
#include "core/mainloop/main.h" #include "app/main/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"

View File

@ -14,7 +14,7 @@
#include "feature/dirauth/voteflags.h" #include "feature/dirauth/voteflags.h"
#include "app/config/config.h" #include "app/config/config.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/or/policies.h" #include "core/or/policies.h"
#include "feature/dirauth/bwauth.h" #include "feature/dirauth/bwauth.h"
#include "feature/dirauth/reachability.h" #include "feature/dirauth/reachability.h"

View File

@ -30,7 +30,7 @@
#include "feature/hs/hs_common.h" #include "feature/hs/hs_common.h"
#include "feature/hs/hs_control.h" #include "feature/hs/hs_control.h"
#include "feature/hs/hs_client.h" #include "feature/hs/hs_client.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"

View File

@ -38,7 +38,7 @@ hibernating, phase 2:
#include "feature/control/control.h" #include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/relay/router.h" #include "feature/relay/router.h"
#include "app/config/statefile.h" #include "app/config/statefile.h"
#include "lib/evloop/compat_libevent.h" #include "lib/evloop/compat_libevent.h"

View File

@ -20,7 +20,7 @@
#include "lib/crypt_ops/crypto_ope.h" #include "lib/crypt_ops/crypto_ope.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/relay.h" #include "core/or/relay.h"

View File

@ -20,7 +20,7 @@
#include "app/config/config.h" #include "app/config/config.h"
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/or/policies.h" #include "core/or/policies.h"
#include "feature/client/bridges.h" #include "feature/client/bridges.h"
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"

View File

@ -29,7 +29,7 @@
/* #include "feature/dircache/dirserv.h" */ /* #include "feature/dircache/dirserv.h" */
/* #include "feature/hibernate/hibernate.h" */ /* #include "feature/hibernate/hibernate.h" */
/* #include "feature/dirauth/keypin.h" */ /* #include "feature/dirauth/keypin.h" */
/* #include "core/mainloop/main.h" */ /* #include "core/mainloop/mainloop.h" */
/* #include "feature/nodelist/microdesc.h" */ /* #include "feature/nodelist/microdesc.h" */
/* #include "feature/nodelist/networkstatus.h" */ /* #include "feature/nodelist/networkstatus.h" */
/* #include "feature/nodelist/nodelist.h" */ /* #include "feature/nodelist/nodelist.h" */

View File

@ -57,7 +57,7 @@
#include "core/or/dos.h" #include "core/or/dos.h"
#include "feature/client/entrynodes.h" #include "feature/client/entrynodes.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"

View File

@ -52,7 +52,7 @@
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "feature/hs/hs_common.h" #include "feature/hs/hs_common.h"
#include "feature/hs/hs_client.h" #include "feature/hs/hs_client.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"

View File

@ -64,7 +64,7 @@
#include "app/config/config.h" #include "app/config/config.h"
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/or/policies.h" #include "core/or/policies.h"
#include "feature/client/bridges.h" #include "feature/client/bridges.h"
#include "feature/control/control.h" #include "feature/control/control.h"

View File

@ -58,7 +58,7 @@
#include "feature/control/control.h" #include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "feature/relay/dns.h" #include "feature/relay/dns.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/or/policies.h" #include "core/or/policies.h"
#include "core/or/relay.h" #include "core/or/relay.h"
#include "feature/relay/router.h" #include "feature/relay/router.h"

View File

@ -25,7 +25,7 @@
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h" #include "lib/crypt_ops/crypto_util.h"
#include "feature/relay/ext_orport.h" #include "feature/relay/ext_orport.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/proto/proto_ext_or.h" #include "core/proto/proto_ext_or.h"
#include "core/or/or_connection_st.h" #include "core/or/or_connection_st.h"

View File

@ -22,7 +22,8 @@
#include "feature/relay/dns.h" #include "feature/relay/dns.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h" #include "app/main/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/policies.h" #include "core/or/policies.h"

View File

@ -23,7 +23,7 @@
#include "feature/hs/hs_circuit.h" #include "feature/hs/hs_circuit.h"
#include "feature/hs/hs_client.h" #include "feature/hs/hs_client.h"
#include "feature/hs/hs_common.h" #include "feature/hs/hs_common.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/relay.h" #include "core/or/relay.h"

View File

@ -22,7 +22,7 @@
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"
#include "feature/hs/hs_common.h" #include "feature/hs/hs_common.h"
#include "feature/hs/hs_config.h" #include "feature/hs/hs_config.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/policies.h" #include "core/or/policies.h"

View File

@ -32,7 +32,7 @@
#define ROUTER_PRIVATE #define ROUTER_PRIVATE
#define CIRCUITSTATS_PRIVATE #define CIRCUITSTATS_PRIVATE
#define CIRCUITLIST_PRIVATE #define CIRCUITLIST_PRIVATE
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#define STATEFILE_PRIVATE #define STATEFILE_PRIVATE
#include "core/or/or.h" #include "core/or/or.h"
@ -46,7 +46,7 @@
#include "feature/rend/rendcommon.h" #include "feature/rend/rendcommon.h"
#include "feature/rend/rendcache.h" #include "feature/rend/rendcache.h"
#include "test/test.h" #include "test/test.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "lib/memarea/memarea.h" #include "lib/memarea/memarea.h"
#include "core/or/onion.h" #include "core/or/onion.h"
#include "core/crypto/onion_ntor.h" #include "core/crypto/onion_ntor.h"

View File

@ -2,7 +2,7 @@
/* See LICENSE for licensing information */ /* See LICENSE for licensing information */
#define TOR_CHANNEL_INTERNAL_ #define TOR_CHANNEL_INTERNAL_
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#define NETWORKSTATUS_PRIVATE #define NETWORKSTATUS_PRIVATE
#define TOR_TIMERS_PRIVATE #define TOR_TIMERS_PRIVATE
#include "core/or/or.h" #include "core/or/or.h"
@ -16,7 +16,7 @@
#include "lib/evloop/compat_libevent.h" #include "lib/evloop/compat_libevent.h"
#include "app/config/config.h" #include "app/config/config.h"
#include "lib/time/compat_time.h" #include "lib/time/compat_time.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "test/log_test_helpers.h" #include "test/log_test_helpers.h"
#include "lib/tls/tortls.h" #include "lib/tls/tortls.h"

View File

@ -31,7 +31,7 @@
#include "feature/relay/ext_orport.h" #include "feature/relay/ext_orport.h"
#include "feature/stats/geoip.h" #include "feature/stats/geoip.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/policies.h" #include "core/or/policies.h"

View File

@ -4,7 +4,7 @@
#include "orconfig.h" #include "orconfig.h"
#define CONNECTION_PRIVATE #define CONNECTION_PRIVATE
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#define CONNECTION_OR_PRIVATE #define CONNECTION_OR_PRIVATE
#include "core/or/or.h" #include "core/or/or.h"
@ -13,7 +13,7 @@
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "core/or/connection_edge.h" #include "core/or/connection_edge.h"
#include "feature/hs/hs_common.h" #include "feature/hs/hs_common.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h" #include "feature/nodelist/microdesc.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"

View File

@ -3,7 +3,7 @@
#define CONNECTION_PRIVATE #define CONNECTION_PRIVATE
#define EXT_ORPORT_PRIVATE #define EXT_ORPORT_PRIVATE
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#include "core/or/or.h" #include "core/or/or.h"
#include "lib/container/buffers.h" #include "lib/container/buffers.h"
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
@ -12,7 +12,7 @@
#include "feature/control/control.h" #include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "feature/relay/ext_orport.h" #include "feature/relay/ext_orport.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/or/or_connection_st.h" #include "core/or/or_connection_st.h"
@ -463,7 +463,7 @@ test_ext_or_handshake(void *arg)
memcpy(ext_or_auth_cookie, "Gliding wrapt in a brown mantle," , 32); memcpy(ext_or_auth_cookie, "Gliding wrapt in a brown mantle," , 32);
ext_or_auth_cookie_is_set = 1; ext_or_auth_cookie_is_set = 1;
init_connection_lists(); tor_init_connection_lists();
conn = or_connection_new(CONN_TYPE_EXT_OR, AF_INET); conn = or_connection_new(CONN_TYPE_EXT_OR, AF_INET);
tt_int_op(0, OP_EQ, connection_ext_or_start_auth(conn)); tt_int_op(0, OP_EQ, connection_ext_or_start_auth(conn));

View File

@ -9,7 +9,7 @@
#define ROUTERLIST_PRIVATE #define ROUTERLIST_PRIVATE
#define CONFIG_PRIVATE #define CONFIG_PRIVATE
#define CONNECTION_PRIVATE #define CONNECTION_PRIVATE
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#include "orconfig.h" #include "orconfig.h"
#include "core/or/or.h" #include "core/or/or.h"
@ -19,7 +19,7 @@
#include "app/config/confparse.h" #include "app/config/confparse.h"
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "core/or/relay.h" #include "core/or/relay.h"
#include "feature/nodelist/routerlist.h" #include "feature/nodelist/routerlist.h"
@ -217,7 +217,7 @@ test_conn_get_connection(uint8_t state, uint8_t type, uint8_t purpose)
mock_connection_connect_sockaddr); mock_connection_connect_sockaddr);
MOCK(tor_close_socket, fake_close_socket); MOCK(tor_close_socket, fake_close_socket);
init_connection_lists(); tor_init_connection_lists();
conn = connection_new(type, TEST_CONN_FAMILY); conn = connection_new(type, TEST_CONN_FAMILY);
tt_assert(conn); tt_assert(conn);

View File

@ -8,7 +8,7 @@
#define CONFIG_PRIVATE #define CONFIG_PRIVATE
#define CRYPTO_PRIVATE #define CRYPTO_PRIVATE
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#define HS_CLIENT_PRIVATE #define HS_CLIENT_PRIVATE
#define TOR_CHANNEL_INTERNAL_ #define TOR_CHANNEL_INTERNAL_
#define CIRCUITBUILD_PRIVATE #define CIRCUITBUILD_PRIVATE
@ -26,7 +26,7 @@
#include "lib/crypt_ops/crypto_dh.h" #include "lib/crypt_ops/crypto_dh.h"
#include "core/or/channeltls.h" #include "core/or/channeltls.h"
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerset.h" #include "feature/nodelist/routerset.h"

View File

@ -15,7 +15,7 @@
#define HS_SERVICE_PRIVATE #define HS_SERVICE_PRIVATE
#define HS_INTROPOINT_PRIVATE #define HS_INTROPOINT_PRIVATE
#define HS_CIRCUIT_PRIVATE #define HS_CIRCUIT_PRIVATE
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#define NETWORKSTATUS_PRIVATE #define NETWORKSTATUS_PRIVATE
#define STATEFILE_PRIVATE #define STATEFILE_PRIVATE
#define TOR_CHANNEL_INTERNAL_ #define TOR_CHANNEL_INTERNAL_
@ -49,7 +49,7 @@
#include "feature/hs/hs_circuitmap.h" #include "feature/hs/hs_circuitmap.h"
#include "feature/hs/hs_service.h" #include "feature/hs/hs_service.h"
#include "feature/hs/hs_client.h" #include "feature/hs/hs_client.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/rend/rendservice.h" #include "feature/rend/rendservice.h"
#include "app/config/statefile.h" #include "app/config/statefile.h"
#include "feature/dirauth/shared_random_state.h" #include "feature/dirauth/shared_random_state.h"

View File

@ -10,7 +10,7 @@
#include "test/log_test_helpers.h" #include "test/log_test_helpers.h"
#include "core/or/or.h" #include "core/or/or.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
static const uint64_t BILLION = 1000000000; static const uint64_t BILLION = 1000000000;

View File

@ -10,7 +10,7 @@
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "core/or/connection_or.h" #include "core/or/connection_or.h"
#include "feature/dircache/directory.h" #include "feature/dircache/directory.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "test/test.h" #include "test/test.h"
#include "feature/dircommon/dir_connection_st.h" #include "feature/dircommon/dir_connection_st.h"

View File

@ -12,7 +12,7 @@
#define ROUTERSET_PRIVATE #define ROUTERSET_PRIVATE
#include "feature/nodelist/routerset.h" #include "feature/nodelist/routerset.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "test/log_test_helpers.h" #include "test/log_test_helpers.h"
#include "lib/sandbox/sandbox.h" #include "lib/sandbox/sandbox.h"

View File

@ -9,7 +9,7 @@
#define CONFIG_PRIVATE #define CONFIG_PRIVATE
#define HS_SERVICE_PRIVATE #define HS_SERVICE_PRIVATE
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#include "test/test.h" #include "test/test.h"
#include "test/test_helpers.h" #include "test/test_helpers.h"
@ -18,7 +18,7 @@
#include "app/config/config.h" #include "app/config/config.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "feature/hs/hs_service.h" #include "feature/hs/hs_service.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "core/mainloop/periodic.h" #include "core/mainloop/periodic.h"
/** Helper function: This is replaced in some tests for the event callbacks so /** Helper function: This is replaced in some tests for the event callbacks so

View File

@ -6,7 +6,7 @@
#define RELAY_PRIVATE #define RELAY_PRIVATE
#define CIRCUITLIST_PRIVATE #define CIRCUITLIST_PRIVATE
#include "core/or/or.h" #include "core/or/or.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "app/config/config.h" #include "app/config/config.h"
#include "core/mainloop/connection.h" #include "core/mainloop/connection.h"
#include "lib/crypt_ops/crypto_cipher.h" #include "lib/crypt_ops/crypto_cipher.h"

View File

@ -9,7 +9,7 @@
#include "core/or/or.h" #include "core/or/or.h"
#include "app/config/config.h" #include "app/config/config.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/hibernate/hibernate.h" #include "feature/hibernate/hibernate.h"
#include "feature/nodelist/routerinfo_st.h" #include "feature/nodelist/routerinfo_st.h"
#include "feature/nodelist/routerlist.h" #include "feature/nodelist/routerlist.h"

View File

@ -21,7 +21,7 @@
#include "feature/stats/rephist.h" #include "feature/stats/rephist.h"
#include "core/or/relay.h" #include "core/or/relay.h"
#include "feature/relay/router.h" #include "feature/relay/router.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "app/config/statefile.h" #include "app/config/statefile.h"
#include "lib/tls/tortls.h" #include "lib/tls/tortls.h"

View File

@ -8,7 +8,7 @@
* \brief Common pieces to implement unit tests. * \brief Common pieces to implement unit tests.
**/ **/
#define MAIN_PRIVATE #define MAINLOOP_PRIVATE
#include "orconfig.h" #include "orconfig.h"
#include "core/or/or.h" #include "core/or/or.h"
#include "feature/control/control.h" #include "feature/control/control.h"
@ -20,7 +20,7 @@
#include "lib/err/backtrace.h" #include "lib/err/backtrace.h"
#include "test/test.h" #include "test/test.h"
#include "core/or/channelpadding.h" #include "core/or/channelpadding.h"
#include "core/mainloop/main.h" #include "core/mainloop/mainloop.h"
#include "lib/compress/compress.h" #include "lib/compress/compress.h"
#include "lib/evloop/compat_libevent.h" #include "lib/evloop/compat_libevent.h"
#include "lib/crypt_ops/crypto_init.h" #include "lib/crypt_ops/crypto_init.h"