log: move socket diagnostics SYS->SOCKET and conn lifecycle ETCP->CONNECTION (avoid poll() flood)
This commit is contained in:
1 parent
1bde2eca35
commit
27e66f1092
2 files changed
+8
-8
No files matched your search
+6
-6
@@ -707,7 +707,7 @@ void* uasync_add_socket(struct UASYNC* ua, int fd, socket_callback_t read_cbk, s
|
||||
}
|
||||
#endif
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SYS, "socket_add fd=%d name='%s' type=FD r=%p w=%p e=%p ud=%p",
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SOCKET, "socket_add fd=%d name='%s' type=FD r=%p w=%p e=%p ud=%p",
|
||||
fd, name ? name : "?", (void*)read_cbk, (void*)write_cbk, (void*)except_cbk, user_data);
|
||||
|
||||
// Return index-based handle
|
||||
@@ -736,7 +736,7 @@ err_t uasync_remove_socket(struct UASYNC* ua, void* s_id) {
|
||||
if (ret == 0) {
|
||||
ua->socket_free_count++;
|
||||
ua->poll_fds_dirty = 1; // Mark poll_fds as needing rebuild
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SYS, "socket_remove fd=%d name='%s'", fd, rname);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SOCKET, "socket_remove fd=%d name='%s'", fd, rname);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_FAIL;
|
||||
@@ -775,7 +775,7 @@ void* uasync_add_socket_t(struct UASYNC* ua, socket_t sock, socket_t_callback_t
|
||||
}
|
||||
#endif
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SYS, "socket_add fd=%d name='%s' type=SOCK r=%p w=%p e=%p ud=%p",
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SOCKET, "socket_add fd=%d name='%s' type=SOCK r=%p w=%p e=%p ud=%p",
|
||||
(int)sock, name ? name : "?", (void*)read_cbk, (void*)write_cbk, (void*)except_cbk, user_data);
|
||||
|
||||
return (void*)(uintptr_t)(index + 1); /* +1: index 0 ≠ NULL */
|
||||
@@ -809,7 +809,7 @@ err_t uasync_remove_socket_t(struct UASYNC* ua, socket_t sock) {
|
||||
if (ret == 0) {
|
||||
ua->socket_free_count++;
|
||||
ua->poll_fds_dirty = 1;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SYS, "socket_remove fd=%d name='%s'", fd, rname);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_SOCKET, "socket_remove fd=%d name='%s'", fd, rname);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_FAIL;
|
||||
@@ -1024,7 +1024,7 @@ static void process_epoll_events(struct UASYNC* ua, struct epoll_event* events,
|
||||
struct socket_node* n = socket_array_get(ua->sockets, fd);
|
||||
if (!n) n = socket_array_get_by_sock(ua->sockets, fd);
|
||||
if (n && n->active && n->gen == ev_gen) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SYS, "socket HUP/ERR without except handler: fd=%d name='%s' type=%s r=%p w=%p — unregister",
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "socket HUP/ERR without except handler: fd=%d name='%s' type=%s r=%p w=%p — unregister",
|
||||
fd, n->name ? n->name : "?",
|
||||
n->type == SOCKET_NODE_TYPE_SOCK ? "SOCK" : "FD",
|
||||
(void*)(n->type == SOCKET_NODE_TYPE_SOCK ? (void*)n->read_cbk_sock : (void*)n->read_cbk),
|
||||
@@ -1364,7 +1364,7 @@ void uasync_poll(struct UASYNC* ua, int timeout_tb) {
|
||||
if (node->except_cbk) {
|
||||
node->except_cbk(node->fd, node->user_data);
|
||||
} else {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SYS, "socket HUP/ERR/NVAL without except handler: fd=%d rev=0x%x name='%s' type=%s r=%p w=%p — unregister",
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "socket HUP/ERR/NVAL without except handler: fd=%d rev=0x%x name='%s' type=%s r=%p w=%p — unregister",
|
||||
fd, ua->poll_fds[i].revents, node->name ? node->name : "?",
|
||||
node->type == SOCKET_NODE_TYPE_SOCK ? "SOCK" : "FD",
|
||||
(void*)(node->type == SOCKET_NODE_TYPE_SOCK ? (void*)node->read_cbk_sock : (void*)node->read_cbk),
|
||||
|
||||
@@ -349,7 +349,7 @@ static void etcp_on_down(struct ETCP_CONN* etcp, struct ETCP_LINK* down_link) {
|
||||
// Phase 2 resources cleanup (callable both sync and async via call_soon)
|
||||
static void etcp_connection_free_resources(struct ETCP_CONN* etcp) {
|
||||
if (!etcp) return;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "[%s] freeing resources phase 2 conn=%p peer=%016llx",
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_CONNECTION, "[%s] freeing resources phase 2 conn=%p peer=%016llx",
|
||||
etcp->log_name, (void*)etcp, (unsigned long long)etcp->peer_node_id);
|
||||
|
||||
// Close links
|
||||
@@ -401,7 +401,7 @@ void etcp_connection_close(struct ETCP_CONN* etcp) {
|
||||
if (etcp->links_up != 0) etcp->links_up = 0;
|
||||
|
||||
etcp_fire_conn_status(etcp, ETCP_CONN_STATUS_DELETE);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "[%s] close: state=2 conn=%p peer=%016llx (DELETE fired)", etcp->log_name, (void*)etcp, (unsigned long long)etcp->peer_node_id);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_CONNECTION, "[%s] close: state=2 conn=%p peer=%016llx (DELETE fired)", etcp->log_name, (void*)etcp, (unsigned long long)etcp->peer_node_id);
|
||||
etcp_cbk_fire(etcp, ETCP_CBK_EVENT_DOWN);
|
||||
|
||||
// Cancel active timers
|
||||
|
||||
Reference in new issue
Block a user