Do not generate the non-verbose circuit path when generating a circuit event unless we will use it.

svn:r19079
This commit is contained in:
Nick Mathewson 2009-03-18 19:30:34 +00:00
parent a335b43a67
commit c2f8d97212

View File

@ -2989,14 +2989,10 @@ control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t tp,
const char *status; const char *status;
char extended_buf[96]; char extended_buf[96];
int providing_reason=0; int providing_reason=0;
char *path=NULL;
if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS)) if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS))
return 0; return 0;
tor_assert(circ); tor_assert(circ);
if (EVENT_IS_INTERESTING1S(EVENT_CIRCUIT_STATUS))
path = circuit_list_path(circ,0);
switch (tp) switch (tp)
{ {
case CIRC_EVENT_LAUNCHED: status = "LAUNCHED"; break; case CIRC_EVENT_LAUNCHED: status = "LAUNCHED"; break;
@ -3033,11 +3029,13 @@ control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t tp,
} }
if (EVENT_IS_INTERESTING1S(EVENT_CIRCUIT_STATUS)) { if (EVENT_IS_INTERESTING1S(EVENT_CIRCUIT_STATUS)) {
char *path = circuit_list_path(circ,0);
const char *sp = strlen(path) ? " " : ""; const char *sp = strlen(path) ? " " : "";
send_control_event_extended(EVENT_CIRCUIT_STATUS, SHORT_NAMES, send_control_event_extended(EVENT_CIRCUIT_STATUS, SHORT_NAMES,
"650 CIRC %lu %s%s%s@%s\r\n", "650 CIRC %lu %s%s%s@%s\r\n",
(unsigned long)circ->global_identifier, (unsigned long)circ->global_identifier,
status, sp, path, extended_buf); status, sp, path, extended_buf);
tor_free(path);
} }
if (EVENT_IS_INTERESTING1L(EVENT_CIRCUIT_STATUS)) { if (EVENT_IS_INTERESTING1L(EVENT_CIRCUIT_STATUS)) {
char *vpath = circuit_list_path_for_controller(circ); char *vpath = circuit_list_path_for_controller(circ);
@ -3049,8 +3047,6 @@ control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t tp,
tor_free(vpath); tor_free(vpath);
} }
tor_free(path);
return 0; return 0;
} }