From 558e196cced8f085001620620882240e2a41ddc5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 3 Sep 2009 00:24:21 +0000 Subject: [PATCH] React to errors on socket correctly when using epoll(). Even though the socket is not registered for wxFDIO_EXCEPTION events, wxEpollDispatcher will currently generate them anyhow so we shouldn't assert if wxSocketImplUnix::OnExceptionWaiting() is called. Instead, notify the socket about the connection loss if this happens. Closes #11085. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/sockunix.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/unix/sockunix.cpp b/src/unix/sockunix.cpp index b2e298d83f..0bcaa363b9 100644 --- a/src/unix/sockunix.cpp +++ b/src/unix/sockunix.cpp @@ -230,7 +230,15 @@ void wxSocketImplUnix::OnWriteWaiting() void wxSocketImplUnix::OnExceptionWaiting() { - wxFAIL_MSG( "not supposed to be called" ); + // when using epoll() this is called when an error occurred on the socket + // so close it if it hadn't been done yet -- what else can we do? + // + // notice that we shouldn't be called at all when using select() as we + // don't use wxFDIO_EXCEPTION when registering the socket for monitoring + // and this is good because select() would call this for any OOB data which + // is not necessarily an error + if ( m_fd != INVALID_SOCKET ) + OnStateChange(wxSOCKET_LOST); } #endif /* wxUSE_SOCKETS */ -- 2.47.2