aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-07-12 23:53:16 +0000
committerRoger Dingledine <arma@torproject.org>2004-07-12 23:53:16 +0000
commit149115cc4eb26b755865117028f97f1f6a1f3d69 (patch)
treefdc3c743b747982d851753184cff738dc79b307a /src
parentd1fe3c171154f01b8a8af1df2d81b26ea0f58fe6 (diff)
downloadtor-149115cc4eb26b755865117028f97f1f6a1f3d69.tar
tor-149115cc4eb26b755865117028f97f1f6a1f3d69.tar.gz
bugfix: tell circuits what id_digest to look for, so
n_conn_open() can find waiting circuits. svn:r2034
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 123279667..ca92186c3 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -220,6 +220,8 @@ circuit_t *circuit_establish_circuit(uint8_t purpose,
log_fn(LOG_DEBUG,"Looking for firsthop '%s:%u'",
firsthop->address,firsthop->or_port);
+ /* imprint the circuit with its future n_conn->id */
+ memcpy(circ->n_conn_id_digest, firsthop->identity_digest, DIGEST_LEN);
n_conn = connection_get_by_identity_digest(firsthop->identity_digest,
CONN_TYPE_OR);
if(!n_conn || n_conn->state != OR_CONN_STATE_OPEN) { /* not currently connected */
@@ -245,7 +247,6 @@ circuit_t *circuit_establish_circuit(uint8_t purpose,
circ->n_addr = n_conn->addr;
circ->n_port = n_conn->port;
circ->n_conn = n_conn;
- memcpy(circ->n_conn_id_digest, n_conn->identity_digest, DIGEST_LEN);
log_fn(LOG_DEBUG,"Conn open. Delivering first onion skin.");
if(circuit_send_next_onion_skin(circ) < 0) {
log_fn(LOG_INFO,"circuit_send_next_onion_skin failed.");
@@ -262,6 +263,8 @@ circuit_t *circuit_establish_circuit(uint8_t purpose,
void circuit_n_conn_done(connection_t *or_conn, int success) {
circuit_t *circ;
+ log_fn(LOG_DEBUG,"or_conn to %s, success=%d", or_conn->nickname, success);
+
for(circ=global_circuitlist;circ;circ = circ->next) {
if (circ->marked_for_close)
continue;
@@ -492,6 +495,10 @@ int circuit_extend(cell_t *cell, circuit_t *circ) {
memcpy(circ->onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
circ->state = CIRCUIT_STATE_OR_WAIT;
+
+ /* imprint the circuit with its future n_conn->id */
+ memcpy(circ->n_conn_id_digest, id_digest, DIGEST_LEN);
+
n_conn = connection_or_connect(circ->n_addr, circ->n_port, id_digest);
if(!n_conn) {
log_fn(LOG_INFO,"Launching n_conn failed. Closing.");