diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-09-11 20:32:15 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-09-11 20:32:15 +0000 |
commit | 36a308643464890ca6cc2e33222bc66b696d8c37 (patch) | |
tree | 9da6c8b30ab73f4aa784750e6cc6cad519eb4fc8 /src/or/routers.c | |
parent | 0761bc7b83e4eeaa02ee45807cc691cb753c43a2 (diff) | |
download | tor-36a308643464890ca6cc2e33222bc66b696d8c37.tar.gz tor-36a308643464890ca6cc2e33222bc66b696d8c37.zip |
Add router_get_by_pk function; use in connection_tls_finish_handshake.
svn:r441
Diffstat (limited to 'src/or/routers.c')
-rw-r--r-- | src/or/routers.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/or/routers.c b/src/or/routers.c index 5d6492a51b..a1b8289b67 100644 --- a/src/or/routers.c +++ b/src/or/routers.c @@ -111,6 +111,24 @@ routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port) { return NULL; } +routerinfo_t *router_get_by_pk(crypto_pk_env_t *pk) +{ + int i; + routerinfo_t *router; + + assert(directory); + + for(i=0;i<directory->n_routers;i++) { + router = directory->routers[i]; + /* XXX Should this really be a separate link key? */ + if (0 == crypto_pk_cmp_keys(router->pkey, pk)) + return router; + } + + return NULL; +} + + void router_get_directory(directory_t **pdirectory) { *pdirectory = directory; } |