mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-20 21:16:22 +02:00
Break tor_main into startup/loop/shutdown portions, to make NT service refactoring possible.
svn:r1965
This commit is contained in:
parent
23c1a72c4c
commit
125b351970
@ -870,7 +870,7 @@ void exit_function(void)
|
||||
|
||||
/** Main entry point for the Tor command-line client.
|
||||
*/
|
||||
int tor_main(int argc, char *argv[]) {
|
||||
int tor_init(int argc, char *argv[]) {
|
||||
|
||||
/* give it somewhere to log to initially */
|
||||
add_temp_log();
|
||||
@ -878,7 +878,7 @@ int tor_main(int argc, char *argv[]) {
|
||||
|
||||
if (network_init()<0) {
|
||||
log_fn(LOG_ERR,"Error initializing network; exiting.");
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
atexit(exit_function);
|
||||
|
||||
@ -915,8 +915,18 @@ int tor_main(int argc, char *argv[]) {
|
||||
|
||||
crypto_global_init();
|
||||
crypto_seed_rng();
|
||||
do_main_loop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tor_cleanup(void) {
|
||||
crypto_global_cleanup();
|
||||
}
|
||||
|
||||
int tor_main(int argc, char *argv[]) {
|
||||
if (tor_init(argc, argv)<0)
|
||||
return -1;
|
||||
do_main_loop();
|
||||
tor_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user