Fix crash when trying to send to an unreachable client

This commit is contained in:
Gustaf Alhäll 2023-12-06 17:00:27 +01:00
parent d6bb89fbb2
commit e1562ad4c5
No known key found for this signature in database
GPG key ID: 6C1F67D690CDEDFD

View file

@ -83,6 +83,10 @@
#undef ETIMEDOUT #undef ETIMEDOUT
#endif #endif
#define ETIMEDOUT WSAETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT
#ifdef EHOSTUNREACH
#undef EHOSTUNREACH
#endif
#define EHOSTUNREACH WSAEHOSTUNREACH
#ifndef IOC_VENDOR #ifndef IOC_VENDOR
#define IOC_VENDOR 0x18000000 #define IOC_VENDOR 0x18000000
#endif #endif
@ -678,7 +682,7 @@ static void SOCK_Send(void)
if (c == ERRSOCKET) if (c == ERRSOCKET)
{ {
int e = errno; // save error code so it can't be modified later int e = errno; // save error code so it can't be modified later
if (e != ECONNREFUSED && e != EWOULDBLOCK) if (e != ECONNREFUSED && e != EWOULDBLOCK && e != EHOSTUNREACH)
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode, I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e)); SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
} }