X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39b61b058123378e0e132f7f75f53f042d96eca0..51181d291194b7ae616cfb17c984fd8927e4a977:/include/wx/unix/private/sockunix.h diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index afdcc4e0cf..2531060364 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -31,6 +31,23 @@ 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(); @@ -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; };