summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2017-03-02 15:14:45 +1100
committerNick Mathewson <nickm@torproject.org>2017-03-07 08:04:57 -0500
commit93ede051c2e11326203879f9ce42a50357e0b348 (patch)
tree50bdd0d9648c7a894a57eb1c88a07ec4c05bd60e
parent75492598b2fa595c25c41212d3b2714e59efdcc2 (diff)
downloadtor-93ede051c2e11326203879f9ce42a50357e0b348.tar.gz
tor-93ede051c2e11326203879f9ce42a50357e0b348.zip
Remove delay in hidden service introduction point checks
Make hidden services with 8 to 10 introduction points check for failed circuits immediately after startup. Previously, they would wait for 5 minutes before performing their first checks. Fixes bug 21594; bugfix on commit 190aac0eab9 in Tor 0.2.3.9-alpha. Reported by alecmuffett.
-rw-r--r--changes/bug215945
-rw-r--r--src/or/rendservice.c18
2 files changed, 19 insertions, 4 deletions
diff --git a/changes/bug21594 b/changes/bug21594
new file mode 100644
index 0000000000..e624d1226d
--- /dev/null
+++ b/changes/bug21594
@@ -0,0 +1,5 @@
+ o Minor bugfixes (hidden services):
+ - Make hidden services with 8 to 10 introduction points check for failed
+ circuits immediately after startup. Previously, they would wait for 5
+ minutes before performing their first checks. Fixes bug 21594; bugfix on
+ commit 190aac0eab9 in Tor 0.2.3.9-alpha. Reported by alecmuffett.
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 4d04da02aa..f0de3861ce 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -105,9 +105,6 @@ struct rend_service_port_config_s {
/** If we can't build our intro circuits, don't retry for this long. */
#define INTRO_CIRC_RETRY_PERIOD (60*5)
-/** Don't try to build more than this many circuits before giving up
- * for a while.*/
-#define MAX_INTRO_CIRCS_PER_PERIOD 10
/** How many times will a hidden service operator attempt to connect to
* a requested rendezvous point before giving up? */
#define MAX_REND_FAILURES 1
@@ -3886,6 +3883,18 @@ rend_service_desc_has_uploaded(const rend_data_t *rend_data)
} SMARTLIST_FOREACH_END(intro);
}
+/** Don't try to build more than this many circuits before giving up
+ * for a while. Dynamically calculated based on the configured number of
+ * introduction points for the service, n_intro_points_wanted. */
+static int
+rend_max_intro_circs_per_period(unsigned int n_intro_points_wanted)
+{
+ /* Allow all but one of the initial connections to fail and be
+ * retried. (If all fail, we *want* to wait, because something is broken.) */
+ tor_assert(n_intro_points_wanted <= NUM_INTRO_POINTS_MAX);
+ return (int)(2*n_intro_points_wanted + NUM_INTRO_POINTS_EXTRA);
+}
+
/** For every service, check how many intro points it currently has, and:
* - Invalidate introdution points based on specific criteria, see
* remove_invalid_intro_points comments.
@@ -3937,7 +3946,8 @@ rend_consider_services_intro_points(void)
service->intro_period_started = now;
service->n_intro_circuits_launched = 0;
} else if (service->n_intro_circuits_launched >=
- MAX_INTRO_CIRCS_PER_PERIOD) {
+ rend_max_intro_circs_per_period(
+ service->n_intro_points_wanted)) {
/* We have failed too many times in this period; wait for the next
* one before we try again. */
continue;