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.
This commit is contained in:
Daniel Kulp
2020-07-16 11:51:51 +02:00
committed by Vadim Zeitlin
parent 7687d10c51
commit 6d12e746e1

View File

@@ -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