work in progress to prevent SIGPIPE signals (this is going to fix #79)
This commit is contained in:
parent
dddd16b74d
commit
aad09a1dd2
|
|
@ -187,10 +187,10 @@ public:
|
||||||
{
|
{
|
||||||
// is there already a buffer of data that can not be sent?
|
// is there already a buffer of data that can not be sent?
|
||||||
if (_out) return _out.add(buffer, size);
|
if (_out) return _out.add(buffer, size);
|
||||||
|
|
||||||
// there is no buffer, send the data right away
|
// 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
|
// number of bytes sent
|
||||||
size_t bytes = result < 0 ? 0 : result;
|
size_t bytes = result < 0 ? 0 : result;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,6 +226,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the data
|
// send the data
|
||||||
|
// @todo use sendmsg() with a MSG_NOSIG flag
|
||||||
auto result = writev(socket, (const struct iovec *)&buffer, index);
|
auto result = writev(socket, (const struct iovec *)&buffer, index);
|
||||||
|
|
||||||
// skip on error, or when nothing was written
|
// skip on error, or when nothing was written
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue