Use send(MSG_NOSIGNAL) instead of write() in one other place.

This commit is contained in:
Ian Gulliver
2016-02-25 11:56:51 -08:00
parent b4171c971a
commit 6f082ecf32

View File

@@ -154,13 +154,13 @@ void send_write(struct packet *packet) {
if (buf.length == 0) {
continue;
}
struct send *send = serializer->send_head;
while (send) {
if (write(send->peer.fd, buf_at(&buf, 0), buf.length) != buf.length) {
struct send *send_obj = serializer->send_head;
while (send_obj) {
if (send(send_obj->peer.fd, buf_at(&buf, 0), buf.length, MSG_NOSIGNAL) != buf.length) {
// peer_loop() will see this shutdown and call send_del
shutdown(send->peer.fd, SHUT_RD | SHUT_WR);
shutdown(send_obj->peer.fd, SHUT_RD | SHUT_WR);
}
send = send->next;
send_obj = send_obj->next;
}
}
}