commit 0e911abf27c7a7ede6dea81167c6e8b12b53174c Author: Nick Mathewson nickm@torproject.org Date: Wed Jan 11 10:19:24 2012 -0500
Rename CIRC2 to CIRC_MINOR
Also give the arguments to control_event_circuit_status_minor real names. --- src/or/circuituse.c | 12 ++++++------ src/or/control.c | 32 +++++++++++++++----------------- src/or/control.h | 6 +++--- src/or/or.h | 10 +++++----- 4 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index cd288ab..55ec88a 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1228,9 +1228,9 @@ circuit_launch_by_extend_info(uint8_t purpose, * began. */ tor_gettimeofday(&circ->_base.timestamp_created);
- control_event_circuit_status_2(circ, CIRC2_EVENT_CANNIBALIZED, - (int)old_purpose, - &old_timestamp_created); + control_event_circuit_status_minor(circ, CIRC_MINOR_EVENT_CANNIBALIZED, + (int)old_purpose, + &old_timestamp_created);
switch (purpose) { case CIRCUIT_PURPOSE_C_ESTABLISH_REND: @@ -1965,9 +1965,9 @@ circuit_change_purpose(circuit_t *circ, uint8_t new_purpose) circ->purpose = new_purpose;
if (CIRCUIT_IS_ORIGIN(circ)) { - control_event_circuit_status_2(TO_ORIGIN_CIRCUIT(circ), - CIRC2_EVENT_PURPOSE_CHANGED, - (int)old_purpose, NULL); + control_event_circuit_status_minor(TO_ORIGIN_CIRCUIT(circ), + CIRC_MINOR_EVENT_PURPOSE_CHANGED, + (int)old_purpose, NULL); } }
diff --git a/src/or/control.c b/src/or/control.c index eedc8ea..9cbb8cd 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -54,7 +54,7 @@ #define EVENT_STREAM_STATUS 0x0002 #define EVENT_OR_CONN_STATUS 0x0003 #define EVENT_BANDWIDTH_USED 0x0004 -#define EVENT_CIRCUIT_STATUS_2 0x0005 +#define EVENT_CIRCUIT_STATUS_MINOR 0x0005 #define EVENT_NEW_DESC 0x0006 #define EVENT_DEBUG_MSG 0x0007 #define EVENT_INFO_MSG 0x0008 @@ -924,7 +924,7 @@ struct control_event_t { }; static const struct control_event_t control_event_table[] = { { EVENT_CIRCUIT_STATUS, "CIRC" }, - { EVENT_CIRCUIT_STATUS_2, "CIRC2" }, + { EVENT_CIRCUIT_STATUS_MINOR, "CIRC_MINOR" }, { EVENT_STREAM_STATUS, "STREAM" }, { EVENT_OR_CONN_STATUS, "ORCONN" }, { EVENT_BANDWIDTH_USED, "BW" }, @@ -3377,47 +3377,45 @@ control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t tp, /** Something minor has happened to circuit <b>circ</b>: tell any * interested control connections. */ int -control_event_circuit_status_2(origin_circuit_t *circ, - circuit_status_2_event_t e, - int arg1, const void *arg2) +control_event_circuit_status_minor(origin_circuit_t *circ, + circuit_status_minor_event_t e, + int purpose, const struct timeval *tv) { const char *event_desc; char event_tail[160] = ""; - if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS_2)) + if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS_MINOR)) return 0; tor_assert(circ);
switch (e) { - case CIRC2_EVENT_PURPOSE_CHANGED: - /* arg1 is the previous purpose of the circuit. */ + case CIRC_MINOR_EVENT_PURPOSE_CHANGED: 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); + circuit_purpose_to_controller_hs_state_string(purpose); tor_snprintf(event_tail, sizeof(event_tail), " OLD_PURPOSE=%s%s%s", - circuit_purpose_to_controller_string(arg1), + circuit_purpose_to_controller_string(purpose), (hs_state_str != NULL) ? " OLD_HS_STATE=" : "", (hs_state_str != NULL) ? hs_state_str : ""); }
break; - case CIRC2_EVENT_CANNIBALIZED: - /* arg1 is the previous purpose of the circuit. */ + case CIRC_MINOR_EVENT_CANNIBALIZED: 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; + circuit_purpose_to_controller_hs_state_string(purpose); + const struct timeval *old_timestamp_created = tv;
tor_snprintf(event_tail, sizeof(event_tail), " OLD_PURPOSE=%s%s%s OLD_TIME_CREATED=%ld,%ld", - circuit_purpose_to_controller_string(arg1), + circuit_purpose_to_controller_string(purpose), (hs_state_str != NULL) ? " OLD_HS_STATE=" : "", (hs_state_str != NULL) ? hs_state_str : "", old_timestamp_created->tv_sec, @@ -3434,8 +3432,8 @@ control_event_circuit_status_2(origin_circuit_t *circ, { char *circdesc = circuit_describe_status_for_controller(circ); const char *sp = strlen(circdesc) ? " " : ""; - send_control_event(EVENT_CIRCUIT_STATUS_2, ALL_FORMATS, - "650 CIRC2 %lu %s%s%s%s\r\n", + send_control_event(EVENT_CIRCUIT_STATUS_MINOR, ALL_FORMATS, + "650 CIRC_MINOR %lu %s%s%s%s\r\n", (unsigned long)circ->global_identifier, event_desc, sp, circdesc, diff --git a/src/or/control.h b/src/or/control.h index e5d136b..d7127f4 100644 --- a/src/or/control.h +++ b/src/or/control.h @@ -37,9 +37,9 @@ int control_event_is_interesting(int event);
int control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t e, int reason); -int control_event_circuit_status_2(origin_circuit_t *circ, - circuit_status_2_event_t e, - int arg1, const void *arg2); +int control_event_circuit_status_minor(origin_circuit_t *circ, + circuit_status_minor_event_t e, + int purpose, const struct timeval *tv); int control_event_stream_status(entry_connection_t *conn, stream_status_event_t e, int reason); diff --git a/src/or/or.h b/src/or/or.h index 0ba52af..e103a69 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3751,12 +3751,12 @@ typedef enum circuit_status_event_t { CIRC_EVENT_CLOSED = 4, } circuit_status_event_t;
-/** Used to indicate the type of a CIRC2 event passed to the controller. +/** Used to indicate the type of a CIRC_MINOR event passed to the controller. * The various types are defined in control-spec.txt . */ -typedef enum circuit_status_2_event_t { - CIRC2_EVENT_PURPOSE_CHANGED = 0, - CIRC2_EVENT_CANNIBALIZED = 1, -} circuit_status_2_event_t; +typedef enum circuit_status_minor_event_t { + CIRC_MINOR_EVENT_PURPOSE_CHANGED, + CIRC_MINOR_EVENT_CANNIBALIZED, +} circuit_status_minor_event_t;
/** Used to indicate the type of a stream event passed to the controller. * The various types are defined in control-spec.txt */
tor-commits@lists.torproject.org