[tor-commits] [tor/master] Close orconns correctly through channels when setting DisableNetwork to 1

nickm at torproject.org nickm at torproject.org
Thu Apr 17 03:15:50 UTC 2014


commit a5544e589d1724fc2765b277da736bbb2a9a8299
Author: Andrea Shepard <andrea at torproject.org>
Date:   Tue Apr 15 20:19:39 2014 -0700

    Close orconns correctly through channels when setting DisableNetwork to 1
---
 changes/bug11306    |    4 ++++
 src/or/connection.c |   14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/changes/bug11306 b/changes/bug11306
new file mode 100644
index 0000000..bf8ea40
--- /dev/null
+++ b/changes/bug11306
@@ -0,0 +1,4 @@
+  o Bugfixes:
+    - When closing all connections on setting DisableNetwork to 1, use
+      connection_or_close_normally() rather than closing orconns out from
+      under the channel layer.  Fixes bug #11306.
diff --git a/src/or/connection.c b/src/or/connection.c
index 1be4c45..0c61b0d 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2359,6 +2359,20 @@ connection_mark_all_noncontrol_connections(void)
         connection_mark_unattached_ap(TO_ENTRY_CONN(conn),
                                       END_STREAM_REASON_HIBERNATING);
         break;
+      case CONN_TYPE_OR:
+        {
+          or_connection_t *orconn = TO_OR_CONN(conn);
+          if (orconn->chan) {
+            connection_or_close_normally(orconn, 0);
+          } else {
+            /*
+             * There should have been one, but mark for close and hope
+             * for the best..
+             */
+            connection_mark_for_close(conn);
+          }
+        }
+        break;
       default:
         connection_mark_for_close(conn);
         break;





More information about the tor-commits mailing list