Skip to content

Commit

Permalink
work in progress to prevent SIGPIPE signals (this is going to fix #79)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmielBruijntjes committed Jul 6, 2016
1 parent dddd16b commit aad09a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tcpconnected.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ class TcpConnected : public TcpState, private Watchable
{
// is there already a buffer of data that can not be sent?
if (_out) return _out.add(buffer, size);

// there is no buffer, send the data right away
auto result = write(_socket, buffer, size);
auto result = ::send(_socket, buffer, size, MSG_NOSIGNAL);

// number of bytes sent
size_t bytes = result < 0 ? 0 : result;

Expand Down
1 change: 1 addition & 0 deletions src/tcpoutbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class TcpOutBuffer
}

// send the data
// @todo use sendmsg() with a MSG_NOSIG flag
auto result = writev(socket, (const struct iovec *)&buffer, index);

// skip on error, or when nothing was written
Expand Down

0 comments on commit aad09a1

Please sign in to comment.