]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
More emergency-check code for un-removed pending entry conns
authorNick Mathewson <nickm@torproject.org>
Thu, 17 Dec 2015 00:16:07 +0000 (19:16 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 17 Dec 2015 00:16:07 +0000 (19:16 -0500)
This might also be what #17752 needs.

src/or/connection.c
src/or/connection_edge.c
src/or/connection_edge.h

index d6e5fcb27791eb0c9458ab21f49349c17546850c..b4cd4cdddb4a26a28992ea40fa4166085af5fa63 100644 (file)
@@ -678,6 +678,13 @@ connection_free,(connection_t *conn))
   if (conn->type == CONN_TYPE_CONTROL) {
     connection_control_closed(TO_CONTROL_CONN(conn));
   }
+#if 1
+  /* DEBUGGING */
+  if (conn->type == CONN_TYPE_AP) {
+    connection_ap_warn_and_unmark_if_pending_circ(TO_ENTRY_CONN(conn),
+                                                  "connection_free");
+  }
+#endif
   connection_unregister_events(conn);
   connection_free_(conn);
 }
index d4ef064164477064a181682bf92817fbd81ed9a7..8a3beb3ce9dbdd5584c3affa49ff2df635439067 100644 (file)
@@ -566,11 +566,9 @@ connection_ap_about_to_close(entry_connection_t *entry_conn)
 #if 1
   /* Check to make sure that this isn't in pending_entry_connections if it
    * didn't actually belong there. */
-  if (TO_CONN(edge_conn)->type == CONN_TYPE_AP &&
-      smartlist_contains(pending_entry_connections, entry_conn)) {
-    log_warn(LD_BUG, "What was %p doing in pending_entry_connections???",
-             entry_conn);
-    smartlist_remove(pending_entry_connections, entry_conn);
+  if (TO_CONN(edge_conn)->type == CONN_TYPE_AP) {
+    connection_ap_warn_and_unmark_if_pending_circ(entry_conn,
+                                                  "about_to_close");
   }
 #endif
 
@@ -903,6 +901,19 @@ connection_ap_mark_as_non_pending_circuit(entry_connection_t *entry_conn)
   smartlist_remove(pending_entry_connections, entry_conn);
 }
 
+/** DOCDOC */
+void
+connection_ap_warn_and_unmark_if_pending_circ(entry_connection_t *entry_conn,
+                                              const char *where)
+{
+  if (pending_entry_connections &&
+      smartlist_contains(pending_entry_connections, entry_conn)) {
+    log_warn(LD_BUG, "What was %p doing in pending_entry_connections in %s?",
+             entry_conn, where);
+    connection_ap_mark_as_non_pending_circuit(entry_conn);
+  }
+}
+
 /** Tell any AP streams that are waiting for a one-hop tunnel to
  * <b>failed_digest</b> that they are going to fail. */
 /* XXX024 We should get rid of this function, and instead attach
index 6da51eb0c6721f18e95300c0c3e71773e791d483..2aba801461c8850d4a5a77991164be5148778377 100644 (file)
@@ -115,6 +115,10 @@ streamid_t get_unique_stream_id_by_circ(origin_circuit_t *circ);
 
 void connection_edge_free_all(void);
 
+void connection_ap_warn_and_unmark_if_pending_circ(
+                                             entry_connection_t *entry_conn,
+                                             const char *where);
+
 /** @name Begin-cell flags
  *
  * These flags are used in RELAY_BEGIN cells to change the default behavior