[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] backport] We were neglecting to unlink marked circuits from...
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv13921/src/or
Modified Files:
Tag: tor-0_1_0-patches
circuitlist.c circuituse.c or.h
Log Message:
[backport] We were neglecting to unlink marked circuits from soon-to-close OR connections. (Why, of course it is a coincidence that my improved fix is a trivial backport! Nothing to see here...)
Index: circuitlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitlist.c,v
retrieving revision 1.47
retrieving revision 1.47.2.1
diff -u -d -r1.47 -r1.47.2.1
--- circuitlist.c 3 May 2005 10:04:07 -0000 1.47
+++ circuitlist.c 5 Dec 2005 19:52:05 -0000 1.47.2.1
@@ -407,6 +407,27 @@
return NULL;
}
+/** For each circuits that have <b>conn</b> as n_conn or p_conn, unlink the
+ * circuit from the orconn,circid map, and mark it for close if it hasn't
+ * been marked already.
+ */
+void
+circuit_unlink_all_from_or_conn(connection_t *conn)
+{
+ circuit_t *circ;
+
+ for (circ = global_circuitlist; circ; circ = circ->next) {
+ if (circ->n_conn == conn || circ->p_conn == conn) {
+ if (circ->n_conn == conn)
+ circuit_set_circid_orconn(circ, 0, NULL, N_CONN_CHANGED);
+ if (circ->p_conn == conn)
+ circuit_set_circid_orconn(circ, 0, NULL, P_CONN_CHANGED);
+ if (!circ->marked_for_close)
+ circuit_mark_for_close(circ);
+ }
+ }
+}
+
/** Return a circ such that:
* - circ-\>rend_query is equal to <b>rend_query</b>, and
* - circ-\>purpose is equal to <b>purpose</b>.
Index: circuituse.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.72.2.3
retrieving revision 1.72.2.4
diff -u -d -r1.72.2.3 -r1.72.2.4
--- circuituse.c 5 Dec 2005 06:08:20 -0000 1.72.2.3
+++ circuituse.c 5 Dec 2005 19:52:05 -0000 1.72.2.4
@@ -483,15 +483,7 @@
/* Inform any pending (not attached) circs that they should give up. */
circuit_n_conn_done(conn, 0);
/* Now close all the attached circuits on it. */
- while ((circ = circuit_get_by_conn(conn))) {
- if (circ->n_conn == conn)
- /* it's closing in front of us */
- circuit_set_circid_orconn(circ, 0, NULL, N_CONN_CHANGED);
- if (circ->p_conn == conn)
- /* it's closing behind us */
- circuit_set_circid_orconn(circ, 0, NULL, P_CONN_CHANGED);
- circuit_mark_for_close(circ);
- }
+ circuit_unlink_all_from_or_conn(conn);
return;
case CONN_TYPE_AP:
case CONN_TYPE_EXIT:
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.610.2.3
retrieving revision 1.610.2.4
diff -u -d -r1.610.2.3 -r1.610.2.4
--- or.h 11 Sep 2005 22:37:20 -0000 1.610.2.3
+++ or.h 5 Dec 2005 19:52:05 -0000 1.610.2.4
@@ -1187,6 +1187,7 @@
circuit_t *circuit_get_by_circid_orconn(uint16_t circ_id, connection_t *conn);
circuit_t *circuit_get_by_edge_conn(connection_t *conn);
circuit_t *circuit_get_by_conn(connection_t *conn);
+void circuit_unlink_all_from_or_conn(connection_t *conn);
circuit_t *circuit_get_by_global_id(uint32_t id);
circuit_t *circuit_get_by_rend_query_and_purpose(const char *rend_query, uint8_t purpose);
circuit_t *circuit_get_next_by_pk_and_purpose(circuit_t *start,