summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-12-06 19:49:21 -0500
committerNick Mathewson <nickm@torproject.org>2011-12-06 19:49:21 -0500
commit9727d21f68d0ef91f9c9002bebde425477bc4c6f (patch)
treeaf7cc98eae122634113afd05931a96fa28576b14
parente09dd43ab38e2f1a23010463b1188a1d3631e960 (diff)
downloadtor-9727d21f68d0ef91f9c9002bebde425477bc4c6f.tar.gz
tor-9727d21f68d0ef91f9c9002bebde425477bc4c6f.zip
Revert "Detect renegotiation when it actually happens."
This reverts commit 4fd79f9def28996552b5739792f428c2514de1f6.
-rw-r--r--src/common/tortls.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index c0ff4e172d..e26fd1ff26 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -1638,28 +1638,19 @@ tor_tls_read(tor_tls_t *tls, char *cp, size_t len)
tor_assert(tls->state == TOR_TLS_ST_OPEN);
tor_assert(len<INT_MAX);
r = SSL_read(tls->ssl, cp, (int)len);
- if (r > 0) /* return the number of characters read */
- return r;
-
- /* If we got here, SSL_read() did not go as expected. */
-
- err = tor_tls_get_error(tls, r, CATCH_ZERO, "reading", LOG_DEBUG, LD_NET);
-
+ if (r > 0) {
#ifdef V2_HANDSHAKE_SERVER
- if (tls->got_renegotiate) {
- tor_assert(tls->server_handshake_count == 2);
- /* XXX tor_assert(err == TOR_TLS_WANTREAD); */
-
- /* Renegotiation happened! */
- log_info(LD_NET, "Got a TLS renegotiation from %s", ADDR(tls));
- if (tls->negotiated_callback)
- tls->negotiated_callback(tls, tls->callback_arg);
- tls->got_renegotiate = 0;
-
+ if (tls->got_renegotiate) {
+ /* Renegotiation happened! */
+ log_info(LD_NET, "Got a TLS renegotiation from %s", ADDR(tls));
+ if (tls->negotiated_callback)
+ tls->negotiated_callback(tls, tls->callback_arg);
+ tls->got_renegotiate = 0;
+ }
+#endif
return r;
}
-#endif
-
+ err = tor_tls_get_error(tls, r, CATCH_ZERO, "reading", LOG_DEBUG, LD_NET);
if (err == _TOR_TLS_ZERORETURN || err == TOR_TLS_CLOSE) {
log_debug(LD_NET,"read returned r=%d; TLS is closed",r);
tls->state = TOR_TLS_ST_CLOSED;