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

[or-cvs] r8533: Implement DESCCHANGED event to tell controller when our rout (in tor/trunk: . doc src/or)



Author: nickm
Date: 2006-09-29 14:13:25 -0400 (Fri, 29 Sep 2006)
New Revision: 8533

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO
   tor/trunk/src/or/control.c
   tor/trunk/src/or/or.h
   tor/trunk/src/or/router.c
Log:
 r9005@Kushana:  nickm | 2006-09-29 10:37:55 -0400
 Implement DESCCHANGED event to tell controller when our router descriptor changes.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r9005] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-09-29 18:13:21 UTC (rev 8532)
+++ tor/trunk/ChangeLog	2006-09-29 18:13:25 UTC (rev 8533)
@@ -40,6 +40,8 @@
       any router can call itself Unnamed; directory servers will never
       allocate Unnamed to any particular router; clients won't believe that
       any router is the canonical Unnamed.
+    - New controller event to alert the controller when our server descriptor
+      has changed.
 
   o Security Fixes, minor:
     - If a client asked for a server by name, and we didn't have a

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2006-09-29 18:13:21 UTC (rev 8532)
+++ tor/trunk/doc/TODO	2006-09-29 18:13:25 UTC (rev 8533)
@@ -85,8 +85,8 @@
         registered and can't be looked up by nickname.]
 d     - Tolerate clock skew on bridge relays.
 d     - A way to examine and twiddle router flags from controller.
-      - A way to export server descriptors to controllers
-N         - Event / getinfo for "when did routerdesc last change".
+      o A way to export server descriptors to controllers
+          o Event for "when did routerdesc last change".
 d     - a way to pick entries based wholly on extend_info equivalent;
         a way to export extend_info equivalent.
 R     - option to dl directory info via tor
@@ -410,6 +410,8 @@
     - Specify; implement.
   - let each hidden service (or other thing) specify its own
     OutboundBindAddress?
+  - Stop using tor_socketpair to make connection bridges: do an
+    implementation that uses buffers only.
 
 Blue-sky:
   - Patch privoxy and socks protocol to pass strings to the browser.

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2006-09-29 18:13:21 UTC (rev 8532)
+++ tor/trunk/src/or/control.c	2006-09-29 18:13:25 UTC (rev 8533)
@@ -77,7 +77,8 @@
 #define LAST_V0_EVENT         0x000B
 #define EVENT_ADDRMAP         0x000C
 #define EVENT_AUTHDIR_NEWDESCS 0x000D
-#define _EVENT_MAX            0x000D
+#define EVENT_DESCCHANGED     0x000E
+#define _EVENT_MAX            0x000E
 
 /** Array mapping from message type codes to human-readable message
  * type names. Used for compatibility with version 0 of the control
@@ -952,6 +953,8 @@
           event_code = EVENT_ADDRMAP;
         else if (!strcasecmp(ev, "AUTHDIR_NEWDESCS"))
           event_code = EVENT_AUTHDIR_NEWDESCS;
+        else if (!strcasecmp(ev, "DESCCHANGED"))
+          event_code = EVENT_DESCCHANGED;
         else {
           connection_printf_to_buf(conn, "552 Unrecognized event \"%s\"\r\n",
                                    ev);
@@ -2982,6 +2985,15 @@
   return 0;
 }
 
+/** Our own router descriptor has changed; tell any controllers that care.
+ */
+int
+control_event_my_descriptor_changed(void)
+{
+  send_control1_event(EVENT_DESCCHANGED, "650 DESCCHANGED\r\n");
+  return 0;
+}
+
 /** Choose a random authentication cookie and write it to disk.
  * Anybody who can read the cookie from disk will be considered
  * authorized to use the control connection. */

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-09-29 18:13:21 UTC (rev 8532)
+++ tor/trunk/src/or/or.h	2006-09-29 18:13:25 UTC (rev 8533)
@@ -2063,6 +2063,7 @@
 int control_event_or_authdir_new_descriptor(const char *action,
                                             const char *descriptor,
                                             const char *msg);
+int control_event_my_descriptor_changed(void);
 
 int init_cookie_authentication(int enabled);
 int decode_hashed_password(char *buf, const char *hashed);

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2006-09-29 18:13:21 UTC (rev 8532)
+++ tor/trunk/src/or/router.c	2006-09-29 18:13:25 UTC (rev 8533)
@@ -903,6 +903,7 @@
 
   desc_clean_since = time(NULL);
   desc_needs_upload = 1;
+  control_event_my_descriptor_changed();
   return 0;
 }