summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-02-04 16:58:50 +0000
committerRoger Dingledine <arma@torproject.org>2008-02-04 16:58:50 +0000
commit426a9bbde18046ad021fbfc5b38383ce18d5c798 (patch)
treea13849678c87892dd5a3060d913e2571d4eb3fe9 /src/or/router.c
parentdad9f434e0573b417f1029d53c89984b764d4689 (diff)
downloadtor-426a9bbde18046ad021fbfc5b38383ce18d5c798.tar.gz
tor-426a9bbde18046ad021fbfc5b38383ce18d5c798.zip
Don't trigger an assert if we start a directory authority with a
private IP address (like 127.0.0.1). svn:r13371
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 1b098c3a1e..349c119547 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -559,16 +559,20 @@ init_keys(void)
(options->BridgeAuthoritativeDir ? BRIDGE_AUTHORITY : NO_AUTHORITY) |
(options->HSAuthoritativeDir ? HIDSERV_AUTHORITY : NO_AUTHORITY));
- if (!router_get_trusteddirserver_by_digest(digest)) {
- add_trusted_dir_server(options->Nickname, NULL,
- (uint16_t)options->DirPort,
- (uint16_t)options->ORPort,
- digest,
- v3_digest,
- type);
- }
ds = router_get_trusteddirserver_by_digest(digest);
- tor_assert(ds);
+ if (!ds) {
+ ds = add_trusted_dir_server(options->Nickname, NULL,
+ (uint16_t)options->DirPort,
+ (uint16_t)options->ORPort,
+ digest,
+ v3_digest,
+ type);
+ if (!ds) {
+ log_err(LD_GENERAL,"We want to be a directory authority, but we "
+ "couldn't add ourselves to the authority list. Failing.");
+ return -1;
+ }
+ }
if (ds->type != type) {
log_warn(LD_DIR, "Configured authority type does not match authority "
"type in DirServer list. Adjusting. (%d v %d)",