aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-11-03 18:33:07 +0000
committerNick Mathewson <nickm@torproject.org>2004-11-03 18:33:07 +0000
commit451f8b50452ae44c4319cfe55c666a45b9994e9f (patch)
treed88f565d8f7f74253af9d2a721978737b157782a /src/or/circuitlist.c
parent86ba00290b4e1f7095c1d34c46ac5b61273953be (diff)
downloadtor-451f8b50452ae44c4319cfe55c666a45b9994e9f.tar.gz
tor-451f8b50452ae44c4319cfe55c666a45b9994e9f.zip
- Implement all of control interface except authentication, setconfig,
and actually making the sockets. - Make sure that identity-based nicknames start with $. - Use new string_join interface. svn:r2661
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index dc90b9bc99..ad31d6f8ec 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -74,6 +74,7 @@ void circuit_close_all_marked(void)
*/
circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) {
circuit_t *circ;
+ static uint32_t n_circuits_allocated = 0;
circ = tor_malloc_zero(sizeof(circuit_t));
circ->magic = CIRCUIT_MAGIC;
@@ -93,6 +94,7 @@ circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) {
circ->deliver_window = CIRCWINDOW_START;
circ->next_stream_id = crypto_pseudo_rand_int(1<<16);
+ circ->global_identifier = n_circuits_allocated++;
circuit_add(circ);
@@ -353,10 +355,15 @@ int _circuit_mark_for_close(circuit_t *circ) {
* links worked and which didn't.
*/
if (circ->state != CIRCUIT_STATE_OPEN) {
- if(CIRCUIT_IS_ORIGIN(circ))
+ if(CIRCUIT_IS_ORIGIN(circ)) {
circuit_build_failed(circ); /* take actions if necessary */
+ }
circuit_rep_hist_note_result(circ);
}
+ if (CIRCUIT_IS_ORIGIN(circ)) {
+ control_event_circuit_status(circ,
+ (circ->state == CIRCUIT_STATE_OPEN)?CIRC_EVENT_CLOSED:CIRC_EVENT_FAILED);
+ }
if (circ->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) {
tor_assert(circ->state == CIRCUIT_STATE_OPEN);
/* treat this like getting a nack from it */