Browse Source

r13667@catbus: nickm | 2007-07-10 13:12:52 -0400
Patch from tup: add GETINFO status/enough-dir-info


svn:r10782

Nick Mathewson 17 years ago
parent
commit
a8465adaa2
3 changed files with 10 additions and 0 deletions
  1. 2 0
      ChangeLog
  2. 3 0
      doc/spec/control-spec.txt
  3. 5 0
      src/or/control.c

+ 2 - 0
ChangeLog

@@ -17,6 +17,8 @@ Changes in version 0.2.0.3-alpha - 2007-??-??
       from Robert Hogan.)
     - Add a RESOLVE command to launch hostname lookups. (Original patch
       from Robert Hogan.)
+    - Add GETINFO status/enough-dir-info to let controllers tell whether
+      Tor has downloaded sufficient directory information. (Patch from Tup.)
 
   o Performance improvements (win32):
     - Use Critical Sections rather than Mutexes for synchronizing threads

+ 3 - 0
doc/spec/control-spec.txt

@@ -484,6 +484,7 @@ $Id$
       an empty string.
 
     "status/circuit-established"
+    "status/enough-dir-info"
     "status/..."
       These provide the current internal Tor values for various Tor
       states. See Section 4.1.10 for explanations. (Only a few of the
@@ -695,6 +696,8 @@ $Id$
   request is done in the background: to see the answers, your controller will
   need to listen for ADDRMAP events; see 4.1.7 below.
 
+  [Added in Tor 0.2.0.3-alpha]
+
 4. Replies
 
   Reply codes follow the same 3-character format as used by SMTP, with the

+ 5 - 0
src/or/control.c

@@ -1483,6 +1483,8 @@ getinfo_helper_events(control_connection_t *control_conn,
      * to be a status GETINFO if there's a corresponding STATUS event. */
     if (!strcmp(question, "status/circuit-established")) {
       *answer = tor_strdup(has_completed_circuit ? "1" : "0");
+    } else if (!strcmp(question, "status/enough-dir-info")) {
+      *answer = tor_strdup(router_have_minimum_dir_info() ? "1" : "0");
     } else if (!strcmpstart(question, "status/version/")) {
       combined_version_status_t st;
       int is_server = server_mode(get_options());
@@ -1595,6 +1597,9 @@ static const getinfo_item_t getinfo_items[] = {
   PREFIX("status/", events, NULL),
   DOC("status/circuit-established",
       "Whether we think client functionality is working."),
+  DOC("status/enough-dir-info",
+      "Whether we have enough up-to-date directory information to build "
+      "circuits."),
   /* DOCDOC specify status/version/ */
   DOC("status/version/recommended", "List of currently recommended versions."),
   DOC("status/version/current", "Status of the current version."),