diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-06-03 23:08:07 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-06-03 23:08:07 +0000 |
commit | 6d447e04a23bdcb368151edd08393e6a028277b9 (patch) | |
tree | 243740493cbe91003b6a599a9f9e48b05d1a2a72 | |
parent | d3ee41619cae00085f555e92ca0a94816a3f69e8 (diff) | |
download | tor-6d447e04a23bdcb368151edd08393e6a028277b9.tar.gz tor-6d447e04a23bdcb368151edd08393e6a028277b9.zip |
r13189@catbus: nickm | 2007-06-03 19:08:01 -0400
Oops. Only bind ports and start libevent if we are actually running Tor.
svn:r10474
-rw-r--r-- | src/or/config.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/or/config.c b/src/or/config.c index 2d0b29538e..19265965f5 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -811,27 +811,29 @@ options_act_reversible(or_options_t *old_options, char **msg) start_daemon(); } - /* We need to set the connection limit before we can open the listeners. */ - options->_ConnLimit = - set_max_file_descriptors((unsigned)options->ConnLimit, MAXCONNECTIONS); - if (options->_ConnLimit < 0) { - *msg = tor_strdup("Problem with ConnLimit value. See logs for details."); - goto rollback; - } - set_conn_limit = 1; + if (running_tor) { + /* We need to set the connection limit before we can open the listeners. */ + options->_ConnLimit = + set_max_file_descriptors((unsigned)options->ConnLimit, MAXCONNECTIONS); + if (options->_ConnLimit < 0) { + *msg = tor_strdup("Problem with ConnLimit value. See logs for details."); + goto rollback; + } + set_conn_limit = 1; - /* Set up libevent. (We need to do this before we can register the - * listeners as listeners.) */ - if (running_tor && !libevent_initialized) { - init_libevent(); - libevent_initialized = 1; - } + /* Set up libevent. (We need to do this before we can register the + * listeners as listeners.) */ + if (running_tor && !libevent_initialized) { + init_libevent(); + libevent_initialized = 1; + } - /* Launch the listeners. (We do this before we setuid, so we can bind to - * ports under 1024.) */ - if (retry_all_listeners(0, replaced_listeners, new_listeners) < 0) { - *msg = tor_strdup("Failed to bind one of the listener ports."); - goto rollback; + /* Launch the listeners. (We do this before we setuid, so we can bind to + * ports under 1024.) */ + if (retry_all_listeners(0, replaced_listeners, new_listeners) < 0) { + *msg = tor_strdup("Failed to bind one of the listener ports."); + goto rollback; + } } /* Setuid/setgid as appropriate */ @@ -857,7 +859,7 @@ options_act_reversible(or_options_t *old_options, char **msg) /* Bail out at this point if we're not going to be a client or server: * we don't run Tor itself. */ - if (options->command != CMD_RUN_TOR) + if (!running_tor) goto commit; mark_logs_temp(); /* Close current logs once new logs are open. */ |