From 36853ca683816063e194d68ad25ad102d2613ad2 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Fri, 11 Feb 2022 10:59:17 +0100 Subject: [PATCH] add MSG_NOSIGNAL to all calls to send() to get rid of useless SIGPIPE signals --- src/TNetwork.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 79ddc15..1e0e5be 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -187,7 +187,11 @@ void TNetwork::Identify(const TConnection& client) { } else if (Code == 'D') { HandleDownload(client.Socket); } else if (Code == 'P') { +#if defined(BEAMMP_LINUX) || defined(BEAMMP_APPLE) + send(client.Socket, "P", 1, MSG_NOSIGNAL); +#else send(client.Socket, "P", 1, 0); +#endif CloseSocketProper(client.Socket); return; } else { @@ -778,7 +782,11 @@ void TNetwork::SplitLoad(TClient& c, size_t Sent, size_t Size, bool D, const std bool TNetwork::TCPSendRaw(TClient& C, SOCKET socket, char* Data, int32_t Size) { intmax_t Sent = 0; do { +#if defined(BEAMMP_LINUX) || defined(BEAMMP_APPLE) + intmax_t Temp = send(socket, &Data[Sent], int(Size - Sent), MSG_NOSIGNAL); +#else intmax_t Temp = send(socket, &Data[Sent], int(Size - Sent), 0); +#endif if (Temp < 1) { beammp_info("Socket Closed! " + std::to_string(socket)); CloseSocketProper(socket);