diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-03-01 22:42:31 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-03-01 22:42:31 +0000 |
commit | afe414f070cee8ce1469fc6db8f51bb9e71c654d (patch) | |
tree | 75bf4f5349f0bfd7bab12433b200329f45e91e3a /src/or/connection.c | |
parent | 4ddf768a4fc98bfc2e18a7076bd0397967e3de5e (diff) | |
download | tor-afe414f070cee8ce1469fc6db8f51bb9e71c654d.tar.gz tor-afe414f070cee8ce1469fc6db8f51bb9e71c654d.zip |
Revise all calls to connection_edge_end to avoid sending MISC, and to take errno into account where possible.
svn:r3720
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 79c98fd280..75c61b4daa 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -913,9 +913,7 @@ loop_again: /* There's a read error; kill the connection.*/ connection_close_immediate(conn); /* Don't flush; connection is dead. */ if (CONN_IS_EDGE(conn)) { - connection_edge_end(conn, (char)(connection_state_is_open(conn) ? - END_STREAM_REASON_MISC : END_STREAM_REASON_CONNECTREFUSED), - conn->cpath_layer); + connection_edge_end_errno(conn, conn->cpath_layer); } connection_mark_for_close(conn); return -1; @@ -1083,7 +1081,7 @@ int connection_handle_write(connection_t *conn) { if (getsockopt(conn->s, SOL_SOCKET, SO_ERROR, (void*)&e, &len) < 0) { log_fn(LOG_WARN,"getsockopt() syscall failed?! Please report to tor-ops."); if (CONN_IS_EDGE(conn)) - connection_edge_end(conn, END_STREAM_REASON_MISC, conn->cpath_layer); + connection_edge_end_errno(conn, conn->cpath_layer); connection_mark_for_close(conn); return -1; } @@ -1092,8 +1090,7 @@ int connection_handle_write(connection_t *conn) { if (!ERRNO_IS_CONN_EINPROGRESS(e)) { log_fn(LOG_INFO,"in-progress connect failed. Removing."); if (CONN_IS_EDGE(conn)) - connection_edge_end(conn, END_STREAM_REASON_CONNECTREFUSED, - conn->cpath_layer); + connection_edge_end_errno(conn, conn->cpath_layer); connection_close_immediate(conn); connection_mark_for_close(conn); @@ -1157,11 +1154,9 @@ int connection_handle_write(connection_t *conn) { } else { result = flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); if (result < 0) { - /* XXXX Is this right? -NM if (CONN_IS_EDGE(conn)) - connection_edge_end(conn, END_STREAM_REASON_MISC, - conn->cpath_layer); - */ + connection_edge_end_errno(conn, conn->cpath_layer); + connection_close_immediate(conn); /* Don't flush; connection is dead. */ conn->has_sent_end = 1; connection_mark_for_close(conn); |