diff options
author | Christopher Baines <cbaines8@gmail.com> | 2013-11-22 20:48:51 +0000 |
---|---|---|
committer | Christopher Baines <cb15g11@soton.ac.uk> | 2014-02-16 16:55:10 +0000 |
commit | df6e17ad5feb3fd28182442e77862d0deb4d8888 (patch) | |
tree | 9656ad896104305e2fa94474d598ea44cd88e33f | |
parent | c5b91f8b2c6f250ea4f0b53b74ae09b4a8efb55b (diff) | |
download | tor-df6e17ad5feb3fd28182442e77862d0deb4d8888.tar tor-df6e17ad5feb3fd28182442e77862d0deb4d8888.tar.gz |
Fix some output messages
-rw-r--r-- | src/or/rendservice.c | 6 | ||||
-rw-r--r-- | src/or/router.c | 31 | ||||
-rw-r--r-- | src/or/router.h | 2 |
3 files changed, 36 insertions, 3 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 89b12a35c..06d7a4900 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -3141,7 +3141,7 @@ rend_services_introduce(void) SMARTLIST_FOREACH(entry->parsed->intro_nodes, rend_intro_point_t *, intro, { log_info(LD_REND, "Found router %s as an existing intro point for %s.", - safe_str_client(node_describe(node)), + safe_str_client(intro_describe(intro)), safe_str_client(service->service_id)); int existing = 0; @@ -3156,7 +3156,7 @@ rend_services_introduce(void) if (existing == 0) { log_info(LD_REND, "Also connecting to %s.", - safe_str_client(node_describe(node))); + safe_str_client(intro_describe(intro))); rend_intro_point_t *new_intro = tor_malloc_zero(sizeof(rend_intro_point_t)); memcpy((void*) new_intro, intro, sizeof(rend_intro_point_t)); @@ -3172,7 +3172,7 @@ rend_services_introduce(void) intro_point_set_changed = 1; } else { log_info(LD_REND, "Already connected to %s, ignoring.", - safe_str_client(node_describe(node))); + safe_str_client(intro_describe(intro))); } }); diff --git a/src/or/router.c b/src/or/router.c index c22f4c367..df13cc78b 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2811,6 +2811,25 @@ router_get_description(char *buf, const routerinfo_t *ri) * Return a pointer to the front of <b>buf</b>. */ const char * +intro_get_description(char *buf, const rend_intro_point_t *intro) +{ + if (!intro) + return "<null>"; + + return format_node_description(buf, + (const char *) &intro->extend_info->identity_digest, + 0, // unsure? + intro->extend_info->nickname, + &intro->extend_info->addr, + 0); +} + +/** Use <b>buf</b> (which must be at least NODE_DESC_BUF_LEN bytes long) to + * hold a human-readable description of <b>node</b>. + * + * Return a pointer to the front of <b>buf</b>. + */ +const char * node_get_description(char *buf, const node_t *node) { const char *nickname = NULL; @@ -2873,6 +2892,18 @@ extend_info_get_description(char *buf, const extend_info_t *ei) 0); } +/** Return a human-readable description of the node_t <b>node</b>. + * + * This function is not thread-safe. Each call to this function invalidates + * previous values returned by this function. + */ +const char * +intro_describe(const rend_intro_point_t *intro) +{ + static char buf[NODE_DESC_BUF_LEN]; + return intro_get_description(buf, intro); +} + /** Return a human-readable description of the routerinfo_t <b>ri</b>. * * This function is not thread-safe. Each call to this function invalidates diff --git a/src/or/router.h b/src/or/router.h index 74b673fbe..5904d5b81 100644 --- a/src/or/router.h +++ b/src/or/router.h @@ -126,11 +126,13 @@ const char *format_node_description(char *buf, const tor_addr_t *addr, uint32_t addr32h); const char *router_get_description(char *buf, const routerinfo_t *ri); +const char *intro_get_description(char *buf, const rend_intro_point_t *intro); const char *node_get_description(char *buf, const node_t *node); const char *routerstatus_get_description(char *buf, const routerstatus_t *rs); const char *extend_info_get_description(char *buf, const extend_info_t *ei); const char *router_describe(const routerinfo_t *ri); const char *node_describe(const node_t *node); +const char *intro_describe(const rend_intro_point_t *intro); const char *routerstatus_describe(const routerstatus_t *ri); const char *extend_info_describe(const extend_info_t *ei); |