diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-06-23 14:34:56 -0700 |
---|---|---|
committer | Robert Ransom <rransom.8774@gmail.com> | 2011-11-24 06:32:54 -0800 |
commit | b7c765b1b196433f38b94353edbc1655f5da1017 (patch) | |
tree | 224a59c8b74eb87ebc8a9fea061e16bab9a1d87e /src/or/control.c | |
parent | 9ce76adfe8ccf873302cc8690fac266f966ea8b5 (diff) | |
download | tor-b7c765b1b196433f38b94353edbc1655f5da1017.tar.gz tor-b7c765b1b196433f38b94353edbc1655f5da1017.zip |
Report circuit build_state flags in CIRC events
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c index 735492271a..3dda9979fb 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1795,6 +1795,34 @@ circuit_describe_status_for_controller(origin_circuit_t *circ) } { + char *buildflags = NULL; + cpath_build_state_t *build_state = circ->build_state; + smartlist_t *flaglist = smartlist_create(); + char *flaglist_joined; + + if (build_state->onehop_tunnel) + smartlist_add(flaglist, (void *)"ONEHOP_TUNNEL"); + if (build_state->is_internal) + smartlist_add(flaglist, (void *)"IS_INTERNAL"); + if (build_state->need_capacity) + smartlist_add(flaglist, (void *)"NEED_CAPACITY"); + if (build_state->need_uptime) + smartlist_add(flaglist, (void *)"NEED_UPTIME"); + + /* Only emit a BUILD_FLAGS argument if it will have a non-empty value. */ + if (smartlist_len(flaglist)) { + flaglist_joined = smartlist_join_strings(flaglist, ",", 0, NULL); + + tor_asprintf(&buildflags, "BUILD_FLAGS=%s", flaglist_joined); + smartlist_add(descparts, buildflags); + + tor_free(flaglist_joined); + } + + smartlist_free(flaglist); + } + + { char *purpose = NULL; tor_asprintf(&purpose, "PURPOSE=%s", circuit_purpose_to_controller_string(circ->_base.purpose)); |