aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-05-31 14:37:29 -0400
committerNick Mathewson <nickm@torproject.org>2012-05-31 14:37:29 -0400
commitd1bbd84a6d1f5e721badb55755e278f2e4f0bf7b (patch)
tree9511d811c22fb96a37a0ff021f1e9c0e8cbe2b45
parentfc5d960fbda217a301b4ec09d906992b74849c15 (diff)
parent0ed963e72ac381edf5e6ad5d084b508aa8d21d15 (diff)
downloadtor-d1bbd84a6d1f5e721badb55755e278f2e4f0bf7b.tar.gz
tor-d1bbd84a6d1f5e721badb55755e278f2e4f0bf7b.zip
Merge remote-tracking branch 'linus/bug4873_ln'
-rw-r--r--changes/bug48733
-rw-r--r--src/or/connection_or.c26
2 files changed, 17 insertions, 12 deletions
diff --git a/changes/bug4873 b/changes/bug4873
new file mode 100644
index 0000000000..6c999ccfcb
--- /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 81df70eb37..8f88292721 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -1286,27 +1286,29 @@ 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;
+ } 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 told that a connection "
+ "got %d handshakes. Closing.", handshakes);
+ connection_mark_for_close(TO_CONN(conn));
}
return;
}