aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/channel.c
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-04-06 19:11:17 +1000
committerteor <teor@torproject.org>2020-04-09 11:00:04 +1000
commit8f3cbe755bc6817a164fe59b5ed1916a1c71fb5b (patch)
tree00b515979e3cda07d376adbc895e381271fdde40 /src/core/or/channel.c
parent7bc34133225c38b8ababbf9ff4c220285e65b1ef (diff)
downloadtor-8f3cbe755bc6817a164fe59b5ed1916a1c71fb5b.tar.gz
tor-8f3cbe755bc6817a164fe59b5ed1916a1c71fb5b.zip
channel: Rewrite the channel_get_for_extend() comments
Explain what the function does now. Fix some typos. Part of 33633.
Diffstat (limited to 'src/core/or/channel.c')
-rw-r--r--src/core/or/channel.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/core/or/channel.c b/src/core/or/channel.c
index 160ab587f5..542b4d88bb 100644
--- a/src/core/or/channel.c
+++ b/src/core/or/channel.c
@@ -2360,12 +2360,15 @@ channel_is_better(channel_t *a, channel_t *b)
/**
* Get a channel to extend a circuit.
*
- * Pick a suitable channel to extend a circuit to given the desired digest
- * the address we believe is correct for that digest; this tries to see
- * if we already have one for the requested endpoint, but if there is no good
- * channel, set *msg_out to a message describing the channel's state
- * and our next action, and set *launch_out to a boolean indicated whether
- * the caller should try to launch a new channel with channel_connect().
+ * Given the desired relay identity, pick a suitable channel to extend a
+ * circuit to the target address requsted by the client. Search for an
+ * existing channel for the requested endpoint. Make sure the channel is
+ * usable for new circuits, and matches the target address.
+ *
+ * Try to return the best channel. But if there is no good channel, set
+ * *msg_out to a message describing the channel's state and our next action,
+ * and set *launch_out to a boolean indicated whether the caller should try to
+ * launch a new channel with channel_connect().
*/
channel_t *
channel_get_for_extend(const char *rsa_id_digest,
@@ -2383,9 +2386,7 @@ channel_get_for_extend(const char *rsa_id_digest,
chan = channel_find_by_remote_identity(rsa_id_digest, ed_id);
- /* Walk the list, unrefing the old one and refing the new at each
- * iteration.
- */
+ /* Walk the list of channels */
for (; chan; chan = channel_next_with_rsa_identity(chan)) {
tor_assert(tor_memeq(chan->identity_digest,
rsa_id_digest, DIGEST_LEN));