diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-02-10 00:45:30 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-02-10 00:45:30 +0000 |
commit | 91fece7be2af17a18986f3a2f00a2fc90ab9f1e0 (patch) | |
tree | a5dc11062dfea0a3f2b607ab8698f29ca5864d65 /src | |
parent | 32aaa16100b062729c00726e9fe1f8097627356f (diff) | |
download | tor-91fece7be2af17a18986f3a2f00a2fc90ab9f1e0.tar.gz tor-91fece7be2af17a18986f3a2f00a2fc90ab9f1e0.zip |
Don't extend introduction circuits indefinitely.
Doing so could run you out of relay_early cells and give you a
senselessly long circuit. Patch from Karsten; may fix bug 878.
svn:r18459
Diffstat (limited to 'src')
-rw-r--r-- | src/or/rendclient.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 3568d50d86..c68a297c02 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -274,13 +274,31 @@ rend_client_introduction_acked(origin_circuit_t *circ, circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_INTERNAL); return -1; } - log_info(LD_REND, - "Got nack for %s from %s. Re-extending circ %d, " - "this time to %s.", - escaped_safe_str(circ->rend_data->onion_address), - circ->build_state->chosen_exit->nickname, circ->_base.n_circ_id, - extend_info->nickname); - result = circuit_extend_to_new_exit(circ, extend_info); + if (circ->remaining_relay_early_cells) { + log_info(LD_REND, + "Got nack for %s from %s. Re-extending circ %d, " + "this time to %s.", + escaped_safe_str(circ->rend_data->onion_address), + circ->build_state->chosen_exit->nickname, + circ->_base.n_circ_id, extend_info->nickname); + result = circuit_extend_to_new_exit(circ, extend_info); + } else { + log_info(LD_REND, + "Got nack for %s from %s. Building a new introduction " + "circuit, this time to %s.", + escaped_safe_str(circ->rend_data->onion_address), + circ->build_state->chosen_exit->nickname, + extend_info->nickname); + circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_FINISHED); + if (!circuit_launch_by_extend_info(CIRCUIT_PURPOSE_C_INTRODUCING, + extend_info, + CIRCLAUNCH_IS_INTERNAL)) { + log_warn(LD_REND, "Building introduction circuit failed."); + result = -1; + } else { + result = 0; + } + } extend_info_free(extend_info); return result; } |