diff options
author | Roger Dingledine <arma@torproject.org> | 2004-03-03 07:26:34 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-03-03 07:26:34 +0000 |
commit | d8e5f3a3a2fe68be89eddd00c4a5c01922c378a8 (patch) | |
tree | 4ab9f7d3d14b8dbbc885791aac57f867b2e676e1 /src/or | |
parent | dbdd2eaa2a00ab9144c118b975fe5ec5e9e57312 (diff) | |
download | tor-d8e5f3a3a2fe68be89eddd00c4a5c01922c378a8.tar.gz tor-d8e5f3a3a2fe68be89eddd00c4a5c01922c378a8.zip |
close immediately when write() fails too, else things will turn bad
svn:r1212
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/connection.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 58e82616af..1ec9df3006 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -568,7 +568,12 @@ int connection_handle_write(connection_t *conn) { conn->state != OR_CONN_STATE_CONNECTING) { if (conn->state == OR_CONN_STATE_HANDSHAKING) { connection_stop_writing(conn); - return connection_tls_continue_handshake(conn); + if(connection_tls_continue_handshake(conn) < 0) { + connection_close_immediate(conn); /* Don't flush; connection is dead. */ + connection_mark_for_close(conn, 0); + return -1; + } + return 0; } /* else open, or closing */ @@ -576,6 +581,7 @@ int connection_handle_write(connection_t *conn) { case TOR_TLS_ERROR: case TOR_TLS_CLOSE: log_fn(LOG_INFO,"tls error. breaking."); + connection_close_immediate(conn); /* Don't flush; connection is dead. */ connection_mark_for_close(conn, 0); return -1; /* XXX deal with close better */ case TOR_TLS_WANTWRITE: @@ -601,6 +607,7 @@ int connection_handle_write(connection_t *conn) { } } else { if (flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen) < 0) { + connection_close_immediate(conn); /* Don't flush; connection is dead. */ connection_mark_for_close(conn, END_STREAM_REASON_MISC); return -1; } |