Factor out socket flag selection into GetBlockingFlagIfNeeded()

No real changes, just refactor wxProtocol ctor to use a new function
that can be reused elsewhere too.
This commit is contained in:
Vadim Zeitlin
2017-08-15 19:26:38 +02:00
parent 01fac4b748
commit ba8bab2282
3 changed files with 20 additions and 3 deletions

View File

@@ -65,9 +65,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxProtocol, wxObject);
wxProtocol::wxProtocol()
#if wxUSE_SOCKETS
// Only use non blocking sockets if we can dispatch events.
: wxSocketClient((wxIsMainThread() && wxApp::IsMainLoopRunning()
? wxSOCKET_NONE
: wxSOCKET_BLOCK) | wxSOCKET_WAITALL)
: wxSocketClient(wxSocketClient::GetBlockingFlagIfNeeded() | wxSOCKET_WAITALL)
#endif
{
m_lastError = wxPROTO_NOERR;