[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r8234: i'm guessing nick meant to check the return value of dns_ini (tor/trunk/src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r8234: i'm guessing nick meant to check the return value of dns_ini (tor/trunk/src/or)
- From: arma@xxxxxxxx
- Date: Sat, 26 Aug 2006 21:41:08 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 26 Aug 2006 21:41:15 -0400
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: arma
Date: 2006-08-26 21:41:08 -0400 (Sat, 26 Aug 2006)
New Revision: 8234
Modified:
tor/trunk/src/or/dns.c
tor/trunk/src/or/main.c
Log:
i'm guessing nick meant to check the return value of dns_init.
and revise some log severities to match the convention.
Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c 2006-08-27 01:33:35 UTC (rev 8233)
+++ tor/trunk/src/or/dns.c 2006-08-27 01:41:08 UTC (rev 8234)
@@ -1187,6 +1187,8 @@
return 0;
}
static int nameservers_configured = 0;
+
+/* DOCDOC */
static int
configure_nameservers(void)
{
@@ -1207,9 +1209,9 @@
}
});
if (eventdns_count_nameservers() == 0) {
- log_err(LD_EXIT, "Unable to add any configured nameserver. "
- "Either remove the Nameservers line from your configuration, or "
- "put in a nameserver that we can parse.");
+ log_warn(LD_EXIT, "Unable to add any configured nameserver. "
+ "Either remove the Nameservers line from your configuration, "
+ "or put in a nameserver that we can parse.");
return -1;
}
} else {
@@ -1217,9 +1219,9 @@
if (eventdns_config_windows_nameservers())
return -1;
if (eventdns_count_nameservers() == 0) {
- log_err(LD_EXIT, "Unable to find any platform nameservers in "
- "your Windows configuration. Perhaps you should add a "
- "Nameservers line to your torrc?");
+ log_warn(LD_EXIT, "Unable to find any platform nameservers in "
+ "your Windows configuration. Perhaps you should add a "
+ "Nameservers line to your torrc?");
return -1;
}
#else
@@ -1228,9 +1230,9 @@
"/etc/resolv.conf"))
return -1;
if (eventdns_count_nameservers() == 0) {
- log_err(LD_EXIT, "Unable to find any platform nameservers in "
- "/etc/resolv.conf. Perhaps you should add a Nameservers line "
- "to your torrc?");
+ log_warn(LD_EXIT, "Unable to find any platform nameservers in "
+ "/etc/resolv.conf. Perhaps you should add a Nameservers line "
+ "to your torrc?");
return -1;
}
#endif
@@ -1238,6 +1240,8 @@
nameservers_configured = 1;
return 0;
}
+
+/* XXX DOCDOC */
static void
eventdns_callback(int result, char type, int count, int ttl, void *addresses,
void *arg)
@@ -1272,13 +1276,15 @@
tor_free(string_address);
}
+/* XXX DOCDOC */
static int
launch_resolve(edge_connection_t *exitconn)
{
char *addr = tor_strdup(exitconn->_base.address);
int r;
if (!nameservers_configured)
- configure_nameservers();
+ if (configure_nameservers() < 0)
+ return -1;
log_info(LD_EXIT, "Launching eventdns request for %s",
escaped_safe_str(exitconn->_base.address));
r = eventdns_resolve_ipv4(exitconn->_base.address, DNS_QUERY_NO_SEARCH,
@@ -1294,7 +1300,7 @@
send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
}
}
- dns_cancel_pending_resolve(addr);/* also sends end and frees */
+ dns_cancel_pending_resolve(addr); /* also sends end and frees */
tor_free(addr);
}
return r ? -1 : 0;
Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c 2006-08-27 01:33:35 UTC (rev 8233)
+++ tor/trunk/src/or/main.c 2006-08-27 01:41:08 UTC (rev 8234)
@@ -1105,7 +1105,11 @@
{
int loop_result;
- dns_init(); /* initialize dns resolve map, spawn workers if needed */
+ /* initialize dns resolve map, spawn workers if needed */
+ if (dns_init() < 0) {
+ log_err(LD_GENERAL,"Error initializing dns subsystem; exiting");
+ return -1;
+ }
handle_signals(1);