ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit eb3e2c3754fc1aee0454a7807637aeb14182e70b
parent bcce11eed363065c1910e1d65f6659ae1e1a7f29
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Wed,  9 Jun 2021 17:53:19 -0700

Gracefully handle early client disconnects

Use send(2)'s MSG_NOSIGNAL flag to prevent SIGPIPE from being sent.
The client will later be dropped when it is polled.

Diffstat:
Mresponse.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/response.c b/response.c @@ -86,7 +86,8 @@ resp_send(struct aps *aps, int fd) if (!resp->lock || resp->len - resp->sent == 0) return 1; - n = send(fd, resp->buf + resp->sent, resp->len - resp->sent, 0); + n = send(fd, resp->buf + resp->sent, resp->len - resp->sent, + MSG_NOSIGNAL); switch (n) { case -1: return 1;