summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-06-26 10:45:42 -0400
committerNick Mathewson <nickm@torproject.org>2020-06-26 10:58:53 -0400
commitd486c6cf74db6bce80689c17c7427a6e3a055f93 (patch)
tree34c33bc3f9fde679562afe77cfd68a7a452ba4c0 /src/core
parent68d848e244cf274d1a1df4da2f9adca2aaffec19 (diff)
downloadtor-d486c6cf74db6bce80689c17c7427a6e3a055f93.tar.gz
tor-d486c6cf74db6bce80689c17c7427a6e3a055f93.zip
Store errors from TLS write and handshake in the tls_error field.
Previously, we would only update this field when the error happened during a read. This will improves our reporting for our bootstrap status, and help to address #32622. The problem is not completely solved by this patch, however: too many errors are still lumped into "MISC".
Diffstat (limited to 'src/core')
-rw-r--r--src/core/mainloop/connection.c1
-rw-r--r--src/core/or/connection_or.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index a8417e46d9..792cdbf686 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -4205,6 +4205,7 @@ connection_handle_write_impl(connection_t *conn, int force)
switch (result) {
CASE_TOR_TLS_ERROR_ANY:
case TOR_TLS_CLOSE:
+ or_conn->tls_error = result;
log_info(LD_NET, result != TOR_TLS_CLOSE ?
"tls error. breaking.":"TLS connection closed on flush");
/* Don't flush; connection is dead. */
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index 5d71b363f8..4cb83f45a9 100644
--- a/src/core/or/connection_or.c
+++ b/src/core/or/connection_or.c
@@ -1692,7 +1692,8 @@ connection_tls_continue_handshake(or_connection_t *conn)
switch (result) {
CASE_TOR_TLS_ERROR_ANY:
- log_info(LD_OR,"tls error [%s]. breaking connection.",
+ conn->tls_error = result;
+ log_info(LD_OR,"tls error [%s]. breaking connection.",
tor_tls_err_to_string(result));
return -1;
case TOR_TLS_DONE:
@@ -1724,6 +1725,7 @@ connection_tls_continue_handshake(or_connection_t *conn)
log_debug(LD_OR,"wanted read");
return 0;
case TOR_TLS_CLOSE:
+ conn->tls_error = result;
log_info(LD_OR,"tls closed. breaking connection.");
return -1;
}