]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - lhnet.c
Factorized audio CD code
[xonotic/darkplaces.git] / lhnet.c
diff --git a/lhnet.c b/lhnet.c
index bdb21c522a12b93ca874ebd27ff57b837e5240cc..16cf41748734bcac2fded46bad9e4db14f4b3e08 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -9,7 +9,7 @@
 #include <winsock.h>
 #else
 #include <netdb.h>
-//#include <netinet/in.h>
+#include <netinet/in.h>
 //#include <arpa/inet.h>
 #include <unistd.h>
 #include <sys/socket.h>
@@ -532,11 +532,23 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
                {
 #ifdef WIN32
                        int e = WSAGetLastError();
-                       if (e == WSAEWOULDBLOCK || e == WSAECONNREFUSED)
+                       if (e == WSAEWOULDBLOCK)
                                return 0;
+                       switch (e)
+                       {
+                               case WSAECONNREFUSED:
+                                       Con_Printf("Connection refused\n");
+                                       return 0;
+                       }
 #else
-                       if (errno == EWOULDBLOCK || errno == ECONNREFUSED)
+                       if (errno == EWOULDBLOCK)
                                return 0;
+                       switch (errno)
+                       {
+                               case ECONNREFUSED:
+                                       Con_Printf("Connection refused\n");
+                                       return 0;
+                       }
 #endif
                }
        }
@@ -555,11 +567,23 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
                {
 #ifdef WIN32
                        int e = WSAGetLastError();
-                       if (e == WSAEWOULDBLOCK || e == WSAECONNREFUSED)
+                       if (e == WSAEWOULDBLOCK)
                                return 0;
+                       switch (e)
+                       {
+                               case WSAECONNREFUSED:
+                                       Con_Printf("Connection refused\n");
+                                       return 0;
+                       }
 #else
-                       if (errno == EWOULDBLOCK || errno == ECONNREFUSED)
+                       if (errno == EWOULDBLOCK)
                                return 0;
+                       switch (errno)
+                       {
+                               case ECONNREFUSED:
+                                       Con_Printf("Connection refused\n");
+                                       return 0;
+                       }
 #endif
                }
        }