mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Improve the logging on failed TCP accept
Previously, when TCP accept failed, we have logged a message with ISC_LOG_ERROR level. One common case, how this could happen is that the client hits TCP client quota and is put on hold and when resumed, the client has already given up and closed the TCP connection. In such case, the named would log: TCP connection failed: socket is not connected This message was quite confusing because it actually doesn't say that it's related to the accepting the TCP connection and also it logs everything on the ISC_LOG_ERROR level. Change the log message to "Accepting TCP connection failed" and for specific error states lower the severity of the log message to ISC_LOG_INFO.
This commit is contained in:
@@ -2048,6 +2048,33 @@ isc__nmsocket_connecttimeout_cb(uv_timer_t *timer) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_accept_connection_log(isc_result_t result, bool can_log_quota) {
|
||||
int level;
|
||||
|
||||
switch (result) {
|
||||
case ISC_R_SUCCESS:
|
||||
case ISC_R_NOCONN:
|
||||
return;
|
||||
case ISC_R_QUOTA:
|
||||
case ISC_R_SOFTQUOTA:
|
||||
if (!can_log_quota) {
|
||||
return;
|
||||
}
|
||||
level = ISC_LOG_INFO;
|
||||
break;
|
||||
case ISC_R_NOTCONNECTED:
|
||||
level = ISC_LOG_INFO;
|
||||
break;
|
||||
default:
|
||||
level = ISC_LOG_ERROR;
|
||||
}
|
||||
|
||||
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR,
|
||||
level, "Accepting TCP connection failed: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
static void
|
||||
isc__nmsocket_readtimeout_cb(uv_timer_t *timer) {
|
||||
isc_nmsocket_t *sock = uv_handle_get_data((uv_handle_t *)timer);
|
||||
|
Reference in New Issue
Block a user