From c5181d5bdea519fc7de5ee6c66ccfaa76461928d Mon Sep 17 00:00:00 2001 From: Yan Burman Date: Tue, 23 Jan 2024 14:14:02 +0200 Subject: [PATCH] usr/transport/tcp: Print exact error we got from epoll Signed-off-by: Yan Burman --- src/usr/transport/tcp/xio_tcp_management.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/usr/transport/tcp/xio_tcp_management.c b/src/usr/transport/tcp/xio_tcp_management.c index 98343e1f..87ee268e 100644 --- a/src/usr/transport/tcp/xio_tcp_management.c +++ b/src/usr/transport/tcp/xio_tcp_management.c @@ -672,8 +672,11 @@ void xio_tcp_data_ready_ev_handler(int fd, int events, void *user_context) } if (events & (XIO_POLLHUP | XIO_POLLRDHUP | XIO_POLLERR)) { - DEBUG_LOG("epoll returned with error events=%d for fd=%d\n", - events, fd); + int so_error; + socklen_t so_error_len = sizeof(so_error); + int ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, &so_error, &so_error_len); + DEBUG_LOG("epoll returned with error=%d events=%d for fd=%d (ret=%d)\n", + so_error, events, fd, ret); xio_tcp_disconnect_helper(tcp_hndl); } }