[memcached] kronuz, r291: Fixed a bug when the connection to a cli...

commits at code.sixapart.com commits at code.sixapart.com
Fri Jun 9 18:52:15 UTC 2006


Fixed a bug when the connection to a client was lost.

U   branches/server-win32/Win32-Code/win32.h


Modified: branches/server-win32/Win32-Code/win32.h
===================================================================
--- branches/server-win32/Win32-Code/win32.h	2006-05-31 03:03:26 UTC (rev 290)
+++ branches/server-win32/Win32-Code/win32.h	2006-06-09 18:52:11 UTC (rev 291)
@@ -28,8 +28,6 @@
 #undef errno
 #define errno WSAGetLastError()
 #define close(s) closesocket(s)
-#define write(s, buf, len) send(s, buf, len, 0)
-#define read(s, buf, len) recv(s, buf, len, 0)
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #define EAGAIN EWOULDBLOCK 
 typedef int socklen_t;
@@ -41,4 +39,15 @@
 int fcntl(SOCKET s, int cmd, int val);
 int inet_aton(register const char *cp, struct in_addr *addr);
 
+__inline size_t write(int s, void *buf, size_t len) {
+	size_t ret = send(s, buf, len, 0);
+	if(ret == -1 && WSAGetLastError() == WSAECONNRESET) return 0;
+	return ret;
+}
+__inline size_t read(int s, void *buf, size_t len) {
+	size_t ret = recv(s, buf, len, 0);
+	if(ret == -1 && WSAGetLastError() == WSAECONNRESET) return 0;
+	return ret;
+}
+
 #endif




More information about the memcached-commits mailing list