diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-01-13 21:32:08 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-01-13 21:32:08 +0000 |
commit | a38bccdca712be6263f11ccffca862f0ff9e6476 (patch) | |
tree | 1b38f6d2c38b04598aa8da656e95998140e28d8c /src/or/config.c | |
parent | 0aff4ff4cbce21c5d85a0a0a75aea86b4c9842df (diff) | |
download | tor-a38bccdca712be6263f11ccffca862f0ff9e6476.tar.gz tor-a38bccdca712be6263f11ccffca862f0ff9e6476.zip |
Move call to event_init() immediately after start_daemon(); move start_daemon earlier. This should fix using libevent with RunAsDaemon.
svn:r3354
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/or/config.c b/src/or/config.c index 63e586c3e3..ca756a4364 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -245,6 +245,18 @@ int options_act(void) { struct config_line_t *cl; or_options_t *options = get_options(); + static int libevent_initialized = 0; + + /* XXXX009 We once had a reason to separate start_daemon and finish_daemon: + * It let us have the parent process stick around until we were sure Tor + * was started. Should we make start_daemon get called earlier? -NM */ + if (options->RunAsDaemon) { + start_daemon(options->DataDirectory); + } + if (!libevent_initialized) { + event_init(); + libevent_initialized = 1; + } clear_trusted_dir_servers(); for (cl = options->DirServers; cl; cl = cl->next) { @@ -302,13 +314,6 @@ options_act(void) { /* Start backgrounding the process, if requested. */ - /* XXXX009 We once had a reason to separate start_daemon and finish_daemon: - * It let us have the parent process stick around until we were sure Tor - * was started. Should we make start_daemon get called earlier? -NM */ - if (options->RunAsDaemon) { - start_daemon(options->DataDirectory); - } - /* Finish backgrounding the process */ if (options->RunAsDaemon) { /* We may be calling this for the n'th time (on SIGHUP), but it's safe. */ |