[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Integrate new daemon code, adapted from submission by chris...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] Integrate new daemon code, adapted from submission by chris...
- From: nickm@seul.org (Nick Mathewson)
- Date: Sat, 3 Jan 2004 17:40:51 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 03 Jan 2004 17:41:14 -0500
- 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-serv6366/src/or
Modified Files:
main.c
Log Message:
Integrate new daemon code, adapted from submission by christian grothoff
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- main.c 23 Dec 2003 07:42:01 -0000 1.160
+++ main.c 3 Jan 2004 22:40:49 -0000 1.161
@@ -396,8 +396,6 @@
}
static int init_from_config(int argc, char **argv) {
- static int have_daemonized=0;
-
if(getconfig(argc,argv,&options)) {
log_fn(LOG_ERR,"Reading config failed. For usage, try -h.");
return -1;
@@ -424,9 +422,9 @@
}
}
- if(options.RunAsDaemon && !have_daemonized) {
- daemonize();
- have_daemonized = 1;
+ if(options.RunAsDaemon) {
+ /* XXXX Can we delay this any more? */
+ finish_daemon();
}
/* write our pid to the pid file, if we do not have write permissions we will log a warning */
@@ -633,6 +631,10 @@
if (init_from_config(argc,argv) < 0)
return -1;
+ if (options.RunAsDaemon) {
+ start_daemon();
+ }
+
if(options.ORPort) { /* only spawn dns handlers if we're a router */
dns_init(); /* initialize the dns resolve tree, and spawn workers */
}