aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-09 15:47:27 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-09 15:47:27 +0000
commitb76fd968b4d2deddf2f40f63dc04713f45649c68 (patch)
tree7fc3e02f66375ba7c0513709b4bcc2de0a06bdec /src/or/circuitlist.c
parent17abfa6a6afa352ea5fcb0eddbc4539cd96e448c (diff)
downloadtor-b76fd968b4d2deddf2f40f63dc04713f45649c68.tar.gz
tor-b76fd968b4d2deddf2f40f63dc04713f45649c68.zip
r8972@totoro: nickm | 2006-10-09 10:36:22 -0400
Patch from Mike Perry: add a REASON field to closed and failed circ events. svn:r8671
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 38adadf0b4..65e08a44ea 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -780,7 +780,7 @@ circuit_mark_all_unused_circs(void)
if (CIRCUIT_IS_ORIGIN(circ) &&
!circ->marked_for_close &&
!circ->timestamp_dirty)
- circuit_mark_for_close(circ, END_CIRC_AT_ORIGIN);
+ circuit_mark_for_close(circ, END_CIRC_REASON_REQUESTED);
}
}
@@ -824,6 +824,7 @@ void
_circuit_mark_for_close(circuit_t *circ, int reason, int line,
const char *file)
{
+ int orig_reason = reason;
assert_circuit_ok(circ);
tor_assert(line);
tor_assert(file);
@@ -845,11 +846,13 @@ _circuit_mark_for_close(circuit_t *circ, int reason, int line,
} else if (CIRCUIT_IS_ORIGIN(circ) && reason != END_CIRC_REASON_NONE) {
/* Don't warn about this; there are plenty of places where our code
* is origin-agnostic. */
+ /* In fact, due to the desire to export reason information to the
+ * controller, it has been made even more "origin-agnostic" than before */
reason = END_CIRC_REASON_NONE;
}
if (reason < _END_CIRC_REASON_MIN || reason > _END_CIRC_REASON_MAX) {
log_warn(LD_BUG, "Reason %d out of range at %s:%d", reason, file, line);
- reason = END_CIRC_REASON_NONE;
+ orig_reason = reason = END_CIRC_REASON_NONE;
}
if (circ->state == CIRCUIT_STATE_ONIONSKIN_PENDING) {
@@ -872,7 +875,8 @@ _circuit_mark_for_close(circuit_t *circ, int reason, int line,
}
if (CIRCUIT_IS_ORIGIN(circ)) {
control_event_circuit_status(TO_ORIGIN_CIRCUIT(circ),
- (circ->state == CIRCUIT_STATE_OPEN)?CIRC_EVENT_CLOSED:CIRC_EVENT_FAILED);
+ (circ->state == CIRCUIT_STATE_OPEN)?CIRC_EVENT_CLOSED:CIRC_EVENT_FAILED,
+ orig_reason);
}
if (circ->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) {
origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ);