diff options
author | Andrea Shepard <andrea@persephoneslair.org> | 2012-09-07 04:42:13 -0700 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2012-10-08 03:06:09 -0700 |
commit | cb62a0b69a7d67b427224ca4c3075b49853a3a1f (patch) | |
tree | 947c1112b51731f254fa3f29e5faa51270ebc0e0 /src/or/main.c | |
parent | 9ad7ba9f2267a9ee34fafda9356f1fa86633f00f (diff) | |
download | tor-cb62a0b69a7d67b427224ca4c3075b49853a3a1f.tar.gz tor-cb62a0b69a7d67b427224ca4c3075b49853a3a1f.zip |
Use channel_is_bad_for_new_circs(), connection_or_get_num_circs() in main.c
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c index a1b1502e4f..f53bcf3574 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -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) " |