aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-05-03 18:29:44 +0000
committerRoger Dingledine <arma@torproject.org>2006-05-03 18:29:44 +0000
commite24e5475fb259c560b32c4ad058616503bc42736 (patch)
treeb6b041e619d6bf151b86e1c11f19a0fa8f85d5eb /src
parent821a3963fa328c3a15ae49cf138cc1f5d1d71681 (diff)
downloadtor-e24e5475fb259c560b32c4ad058616503bc42736.tar
tor-e24e5475fb259c560b32c4ad058616503bc42736.tar.gz
forward-port the ORPort==0 patch
svn:r6430
Diffstat (limited to 'src')
-rw-r--r--src/or/connection.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 0c18735e1..3135c6158 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -855,7 +855,8 @@ static int
retry_listeners(int type, config_line_t *cfg,
int port_option, const char *default_addr, int force,
smartlist_t *replaced_conns,
- smartlist_t *new_conns)
+ smartlist_t *new_conns,
+ int never_open_conns)
{
smartlist_t *launch = smartlist_create();
int free_launch_elts = 1;
@@ -935,17 +936,19 @@ retry_listeners(int type, config_line_t *cfg,
/* Now open all the listeners that are configured but not opened. */
i = 0;
- SMARTLIST_FOREACH(launch, config_line_t *, cfg,
- {
- conn = connection_create_listener(cfg->value, (uint16_t) port_option,
- type);
- if (!conn) {
- i = -1;
- } else {
- if (new_conns)
- smartlist_add(new_conns, conn);
- }
- });
+ if (!never_open_conns) {
+ SMARTLIST_FOREACH(launch, config_line_t *, cfg,
+ {
+ conn = connection_create_listener(cfg->value, (uint16_t) port_option,
+ type);
+ if (!conn) {
+ i = -1;
+ } else {
+ if (new_conns)
+ smartlist_add(new_conns, conn);
+ }
+ });
+ }
if (free_launch_elts) {
SMARTLIST_FOREACH(launch, config_line_t *, cfg,
@@ -970,23 +973,22 @@ retry_all_listeners(int force, smartlist_t *replaced_conns,
{
or_options_t *options = get_options();
- if (server_mode(options) &&
- retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress,
+ if (retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress,
options->ORPort, "0.0.0.0", force,
- replaced_conns, new_conns)<0)
+ replaced_conns, new_conns, options->ClientOnly)<0)
return -1;
if (retry_listeners(CONN_TYPE_DIR_LISTENER, options->DirListenAddress,
options->DirPort, "0.0.0.0", force,
- replaced_conns, new_conns)<0)
+ replaced_conns, new_conns, 0)<0)
return -1;
if (retry_listeners(CONN_TYPE_AP_LISTENER, options->SocksListenAddress,
options->SocksPort, "127.0.0.1", force,
- replaced_conns, new_conns)<0)
+ replaced_conns, new_conns, 0)<0)
return -1;
if (retry_listeners(CONN_TYPE_CONTROL_LISTENER,
options->ControlListenAddress,
options->ControlPort, "127.0.0.1", force,
- replaced_conns, new_conns)<0)
+ replaced_conns, new_conns, 0)<0)
return -1;
return 0;