[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] forward-port the ORPort==0 patch
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
connection.c
Log Message:
forward-port the ORPort==0 patch
Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.449
retrieving revision 1.450
diff -u -p -d -r1.449 -r1.450
--- connection.c 1 Apr 2006 10:22:57 -0000 1.449
+++ connection.c 3 May 2006 18:29:44 -0000 1.450
@@ -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
/* 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
{
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;