[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9364: Be even more clever about severity of messages from eventdns (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9364: Be even more clever about severity of messages from eventdns (in tor/trunk: . src/or)
- From: nickm@xxxxxxxx
- Date: Tue, 16 Jan 2007 12:39:24 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 16 Jan 2007 12:39:53 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2007-01-16 12:39:08 -0500 (Tue, 16 Jan 2007)
New Revision: 9364
Modified:
tor/trunk/
tor/trunk/src/or/dns.c
Log:
r11983@Kushana: nickm | 2007-01-16 10:28:47 -0500
Be even more clever about severity of messages from eventdns: NOTICE when the first nameserver comes up; INFO on subsequent ones.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r11983] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c 2007-01-16 08:19:52 UTC (rev 9363)
+++ tor/trunk/src/or/dns.c 2007-01-16 17:39:08 UTC (rev 9364)
@@ -172,6 +172,8 @@
evdns_log_cb(int warn, const char *msg)
{
const char *cp;
+ static int all_down = 0;
+ int severity = warn ? LOG_WARN : LOG_INFO;
if (!strcmpstart(msg, "Resolve requested for") &&
get_options()->SafeLogging) {
log(LOG_INFO, LD_EXIT, "eventdns: Resolve requested.");
@@ -185,7 +187,7 @@
/* Don't warn about a single failed nameserver; we'll warn with 'all
* nameservers have failed' if we're completely out of nameservers;
* otherwise, the situation is tolerable. */
- warn = 0;
+ severity = LOG_INFO;
control_event_server_status(LOG_NOTICE,
"NAMESERVER_STATUS NS=%s STATUS=DOWN ERR=%s",
ns, escaped(err));
@@ -193,14 +195,16 @@
} else if (!strcmpstart(msg, "Nameserver ") &&
(cp=strstr(msg, " is back up"))) {
char *ns = tor_strndup(msg+11, cp-(msg+11));
- warn = 0; /* It's never a warning when a nameserver comes back up. */
+ severity = all_down ? LOG_NOTICE : LOG_INFO;
+ all_down = 0;
control_event_server_status(LOG_NOTICE,
"NAMESERVER_STATUS NS=%s STATUS=UP", ns);
tor_free(ns);
} else if (!strcmp(msg, "All nameservers have failed")) {
control_event_server_status(LOG_WARN, "NAMESERVER_ALL_DOWN");
+ all_down = 1;
}
- log(warn?LOG_WARN:LOG_INFO, LD_EXIT, "eventdns: %s", msg);
+ log(severity, LD_EXIT, "eventdns: %s", msg);
}
#endif