X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fsocket.hh;h=c592fdbfb097dd4488d2590a94c8ce267b9aadcf;hp=f4d2c82609e433d95cc8cc6ce2cf6429b291e2d7;hb=bc795376d093ee097040f029b891b5435eb3bd21;hpb=831f04d4bc19a390415ac0bbac4331c7a65509bc diff --git a/src/moof/socket.hh b/src/moof/socket.hh index f4d2c82..c592fdb 100644 --- a/src/moof/socket.hh +++ b/src/moof/socket.hh @@ -24,11 +24,7 @@ #include #include -#if HAVE_FCNTL_H #include -#else -#error No alternative to fcntl implemented yet. -#endif #if defined(_WIN32) #include @@ -44,7 +40,7 @@ #include #endif -#include +#include #include #include @@ -733,13 +729,13 @@ public: */ void is_blocking(bool is_blocking) { -#ifdef HAVE_FCNTL +#if defined(_WIN32) + u_long value = is_blocking; + ioctlsocket(impl_.fd, FIONBIO, &value); +#else int flags = fcntl(impl_.fd, F_GETFL); flags = is_blocking ? (flags & ~O_NONBLOCK) : (flags | O_NONBLOCK); fcntl(impl_.fd, F_SETFL, flags); -#elif defined(_WIN32) - u_long value = is_blocking; - ioctlsocket(impl_.fd, FIONBIO, &value); #endif } @@ -751,11 +747,12 @@ public: */ bool is_blocking() const { -#ifdef HAVE_FCNTL +#if defined(_WIN32) + return true; +#else int flags = fcntl(impl_.fd, F_GETFL); return !(flags & O_NONBLOCK); #endif - return true; }