From 2bb64c5dcfb66e9bf7f6114de6501fd5dcd97138 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 24 Apr 2013 19:54:58 +0200 Subject: Move SocketEngine::IgnoreError() code into socketengine.h and add test for EWOULDBLOCK --- include/socketengine.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/socketengine.h') diff --git a/include/socketengine.h b/include/socketengine.h index 293d27e43..2fc3cdbfd 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -496,6 +496,19 @@ public: 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(); #endif -- cgit v1.2.3