summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-05-30 16:14:45 -0400
committerNick Mathewson <nickm@torproject.org>2011-05-30 16:14:45 -0400
commitd0e7c545bacb45921569bf2236cc49d510530af4 (patch)
tree2acd00b46ce356f901661ad7bd07fdb430741c49 /src/or
parentd274f539e5ae8ffe50f2bb364c3a3b64e3920e9c (diff)
parente035cea0318add5cf8ed8d8f1c518a26434cbeda (diff)
downloadtor-d0e7c545bacb45921569bf2236cc49d510530af4.tar.gz
tor-d0e7c545bacb45921569bf2236cc49d510530af4.zip
Merge remote-tracking branch 'origin/maint-0.2.2'
Diffstat (limited to 'src/or')
-rw-r--r--src/or/connection.c26
-rw-r--r--src/or/router.c7
2 files changed, 25 insertions, 8 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 364816af8f..f59b36ab9d 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2006,37 +2006,40 @@ retry_all_listeners(smartlist_t *replaced_conns,
smartlist_t *new_conns)
{
or_options_t *options = get_options();
+ int retval = 0;
+ const uint16_t old_or_port = router_get_advertised_or_port(options);
+ const uint16_t old_dir_port = router_get_advertised_dir_port(options);
if (retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress,
options->ORPort, "0.0.0.0",
replaced_conns, new_conns, options->ClientOnly,
AF_INET)<0)
- return -1;
+ retval = -1;
if (retry_listeners(CONN_TYPE_DIR_LISTENER, options->DirListenAddress,
options->DirPort, "0.0.0.0",
replaced_conns, new_conns, options->ClientOnly,
AF_INET)<0)
- return -1;
+ retval = -1;
if (retry_listeners(CONN_TYPE_AP_LISTENER, options->SocksListenAddress,
options->SocksPort, "127.0.0.1",
replaced_conns, new_conns, 0,
AF_INET)<0)
- return -1;
+ retval = -1;
if (retry_listeners(CONN_TYPE_AP_TRANS_LISTENER, options->TransListenAddress,
options->TransPort, "127.0.0.1",
replaced_conns, new_conns, 0,
AF_INET)<0)
- return -1;
+ retval = -1;
if (retry_listeners(CONN_TYPE_AP_NATD_LISTENER, options->NATDListenAddress,
options->NATDPort, "127.0.0.1",
replaced_conns, new_conns, 0,
AF_INET)<0)
- return -1;
+ retval = -1;
if (retry_listeners(CONN_TYPE_AP_DNS_LISTENER, options->DNSListenAddress,
options->DNSPort, "127.0.0.1",
replaced_conns, new_conns, 0,
AF_INET)<0)
- return -1;
+ retval = -1;
if (retry_listeners(CONN_TYPE_CONTROL_LISTENER,
options->ControlListenAddress,
options->ControlPort, "127.0.0.1",
@@ -2050,7 +2053,16 @@ retry_all_listeners(smartlist_t *replaced_conns,
AF_UNIX)<0)
return -1;
- return 0;
+ if (old_or_port != router_get_advertised_or_port(options) ||
+ old_dir_port != router_get_advertised_dir_port(options)) {
+ /* Our chosen ORPort or DirPort is not what it used to be: the
+ * descriptor we had (if any) should be regenerated. (We won't
+ * automatically notice this because of changes in the option,
+ * since the value could be "auto".) */
+ mark_my_descriptor_dirty("Chosen Or/DirPort changed");
+ }
+
+ return retval;
}
/** Return 1 if we should apply rate limiting to <b>conn</b>,
diff --git a/src/or/router.c b/src/or/router.c
index 73fabefb33..a7879635c4 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -805,6 +805,8 @@ decide_to_advertise_dirport(or_options_t *options, uint16_t dir_port)
return 0;
if (!check_whether_dirport_reachable())
return 0;
+ if (!router_get_advertised_dir_port(options))
+ return 0;
/* Section two: reasons to publish or not publish that the user
* might find surprising. These are generally config options that
@@ -1142,6 +1144,8 @@ decide_if_publishable_server(void)
return 0;
if (authdir_mode(options))
return 1;
+ if (!router_get_advertised_or_port(options))
+ return 0;
return check_whether_orport_reachable();
}
@@ -1421,7 +1425,8 @@ router_rebuild_descriptor(int force)
if (desc_clean_since && !force)
return 0;
- if (router_pick_published_address(options, &addr) < 0) {
+ if (router_pick_published_address(options, &addr) < 0 ||
+ router_get_advertised_or_port(options) == 0) {
/* Stop trying to rebuild our descriptor every second. We'll
* learn that it's time to try again when ip_address_changed()
* marks it dirty. */