summaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-02-05 23:20:49 +0000
committerNick Mathewson <nickm@torproject.org>2008-02-05 23:20:49 +0000
commit12071df6c88415e60c990f230dcb67635431aafa (patch)
tree161c07b560b5e3464ce99ba98fe29c944a7ba8c7 /src/or/circuitbuild.c
parentff9bd0fd3a0acd38e495a3ff7c85011b51c9fcb6 (diff)
downloadtor-12071df6c88415e60c990f230dcb67635431aafa.tar.gz
tor-12071df6c88415e60c990f230dcb67635431aafa.zip
r17930@catbus: nickm | 2008-02-05 18:20:40 -0500
Initial attempts to track down bug 600, and refactor possibly offending code. 1) complain early if circuit state is set to OPEN when an onionskin is pending. 2) refactor onionskin field into one only used when n_conn is pending, and a separate onionskin field waiting for attention by a cpuworker. This might even fix the bug. More likely, it will make it fail with a more useful core. svn:r13394
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 785926b09b..512b5d59dd 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -461,12 +461,13 @@ circuit_n_conn_done(or_connection_t *or_conn, int status)
}
} else {
/* pull the create cell out of circ->onionskin, and send it */
- tor_assert(circ->onionskin);
- if (circuit_deliver_create_cell(circ,CELL_CREATE,circ->onionskin)<0) {
+ tor_assert(circ->n_conn_onionskin);
+ if (circuit_deliver_create_cell(circ,CELL_CREATE,
+ circ->n_conn_onionskin)<0) {
circuit_mark_for_close(circ, END_CIRC_REASON_RESOURCELIMIT);
continue;
}
- tor_free(circ->onionskin);
+ tor_free(circ->n_conn_onionskin);
circuit_set_state(circ, CIRCUIT_STATE_OPEN);
}
});
@@ -757,8 +758,8 @@ circuit_extend(cell_t *cell, circuit_t *circ)
log_info(LD_CIRC|LD_OR,"Next router (%s:%d) not connected. Connecting.",
tmpbuf, circ->n_port);
- circ->onionskin = tor_malloc(ONIONSKIN_CHALLENGE_LEN);
- memcpy(circ->onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
+ circ->n_conn_onionskin = tor_malloc(ONIONSKIN_CHALLENGE_LEN);
+ memcpy(circ->n_conn_onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
circuit_set_state(circ, CIRCUIT_STATE_OR_WAIT);
/* imprint the circuit with its future n_conn->id */