Extend and rename wxSocketImpl::UnblockAndRegisterWithEventLoop()
In addition to unblocking and registering the socket, also support using this function to make the socket blocking and unregistering it from the event loop, if its flags include wxSOCKET_BLOCK. This was already half-done by wxMSW, which took wxSOCKET_BLOCK presence into account in its implementation, but not by the Unix implementation. Now do it under all platforms, as this will be useful for switching a previously non-blocking socket to blocking mode. Finally, rename the function to better reflect what it really does. See #12886.
This commit is contained in:
@@ -60,7 +60,7 @@ public:
|
||||
private:
|
||||
virtual void DoClose() wxOVERRIDE;
|
||||
|
||||
virtual void UnblockAndRegisterWithEventLoop() wxOVERRIDE
|
||||
virtual void UpdateBlockingState() wxOVERRIDE
|
||||
{
|
||||
if ( GetSocketFlags() & wxSOCKET_BLOCK )
|
||||
{
|
||||
@@ -74,6 +74,9 @@ private:
|
||||
// would result in data races and other unpleasantness.
|
||||
wxIoctlSocketArg_t trueArg = 1;
|
||||
ioctlsocket(m_fd, FIONBIO, &trueArg);
|
||||
|
||||
// Uninstall it in case it was installed before.
|
||||
wxSocketManager::Get()->Uninstall_Callback(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user