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

@@ -225,6 +225,16 @@ public:
bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); }
wxSocketType GetType() const { return m_type; }
// Helper returning wxSOCKET_NONE if non-blocking sockets can be used, i.e.
// the socket is being created in the main thread and the event loop is
// running, or wxSOCKET_BLOCK otherwise.
//
// This is an internal function used only by wxWidgets itself, user code
// should decide if it wants blocking sockets or not and use the
// appropriate style instead of using it (but wxWidgets has to do it like
// this for compatibility with the original network classes behaviour).
static int GetBlockingFlagIfNeeded();
private:
friend class wxSocketClient;
friend class wxSocketServer;