diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-06-25 13:46:20 -0700 |
---|---|---|
committer | Robert Ransom <rransom.8774@gmail.com> | 2011-11-24 06:55:06 -0800 |
commit | 88e0026d2f0260bb5e3ce88bf2cdead6b521b6b3 (patch) | |
tree | d6e52093b49660e502bc2f17292a79848b3104bc /src/or/control.c | |
parent | 296b8d0b10cc8e5d42c88284ed1b37b510f4a5bc (diff) | |
download | tor-88e0026d2f0260bb5e3ce88bf2cdead6b521b6b3.tar.gz tor-88e0026d2f0260bb5e3ce88bf2cdead6b521b6b3.zip |
Send CIRC2 event when a circuit is cannibalized
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c index c575ff634b..5874fe1d5a 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -3372,13 +3372,11 @@ control_event_circuit_status_2(origin_circuit_t *circ, int arg1, const void *arg2) { const char *event_desc; - char event_tail[96] = ""; + char event_tail[160] = ""; if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS_2)) return 0; tor_assert(circ); - (void)arg2; /* currently unused */ - switch (e) { case CIRC2_EVENT_PURPOSE_CHANGED: @@ -3386,6 +3384,7 @@ control_event_circuit_status_2(origin_circuit_t *circ, event_desc = "PURPOSE_CHANGED"; { + /* event_tail can currently be up to 68 chars long */ const char *hs_state_str = circuit_purpose_to_controller_hs_state_string(arg1); tor_snprintf(event_tail, sizeof(event_tail), @@ -3396,6 +3395,26 @@ control_event_circuit_status_2(origin_circuit_t *circ, } break; + case CIRC2_EVENT_CANNIBALIZED: + /* arg1 is the previous purpose of the circuit. */ + event_desc = "CANNIBALIZED"; + + { + /* event_tail can currently be up to 130 chars long */ + const char *hs_state_str = + circuit_purpose_to_controller_hs_state_string(arg1); + const struct timeval *old_timestamp_created = arg2; + + tor_snprintf(event_tail, sizeof(event_tail), + " OLD_PURPOSE=%s%s%s OLD_TIME_CREATED=%ld,%ld", + circuit_purpose_to_controller_string(arg1), + (hs_state_str != NULL) ? " OLD_HS_STATE=" : "", + (hs_state_str != NULL) ? hs_state_str : "", + old_timestamp_created->tv_sec, + old_timestamp_created->tv_usec); + } + + break; default: log_warn(LD_BUG, "Unrecognized status code %d", (int)e); tor_fragile_assert(); |