[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] New GETINFO consensus/packages to expose package information from consensus



commit 9c4328c0384dc5fd84555daddbd54da2d375c4d0
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jan 27 16:40:32 2015 -0500

    New GETINFO consensus/packages to expose package information from consensus
---
 src/or/control.c       |    2 ++
 src/or/networkstatus.c |    5 +++++
 2 files changed, 7 insertions(+)

diff --git a/src/or/control.c b/src/or/control.c
index 9ff71c9..8e2b462 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2165,6 +2165,8 @@ static const getinfo_item_t getinfo_items[] = {
          "Brief summary of router status by nickname (v2 directory format)."),
   PREFIX("ns/purpose/", networkstatus,
          "Brief summary of router status by purpose (v2 directory format)."),
+  PREFIX("consensus/", networkstatus,
+         "Information abour and from the ns consensus."),
   ITEM("network-status", dir,
        "Brief summary of router status (v1 directory format)"),
   ITEM("circuit-status", events, "List of current circuits originating here."),
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 19c0b21..0024b1f 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1913,6 +1913,11 @@ getinfo_helper_networkstatus(control_connection_t *conn,
   } else if (!strcmpstart(question, "ns/purpose/")) {
     *answer = networkstatus_getinfo_by_purpose(question+11, time(NULL));
     return *answer ? 0 : -1;
+  } else if (!strcmpstart(question, "consensus/packages")) {
+    const networkstatus_t *ns = networkstatus_get_latest_consensus();
+    if (ns->package_lines)
+      *answer = smartlist_join_strings(ns->package_lines, "\n", 1, NULL);
+    return *answer ? 0 : -1;
   } else {
     return 0;
   }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits