From 6d12e746e1c62d9072b7b819f5990ddc96193ce5 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Thu, 16 Jul 2020 11:51:51 +0200 Subject: [PATCH] Fix regression with making sockets non-blocking under Unix The refactoring in the commit 51ea713826 (Extend and rename wxSocketImpl::UnblockAndRegisterWithEventLoop(), 2019-11-20) accidentally inverted the test for wxSOCKET_BLOCK, restore the correct logic to make non-blocking sockets work again. Closes #18834. --- include/wx/unix/private/sockunix.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index 0c220e3148..97f4e6f585 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -62,10 +62,10 @@ public: virtual void UpdateBlockingState() wxOVERRIDE { // Make this int and not bool to allow passing it to ioctl(). - int isBlocking = (GetSocketFlags() & wxSOCKET_BLOCK) != 0; - ioctl(m_fd, FIONBIO, &isBlocking); + int isNonBlocking = (GetSocketFlags() & wxSOCKET_BLOCK) == 0; + ioctl(m_fd, FIONBIO, &isNonBlocking); - DoEnableEvents(wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG, !isBlocking); + DoEnableEvents(wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG, isNonBlocking); } // wxFDIOHandler methods