mirror of https://github.com/getdnsapi/getdns.git
Refine the logging levels to match the errors given when backing off, etc.
This commit is contained in:
parent
729af1d159
commit
b760a2ced2
|
@ -754,7 +754,7 @@ upstream_backoff(getdns_upstream *upstream) {
|
||||||
upstream->conn_setup_failed = 0;
|
upstream->conn_setup_failed = 0;
|
||||||
upstream->conn_shutdowns = 0;
|
upstream->conn_shutdowns = 0;
|
||||||
upstream->conn_backoffs++;
|
upstream->conn_backoffs++;
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE,
|
||||||
"%-40s : !Backing off this upstream - Will retry again at %s",
|
"%-40s : !Backing off this upstream - Will retry again at %s",
|
||||||
upstream->addr_str,
|
upstream->addr_str,
|
||||||
asctime(gmtime(&upstream->conn_retry_time)));
|
asctime(gmtime(&upstream->conn_retry_time)));
|
||||||
|
@ -836,13 +836,13 @@ _getdns_upstream_shutdown(getdns_upstream *upstream)
|
||||||
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
||||||
(int)upstream->responses_received, (int)upstream->responses_timeouts,
|
(int)upstream->responses_received, (int)upstream->responses_timeouts,
|
||||||
_getdns_auth_str(upstream->tls_auth_state), (int)upstream->keepalive_timeout);
|
_getdns_auth_str(upstream->tls_auth_state), (int)upstream->keepalive_timeout);
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO,
|
||||||
"%-40s : Upstream : %s - Resps=%6d, Timeouts =%6d, Best_auth =%7s\n",
|
"%-40s : Upstream : %s - Resps=%6d, Timeouts =%6d, Best_auth =%7s\n",
|
||||||
upstream->addr_str,
|
upstream->addr_str,
|
||||||
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
||||||
(int)upstream->total_responses, (int)upstream->total_timeouts,
|
(int)upstream->total_responses, (int)upstream->total_timeouts,
|
||||||
_getdns_auth_str(upstream->best_tls_auth_state));
|
_getdns_auth_str(upstream->best_tls_auth_state));
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO,
|
||||||
"%-40s : Upstream : %s - Conns=%6d, Conn_fails=%6d, Conn_shuts=%7d, Backoffs =%6d\n",
|
"%-40s : Upstream : %s - Conns=%6d, Conn_fails=%6d, Conn_shuts=%7d, Backoffs =%6d\n",
|
||||||
upstream->addr_str,
|
upstream->addr_str,
|
||||||
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
||||||
|
|
|
@ -520,7 +520,7 @@ typedef enum getdns_loglevel_type {
|
||||||
#define GETDNS_LOG_CRIT_TEXT "Critical conditions"
|
#define GETDNS_LOG_CRIT_TEXT "Critical conditions"
|
||||||
#define GETDNS_LOG_ERR_TEXT "Error conditions"
|
#define GETDNS_LOG_ERR_TEXT "Error conditions"
|
||||||
#define GETDNS_LOG_WARNING_TEXT "Warning conditions"
|
#define GETDNS_LOG_WARNING_TEXT "Warning conditions"
|
||||||
#define GETDNS_LOG_NOTICE_TEXT "normal, but significant, condition"
|
#define GETDNS_LOG_NOTICE_TEXT "Normal, but significant, condition"
|
||||||
#define GETDNS_LOG_INFO_TEXT "Informational message"
|
#define GETDNS_LOG_INFO_TEXT "Informational message"
|
||||||
#define GETDNS_LOG_DEBUG_TEXT "Debug-level message"
|
#define GETDNS_LOG_DEBUG_TEXT "Debug-level message"
|
||||||
|
|
||||||
|
|
14
src/stub.c
14
src/stub.c
|
@ -609,7 +609,7 @@ stub_timeout_cb(void *userarg)
|
||||||
netreq->fd = -1;
|
netreq->fd = -1;
|
||||||
netreq->upstream->udp_timeouts++;
|
netreq->upstream->udp_timeouts++;
|
||||||
if (netreq->upstream->udp_timeouts % 100 == 0)
|
if (netreq->upstream->udp_timeouts % 100 == 0)
|
||||||
_getdns_upstream_log(netreq->upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(netreq->upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO,
|
||||||
"%-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n",
|
"%-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n",
|
||||||
netreq->upstream->addr_str,
|
netreq->upstream->addr_str,
|
||||||
(int)netreq->upstream->udp_responses, (int)netreq->upstream->udp_timeouts);
|
(int)netreq->upstream->udp_responses, (int)netreq->upstream->udp_timeouts);
|
||||||
|
@ -910,7 +910,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||||
X509_verify_cert_error_string(err));
|
X509_verify_cert_error_string(err));
|
||||||
#endif
|
#endif
|
||||||
if (!preverify_ok && !upstream->tls_fallback_ok)
|
if (!preverify_ok && !upstream->tls_fallback_ok)
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_ERR,
|
||||||
"%-40s : Verify failed : Transport=TLS - *Failure* - (%d) \"%s\"\n",
|
"%-40s : Verify failed : Transport=TLS - *Failure* - (%d) \"%s\"\n",
|
||||||
upstream->addr_str, err,
|
upstream->addr_str, err,
|
||||||
X509_verify_cert_error_string(err));
|
X509_verify_cert_error_string(err));
|
||||||
|
@ -946,7 +946,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||||
DEBUG_STUB("%s %-35s: FD: %d, WARNING: Proceeding even though pinset validation failed!\n",
|
DEBUG_STUB("%s %-35s: FD: %d, WARNING: Proceeding even though pinset validation failed!\n",
|
||||||
STUB_DEBUG_SETUP_TLS, __FUNC__, upstream->fd);
|
STUB_DEBUG_SETUP_TLS, __FUNC__, upstream->fd);
|
||||||
else
|
else
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_ERR,
|
||||||
"%-40s : Conn failed : Transport=TLS - *Failure* - Pinset validation failure\n",
|
"%-40s : Conn failed : Transport=TLS - *Failure* - Pinset validation failure\n",
|
||||||
upstream->addr_str);
|
upstream->addr_str);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1475,7 +1475,7 @@ stub_udp_read_cb(void *userarg)
|
||||||
upstream->udp_responses++;
|
upstream->udp_responses++;
|
||||||
if (upstream->udp_responses == 1 ||
|
if (upstream->udp_responses == 1 ||
|
||||||
upstream->udp_responses % 100 == 0)
|
upstream->udp_responses % 100 == 0)
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO,
|
||||||
"%-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n",
|
"%-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n",
|
||||||
upstream->addr_str,
|
upstream->addr_str,
|
||||||
(int)upstream->udp_responses, (int)upstream->udp_timeouts);
|
(int)upstream->udp_responses, (int)upstream->udp_timeouts);
|
||||||
|
@ -1900,7 +1900,7 @@ upstream_select_stateful(getdns_network_req *netreq, getdns_transport_list_t tra
|
||||||
upstreams->upstreams[i].conn_retry_time < now) {
|
upstreams->upstreams[i].conn_retry_time < now) {
|
||||||
upstreams->upstreams[i].conn_state = GETDNS_CONN_CLOSED;
|
upstreams->upstreams[i].conn_state = GETDNS_CONN_CLOSED;
|
||||||
upstreams->upstreams[i].conn_backoff_interval = 1;
|
upstreams->upstreams[i].conn_backoff_interval = 1;
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE,
|
||||||
"%-40s : Re-instating upstream\n",
|
"%-40s : Re-instating upstream\n",
|
||||||
upstreams->upstreams[i].addr_str);
|
upstreams->upstreams[i].addr_str);
|
||||||
}
|
}
|
||||||
|
@ -1958,7 +1958,7 @@ upstream_select_stateful(getdns_network_req *netreq, getdns_transport_list_t tra
|
||||||
} while (i != upstreams->current_stateful);
|
} while (i != upstreams->current_stateful);
|
||||||
upstream->conn_state = GETDNS_CONN_CLOSED;
|
upstream->conn_state = GETDNS_CONN_CLOSED;
|
||||||
upstream->conn_backoff_interval = 1;
|
upstream->conn_backoff_interval = 1;
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE,
|
||||||
"%-40s : No valid upstreams... promoting backed-off upstream %s for re-try...\n",
|
"%-40s : No valid upstreams... promoting backed-off upstream %s for re-try...\n",
|
||||||
upstreams->upstreams[i].addr_str);
|
upstreams->upstreams[i].addr_str);
|
||||||
return upstream;
|
return upstream;
|
||||||
|
@ -2142,7 +2142,7 @@ upstream_find_for_netreq(getdns_network_req *netreq)
|
||||||
}
|
}
|
||||||
/* Handle better, will give generic error*/
|
/* Handle better, will give generic error*/
|
||||||
DEBUG_STUB("%s %-35s: MSG: %p No valid upstream! \n", STUB_DEBUG_SCHEDULE, __FUNC__, (void*)netreq);
|
DEBUG_STUB("%s %-35s: MSG: %p No valid upstream! \n", STUB_DEBUG_SCHEDULE, __FUNC__, (void*)netreq);
|
||||||
_getdns_context_log(netreq->owner->context, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
_getdns_context_log(netreq->owner->context, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_ERR,
|
||||||
"*FAILURE* no valid transports or upstreams available!\n");
|
"*FAILURE* no valid transports or upstreams available!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue