[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r14066: Part of fix for bug 617: allow connection_ap_handshake_attac (in tor/trunk: . src/or)
Author: nickm
Date: 2008-03-16 23:37:54 -0400 (Sun, 16 Mar 2008)
New Revision: 14066
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/circuituse.c
tor/trunk/src/or/connection_edge.c
tor/trunk/src/or/relay.c
tor/trunk/src/or/rendclient.c
Log:
r18862@catbus: nickm | 2008-03-16 23:33:11 -0400
Part of fix for bug 617: allow connection_ap_handshake_attach_circuit() to mark connections, to avoid double-mark warnings. Note that this is an incomplete refactoring.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r18862] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2008-03-17 03:37:52 UTC (rev 14065)
+++ tor/trunk/ChangeLog 2008-03-17 03:37:54 UTC (rev 14066)
@@ -28,6 +28,7 @@
0.2.0.x.
- Detect mismatched page sizes when using --enable-openbsd-malloc.
Bugfix on 0.2.0.x.
+ - Stop giving double-close warn when we reject an address for client DNS.
o Minor features:
- Allow separate log levels to be configured for different logging
@@ -38,7 +39,12 @@
to avoid unused RAM in buffer chunks and memory pools.
- Downgrade "sslv3 alert handshake failure" message to INFO.
+ o Code simplifications and refactoring:
+ - Refactor code using connection_ap_handshake_attach_circuit() to
+ allow that function to mark connections for close. Part of a fix for
+ bug 617. Bugfix on 0.2.0.1-alpha.
+
Changes in version 0.2.0.21-rc - 2008-03-02
o Major bugfixes:
- The control port should declare that it requires password auth
Modified: tor/trunk/src/or/circuituse.c
===================================================================
--- tor/trunk/src/or/circuituse.c 2008-03-17 03:37:52 UTC (rev 14065)
+++ tor/trunk/src/or/circuituse.c 2008-03-17 03:37:54 UTC (rev 14066)
@@ -1255,11 +1255,13 @@
/** Try to find a safe live circuit for CONN_TYPE_AP connection conn. If
* we don't find one: if conn cannot be handled by any known nodes,
- * warn and return -1 (conn needs to die);
+ * warn and return -1 (conn needs to die, and is maybe already marked);
* else launch new circuit (if necessary) and return 0.
* Otherwise, associate conn with a safe live circuit, do the
* right next step, and return 1.
*/
+/* XXXX021 this function should mark for close whenever it returns -1;
+ * its callers shouldn't have to worry about that. */
int
connection_ap_handshake_attach_circuit(edge_connection_t *conn)
{
Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c 2008-03-17 03:37:52 UTC (rev 14065)
+++ tor/trunk/src/or/connection_edge.c 2008-03-17 03:37:54 UTC (rev 14066)
@@ -431,7 +431,8 @@
/* move it back into 'pending' state, and try to attach. */
if (connection_ap_detach_retriable(conn, TO_ORIGIN_CIRCUIT(circ),
END_STREAM_REASON_TIMEOUT)<0) {
- connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
+ if (!conn->_base.marked_for_close)
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
}
}); /* end foreach */
}
@@ -452,7 +453,9 @@
continue;
edge_conn = TO_EDGE_CONN(conn);
if (connection_ap_handshake_attach_circuit(edge_conn) < 0) {
- connection_mark_unattached_ap(edge_conn, END_STREAM_REASON_CANT_ATTACH);
+ if (!edge_conn->_base.marked_for_close)
+ connection_mark_unattached_ap(edge_conn,
+ END_STREAM_REASON_CANT_ATTACH);
}
});
}
@@ -1501,7 +1504,8 @@
conn, circ, cpath) < 0) ||
(!circ &&
connection_ap_handshake_attach_circuit(conn) < 0)) {
- connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
+ if (!conn->_base.marked_for_close)
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
return -1;
}
return 0;
@@ -1562,7 +1566,8 @@
conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
log_info(LD_REND, "Descriptor is here and fresh enough. Great.");
if (connection_ap_handshake_attach_circuit(conn) < 0) {
- connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
+ if (!conn->_base.marked_for_close)
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
return -1;
}
} else {
@@ -2100,7 +2105,8 @@
/* attaching to a dirty circuit is fine */
if (connection_ap_handshake_attach_circuit(conn) < 0) {
- connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
+ if (!conn->_base.marked_for_close)
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
return NULL;
}
Modified: tor/trunk/src/or/relay.c
===================================================================
--- tor/trunk/src/or/relay.c 2008-03-17 03:37:52 UTC (rev 14065)
+++ tor/trunk/src/or/relay.c 2008-03-17 03:37:54 UTC (rev 14066)
@@ -845,7 +845,9 @@
connection_edge_end_reason_str(rh->length > 0 ? reason : -1));
if (conn->_base.type == CONN_TYPE_AP) {
circuit_log_path(LOG_INFO,LD_APP,circ);
- connection_mark_unattached_ap(conn, control_reason);
+ /* need to test because of detach_retriable*/
+ if (!conn->_base.marked_for_close)
+ connection_mark_unattached_ap(conn, control_reason);
} else {
/* we just got an 'end', don't need to send one */
conn->_base.edge_has_sent_end = 1;
Modified: tor/trunk/src/or/rendclient.c
===================================================================
--- tor/trunk/src/or/rendclient.c 2008-03-17 03:37:52 UTC (rev 14065)
+++ tor/trunk/src/or/rendclient.c 2008-03-17 03:37:54 UTC (rev 14066)
@@ -650,7 +650,8 @@
if (connection_ap_handshake_attach_circuit(conn) < 0) {
/* it will never work */
log_warn(LD_REND,"Rendezvous attempt failed. Closing.");
- connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
+ if (!conn->_base.marked_for_close)
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
}
} else { /* 404, or fetch didn't get that far */
log_notice(LD_REND,"Closing stream for '%s.onion': hidden service is "