diff options
author | Roger Dingledine <arma@torproject.org> | 2004-10-14 09:28:31 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-10-14 09:28:31 +0000 |
commit | cf9664151d90b7de6481a350cda769c2d5883b82 (patch) | |
tree | cbef32d3f337c607f54dc07bec20334d93ada02a /src | |
parent | 572714a458bbf3c8a121db721881d5be67753019 (diff) | |
download | tor-cf9664151d90b7de6481a350cda769c2d5883b82.tar tor-cf9664151d90b7de6481a350cda769c2d5883b82.tar.gz |
bugfix on a really old bug:
if read() fails on a stream, send back an end cell before you
close it down.
svn:r2509
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 090922b0a..a5e857cf6 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -733,14 +733,18 @@ 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) { /* it's a directory server and connecting failed: forget about this router */ /* XXX I suspect pollerr may make Windows not get to this point. :( */ router_mark_as_down(conn->identity_digest); - if(conn->purpose == DIR_PURPOSE_FETCH_DIR && + if(conn->purpose == DIR_PURPOSE_FETCH_DIR && !all_trusted_directory_servers_down()) { log_fn(LOG_INFO,"Giving up on dirserver %s; trying another.", conn->address); directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 0); |