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

[tor-commits] [tor/maint-0.2.2] Split control connection cleanup out of connection_free



commit 338a0266101e3addecbaf5771f62a860244896b3
Author: Robert Ransom <rransom.8774@xxxxxxxxx>
Date:   Thu May 19 16:27:51 2011 -0700

    Split control connection cleanup out of connection_free
---
 src/or/connection.c |    3 +--
 src/or/control.c    |   10 ++++++++++
 src/or/control.h    |    2 ++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/or/connection.c b/src/or/connection.c
index fc2097f..24ab593 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -479,8 +479,7 @@ connection_free(connection_t *conn)
     }
   }
   if (conn->type == CONN_TYPE_CONTROL) {
-    TO_CONTROL_CONN(conn)->event_mask = 0;
-    control_update_global_event_mask();
+    connection_control_closed(TO_CONTROL_CONN(conn));
   }
   connection_unregister_events(conn);
   _connection_free(conn);
diff --git a/src/or/control.c b/src/or/control.c
index 47e7081..0ddbee9 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2739,6 +2739,16 @@ connection_control_reached_eof(control_connection_t *conn)
   return 0;
 }
 
+/** Called when <b>conn</b> is being freed. */
+void
+connection_control_closed(control_connection_t *conn)
+{
+  tor_assert(conn);
+
+  conn->event_mask = 0;
+  control_update_global_event_mask();
+}
+
 /** Return true iff <b>cmd</b> is allowable (or at least forgivable) at this
  * stage of the protocol. */
 static int
diff --git a/src/or/control.h b/src/or/control.h
index a83e374..6694c96 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -25,6 +25,8 @@ void control_adjust_event_log_severity(void);
 
 int connection_control_finished_flushing(control_connection_t *conn);
 int connection_control_reached_eof(control_connection_t *conn);
+void connection_control_closed(control_connection_t *conn);
+
 int connection_control_process_inbuf(control_connection_t *conn);
 
 #define EVENT_AUTHDIR_NEWDESCS 0x000D



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits