]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Split control connection cleanup out of connection_free
authorRobert Ransom <rransom.8774@gmail.com>
Thu, 19 May 2011 23:27:51 +0000 (16:27 -0700)
committerRobert Ransom <rransom.8774@gmail.com>
Fri, 20 May 2011 15:25:42 +0000 (08:25 -0700)
src/or/connection.c
src/or/control.c
src/or/control.h

index fc2097f9a926d8301d0ccea7ec24644ef3e42a4a..24ab593fef2d1245dcc3a8de0f1a95f4add9c0ce 100644 (file)
@@ -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);
index 47e70818256f13a2d6ca636ed7a2c4ad14aacd25..0ddbee99c10f8c0655ea6d5cb85f14590788d008 100644 (file)
@@ -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
index a83e3747e645b01fc729464775473587fd901275..6694c96438c47e85fd2e60ec1daf5646f7735186 100644 (file)
@@ -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