summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-08 04:39:13 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-08 04:39:13 +0000
commitcf04e1e6e75373ab28f7f27413bf62ad71881fb3 (patch)
tree66092a5d56f00e53dc561a7beaa396ac199b2335 /src/or/dirserv.c
parent1567e13dc853bcba4b75789d25a318ada9f81fab (diff)
downloadtor-cf04e1e6e75373ab28f7f27413bf62ad71881fb3.tar.gz
tor-cf04e1e6e75373ab28f7f27413bf62ad71881fb3.zip
r11479@Kushana: nickm | 2006-12-07 23:38:54 -0500
Refactor GETINFO into a table-driven dispatch, as suggested by arma. My brain hurts. svn:r9052
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index cccc494f4d..ff1da4125d 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -629,8 +629,9 @@ directory_remove_invalid(void)
* string and return it. Used by dirserv operators to keep track of
* fast nodes that haven't registered.
*/
-char *
-dirserver_getinfo_unregistered(const char *question)
+int
+getinfo_helper_dirserv_unregistered(control_connection_t *control_conn,
+ const char *question, char **answer_out)
{
smartlist_t *answerlist;
char buf[1024];
@@ -638,6 +639,12 @@ dirserver_getinfo_unregistered(const char *question)
int min_bw = atoi(question);
routerlist_t *rl = router_get_routerlist();
+ (void) control_conn;
+
+ if (strcmpstart(question, "unregistered-servers-"))
+ return 0;
+ question += strlen("unregistered-servers-");
+
answerlist = smartlist_create();
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ent, {
uint32_t r = dirserv_router_get_status(ent, NULL);
@@ -654,7 +661,8 @@ dirserver_getinfo_unregistered(const char *question)
answer = smartlist_join_strings(answerlist, "\r\n", 0, NULL);
SMARTLIST_FOREACH(answerlist, char *, cp, tor_free(cp));
smartlist_free(answerlist);
- return answer;
+ *answer_out = answer;
+ return 0;
}
/** Mark the directory as <b>dirty</b> -- when we're next asked for a