]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Downgrade an assert to LD_BUG
authorNick Mathewson <nickm@torproject.org>
Tue, 19 Feb 2013 19:38:04 +0000 (14:38 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 19 Feb 2013 20:02:08 +0000 (15:02 -0500)
This should prevent crashes on further recurrence of 8065, and help
diagnose such if they occur

changes/bug8065 [new file with mode: 0644]
src/or/circuitbuild.c
src/or/circuitbuild.h
src/or/connection_edge.c

diff --git a/changes/bug8065 b/changes/bug8065
new file mode 100644 (file)
index 0000000..06dbae8
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+    - Downgrade an assertion in connection_ap_expire_beginning to
+      an LD_BUG message. The fix for bug 8024 should prevent this
+      message from displaying, but just in case a warn that we can
+      diagnose is better than more assert crashes. Fix for bug 8065;
+      bugfix on 0.2.4.8-alpha.
index 40751e02b14490e2cfb6c01bf6e38d0f96a38ed7..8a3a36accb83b9f4027c9376977689753246fa7f 100644 (file)
@@ -1269,7 +1269,7 @@ pathbias_get_scale_use_threshold(const or_options_t *options)
 /**
  * Convert a Guard's path state to string.
  */
-static const char *
+const char *
 pathbias_state_to_string(path_state_t state)
 {
   switch (state) {
index 3ca8d1531d1516bdfc71b53d0a47b361f39ccf01..a3091707e8ab1ae64622edf793b44fc93d987c64 100644 (file)
@@ -66,6 +66,7 @@ int pathbias_check_probe_response(circuit_t *circ, const cell_t *cell);
 void pathbias_count_use_attempt(origin_circuit_t *circ);
 void pathbias_mark_use_success(origin_circuit_t *circ);
 void pathbias_mark_use_rollback(origin_circuit_t *circ);
+const char *pathbias_state_to_string(path_state_t state);
 
 #endif
 
index b4fa3e6fe233f5c15f9e09b9624a993089f843ba..abde2e19f2659fb005e161e38bfa9ebf7ac75d72 100644 (file)
@@ -651,7 +651,16 @@ connection_ap_expire_beginning(void)
       }
       continue;
     }
-    tor_assert(circ->purpose == CIRCUIT_PURPOSE_C_GENERAL);
+    if (circ->purpose != CIRCUIT_PURPOSE_C_GENERAL) {
+      log_warn(LD_BUG, "circuit->purpose == CIRCUIT_PURPOSE_C_GENERAL failed. "
+               "The purpose on the circuit was %s; it was in state %s, "
+               "path_state %s.",
+               circuit_purpose_to_string(circ->purpose),
+               circuit_state_to_string(circ->state),
+               CIRCUIT_IS_ORIGIN(circ) ?
+                 pathbias_state_to_string(TO_ORIGIN_CIRCUIT(circ)->path_state) :
+                 "none");
+    }
     log_fn(cutoff < 15 ? LOG_INFO : severity, LD_APP,
            "We tried for %d seconds to connect to '%s' using exit %s."
            " Retrying on a new circuit.",