aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuituse.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-06-29 15:00:59 -0400
committerMicah Elizabeth Scott <beth@torproject.org>2023-05-10 07:37:11 -0700
commitc2f6b057b88ea3ee4d3a4a86ec198775d50c6d4c (patch)
tree30ad80d29a82d020771d90df8d86f8b6f6dd69ce /src/core/or/circuituse.c
parent35227a7a15dd1ff2e993c21b2a5da8d6498c0a3e (diff)
downloadtor-c2f6b057b88ea3ee4d3a4a86ec198775d50c6d4c.tar.gz
tor-c2f6b057b88ea3ee4d3a4a86ec198775d50c6d4c.zip
hs: Don't expire RP circuits to HS with PoW
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/or/circuituse.c')
-rw-r--r--src/core/or/circuituse.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 6956cf9849..d5879a21eb 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -564,6 +564,14 @@ circuit_expire_building(void)
continue;
}
+ /* Ignore circuits that are waiting for an introduction to a service with
+ * PoW enabled, it can take an arbitrary amount of time. They will get
+ * cleaned up if the SOCKS connection is closed. */
+ if (TO_ORIGIN_CIRCUIT(victim)->hs_with_pow_circ &&
+ victim->purpose == CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) {
+ continue;
+ }
+
build_state = TO_ORIGIN_CIRCUIT(victim)->build_state;
if (build_state && build_state->onehop_tunnel)
cutoff = begindir_cutoff;
@@ -2841,8 +2849,10 @@ connection_ap_handshake_attach_circuit(entry_connection_t *conn)
conn_age = (int)(time(NULL) - base_conn->timestamp_created);
- /* Is this connection so old that we should give up on it? */
- if (conn_age >= get_options()->SocksTimeout) {
+ /* Is this connection so old that we should give up on it? Don't timeout if
+ * this is a connection to an HS with PoW enabled because it can take an
+ * arbitrary amount of time. */
+ if (conn_age >= get_options()->SocksTimeout && !conn->hs_with_pow_conn) {
int severity = (tor_addr_is_null(&base_conn->addr) && !base_conn->port) ?
LOG_INFO : LOG_NOTICE;
log_fn(severity, LD_APP,