aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/channeltls.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-09-18 10:03:57 -0400
committerNick Mathewson <nickm@torproject.org>2020-09-18 10:03:57 -0400
commit781ab9eea49b07b1925d7d8dcbad06348896344e (patch)
tree6a5ec10c59617467e25863fb911689625f2467dd /src/core/or/channeltls.c
parent404c224c711714f014288c79257c4bfd3880905c (diff)
downloadtor-781ab9eea49b07b1925d7d8dcbad06348896344e.tar.gz
tor-781ab9eea49b07b1925d7d8dcbad06348896344e.zip
Add flag for whether an OR conn "counts" for bootstrap tracking
We set this flag if we've launched the connection in order to satisfy an origin circuit, or when we decide the connection _would_ satisfy an origin circuit. These are the only or_connections we want to consider for bootstrapping: other or_connections are opened because of client EXTEND requests, and they may succeed or fail because of the clients' confusion or misconfiguration. Closes #25061.
Diffstat (limited to 'src/core/or/channeltls.c')
-rw-r--r--src/core/or/channeltls.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index a0debf8d22..2c52c07bb5 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -360,6 +360,28 @@ channel_tls_handle_incoming(or_connection_t *orconn)
return chan;
}
+/**
+ * Set the `potentially_used_for_bootstrapping` flag on the or_connection_t
+ * corresponding to the provided channel.
+ *
+ * This flag indicates that if the connection fails, it might be interesting
+ * to the bootstrapping subsystem.
+ **/
+void
+channel_mark_as_used_for_origin_circuit(channel_t *chan)
+{
+ if (BUG(!chan))
+ return;
+ if (chan->magic != TLS_CHAN_MAGIC)
+ return;
+ channel_tls_t *tlschan = channel_tls_from_base(chan);
+ if (BUG(!tlschan))
+ return;
+
+ if (tlschan->conn)
+ tlschan->conn->potentially_used_for_bootstrapping = 1;
+}
+
/*********
* Casts *
********/