some more small fixes

svn:r1152
This commit is contained in:
Roger Dingledine
2004-02-28 04:44:48 +00:00
parent b4a7883c90
commit e59f19ca03
3 changed files with 8 additions and 4 deletions
+1
View File
@@ -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 */
+3 -1
View File
@@ -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. */
+4 -3
View File
@@ -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);
}