make router_get_by_nickname consider this router.

svn:r1497
This commit is contained in:
Nick Mathewson 2004-04-05 22:22:42 +00:00
parent 2bb18e62cb
commit 0f74b68edd
4 changed files with 20 additions and 0 deletions

View File

@ -144,6 +144,9 @@ On-going
. Update the spec so it matches the code . Update the spec so it matches the code
Mid-term: Mid-term:
- Refactor: add own routerinfo to routerlist. Right now, only
router_get_by_nickname knows about 'this router', as a hack to
get circuit_launch_new to do the right thing.
- Rotate tls-level connections -- make new ones, expire old ones. - Rotate tls-level connections -- make new ones, expire old ones.
So we get actual key rotation, not just symmetric key rotation So we get actual key rotation, not just symmetric key rotation
o Are there anonymity issues with sequential streamIDs? Sequential o Are there anonymity issues with sequential streamIDs? Sequential

View File

@ -977,6 +977,7 @@ void router_retry_connections(void);
void router_upload_dir_desc_to_dirservers(void); void router_upload_dir_desc_to_dirservers(void);
void router_post_to_dirservers(uint8_t purpose, const char *payload, int payload_len); void router_post_to_dirservers(uint8_t purpose, const char *payload, int payload_len);
int router_compare_to_my_exit_policy(connection_t *conn); int router_compare_to_my_exit_policy(connection_t *conn);
routerinfo_t *router_get_my_routerinfo(void);
const char *router_get_my_descriptor(void); const char *router_get_my_descriptor(void);
int router_rebuild_descriptor(void); int router_rebuild_descriptor(void);
int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,

View File

@ -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) { const char *router_get_my_descriptor(void) {
if (!desc_routerinfo) { if (!desc_routerinfo) {
if (router_rebuild_descriptor()) if (router_rebuild_descriptor())

View File

@ -314,6 +314,10 @@ routerinfo_t *router_get_by_nickname(char *nickname)
if (0 == strcmp(router->nickname, nickname)) if (0 == strcmp(router->nickname, nickname))
return router; return router;
} }
router = router_get_my_routerinfo();
if (router && 0 == strcmp(router->nickname, nickname))
return router;
return NULL; return NULL;
} }