X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocketengine.h;h=8e4c3dfc9e3dbf5dca98ae2a86b276b63c15502e;hb=a2e9e2837da14f7408b794750f86cca0d4cfd884;hp=fd199c324832dd7c9f3693c13ce76498d2121026;hpb=11cafc12d5440b67a9f676c9f6aa67840ca5399d;p=user%2Fhenk%2Fcode%2Finspircd.git 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();