[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Change an assertion into a warning in connection_or_handle_event_cb()
commit 6b7c3b42ee72cb2e7de443e8942ccc21a6304c59
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu May 24 11:14:28 2012 -0400
Change an assertion into a warning in connection_or_handle_event_cb()
Possibly addresses bug 4873, though IMO that's likely not a real
bug: it seems likely to have been an ssl version mismatch.
---
changes/bug4873 | 3 +++
src/or/connection_or.c | 28 ++++++++++++++++------------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/changes/bug4873 b/changes/bug4873
new file mode 100644
index 0000000..6c999cc
--- /dev/null
+++ b/changes/bug4873
@@ -0,0 +1,3 @@
+ o Minor bugfixes:
+ - Turn an assertion (that the number of handshakes received as a
+ server is not < 1) into a warning. Bug 4873.
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 81df70e..f206089 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -1286,27 +1286,31 @@ connection_or_handle_event_cb(struct bufferevent *bufev, short event,
return; /* ???? */
}
}
- } else if (tor_tls_get_num_server_handshakes(conn->tls) == 1) {
- /* v2 or v3 handshake, as a server. Only got one handshake, so
- * wait for the next one. */
- tor_tls_set_renegotiate_callback(conn->tls,
- connection_or_tls_renegotiated_cb,
- conn);
- conn->_base.state = OR_CONN_STATE_TLS_SERVER_RENEGOTIATING;
- /* return 0; */
- return; /* ???? */
} else {
const int handshakes = tor_tls_get_num_server_handshakes(conn->tls);
- tor_assert(handshakes >= 2);
- if (handshakes == 2) {
+
+ if (handshakes == 1) {
+ /* v2 or v3 handshake, as a server. Only got one handshake, so
+ * wait for the next one. */
+ tor_tls_set_renegotiate_callback(conn->tls,
+ connection_or_tls_renegotiated_cb,
+ conn);
+ conn->_base.state = OR_CONN_STATE_TLS_SERVER_RENEGOTIATING;
+ /* return 0; */
+ return; /* ???? */
+ } else if (handshakes == 2) {
/* v2 handshake, as a server. Two handshakes happened already,
* so we treat renegotiation as done.
*/
connection_or_tls_renegotiated_cb(conn->tls, conn);
- } else {
+ } else if (handshakes > 2) {
log_warn(LD_OR, "More than two handshakes done on connection. "
"Closing.");
connection_mark_for_close(TO_CONN(conn));
+ } else {
+ log_warn(LD_BUG, "We were unexpectedly unexpectedly told that "
+ "a connection got %d handshakes. Closing.", handshakes);
+ connection_mark_for_close(TO_CONN(conn));
}
return;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits