Browse Source

Assert if connection is trying to change out of the CLOSED state.

Steven Engler 4 years ago
parent
commit
9d4e217b85
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/core/or/safe_connection.c

+ 7 - 0
src/core/or/safe_connection.c

@@ -855,6 +855,13 @@ safe_or_connection_update_state(safe_or_connection_t *safe_or_conn,
                     "of %d", new_state);
   }
 
+  if (safe_or_conn->state == SAFE_OR_CONN_STATE_CLOSED &&
+      new_state != SAFE_OR_CONN_STATE_CLOSED) {
+    log_warn(LD_OR, "Trying to change out of the CLOSED state "
+                    "(or_conn_state_t) to %d", new_state);
+    tor_assert(0);
+  }
+
   event_data_t null_data = { .ptr = NULL };
   // this is used by several cases below