diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-08 01:50:02 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-08 01:50:02 +0000 |
commit | 1567e13dc853bcba4b75789d25a318ada9f81fab (patch) | |
tree | ab83bdc661a806a3bcf28a7fa2bbdaac965643d9 /src/or/dirserv.c | |
parent | 566543a4f87b41ead10155964884e1b42992e3c1 (diff) | |
download | tor-1567e13dc853bcba4b75789d25a318ada9f81fab.tar.gz tor-1567e13dc853bcba4b75789d25a318ada9f81fab.zip |
r11475@Kushana: nickm | 2006-12-07 20:49:21 -0500
Make GETINFO dir/status/... work even when we are not a directory. Needs a little cleanup. Closes bug 263.
svn:r9051
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 473b7f6ad7..cccc494f4d 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1578,6 +1578,7 @@ generate_v2_networkstatus(void) } /* DOCDOC */ +/* XXXX This can be replace a lot of dirserv_get_networkstatus_v2(). */ void dirserv_get_networkstatus_v2_fingerprints(smartlist_t *result, const char *key) @@ -1598,14 +1599,20 @@ dirserv_get_networkstatus_v2_fingerprints(smartlist_t *result, tor_memdup(me->cache_info.identity_digest, DIGEST_LEN)); } } else if (!strcmp(key, "all")) { - digestmap_iter_t *iter; - iter = digestmap_iter_init(cached_v2_networkstatus); - while (!digestmap_iter_done(iter)) { - const char *ident; - void *val; - digestmap_iter_get(iter, &ident, &val); - smartlist_add(result, tor_memdup(ident, DIGEST_LEN)); - iter = digestmap_iter_next(cached_v2_networkstatus, iter); + if (digestmap_size(cached_v2_networkstatus)) { + digestmap_iter_t *iter; + iter = digestmap_iter_init(cached_v2_networkstatus); + while (!digestmap_iter_done(iter)) { + const char *ident; + void *val; + digestmap_iter_get(iter, &ident, &val); + smartlist_add(result, tor_memdup(ident, DIGEST_LEN)); + iter = digestmap_iter_next(cached_v2_networkstatus, iter); + } + } else { + SMARTLIST_FOREACH(router_get_trusted_dir_servers(), + trusted_dir_server_t *, ds, + smartlist_add(result, tor_memdup(ds->digest, DIGEST_LEN))); } smartlist_sort_digests(result); if (smartlist_len(result) == 0) |