summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-10 20:45:31 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-10 20:45:31 +0000
commit9aa706e20c3ae91f6cac95964e291076b88ecd48 (patch)
treeaa50df5ac10c25413d7321fba023fe2f4ade3360 /src/or/main.c
parent355369a27a86942b34010392167ec9d284e294e4 (diff)
downloadtor-9aa706e20c3ae91f6cac95964e291076b88ecd48.tar.gz
tor-9aa706e20c3ae91f6cac95964e291076b88ecd48.zip
Bug 691 fix: do not shutdown Tor servers right away if the network is down.
svn:r17566
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c
index d68588db90..7872229f42 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -839,6 +839,7 @@ run_scheduled_events(time_t now)
static time_t time_to_recheck_bandwidth = 0;
static time_t time_to_check_for_expired_networkstatus = 0;
static time_t time_to_dump_geoip_stats = 0;
+ static time_t time_to_retry_dns_init = 0;
or_options_t *options = get_options();
int i;
int have_dir_info;
@@ -981,6 +982,14 @@ run_scheduled_events(time_t now)
time_to_clean_caches = now + CLEAN_CACHES_INTERVAL;
}
+#define RETRY_DNS_INTERVAL (10*60)
+ /* If we're a server and initializing dns failed, retry periodically. */
+ if (time_to_retry_dns_init < now) {
+ time_to_retry_dns_init = now + RETRY_DNS_INTERVAL;
+ if (server_mode(options) && has_dns_init_failed())
+ dns_init();
+ }
+
/** 2. Periodically, we consider force-uploading our descriptor
* (if we've passed our internal checks). */
@@ -1367,8 +1376,13 @@ do_main_loop(void)
/* initialize dns resolve map, spawn workers if needed */
if (dns_init() < 0) {
- log_err(LD_GENERAL,"Error initializing dns subsystem; exiting");
- return -1;
+ if (get_options()->ServerDNSAllowBrokenResolvConf)
+ log_warn(LD_GENERAL, "Couldn't set up any working nameservers. "
+ "Network not up yet? Will try again soon.");
+ else {
+ log_err(LD_GENERAL,"Error initializing dns subsystem; exiting. To "
+ "retry instead, set the ServerDNSAllowBrokenResolvConf option.");
+ }
}
handle_signals(1);