Improve error logging for epoll_ctl failures in TLS, TCP, and QUIC clients

This commit is contained in:
Nick Peng
2025-12-19 23:13:42 +08:00
parent 9929ddd098
commit 12b2274822
3 changed files with 13 additions and 1 deletions

View File

@@ -342,6 +342,8 @@ errout:
}
server_info->status = DNS_SERVER_STATUS_INIT;
server_info->proxy = NULL;
server_info->ssl_write_len = -1;
if (fd > 0 && proxy == NULL) {
close(fd);

View File

@@ -135,6 +135,9 @@ errout:
}
server_info->status = DNS_SERVER_STATUS_INIT;
server_info->proxy = NULL;
server_info->security_status = DNS_CLIENT_SERVER_SECURITY_UNKNOW;
server_info->ssl_write_len = -1;
if (fd > 0 && proxy == NULL) {
close(fd);

View File

@@ -381,6 +381,11 @@ int _dns_client_create_socket_tls(struct dns_server_info *server_info, const cha
fd = socket(server_info->ai_family, SOCK_STREAM, 0);
}
if (fd < 0) {
tlog(TLOG_ERROR, "create socket failed, %s", strerror(errno));
goto errout;
}
if (server_info->flags.ifname[0] != '\0') {
struct ifreq ifr;
memset(&ifr, 0, sizeof(struct ifreq));
@@ -487,7 +492,7 @@ int _dns_client_create_socket_tls(struct dns_server_info *server_info, const cha
event.events = EPOLLIN | EPOLLOUT;
event.data.ptr = server_info;
if (epoll_ctl(client.epoll_fd, EPOLL_CTL_ADD, fd, &event) != 0) {
tlog(TLOG_ERROR, "epoll ctl failed.");
tlog(TLOG_ERROR, "epoll ctl failed, %s", strerror(errno));
goto errout;
}
@@ -504,6 +509,8 @@ errout:
}
server_info->status = DNS_SERVER_STATUS_INIT;
server_info->proxy = NULL;
server_info->ssl_write_len = -1;
if (fd > 0 && proxy == NULL) {
close(fd);