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

[or-cvs] r13469: Have assert_connection_ok() allow marked-for-close dir conns (in tor/branches/tor-0_1_2-patches: . src/or)



Author: nickm
Date: 2008-02-11 13:55:05 -0500 (Mon, 11 Feb 2008)
New Revision: 13469

Modified:
   tor/branches/tor-0_1_2-patches/
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/src/or/connection.c
   tor/branches/tor-0_1_2-patches/src/or/dirserv.c
Log:
 r18031@catbus:  nickm | 2008-02-11 13:54:58 -0500
 Have assert_connection_ok() allow marked-for-close dir conns with stuff to flush but no way to flush it.  Adjust conn_dirserv_unlink_from_bridge() to mark edge and dir conns not already marked, since once linked conns are unlinked they are no longer viable.  Likely fix for bug 406, which was crashing 0.1.2.x servers periodically.



Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
 svk:merge ticket from /tor/012 [r18031] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2008-02-11 16:49:38 UTC (rev 13468)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2008-02-11 18:55:05 UTC (rev 13469)
@@ -3,6 +3,10 @@
     - Patch from "Andrew S. Lists" to catch when we contact a directory
       mirror at IP address X and he says we look like we're coming from
       IP address X. Bugfix on 0.1.2.x.
+    - Allow a closing-down linked directory connection to have its
+      blocked_on_or_conn field set.  This prevents a rare assertion error
+      that could occur when an OR connection carrying tunneled directory
+      requests closed before the requests were complete.  Fixes bug 406.
 
   o Minor bugfixes:
     - Stop recommending that every server operator send mail to tor-ops.

Modified: tor/branches/tor-0_1_2-patches/src/or/connection.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/connection.c	2008-02-11 16:49:38 UTC (rev 13468)
+++ tor/branches/tor-0_1_2-patches/src/or/connection.c	2008-02-11 18:55:05 UTC (rev 13469)
@@ -2403,7 +2403,8 @@
   if (conn->outbuf_flushlen > 0) {
     tor_assert(connection_is_writing(conn) || conn->wants_to_write ||
                (conn->type == CONN_TYPE_DIR &&
-                TO_DIR_CONN(conn)->is_blocked_on_or_conn));
+                (conn->marked_for_close ||
+                 TO_DIR_CONN(conn)->is_blocked_on_or_conn)));
   }
 
   if (conn->hold_open_until_flushed)

Modified: tor/branches/tor-0_1_2-patches/src/or/dirserv.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/dirserv.c	2008-02-11 16:49:38 UTC (rev 13468)
+++ tor/branches/tor-0_1_2-patches/src/or/dirserv.c	2008-02-11 18:55:05 UTC (rev 13469)
@@ -2051,12 +2051,18 @@
   or_conn = connection_dirserv_get_target_or_conn(dir_conn);
   if (or_conn) {
     /* XXXX Really, this is only necessary if dir_conn->is_blocked_on_or_conn.
-     * But for now, let's leave it in, so the assert can catch  */
+     * But for now, let's leave it in, so the assert can catch problems.  */
     connection_dirserv_remove_from_blocked_list(or_conn, dir_conn);
   }
   dir_conn->is_blocked_on_or_conn = 0; /* Probably redundant. */
-  edge_conn->bridge_for_conn = NULL;
   dir_conn->bridge_conn = NULL;
+  if (edge_conn) {
+    edge_conn->bridge_for_conn = NULL;
+    if (!edge_conn->_base.marked_for_close)
+      connection_mark_for_close(TO_CONN(edge_conn));
+  }
+  if (!dir_conn->_base.marked_for_close)
+    connection_mark_for_close(TO_CONN(dir_conn));
 }
 
 /** Stop writing on a bridged dir_conn, and remember that it's blocked because