mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
Use fewer TO_ORIGIN_CIRCUIT casts in getinfo_helper_events
This commit is contained in:
parent
c818f1f25d
commit
8d5200c6b5
1 changed files with 9 additions and 8 deletions
|
@ -1846,29 +1846,30 @@ getinfo_helper_events(control_connection_t *control_conn,
|
||||||
{
|
{
|
||||||
(void) control_conn;
|
(void) control_conn;
|
||||||
if (!strcmp(question, "circuit-status")) {
|
if (!strcmp(question, "circuit-status")) {
|
||||||
circuit_t *circ;
|
circuit_t *circ_;
|
||||||
smartlist_t *status = smartlist_create();
|
smartlist_t *status = smartlist_create();
|
||||||
for (circ = _circuit_get_global_list(); circ; circ = circ->next) {
|
for (circ_ = _circuit_get_global_list(); circ_; circ_ = circ_->next) {
|
||||||
|
origin_circuit_t *circ;
|
||||||
char *s, *circdesc;
|
char *s, *circdesc;
|
||||||
size_t slen;
|
size_t slen;
|
||||||
const char *state;
|
const char *state;
|
||||||
if (! CIRCUIT_IS_ORIGIN(circ) || circ->marked_for_close)
|
if (! CIRCUIT_IS_ORIGIN(circ_) || circ_->marked_for_close)
|
||||||
continue;
|
continue;
|
||||||
|
circ = TO_ORIGIN_CIRCUIT(circ_);
|
||||||
|
|
||||||
if (circ->state == CIRCUIT_STATE_OPEN)
|
if (circ->_base.state == CIRCUIT_STATE_OPEN)
|
||||||
state = "BUILT";
|
state = "BUILT";
|
||||||
else if (TO_ORIGIN_CIRCUIT(circ)->cpath)
|
else if (circ->cpath)
|
||||||
state = "EXTENDED";
|
state = "EXTENDED";
|
||||||
else
|
else
|
||||||
state = "LAUNCHED";
|
state = "LAUNCHED";
|
||||||
|
|
||||||
circdesc = circuit_describe_status_for_controller(
|
circdesc = circuit_describe_status_for_controller(circ);
|
||||||
TO_ORIGIN_CIRCUIT(circ));
|
|
||||||
|
|
||||||
slen = strlen(circdesc)+strlen(state)+30;
|
slen = strlen(circdesc)+strlen(state)+30;
|
||||||
s = tor_malloc(slen+1);
|
s = tor_malloc(slen+1);
|
||||||
tor_snprintf(s, slen, "%lu %s%s%s",
|
tor_snprintf(s, slen, "%lu %s%s%s",
|
||||||
(unsigned long)TO_ORIGIN_CIRCUIT(circ)->global_identifier,
|
(unsigned long)circ->global_identifier,
|
||||||
state, *circdesc ? " " : "", circdesc);
|
state, *circdesc ? " " : "", circdesc);
|
||||||
smartlist_add(status, s);
|
smartlist_add(status, s);
|
||||||
tor_free(circdesc);
|
tor_free(circdesc);
|
||||||
|
|
Loading…
Add table
Reference in a new issue