[Box Backup-commit] COMMIT r995 - box/trunk/lib/server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Oct 12 23:17:57 BST 2006


Author: chris
Date: 2006-10-12 23:17:57 +0100 (Thu, 12 Oct 2006)
New Revision: 995

Modified:
   box/trunk/lib/server/SocketStreamTLS.cpp
Log:
 * Added support for non-blocking sockets on Win32 as well 
(TODO revisit #ifdefs: refs #3)


Modified: box/trunk/lib/server/SocketStreamTLS.cpp
===================================================================
--- box/trunk/lib/server/SocketStreamTLS.cpp	2006-10-12 22:16:02 UTC (rev 994)
+++ box/trunk/lib/server/SocketStreamTLS.cpp	2006-10-12 22:17:57 UTC (rev 995)
@@ -137,8 +137,12 @@
 		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 @@
 
 		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)
 			{




More information about the Boxbackup-commit mailing list