]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use channel_is_bad_for_new_circs(), connection_or_get_num_circs() in main.c
authorAndrea Shepard <andrea@persephoneslair.org>
Fri, 7 Sep 2012 11:42:13 +0000 (04:42 -0700)
committerAndrea Shepard <andrea@torproject.org>
Mon, 8 Oct 2012 10:06:09 +0000 (03:06 -0700)
src/or/main.c

index a1b1502e4f55120be66c1face39f4967987a910b..f53bcf357435f62f26d2691fe5710b0ba8a2fc0f 100644 (file)
@@ -13,6 +13,8 @@
 #define MAIN_PRIVATE
 #include "or.h"
 #include "buffers.h"
+#include "channel.h"
+#include "channeltls.h"
 #include "circuitbuild.h"
 #include "circuitlist.h"
 #include "circuituse.h"
@@ -1046,7 +1048,8 @@ run_connection_housekeeping(int i, time_t now)
   tor_assert(conn->outbuf);
 #endif
 
-  if (or_conn->is_bad_for_new_circs && !or_conn->n_circuits) {
+  if (channel_is_bad_for_new_circs(TLS_CHAN_TO_BASE(or_conn->chan)) &&
+      !connection_or_get_num_circuits(or_conn)) {
     /* It's bad for new circuits, and has no unmarked circuits on it:
      * mark it now. */
     log_info(LD_OR,
@@ -1064,14 +1067,15 @@ run_connection_housekeeping(int i, time_t now)
                (int)conn->s,conn->address, conn->port);
       connection_mark_for_close(conn);
     }
-  } else if (we_are_hibernating() && !or_conn->n_circuits &&
+  } else if (we_are_hibernating() &&
+             !connection_or_get_num_circuits(or_conn) &&
              !connection_get_outbuf_len(conn)) {
     /* We're hibernating, there's no circuits, and nothing to flush.*/
     log_info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "
              "[Hibernating or exiting].",
              (int)conn->s,conn->address, conn->port);
     connection_mark_and_flush(conn);
-  } else if (!or_conn->n_circuits &&
+  } else if (!connection_or_get_num_circuits(or_conn) &&
              now >= or_conn->timestamp_last_added_nonpadding +
                                          IDLE_OR_CONN_TIMEOUT) {
     log_info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "