diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-11-02 11:11:21 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-11-05 09:22:02 -0500 |
commit | cfe5b35edb38cef6312ef0b4ae44fb0e20342706 (patch) | |
tree | 7a4d37f58a5ecd05255efcd138bc34271dc8df9f /src/app/main | |
parent | 05b54f6a6a24ebdb47de4f7e41cf94f2f6be93bd (diff) | |
download | tor-cfe5b35edb38cef6312ef0b4ae44fb0e20342706.tar.gz tor-cfe5b35edb38cef6312ef0b4ae44fb0e20342706.zip |
Move networking startup/cleanup logic into a subsystem.
Diffstat (limited to 'src/app/main')
-rw-r--r-- | src/app/main/main.c | 19 | ||||
-rw-r--r-- | src/app/main/subsystem_list.c | 2 |
2 files changed, 2 insertions, 19 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c index 5740efb0b6..3e80725b9a 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -427,18 +427,6 @@ dumpstats(int severity) rend_service_dump_stats(severity); } -/** Called by exit() as we shut down the process. - */ -static void -exit_function(void) -{ - /* NOTE: If we ever daemonize, this gets called immediately. That's - * okay for now, because we only use this on Windows. */ -#ifdef _WIN32 - WSACleanup(); -#endif -} - #ifdef _WIN32 #define UNIX_ONLY 0 #else @@ -632,12 +620,6 @@ tor_init(int argc, char *argv[]) rust_log_welcome_string(); #endif /* defined(HAVE_RUST) */ - if (network_init()<0) { - log_err(LD_BUG,"Error initializing network; exiting."); - return -1; - } - atexit(exit_function); - int init_rv = options_init_from_torrc(argc,argv); if (init_rv < 0) { log_err(LD_CONFIG,"Reading config failed--see warnings above."); @@ -784,7 +766,6 @@ tor_free_all(int postfork) routerparse_free_all(); ext_orport_free_all(); control_free_all(); - tor_free_getaddrinfo_cache(); protover_free_all(); bridges_free_all(); consdiffmgr_free_all(); diff --git a/src/app/main/subsystem_list.c b/src/app/main/subsystem_list.c index 3d03a9a4df..cb186c14d9 100644 --- a/src/app/main/subsystem_list.c +++ b/src/app/main/subsystem_list.c @@ -10,6 +10,7 @@ #include "lib/err/torerr_sys.h" #include "lib/log/log_sys.h" +#include "lib/net/network_sys.h" #include "lib/process/winprocess_sys.h" #include "lib/thread/thread_sys.h" #include "lib/wallclock/wallclock_sys.h" @@ -25,6 +26,7 @@ const subsys_fns_t *tor_subsystems[] = { &sys_wallclock, &sys_threads, &sys_logging, + &sys_network, }; const unsigned n_tor_subsystems = ARRAY_LENGTH(tor_subsystems); |