[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Break tor_main into startup/loop/shutdown portions, to make...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] Break tor_main into startup/loop/shutdown portions, to make...
- From: nickm@seul.org (Nick Mathewson)
- Date: Sat, 12 Jun 2004 15:45:48 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 12 Jun 2004 15:45:54 -0400
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv25191/src/or
Modified Files:
main.c
Log Message:
Break tor_main into startup/loop/shutdown portions, to make NT service refactoring possible.
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.281
retrieving revision 1.282
diff -u -d -r1.281 -r1.282
--- main.c 6 Jun 2004 03:38:31 -0000 1.281
+++ main.c 12 Jun 2004 19:45:46 -0000 1.282
@@ -870,7 +870,7 @@
/** 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 @@
if (network_init()<0) {
log_fn(LOG_ERR,"Error initializing network; exiting.");
- return 1;
+ return -1;
}
atexit(exit_function);
@@ -915,8 +915,18 @@
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;
}