From f0a8c27829b2d60993cd4fd9726ac911fb392993 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 17 Sep 2024 20:58:23 +0200 Subject: [PATCH] Fix crash when trying to send to an unreachable client https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2232 --- src/i_tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 77f8aac0c..3baefb94d 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -100,6 +100,10 @@ #undef ETIMEDOUT #endif #define ETIMEDOUT WSAETIMEDOUT + #ifdef EHOSTUNREACH + #undef EHOSTUNREACH + #endif + #define EHOSTUNREACH WSAEHOSTUNREACH #ifndef IOC_VENDOR #define IOC_VENDOR 0x18000000 #endif @@ -853,7 +857,7 @@ static void SOCK_Send(void) if (c == ERRSOCKET) { 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, SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e)); }