Commit c7ce6b98 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

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.
parent 98ef3e82
......@@ -2,7 +2,7 @@
/* See LICENSE for licensing information */
#define TOR_CHANNEL_INTERNAL_
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#define NETWORKSTATUS_PRIVATE
#define TOR_TIMERS_PRIVATE
#include "core/or/or.h"
......@@ -16,7 +16,7 @@
#include "lib/evloop/compat_libevent.h"
#include "app/config/config.h"
#include "lib/time/compat_time.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h"
#include "test/log_test_helpers.h"
#include "lib/tls/tortls.h"
......
......@@ -31,7 +31,7 @@
#include "feature/relay/ext_orport.h"
#include "feature/stats/geoip.h"
#include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
#include "core/or/policies.h"
......
......@@ -4,7 +4,7 @@
#include "orconfig.h"
#define CONNECTION_PRIVATE
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#define CONNECTION_OR_PRIVATE
#include "core/or/or.h"
......@@ -13,7 +13,7 @@
#include "core/mainloop/connection.h"
#include "core/or/connection_edge.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/nodelist.h"
#include "feature/nodelist/networkstatus.h"
......
......@@ -3,7 +3,7 @@
#define CONNECTION_PRIVATE
#define EXT_ORPORT_PRIVATE
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "core/mainloop/connection.h"
......@@ -12,7 +12,7 @@
#include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "feature/relay/ext_orport.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.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);
ext_or_auth_cookie_is_set = 1;
init_connection_lists();
tor_init_connection_lists();
conn = or_connection_new(CONN_TYPE_EXT_OR, AF_INET);
tt_int_op(0, OP_EQ, connection_ext_or_start_auth(conn));
......
......@@ -9,7 +9,7 @@
#define ROUTERLIST_PRIVATE
#define CONFIG_PRIVATE
#define CONNECTION_PRIVATE
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#include "orconfig.h"
#include "core/or/or.h"
......@@ -19,7 +19,7 @@
#include "app/config/confparse.h"
#include "core/mainloop/connection.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/nodelist.h"
#include "core/or/relay.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(tor_close_socket, fake_close_socket);
init_connection_lists();
tor_init_connection_lists();
conn = connection_new(type, TEST_CONN_FAMILY);
tt_assert(conn);
......
......@@ -8,7 +8,7 @@
#define CONFIG_PRIVATE
#define CRYPTO_PRIVATE
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#define HS_CLIENT_PRIVATE
#define TOR_CHANNEL_INTERNAL_
#define CIRCUITBUILD_PRIVATE
......@@ -26,7 +26,7 @@
#include "lib/crypt_ops/crypto_dh.h"
#include "core/or/channeltls.h"
#include "feature/dircache/directory.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerset.h"
......
......@@ -15,7 +15,7 @@
#define HS_SERVICE_PRIVATE
#define HS_INTROPOINT_PRIVATE
#define HS_CIRCUIT_PRIVATE
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#define NETWORKSTATUS_PRIVATE
#define STATEFILE_PRIVATE
#define TOR_CHANNEL_INTERNAL_
......@@ -49,7 +49,7 @@
#include "feature/hs/hs_circuitmap.h"
#include "feature/hs/hs_service.h"
#include "feature/hs/hs_client.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/rend/rendservice.h"
#include "app/config/statefile.h"
#include "feature/dirauth/shared_random_state.h"
......
......@@ -10,7 +10,7 @@
#include "test/log_test_helpers.h"
#include "core/or/or.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
static const uint64_t BILLION = 1000000000;
......
......@@ -10,7 +10,7 @@
#include "core/mainloop/connection.h"
#include "core/or/connection_or.h"
#include "feature/dircache/directory.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "test/test.h"
#include "feature/dircommon/dir_connection_st.h"
......
......@@ -12,7 +12,7 @@
#define ROUTERSET_PRIVATE
#include "feature/nodelist/routerset.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "test/log_test_helpers.h"
#include "lib/sandbox/sandbox.h"
......
......@@ -9,7 +9,7 @@
#define CONFIG_PRIVATE
#define HS_SERVICE_PRIVATE
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#include "test/test.h"
#include "test/test_helpers.h"
......@@ -18,7 +18,7 @@
#include "app/config/config.h"
#include "feature/hibernate/hibernate.h"
#include "feature/hs/hs_service.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "core/mainloop/periodic.h"
/** Helper function: This is replaced in some tests for the event callbacks so
......
......@@ -6,7 +6,7 @@
#define RELAY_PRIVATE
#define CIRCUITLIST_PRIVATE
#include "core/or/or.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "lib/crypt_ops/crypto_cipher.h"
......
......@@ -9,7 +9,7 @@
#include "core/or/or.h"
#include "app/config/config.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/hibernate/hibernate.h"
#include "feature/nodelist/routerinfo_st.h"
#include "feature/nodelist/routerlist.h"
......
......@@ -21,7 +21,7 @@
#include "feature/stats/rephist.h"
#include "core/or/relay.h"
#include "feature/relay/router.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/nodelist.h"
#include "app/config/statefile.h"
#include "lib/tls/tortls.h"
......
......@@ -8,7 +8,7 @@
* \brief Common pieces to implement unit tests.
**/
#define MAIN_PRIVATE
#define MAINLOOP_PRIVATE
#include "orconfig.h"
#include "core/or/or.h"
#include "feature/control/control.h"
......@@ -20,7 +20,7 @@
#include "lib/err/backtrace.h"
#include "test/test.h"
#include "core/or/channelpadding.h"
#include "core/mainloop/main.h"
#include "core/mainloop/mainloop.h"
#include "lib/compress/compress.h"
#include "lib/evloop/compat_libevent.h"
#include "lib/crypt_ops/crypto_init.h"
......
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