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

[or-cvs] r11915: Stop publishing a new server descriptor just because we HUP (in tor/trunk: . src/or)



Author: arma
Date: 2007-10-13 18:31:35 -0400 (Sat, 13 Oct 2007)
New Revision: 11915

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/main.c
   tor/trunk/src/or/router.c
Log:
Stop publishing a new server descriptor just because we HUP or
when we find our DirPort to be reachable but won't actually publish
it. Extra descriptors without any real changes are dropped by the
authorities, and can screw up our "publish every 18 hours" schedule.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-13 22:01:24 UTC (rev 11914)
+++ tor/trunk/ChangeLog	2007-10-13 22:31:35 UTC (rev 11915)
@@ -1,6 +1,12 @@
 Changes in version 0.2.0.9-alpha - 2007-10-??
 
+  o Major bugfixes:
+    - Stop publishing a new server descriptor just because we HUP or
+      when we find our DirPort to be reachable but won't actually publish
+      it. Extra descriptors without any real changes are dropped by the
+      authorities, and can screw up our "publish every 18 hours" schedule.
 
+
 Changes in version 0.2.0.8-alpha - 2007-10-12
   o Major features (router descriptor cache):
     - Store routers in a file called cached-descriptors instead of in

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2007-10-13 22:01:24 UTC (rev 11914)
+++ tor/trunk/src/or/main.c	2007-10-13 22:31:35 UTC (rev 11915)
@@ -1250,7 +1250,7 @@
 }
 
 /** Called when we get a SIGHUP: reload configuration files and keys,
- * retry all connections, re-upload all descriptors, and so on. */
+ * retry all connections, and so on. */
 static int
 do_hup(void)
 {
@@ -1299,8 +1299,6 @@
    * force a retry there. */
 
   if (server_mode(options)) {
-//    const char *descriptor;
-    mark_my_descriptor_dirty();
     /* Restart cpuworker and dnsworker processes, so they get up-to-date
      * configuration options. */
     cpuworkers_rotate();

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2007-10-13 22:01:24 UTC (rev 11914)
+++ tor/trunk/src/or/router.c	2007-10-13 22:31:35 UTC (rev 11915)
@@ -597,7 +597,7 @@
  * a DirPort.
  */
 static int
-decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router)
+decide_to_advertise_dirport(or_options_t *options, uint16_t dir_port)
 {
   static int advertising=1; /* start out assuming we will advertise */
   int new_choice=1;
@@ -607,10 +607,10 @@
    * worth mentioning to the user, either because they're obvious
    * or because they're normal behavior. */
 
-  if (!router->dir_port) /* short circuit the rest of the function */
+  if (!dir_port) /* short circuit the rest of the function */
     return 0;
   if (authdir_mode(options)) /* always publish */
-    return router->dir_port;
+    return dir_port;
   if (we_are_hibernating())
     return 0;
   if (!check_whether_dirport_reachable())
@@ -635,7 +635,7 @@
 
   if (advertising != new_choice) {
     if (new_choice == 1) {
-      log(LOG_NOTICE, LD_DIR, "Advertising DirPort as %d", router->dir_port);
+      log(LOG_NOTICE, LD_DIR, "Advertising DirPort as %d", dir_port);
     } else {
       tor_assert(reason);
       log(LOG_NOTICE, LD_DIR, "Not advertising DirPort (Reason: %s)", reason);
@@ -643,7 +643,7 @@
     advertising = new_choice;
   }
 
-  return advertising ? router->dir_port : 0;
+  return advertising ? dir_port : 0;
 }
 
 /** Some time has passed, or we just got new directory information.
@@ -722,7 +722,8 @@
     log_notice(LD_DIRSERV,"Self-testing indicates your DirPort is reachable "
                "from the outside. Excellent.");
     can_reach_dir_port = 1;
-    mark_my_descriptor_dirty();
+    if (!me || decide_to_advertise_dirport(get_options(), me->dir_port))
+      mark_my_descriptor_dirty();
     if (!me)
       return;
     control_event_server_status(LOG_NOTICE,
@@ -1553,7 +1554,7 @@
     router->nickname,
     router->address,
     router->or_port,
-    decide_to_advertise_dirport(options, router),
+    decide_to_advertise_dirport(options, router->dir_port),
     router->platform,
     published,
     fingerprint,