From fd530671d1dad60bbe6ec5951ef808de18c8d840 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 29 Aug 2003 03:46:52 +0000 Subject: [PATCH] now prints "Connection refused" if LHNET_Read gets an ECONNREFUSED from inet4 or inet6 (thanks to Andreas Kirsh for this) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3426 d7cf8633-e32d-0410-b094-e92efae38249 --- lhnet.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/lhnet.c b/lhnet.c index bdb21c52..d6372548 100644 --- a/lhnet.c +++ b/lhnet.c @@ -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 } } -- 2.39.2