bugfix on a really old bug:

if read() fails on a stream, send back an end cell before you
close it down.


svn:r2509
This commit is contained in:
Roger Dingledine 2004-10-14 09:28:31 +00:00
parent 572714a458
commit cf9664151d

View File

@ -733,7 +733,11 @@ int connection_handle_read(connection_t *conn) {
if(connection_read_to_buf(conn) < 0) {
/* There's a read error; kill the connection.*/
connection_close_immediate(conn); /* Don't flush; connection is dead. */
conn->has_sent_end = 1; /* XXX have we already sent the end? really? */
if(conn->type == CONN_TYPE_AP || conn->type == CONN_TYPE_EXIT) {
connection_edge_end(conn, connection_state_is_open(conn) ?
END_STREAM_REASON_MISC : END_STREAM_REASON_CONNECTFAILED,
conn->cpath_layer);
}
connection_mark_for_close(conn);
if(conn->type == CONN_TYPE_DIR &&
conn->state == DIR_CONN_STATE_CONNECTING) {