[or-cvs] Code to implement networkstatus fetch from controllers. On...

Nick Mathewson nickm at seul.org
Mon Mar 27 06:49:28 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv30610/src/or

Modified Files:
	control.c 
Log Message:
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.

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -p -d -r1.182 -r1.183
--- control.c	26 Mar 2006 06:51:26 -0000	1.182
+++ control.c	27 Mar 2006 06:49:25 -0000	1.183
@@ -1481,6 +1481,26 @@ handle_getinfo_helper(const char *questi
     *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;
 }



More information about the tor-commits mailing list