Skip to content

Commit

Permalink
Merge pull request #46 from daniel-sch/sigpipe_fix
Browse files Browse the repository at this point in the history
 Prevent server from crashing with SIGPIPE when terminating client
  • Loading branch information
guruofquality authored Aug 22, 2018
2 parents 6d8074e + cb5cf1e commit 6efb692
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/SoapyRPCSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ int SoapyRPCSocket::multicastJoin(const std::string &group, const bool loop, con

int SoapyRPCSocket::send(const void *buf, size_t len, int flags)
{
int ret = ::send(_sock, (const char *)buf, int(len), flags);
int ret = ::send(_sock, (const char *)buf, int(len), flags | MSG_NOSIGNAL);
if (ret == -1) this->reportError("send()");
return ret;
}
Expand Down
7 changes: 7 additions & 0 deletions common/SoapySocketDefs.in.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,10 @@ typedef int socklen_t;
#if !defined(IPV6_DROP_MEMBERSHIP) && defined(IPV6_LEAVE_GROUP)
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
#endif

/***********************************************************************
* socket flag definitions
**********************************************************************/
#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
#endif

0 comments on commit 6efb692

Please sign in to comment.