From: Nick Mathewson Date: Tue, 18 Aug 2015 12:56:31 +0000 (-0400) Subject: Merge branch 'decouple_controller_events_squashed' X-Git-Tag: tor-0.2.7.3-rc~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eafae7f677364175e384d0e2c79f05e7d300049d;p=thirdparty%2Ftor.git Merge branch 'decouple_controller_events_squashed' --- eafae7f677364175e384d0e2c79f05e7d300049d diff --cc src/or/main.c index 06fc541567,ee56e10019..08fd29427b --- 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