aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-02-28 04:44:48 +0000
committerRoger Dingledine <arma@torproject.org>2004-02-28 04:44:48 +0000
commite59f19ca034361560d0fa332eb291961c63c1cea (patch)
treede19576dad6abf40a99e527d6677f884881ad404 /src
parentb4a7883c90716aed9362340e2905baf8d5c049c5 (diff)
downloadtor-e59f19ca034361560d0fa332eb291961c63c1cea.tar
tor-e59f19ca034361560d0fa332eb291961c63c1cea.tar.gz
some more small fixes
svn:r1152
Diffstat (limited to 'src')
-rw-r--r--src/or/connection.c1
-rw-r--r--src/or/connection_edge.c4
-rw-r--r--src/or/main.c7
3 files changed, 8 insertions, 4 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index b9b554698..ed96ed482 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -559,6 +559,7 @@ int connection_handle_write(connection_t *conn) {
connection_mark_for_close(conn, END_STREAM_REASON_MISC);
return -1;
}
+ /* conns in CONNECTING state will fall through... */
}
if(!connection_wants_to_flush(conn)) /* it's done flushing */
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 08cf97144..ef07107c8 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -305,7 +305,9 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
conn->done_sending = 1;
shutdown(conn->s, 1); /* XXX check return; refactor NM */
if (conn->done_receiving) {
- connection_mark_for_close(conn, END_STREAM_REASON_DONE);
+ /* We just *got* an end; no reason to send one. */
+ conn->has_sent_end = 1;
+ connection_mark_for_close(conn, 0);
}
#else
/* We just *got* an end; no reason to send one. */
diff --git a/src/or/main.c b/src/or/main.c
index 88fe73820..7bec18ab6 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -158,6 +158,9 @@ void connection_start_writing(connection_t *conn) {
static void conn_read(int i) {
connection_t *conn = connection_array[i];
+ if (conn->marked_for_close)
+ return;
+
/* see http://www.greenend.org.uk/rjk/2001/06/poll.html for
* discussion of POLLIN vs POLLHUP */
if(!(poll_array[i].revents & (POLLIN|POLLHUP|POLLERR)))
@@ -165,8 +168,6 @@ static void conn_read(int i) {
!connection_has_pending_tls_data(conn))
return; /* this conn should not read */
- if (conn->marked_for_close)
- return;
log_fn(LOG_DEBUG,"socket %d wants to read.",conn->s);
assert_connection_ok(conn, time(NULL));
@@ -204,7 +205,7 @@ static void conn_write(int i) {
if (connection_handle_write(conn) < 0) {
if (!conn->marked_for_close) {
/* this connection is broken. remove it. */
- log_fn(LOG_ERR,"Unhandled error on read for %s connection (fd %d); removing",
+ log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing",
conn_type_to_string[conn->type], conn->s);
connection_mark_for_close(conn,0);
}