From 01929346637a62d84b88d8261af288a7c103f888 Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Tue, 8 Jan 2013 23:34:17 +0100 Subject: [PATCH] Some more error handling on socket errors for Win32 --- ogl_editor/src/RemoteConnection.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ogl_editor/src/RemoteConnection.c b/ogl_editor/src/RemoteConnection.c index ed20d4a..aaa7167 100644 --- a/ogl_editor/src/RemoteConnection.c +++ b/ogl_editor/src/RemoteConnection.c @@ -272,13 +272,25 @@ int RemoteConnection_recv(char* buffer, size_t length, int flags) #if defined(_WIN32) if (ret <= 0) -#else + { + int error = WSAGetLastError(); + if (error == WSAEWOULDBLOCK) + return -1; + } + if (ret == 0) -#endif { RemoteConnection_disconnect(); return false; } +#else + if (ret == 0) + { + RemoteConnection_disconnect(); + return false; + } +#endif + return ret; }