aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-01-15 21:21:05 +0000
committerNick Mathewson <nickm@torproject.org>2007-01-15 21:21:05 +0000
commit380f8983c7e32dd26e8746f6cf75d12d08f962f7 (patch)
tree128c9c6149c3c173f9e12450b56cb7237eb2846d /src/or/connection_or.c
parentead35ef9440a4d20a559441b2c6779954d3c02d5 (diff)
downloadtor-380f8983c7e32dd26e8746f6cf75d12d08f962f7.tar
tor-380f8983c7e32dd26e8746f6cf75d12d08f962f7.tar.gz
r11966@Kushana: nickm | 2007-01-15 16:12:17 -0500
Tidy up ORCONN reason patch from Mike Perry. Changes: make some of the handling of TLS error codes less error prone. Enforce house style wrt spaces. Make it compile with --enable-gcc-warnings. Only set or_conn->tls_error in the case of an actual error. Add a changelog entry. svn:r9355
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r--src/or/connection_or.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index b7f944955..25eaf60f2 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -453,7 +453,7 @@ connection_or_connect(uint32_t addr, uint16_t port, const char *id_digest)
time(NULL));
router_set_status(conn->identity_digest, 0);
}
- control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED,
+ control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED,
END_OR_CONN_REASON_TCP_REFUSED);
connection_free(TO_CONN(conn));
return NULL;
@@ -509,17 +509,11 @@ connection_tls_continue_handshake(or_connection_t *conn)
{
check_no_tls_errors();
switch (tor_tls_handshake(conn->tls)) {
- case TOR_TLS_ERROR_IO:
- case TOR_TLS_ERROR_CONNREFUSED:
- case TOR_TLS_ERROR_CONNRESET:
- case TOR_TLS_ERROR_NO_ROUTE:
- case TOR_TLS_ERROR_TIMEOUT:
- case TOR_TLS_ERROR_MISC:
- case TOR_TLS_CLOSE:
+ CASE_TOR_TLS_ERROR_ANY:
log_info(LD_OR,"tls error. breaking connection.");
return -1;
case TOR_TLS_DONE:
- return connection_tls_finish_handshake(conn);
+ return connection_tls_finish_handshake(conn);
case TOR_TLS_WANTWRITE:
connection_start_writing(TO_CONN(conn));
log_debug(LD_OR,"wanted write");
@@ -527,6 +521,9 @@ connection_tls_continue_handshake(or_connection_t *conn)
case TOR_TLS_WANTREAD: /* handshaking conns are *always* reading */
log_debug(LD_OR,"wanted read");
return 0;
+ case TOR_TLS_CLOSE:
+ log_info(LD_OR,"tls closed. breaking connection.");
+ return -1;
}
return 0;
}
@@ -798,16 +795,20 @@ connection_or_send_destroy(uint16_t circ_id, or_connection_t *conn, int reason)
return 0;
}
+/* XXXX012 This global is getting _too_ global. -NM */
+extern smartlist_t *circuits_pending_or_conns;
+
/** Count number of pending circs on an or_conn */
-int
+int
connection_or_count_pending_circs(or_connection_t *or_conn)
{
- extern smartlist_t *circuits_pending_or_conns;
int cnt = 0;
if (!circuits_pending_or_conns)
return 0;
+ tor_assert(or_conn);
+
SMARTLIST_FOREACH(circuits_pending_or_conns, circuit_t *, circ,
{
if (circ->marked_for_close)