diff options
author | teor <teor@torproject.org> | 2020-04-06 19:21:13 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-04-09 11:00:04 +1000 |
commit | d79e5d52bc6bfa5550614e58c1700885912fcff3 (patch) | |
tree | 67855f13a2c703f14546019b5336bbae5ae9a0c0 /src | |
parent | 6d75f3244f04735c7670b732a2e38e2b6f0ef307 (diff) | |
download | tor-d79e5d52bc6bfa5550614e58c1700885912fcff3.tar.gz tor-d79e5d52bc6bfa5550614e58c1700885912fcff3.zip |
relay/circuitbuild: Refactor circuit_extend()
Make the "else" case explicit at the end of the function.
Part of 33633.
Diffstat (limited to 'src')
-rw-r--r-- | src/feature/relay/circuitbuild_relay.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/feature/relay/circuitbuild_relay.c b/src/feature/relay/circuitbuild_relay.c index ae8581075f..2fa92eeac1 100644 --- a/src/feature/relay/circuitbuild_relay.c +++ b/src/feature/relay/circuitbuild_relay.c @@ -295,18 +295,20 @@ circuit_extend(struct cell_t *cell, struct circuit_t *circ) * OR_CONN_STATE_OPEN. */ return 0; - } - - tor_assert(!circ->n_hop); /* Connection is already established. */ - circ->n_chan = n_chan; - log_debug(LD_CIRC, - "n_chan is %s.", - channel_get_canonical_remote_descr(n_chan)); - - if (circuit_deliver_create_cell(circ, &ec.create_cell, 1) < 0) - return -1; + } else { + /* Connection is already established. + * So we need to extend the circuit to the next hop. */ + tor_assert(!circ->n_hop); + circ->n_chan = n_chan; + log_debug(LD_CIRC, + "n_chan is %s.", + channel_get_canonical_remote_descr(n_chan)); + + if (circuit_deliver_create_cell(circ, &ec.create_cell, 1) < 0) + return -1; - return 0; + return 0; + } } /** On a relay, accept a create cell, initialise a circuit, and send a |