From 4da88182912e9e4cf2bc2532309943b9c3c018f9 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 16 Jan 2014 21:08:17 +0100 Subject: Fixed SIGPIPE on cSocket::Send(). --- src/OSSupport/BlockingTCPLink.cpp | 11 ----------- src/OSSupport/Socket.cpp | 2 +- src/OSSupport/Socket.h | 12 ++++++++++++ 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src/OSSupport') diff --git a/src/OSSupport/BlockingTCPLink.cpp b/src/OSSupport/BlockingTCPLink.cpp index 55454a4b5..08aec0c65 100644 --- a/src/OSSupport/BlockingTCPLink.cpp +++ b/src/OSSupport/BlockingTCPLink.cpp @@ -7,17 +7,6 @@ -#ifdef _WIN32 - #define MSG_NOSIGNAL (0) -#endif -#ifdef __MACH__ - #define MSG_NOSIGNAL (0) -#endif - - - - - cBlockingTCPLink::cBlockingTCPLink(void) { } diff --git a/src/OSSupport/Socket.cpp b/src/OSSupport/Socket.cpp index d511e5487..8ea5d8320 100644 --- a/src/OSSupport/Socket.cpp +++ b/src/OSSupport/Socket.cpp @@ -364,7 +364,7 @@ int cSocket::Receive(char* a_Buffer, unsigned int a_Length, unsigned int a_Flags int cSocket::Send(const char * a_Buffer, unsigned int a_Length) { - return send(m_Socket, a_Buffer, a_Length, 0); + return send(m_Socket, a_Buffer, a_Length, MSG_NOSIGNAL); } diff --git a/src/OSSupport/Socket.h b/src/OSSupport/Socket.h index 81bfd28fc..b86560de8 100644 --- a/src/OSSupport/Socket.h +++ b/src/OSSupport/Socket.h @@ -5,6 +5,18 @@ +// Windows and MacOSX don't have the MSG_NOSIGNAL flag +#if ( \ + defined(_WIN32) || \ + (defined(__APPLE__) && defined(__MACH__)) \ +) + #define MSG_NOSIGNAL (0) +#endif + + + + + class cSocket { public: -- cgit v1.2.3