X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c363ead1e206e599d6564ac939ac7342d165e0e3..51181d291194b7ae616cfb17c984fd8927e4a977:/include/wx/unix/private/sockunix.h diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index 5e910a4cf1..2531060364 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -31,12 +31,29 @@ public: virtual wxSocketError GetLastError() const; + virtual void ReenableEvents(wxSocketEventFlags flags) + { + // enable the notifications about input/output being available again in + // case they were disabled by OnRead/WriteWaiting() + // + // notice that we'd like to enable the events here only if there is + // nothing more left on the socket right now as otherwise we're going + // to get a "ready for whatever" notification immediately (well, during + // the next event loop iteration) and disable the event back again + // which is rather inefficient but unfortunately doing it like this + // doesn't work because the existing code (e.g. src/common/sckipc.cpp) + // expects to keep getting notifications about the data available from + // the socket even if it didn't read all the data the last time, so we + // absolutely have to continue generating them + EnableEvents(flags); + } + // wxFDIOHandler methods virtual void OnReadWaiting(); virtual void OnWriteWaiting(); virtual void OnExceptionWaiting(); - // Unix-specific functions + // Unix-specific functions used by wxSocketFDIOManager only bool HasAnyEnabledCallbacks() const { return m_enabledCallbacks != 0; } void EnableCallback(wxFDIODispatcherEntryFlags flag) { m_enabledCallbacks |= flag; } @@ -61,11 +78,13 @@ private: } // enable or disable notifications for socket input/output events - void EnableEvents() { DoEnableEvents(true); } - void DisableEvents() { DoEnableEvents(false); } + void EnableEvents(int flags = wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG) + { DoEnableEvents(flags, true); } + void DisableEvents(int flags = wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG) + { DoEnableEvents(flags, false); } // really enable or disable socket input/output events - void DoEnableEvents(bool enable); + void DoEnableEvents(int flags, bool enable); protected: // descriptors for input and output event notification channels associated @@ -81,6 +100,11 @@ private: // down the socket if the event is wxSOCKET_LOST void OnStateChange(wxSocketNotify event); + // check if there is any input available, return 1 if yes, 0 if no or -1 on + // error + int CheckForInput(); + + // give it access to our m_fds friend class wxSocketFDBasedManager; };