Set routerinfo->addr properly for own routerinfo; do casei routerinfo compare

svn:r1514
This commit is contained in:
Nick Mathewson 2004-04-06 22:23:12 +00:00
parent f24519e4b9
commit fdb58e8ea3
3 changed files with 8 additions and 4 deletions

View File

@ -11,7 +11,6 @@ extern char *conn_state_to_string[][_CONN_TYPE_MAX+1];
static int connection_ap_handshake_process_socks(connection_t *conn);
static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
static int connection_exit_set_rendezvous_addr_port(connection_t *conn);
static void connection_edge_consider_sending_sendme(connection_t *conn);
static uint32_t client_dns_lookup_entry(const char *address);

View File

@ -343,11 +343,16 @@ const char *router_get_my_descriptor(void) {
int router_rebuild_descriptor(void) {
routerinfo_t *ri;
struct in_addr addr;
if (!tor_inet_aton(options.Address, &addr)) {
log_fn(LOG_ERR, "options.Address didn't hold an IP.");
return -1;
}
ri = tor_malloc_zero(sizeof(routerinfo_t));
ri->address = tor_strdup(options.Address);
ri->nickname = tor_strdup(options.Nickname);
/* No need to set addr. */
ri->addr = (uint32_t) addr.s_addr;
ri->or_port = options.ORPort;
ri->socks_port = options.SocksPort;
ri->dir_port = options.DirPort;

View File

@ -311,11 +311,11 @@ routerinfo_t *router_get_by_nickname(char *nickname)
for(i=0;i<routerlist->n_routers;i++) {
router = routerlist->routers[i];
if (0 == strcmp(router->nickname, nickname))
if (0 == strcasecmp(router->nickname, nickname))
return router;
}
router = router_get_my_routerinfo();
if (router && 0 == strcmp(router->nickname, nickname))
if (router && 0 == strcasecmp(router->nickname, nickname))
return router;
return NULL;