aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-09-28 22:24:56 +0000
committerNick Mathewson <nickm@torproject.org>2004-09-28 22:24:56 +0000
commitd20d10f360dfe58ca048ef8c56b013914371a6be (patch)
treea286d0e874ff9087ce9f465ab1b4087490d9009d /src/or/connection_or.c
parentd381aa46960f6ea5db2a29d6abd0d30d34c23b46 (diff)
downloadtor-d20d10f360dfe58ca048ef8c56b013914371a6be.tar
tor-d20d10f360dfe58ca048ef8c56b013914371a6be.tar.gz
If we are an authoritative dirserver, check out the fingerprint list when setting connection nicknames
svn:r2389
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r--src/or/connection_or.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 3f7da9654..fea307a3c 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -120,6 +120,7 @@ connection_or_init_conn_from_address(connection_t *conn,
{
routerinfo_t *r;
struct in_addr in;
+ const char *n;
r = router_get_by_digest(id_digest);
if (r) {
connection_or_init_conn_from_router(conn,r);
@@ -130,9 +131,16 @@ connection_or_init_conn_from_address(connection_t *conn,
/* This next part isn't really right, but it's good enough for now. */
conn->receiver_bucket = conn->bandwidth = options.BandwidthBurst;
memcpy(conn->identity_digest, id_digest, DIGEST_LEN);
- conn->nickname = tor_malloc(HEX_DIGEST_LEN+1);
- base16_encode(conn->nickname, HEX_DIGEST_LEN+1,
- conn->identity_digest, DIGEST_LEN);
+ /* If we're an authoritative directory server, we may know a
+ * nickname for this router. */
+ n = dirserv_get_nickname_by_digest(id_digest);
+ if (n) {
+ conn->nickname = tor_strdup(n);
+ } else {
+ conn->nickname = tor_malloc(HEX_DIGEST_LEN+1);
+ base16_encode(conn->nickname, HEX_DIGEST_LEN+1,
+ conn->identity_digest, DIGEST_LEN);
+ }
tor_free(conn->address);
in.s_addr = htonl(addr);
conn->address = tor_strdup(inet_ntoa(in));