diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-04-12 01:14:32 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-04-12 01:14:32 -0400 |
commit | 63ab5f4849620cee81c578d231174bf9f846d740 (patch) | |
tree | c8a476701ec9d0b17775dfae6b12c4b6f51f8443 /src/or/connection.c | |
parent | d39f7138063125b92f738715ca1bcd53f5ef147c (diff) | |
parent | 97246a5b6d6c2e25db14e7a82f4a01b876447101 (diff) | |
download | tor-63ab5f4849620cee81c578d231174bf9f846d740.tar.gz tor-63ab5f4849620cee81c578d231174bf9f846d740.zip |
Merge remote-tracking branch 'origin/maint-0.2.4'
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 29af7749a7..af52f58e93 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -3065,7 +3065,20 @@ connection_read_to_buf(connection_t *conn, ssize_t *max_to_read, case TOR_TLS_WANTWRITE: connection_start_writing(conn); return 0; - case TOR_TLS_WANTREAD: /* we're already reading */ + case TOR_TLS_WANTREAD: + if (conn->in_connection_handle_write) { + /* We've been invoked from connection_handle_write, because we're + * waiting for a TLS renegotiation, the renegotiation started, and + * SSL_read returned WANTWRITE. But now SSL_read is saying WANTREAD + * again. Stop waiting for write events now, or else we'll + * busy-loop until data arrives for us to read. */ + connection_stop_writing(conn); + if (!connection_is_reading(conn)) + connection_start_reading(conn); + } + /* we're already reading, one hopes */ + result = 0; + break; case TOR_TLS_DONE: /* no data read, so nothing to process */ result = 0; break; /* so we call bucket_decrement below */ @@ -3624,7 +3637,9 @@ connection_handle_write(connection_t *conn, int force) { int res; tor_gettimeofday_cache_clear(); + conn->in_connection_handle_write = 1; res = connection_handle_write_impl(conn, force); + conn->in_connection_handle_write = 0; return res; } |