Tweak ORCONN event based on comments by nickm.

- Move new ID= parameter in ORCONN event to end.  Avoids possible trouble
  from controllers that parse parameters by position, even though they
  shouldn't.
This commit is contained in:
Karsten Loesing 2013-05-24 11:25:30 +02:00
parent 2925e2fe78
commit a84fae7892

View File

@ -3858,18 +3858,17 @@ control_event_or_conn_status(or_connection_t *conn, or_conn_status_event_t tp,
} }
ncircs += connection_or_get_num_circuits(conn); ncircs += connection_or_get_num_circuits(conn);
if (ncircs && (tp == OR_CONN_EVENT_FAILED || tp == OR_CONN_EVENT_CLOSED)) { if (ncircs && (tp == OR_CONN_EVENT_FAILED || tp == OR_CONN_EVENT_CLOSED)) {
tor_snprintf(ncircs_buf, sizeof(ncircs_buf), "%sNCIRCS=%d", tor_snprintf(ncircs_buf, sizeof(ncircs_buf), " NCIRCS=%d", ncircs);
reason ? " " : "", ncircs);
} }
orconn_target_get_name(name, sizeof(name), conn); orconn_target_get_name(name, sizeof(name), conn);
send_control_event(EVENT_OR_CONN_STATUS, ALL_FORMATS, send_control_event(EVENT_OR_CONN_STATUS, ALL_FORMATS,
"650 ORCONN %s %s ID="U64_FORMAT" %s%s%s\r\n", "650 ORCONN %s %s%s%s%s ID="U64_FORMAT"\r\n",
name, status, name, status,
U64_PRINTF_ARG(conn->base_.global_identifier), reason ? " REASON=" : "",
reason ? "REASON=" : "",
orconn_end_reason_to_control_string(reason), orconn_end_reason_to_control_string(reason),
ncircs_buf); ncircs_buf,
U64_PRINTF_ARG(conn->base_.global_identifier));
return 0; return 0;
} }