commit eafae7f677364175e384d0e2c79f05e7d300049d Merge: fe4c0a1 087cf88 Author: Nick Mathewson nickm@torproject.org Date: Tue Aug 18 08:56:31 2015 -0400
Merge branch 'decouple_controller_events_squashed'
changes/decouple_control_events | 8 + src/common/compat_pthreads.c | 27 +++ src/common/compat_threads.h | 36 ++++ src/common/compat_winthreads.c | 43 ++++ src/or/config.c | 3 + src/or/control.c | 405 ++++++++++++++++++++++++++++--------- src/or/control.h | 23 ++- src/or/main.c | 2 +- src/test/test_controller_events.c | 12 +- src/test/test_hs.c | 12 +- src/test/test_pt.c | 12 +- src/test/test_threads.c | 14 +- src/test/testing_common.c | 2 + 13 files changed, 468 insertions(+), 131 deletions(-)
diff --cc src/or/main.c index 06fc541,ee56e10..08fd294 --- a/src/or/main.c +++ b/src/or/main.c @@@ -1007,34 -1007,9 +1007,34 @@@ directory_all_unreachable_cb(evutil_soc connection_mark_unattached_ap(entry_conn, END_STREAM_REASON_NET_UNREACHABLE); } - control_event_general_status(LOG_ERR, "DIR_ALL_UNREACHABLE"); + control_event_general_error("DIR_ALL_UNREACHABLE"); }
+static struct event *directory_all_unreachable_cb_event = NULL; + +/** We've just tried every dirserver we know about, and none of + * them were reachable. Assume the network is down. Change state + * so next time an application connection arrives we'll delay it + * and try another directory fetch. Kill off all the circuit_wait + * streams that are waiting now, since they will all timeout anyway. + */ +void +directory_all_unreachable(time_t now) +{ + (void)now; + + stats_n_seconds_working=0; /* reset it */ + + if (!directory_all_unreachable_cb_event) { + directory_all_unreachable_cb_event = + tor_event_new(tor_libevent_get_base(), + -1, EV_READ, directory_all_unreachable_cb, NULL); + tor_assert(directory_all_unreachable_cb_event); + } + + event_active(directory_all_unreachable_cb_event, EV_READ, 1); +} + /** This function is called whenever we successfully pull down some new * network statuses or server descriptors. */ void
tor-commits@lists.torproject.org