Use send/sendmsg and don't ignore SIGPIPE
This commit is contained in:
@@ -134,7 +134,11 @@ bool Connection::writeBytes() {
|
||||
|
||||
ssize_t w;
|
||||
for (;;) {
|
||||
w = writev(fd_, iov, iov_count);
|
||||
struct msghdr msg = {};
|
||||
msg.msg_iov = iov;
|
||||
msg.msg_iovlen = iov_count;
|
||||
|
||||
w = sendmsg(fd_, &msg, MSG_NOSIGNAL);
|
||||
if (w == -1) {
|
||||
if (errno == EINTR) {
|
||||
continue; // Standard practice: retry on signal interruption
|
||||
@@ -148,7 +152,7 @@ bool Connection::writeBytes() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
perror("writev");
|
||||
perror("sendmsg");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user