[tor-commits] [tor/master] Turn some warnings into bugs and non-fatal asserts.

nickm at torproject.org nickm at torproject.org
Fri Jul 7 15:19:28 UTC 2017


commit fee95dabcfe21a35e3f5a1ad4b455fe4be1f749a
Author: George Kadianakis <desnacked at riseup.net>
Date:   Thu Jul 6 13:50:16 2017 +0300

    Turn some warnings into bugs and non-fatal asserts.
---
 src/or/connection_edge.c | 6 ++----
 src/or/hs_circuit.c      | 8 ++++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 0e18550..5e6041f 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -3566,10 +3566,8 @@ int
 connection_edge_is_rendezvous_stream(const edge_connection_t *conn)
 {
   tor_assert(conn);
-
-  if (BUG(conn->rend_data && conn->hs_ident)) {
-    log_warn(LD_BUG, "Connection has both rend_data and hs_ident...");
-  }
+  /* It should not be possible to set both of these structs */
+  tor_assert_nonfatal(!(conn->rend_data && conn->hs_ident));
 
   if (conn->rend_data || conn->hs_ident) {
     return 1;
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 02c9afa..2d186e9 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -23,8 +23,8 @@ rend_circuit_validate_purpose(unsigned int circ_purpose, int is_service_side)
 {
   if (is_service_side) {
     if (circ_purpose != CIRCUIT_PURPOSE_S_CONNECT_REND) {
-      log_warn(LD_GENERAL, "HS e2e circuit setup with wrong purpose(%d)",
-               circ_purpose);
+      log_fn(LOG_PROTOCOL_WARN, LD_GENERAL,
+             "HS e2e circuit setup with wrong purpose(%d)", circ_purpose);
       return -1;
     }
   }
@@ -32,8 +32,8 @@ rend_circuit_validate_purpose(unsigned int circ_purpose, int is_service_side)
   if (!is_service_side) {
     if (circ_purpose != CIRCUIT_PURPOSE_C_REND_READY &&
         circ_purpose != CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) {
-      log_warn(LD_GENERAL, "Client e2e circuit setup with wrong purpose(%d)",
-               circ_purpose);
+      log_fn(LOG_PROTOCOL_WARN, LD_GENERAL,
+             "Client e2e circuit setup with wrong purpose(%d)", circ_purpose);
       return -1;
     }
   }





More information about the tor-commits mailing list