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:
@@ -323,9 +323,11 @@ private:
|
||||
// called by Close() if we have a valid m_fd
|
||||
virtual void DoClose() = 0;
|
||||
|
||||
// put this socket into non-blocking mode and enable monitoring this socket
|
||||
// as part of the event loop
|
||||
virtual void UnblockAndRegisterWithEventLoop() = 0;
|
||||
// Update the socket depending on the presence or absence of wxSOCKET_BLOCK
|
||||
// in GetSocketFlags(): if it's present, make the socket blocking and
|
||||
// ensure that we don't get any asynchronous event for it, otherwise put
|
||||
// it into non-blocking mode and enable monitoring it in the event loop.
|
||||
virtual void UpdateBlockingState() = 0;
|
||||
|
||||
// check that the socket wasn't created yet and that the given address
|
||||
// (either m_local or m_peer depending on the socket kind) is valid and
|
||||
@@ -350,7 +352,7 @@ private:
|
||||
}
|
||||
|
||||
// apply the options to the (just created) socket and register it with the
|
||||
// event loop by calling UnblockAndRegisterWithEventLoop()
|
||||
// event loop by calling UpdateBlockingState()
|
||||
void PostCreation();
|
||||
|
||||
// update local address after binding/connecting
|
||||
|
Reference in New Issue
Block a user