aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-03-18 19:30:30 +0000
committerNick Mathewson <nickm@torproject.org>2009-03-18 19:30:30 +0000
commita335b43a6719e02f135415a1c9ef860d80a4bdac (patch)
tree5156f3bb405c77e3519a10f7d831ce84b43b24fa /src
parente591aafca420b673a63881573581a9cdb178c3f9 (diff)
downloadtor-a335b43a6719e02f135415a1c9ef860d80a4bdac.tar
tor-a335b43a6719e02f135415a1c9ef860d80a4bdac.tar.gz
If we have a routerstatus but no routerinfo to name a router, use the routerstatus instead when generating circuit events. Also refactor a little.
svn:r19078
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 1cda8e870..9e2f826c4 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -133,39 +133,41 @@ circuit_list_path_impl(origin_circuit_t *circ, int verbose, int verbose_names)
hop = circ->cpath;
do {
routerinfo_t *ri;
+ routerstatus_t *rs;
char *elt;
+ const char *id;
if (!hop)
break;
+ id = hop->extend_info->identity_digest;
if (!verbose && hop->state != CPATH_STATE_OPEN)
break;
if (!hop->extend_info)
break;
if (verbose_names) {
elt = tor_malloc(MAX_VERBOSE_NICKNAME_LEN+1);
- if ((ri = router_get_by_digest(hop->extend_info->identity_digest))) {
+ if ((ri = router_get_by_digest(id))) {
router_get_verbose_nickname(elt, ri);
+ } else if ((rs = router_get_consensus_status_by_id(id))) {
+ routerstatus_get_verbose_nickname(elt, rs);
} else if (hop->extend_info->nickname &&
is_legal_nickname(hop->extend_info->nickname)) {
elt[0] = '$';
- base16_encode(elt+1, HEX_DIGEST_LEN+1,
- hop->extend_info->identity_digest, DIGEST_LEN);
+ base16_encode(elt+1, HEX_DIGEST_LEN+1, id, DIGEST_LEN);
elt[HEX_DIGEST_LEN+1]= '~';
strlcpy(elt+HEX_DIGEST_LEN+2,
hop->extend_info->nickname, MAX_NICKNAME_LEN+1);
} else {
elt[0] = '$';
- base16_encode(elt+1, HEX_DIGEST_LEN+1,
- hop->extend_info->identity_digest, DIGEST_LEN);
+ base16_encode(elt+1, HEX_DIGEST_LEN+1, id, DIGEST_LEN);
}
} else { /* ! verbose_names */
- if ((ri = router_get_by_digest(hop->extend_info->identity_digest)) &&
+ if ((ri = router_get_by_digest(id)) &&
ri->is_named) {
elt = tor_strdup(hop->extend_info->nickname);
} else {
elt = tor_malloc(HEX_DIGEST_LEN+2);
elt[0] = '$';
- base16_encode(elt+1, HEX_DIGEST_LEN+1,
- hop->extend_info->identity_digest, DIGEST_LEN);
+ base16_encode(elt+1, HEX_DIGEST_LEN+1, id, DIGEST_LEN);
}
}
tor_assert(elt);