Browse Source

r15143@catbus: nickm | 2007-09-18 11:49:46 -0400
Add getinfo status/good-server-descriptor and status/reachability-succeeded. Patch from Robert Hogan.


svn:r11483

Nick Mathewson 16 years ago
parent
commit
f45dec1690
3 changed files with 28 additions and 2 deletions
  1. 3 0
      ChangeLog
  2. 13 2
      doc/spec/control-spec.txt
  3. 12 0
      src/or/control.c

+ 3 - 0
ChangeLog

@@ -14,6 +14,9 @@ Changes in version 0.2.0.7-alpha - 2007-??-??
   o Minor features (controller):
     - Accept LF instead of CRLF on controller, since some software has a
       hard time generating real Internet newlines.
+    - Add GETINFO values for the server status events
+      "REACHABILITY_SUCCEEDED" and "GOOD_SERVER_DESCRIPTOR". Patch from
+      Robert Hogan.
 
   o Removed features:
      - Routers no longer include bandwidth-history lines in their

+ 13 - 2
doc/spec/control-spec.txt

@@ -524,11 +524,21 @@ $Id$
 
     "status/circuit-established"
     "status/enough-dir-info"
+    "status/good-server-descriptor"
     "status/..."
       These provide the current internal Tor values for various Tor
       states. See Section 4.1.10 for explanations. (Only a few of the
       status events are available as getinfo's currently. Let us know if
-      you want more exposed.)
+      you want more exposed.)<
+    "status/reachability/or"
+      0 or 1, depending on whether we've found our ORPort reachable.
+    "status/reachability/dir"
+      0 or 1, depending on whether we've found our DirPort reachable.
+    "status/reachability"
+      "OR=" ("0"/"1") SP "DIR=" ("0"/"1")
+      Combines status/reachability/*; controllers MUST ignore unrecognized
+      elements in this entry.
+
     "status/version/recommended" -- List of currently recommended versions
     "status/version/current" -- Status of the current version. One of:
         new, old, unrecommended, recommended, new in series, obsolete.
@@ -1322,7 +1332,8 @@ $Id$
      "ORADDRESS=IP:port"
      "DIRADDRESS=IP:port"
        We successfully verified the reachability of our external OR port or
-       directory port.
+       directory port (depending on which of ORADDRESS or DIRADDRESS is
+       given.)
 
        {This event could effect the controller's idea of server status, but
        the controller should not interrupt the user to tell them so.}

+ 12 - 0
src/or/control.c

@@ -1589,6 +1589,18 @@ getinfo_helper_events(control_connection_t *control_conn,
       *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 (!strcmp(question, "status/good-server-descriptor")) {
+      *answer = tor_strdup(directories_have_accepted_server_descriptor()
+                           ? "1" : "0");
+    } else if (!strcmp(question, "status/reachability-succeeded/or")) {
+      *answer = tor_strdup(check_whether_orport_reachable() ? "1" : "0");
+    } else if (!strcmp(question, "status/reachability-succeeded/dir")) {
+      *answer = tor_strdup(check_whether_dirport_reachable() ? "1" : "0");
+    } else if (!strcmp(question, "status/reachability-succeeded")) {
+      *answer = tor_malloc(16);
+      tor_snprintf(*answer, 16, "OR=%d DIR=%d",
+                   check_whether_orport_reachable() ? 1 : 0,
+                   check_whether_dirport_reachable() ? 1 : 0);
     } else if (!strcmpstart(question, "status/version/")) {
       combined_version_status_t st;
       int is_server = server_mode(get_options());