From eaa6b5322f6aa77f2f95d410f2fec6954e293186 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Tue, 30 Mar 2021 15:04:53 +0200 Subject: [PATCH] dont SIGPIPE on broken pipe send() --- src/TNetwork.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 7733c8f..c7719c8 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -359,12 +359,14 @@ bool TNetwork::TCPSend(TClient& c, const std::string& Data, bool IsSync) { Sent = 0; Size += 4; do { - int32_t Temp = send(c.GetTCPSock(), &Send[Sent], Size - Sent, 0); + int32_t Temp = send(c.GetTCPSock(), &Send[Sent], Size - Sent, MSG_NOSIGNAL); if (Temp == 0) { + debug("send() == 0: " + std::string(std::strerror(errno))); if (c.GetStatus() > -1) c.SetStatus(-1); return false; } else if (Temp < 0) { + debug("send() < 0: " + std::string(std::strerror(errno))); if (c.GetStatus() > -1) c.SetStatus(-1); CloseSocketProper(c.GetTCPSock());