diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-05 22:22:42 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-05 22:22:42 +0000 |
commit | 0f74b68edd9dc4f7cf48201fcbe544212b8b5c69 (patch) | |
tree | ba173c88e5265191c3db41e0d2df8bdf8d52631c /src/or | |
parent | 2bb18e62cb7a323b08577b107c32b8c2976e2453 (diff) | |
download | tor-0f74b68edd9dc4f7cf48201fcbe544212b8b5c69.tar.gz tor-0f74b68edd9dc4f7cf48201fcbe544212b8b5c69.zip |
make router_get_by_nickname consider this router.
svn:r1497
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/or.h | 1 | ||||
-rw-r--r-- | src/or/router.c | 12 | ||||
-rw-r--r-- | src/or/routerlist.c | 4 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index 4458550032..6ddd2587cf 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -977,6 +977,7 @@ void router_retry_connections(void); void router_upload_dir_desc_to_dirservers(void); void router_post_to_dirservers(uint8_t purpose, const char *payload, int payload_len); int router_compare_to_my_exit_policy(connection_t *conn); +routerinfo_t *router_get_my_routerinfo(void); const char *router_get_my_descriptor(void); int router_rebuild_descriptor(void); int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, diff --git a/src/or/router.c b/src/or/router.c index 4bface204b..0fcf1b2bdf 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -320,6 +320,18 @@ int router_compare_to_my_exit_policy(connection_t *conn) { } +routerinfo_t *router_get_my_routerinfo(void) +{ + if (!options.ORPort) + return NULL; + + if (!desc_routerinfo) { + if (router_rebuild_descriptor()) + return NULL; + } + return desc_routerinfo; +} + const char *router_get_my_descriptor(void) { if (!desc_routerinfo) { if (router_rebuild_descriptor()) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index ddd592a02a..7b12678176 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -314,6 +314,10 @@ routerinfo_t *router_get_by_nickname(char *nickname) if (0 == strcmp(router->nickname, nickname)) return router; } + router = router_get_my_routerinfo(); + if (router && 0 == strcmp(router->nickname, nickname)) + return router; + return NULL; } |