diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-03-27 06:49:25 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-03-27 06:49:25 +0000 |
commit | 24217248539688ecb166cb08ef9417b9630b310f (patch) | |
tree | 163e3ff9ca124f835dc6a2cbe1a2daa597ef70ba | |
parent | 56df81199a0c18d27a3fc6f38aa88097adf8e842 (diff) | |
download | tor-24217248539688ecb166cb08ef9417b9630b310f.tar.gz tor-24217248539688ecb166cb08ef9417b9630b310f.zip |
Code to implement networkstatus fetch from controllers. Only works when dirport is set for now; should be good enough to make serifos html front-end not be as wrong.
svn:r6251
-rw-r--r-- | src/or/control.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c index eab6b53511..f4f0f71746 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1481,6 +1481,26 @@ handle_getinfo_helper(const char *question, char **answer) *cp = '\0'; tor_free(url); smartlist_free(descs); + } else if (!strcmpstart(question, "dir/status/")) { + smartlist_t *status_list; + size_t len; + char *cp; + if (!get_options()->DirPort) + return 0; + status_list = smartlist_create(); + if (!dirserv_get_networkstatus_v2(status_list, + question+strlen("dir/status/"))) { + smartlist_free(status_list); + return 0; + } + len = 0; + SMARTLIST_FOREACH(status_list, cached_dir_t *, d, len += d->dir_len); + cp = *answer = tor_malloc(len+1); + SMARTLIST_FOREACH(status_list, cached_dir_t *, d, { + memcpy(cp, d->dir, d->dir_len); + cp += d->dir_len; + }); + *cp = '\0'; } return 0; } |