diff options
author | Mike Perry <mikeperry-git@torproject.org> | 2017-04-20 15:00:46 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-05-08 13:49:23 -0400 |
commit | 02a5835c27780e45f705fc1c044b9c471b929dbe (patch) | |
tree | 1d581cfd49d18bfa5da6b1e3a97da1628eedb60c /src/or/command.c | |
parent | 687a85950afc25010c80cd14539728b3a7ae5675 (diff) | |
download | tor-02a5835c27780e45f705fc1c044b9c471b929dbe.tar.gz tor-02a5835c27780e45f705fc1c044b9c471b929dbe.zip |
Fix issues from dgoulet's code review.
https://gitlab.com/dgoulet/tor/merge_requests/24
Diffstat (limited to 'src/or/command.c')
-rw-r--r-- | src/or/command.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/or/command.c b/src/or/command.c index cebb5bfc7a..5f3b667ad9 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -326,17 +326,18 @@ command_process_create_cell(cell_t *cell, channel_t *chan) return; } + if (connection_or_digest_is_known_relay(chan->identity_digest)) { + rep_hist_note_circuit_handshake_requested(create_cell->handshake_type); + // Needed for chutney: Sometimes relays aren't in the consensus yet, and + // get marked as clients. This resets their channels once they appear. + // Probably useful for normal operation wrt relay flapping, too. + chan->is_client = 0; + } else { + channel_mark_client(chan); + } + if (create_cell->handshake_type != ONION_HANDSHAKE_TYPE_FAST) { /* hand it off to the cpuworkers, and then return. */ - if (connection_or_digest_is_known_relay(chan->identity_digest)) { - rep_hist_note_circuit_handshake_requested(create_cell->handshake_type); - // Needed for chutney: Sometimes relays aren't in the consensus yet, and - // get marked as clients. This resets their channels once they appear. - // Probably useful for normal operation wrt relay flapping, too. - chan->is_client = 0; - } else { - channel_mark_client(chan); - } if (assign_onionskin_to_cpuworker(circ, create_cell) < 0) { log_debug(LD_GENERAL,"Failed to hand off onionskin. Closing."); @@ -352,16 +353,6 @@ command_process_create_cell(cell_t *cell, channel_t *chan) int len; created_cell_t created_cell; - /* If this is a create_fast, this might be a client. Let's check. */ - if (connection_or_digest_is_known_relay(chan->identity_digest)) { - // Needed for chutney: Sometimes relays aren't in the consensus yet, and - // get marked as clients. This resets their channels once they appear. - // Probably useful for normal operation wrt relay flapping, too. - chan->is_client = 0; - } else { - channel_mark_client(chan); - } - memset(&created_cell, 0, sizeof(created_cell)); len = onion_skin_server_handshake(ONION_HANDSHAKE_TYPE_FAST, create_cell->onionskin, |