ignore SIGPIPE in sendfile() implementation of mod sending

This commit is contained in:
Lion Kortlepel 2024-07-14 17:01:08 +02:00
parent b097acfd4a
commit 8b753ab6ea
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -816,10 +816,12 @@ const uint8_t* /* end ptr */ TNetwork::SendSplit(TClient& c, ip::tcp::socket& So
#include <cstring> #include <cstring>
#include <sys/sendfile.h> #include <sys/sendfile.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#endif #endif
void TNetwork::SplitLoad(TClient& c, size_t Offset, size_t End, bool D, const std::string& Name) { void TNetwork::SplitLoad(TClient& c, size_t Offset, size_t End, bool D, const std::string& Name) {
TScopedTimer timer(fmt::format("Download of {}-{} for '{}'", Offset, End, Name)); TScopedTimer timer(fmt::format("Download of {}-{} for '{}'", Offset, End, Name));
#if defined(BEAMMP_LINUX) #if defined(BEAMMP_LINUX)
signal(SIGPIPE, SIG_IGN);
// on linux, we can use sendfile(2)! // on linux, we can use sendfile(2)!
int fd = ::open(Name.c_str(), O_RDONLY); int fd = ::open(Name.c_str(), O_RDONLY);
if (fd < 0) { if (fd < 0) {