aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRobert Ransom <rransom.8774@gmail.com>2011-12-24 00:46:37 -0800
committerRobert Ransom <rransom.8774@gmail.com>2011-12-27 08:02:43 -0800
commit078e3e9dd59520b7f40a126a91e89eba91098c49 (patch)
treef93fd2aeb654cd995a6ef693be2b9e7831c8fa61 /src/or
parent4b13c33c0c18c66cc39caba9b70005bbe43c6613 (diff)
downloadtor-078e3e9dd59520b7f40a126a91e89eba91098c49.tar
tor-078e3e9dd59520b7f40a126a91e89eba91098c49.tar.gz
Add an option to close 'almost-connected' HS client circs on timeout
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuituse.c14
-rw-r--r--src/or/config.c1
-rw-r--r--src/or/or.h5
3 files changed, 14 insertions, 6 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 58d8aa6dc..d9d95bc68 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -511,16 +511,18 @@ circuit_expire_building(void)
}
}
- /* If this is a hidden-service circuit which is far enough along
- * in connecting to its destination, and we haven't already
- * flagged it as 'timed out', flag it as 'timed out' so we'll
- * launch another intro or rend circ, but don't mark it for close
- * yet.
+ /* If this is a hidden service client circuit which is far enough
+ * along in connecting to its destination, and we haven't already
+ * flagged it as 'timed out', and the user has not told us to
+ * close such circs immediately on timeout, flag it as 'timed out'
+ * so we'll launch another intro or rend circ, but don't mark it
+ * for close yet.
*
* (Circs flagged as 'timed out' are given a much longer timeout
* period above, so we won't close them in the next call to
* circuit_expire_building.) */
- if (!(TO_ORIGIN_CIRCUIT(victim)->hs_circ_has_timed_out)) {
+ if (!(options->CloseHSClientCircuitsImmediatelyOnTimeout) &&
+ !(TO_ORIGIN_CIRCUIT(victim)->hs_circ_has_timed_out)) {
switch (victim->purpose) {
case CIRCUIT_PURPOSE_C_REND_READY:
/* We only want to spare a rend circ if it has been specified in
diff --git a/src/or/config.c b/src/or/config.c
index 521f76005..3374459b4 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -306,6 +306,7 @@ static config_var_t _option_vars[] = {
V(HidServAuth, LINELIST, NULL),
V(HSAuthoritativeDir, BOOL, "0"),
OBSOLETE("HSAuthorityRecordStats"),
+ V(CloseHSClientCircuitsImmediatelyOnTimeout, BOOL, "0"),
V(HTTPProxy, STRING, NULL),
V(HTTPProxyAuthenticator, STRING, NULL),
V(HTTPSProxy, STRING, NULL),
diff --git a/src/or/or.h b/src/or/or.h
index 63eb64c81..d84f04b25 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3057,6 +3057,11 @@ typedef struct {
* circuits.) */
int Tor2webMode;
+ /** Close hidden service client circuits immediately when they reach
+ * the normal circuit-build timeout, even if they have already sent
+ * an INTRODUCE1 cell on its way to the service. */
+ int CloseHSClientCircuitsImmediatelyOnTimeout;
+
int ConnLimit; /**< Demanded minimum number of simultaneous connections. */
int _ConnLimit; /**< Maximum allowed number of simultaneous connections. */
int RunAsDaemon; /**< If true, run in the background. (Unix only) */