From ec4516362d759a8b4070729f5129ba24dcbe5e4a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 31 Aug 2006 23:40:18 +0000 Subject: (refs #3) Added support for non-blocking sockets on Win32 as well --- lib/server/SocketStreamTLS.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/server/SocketStreamTLS.cpp b/lib/server/SocketStreamTLS.cpp index 94aa3868..af4ad460 100644 --- a/lib/server/SocketStreamTLS.cpp +++ b/lib/server/SocketStreamTLS.cpp @@ -137,8 +137,12 @@ void SocketStreamTLS::Handshake(const TLSContext &rContext, bool IsServer) THROW_EXCEPTION(ServerException, TLSAllocationFailed) } -#ifndef WIN32 // Make the socket non-blocking so timeouts on Read work + +#ifdef WIN32 + u_long nonblocking = 1; + ioctlsocket(socket, FIONBIO, &nonblocking); +#else // !WIN32 // This is more portable than using ioctl with FIONBIO int statusFlags = 0; if(::fcntl(socket, F_GETFL, &statusFlags) < 0 @@ -309,7 +313,7 @@ int SocketStreamTLS::Read(void *pBuffer, int NBytes, int Timeout) case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: - // wait for the requried data + // wait for the required data // Will only get once around this loop, so don't need to calculate timeout values if(WaitWhenRetryRequired(se, Timeout) == false) { -- cgit v1.2.3