diff options
Diffstat (limited to 'include/socketengine.h')
-rw-r--r-- | include/socketengine.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/socketengine.h b/include/socketengine.h index fd199c324..8e4c3dfc9 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -488,6 +488,24 @@ public: /** Get data transfer statistics, kilobits per second in and out and total. */ void GetStats(float &kbitpersec_in, float &kbitpersec_out, float &kbitpersec_total); + + /** Should we ignore the error in errno? + * Checks EAGAIN and WSAEWOULDBLOCK + */ + static bool IgnoreError(); }; +inline bool SocketEngine::IgnoreError() +{ + if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) + return true; + +#ifdef _WIN32 + if (WSAGetLastError() == WSAEWOULDBLOCK) + return true; +#endif + + return false; +} + SocketEngine* CreateSocketEngine(); |