Skip to content

Commit b51cd8c

Browse files
committed
add MSG_NOSIGNAL to send flags if available
1 parent f3fb20c commit b51cd8c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

library/net/TcpSocket.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ inline namespace v1 {
7676
}
7777

7878
SocketDataResult TcpSocket::sendRawBytes(Span<const uint8_t> buffer) {
79-
int res = ::send(getHandle(), priv::sendPointer(buffer), priv::sendLength(buffer), priv::NoFlag);
79+
#ifdef MSG_NOSIGNAL
80+
static constexpr int SendFlags = MSG_NOSIGNAL;
81+
#else
82+
static constexpr int SendFlags = priv::NoFlag;
83+
#endif
84+
int res = ::send(getHandle(), priv::sendPointer(buffer), priv::sendLength(buffer), SendFlags);
8085

8186
if (res == priv::InvalidCommunication) {
8287
if (priv::nativeWouldBlock(priv::getErrorCode())) {

0 commit comments

Comments
 (0)