diff options
author | Roger Dingledine <arma@torproject.org> | 2004-03-04 01:53:56 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-03-04 01:53:56 +0000 |
commit | 89d9d80e7684d4e4fa813866be46f815c857c799 (patch) | |
tree | 8c3f1d555dcc5f7eba850442d966c47396d8b144 /src/or/router.c | |
parent | b7633e2e67c66fd33f16918070f9565d4fa03c35 (diff) | |
download | tor-89d9d80e7684d4e4fa813866be46f815c857c799.tar tor-89d9d80e7684d4e4fa813866be46f815c857c799.tar.gz |
Store options->Address as IP, not hostname
And figure it out while reading config, not every time you
rebuild the descriptor
svn:r1226
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/or/router.c b/src/or/router.c index aefa0c064..59cade7dc 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -321,23 +321,9 @@ const char *router_get_my_descriptor(void) { int router_rebuild_descriptor(void) { routerinfo_t *ri; - char localhostname[256]; - char *address = options.Address; - if(!address) { /* if not specified in config, we find a default */ - if(gethostname(localhostname,sizeof(localhostname)) < 0) { - log_fn(LOG_WARN,"Error obtaining local hostname"); - return -1; - } - address = localhostname; - if(!strchr(address,'.')) { - log_fn(LOG_WARN,"fqdn '%s' has only one element. Misconfigured machine?",address); - log_fn(LOG_WARN,"Try setting the Address line in your config file."); - return -1; - } - } - ri = tor_malloc(sizeof(routerinfo_t)); - ri->address = tor_strdup(address); + 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->or_port = options.ORPort; |