pulse-server: handle recv of 0 bytes

0 bytes from recv means EOS and we can disconnect the client instead
of looping forever.
This commit is contained in:
Wim Taymans 2020-11-16 15:36:51 +01:00
parent 0e34c552e9
commit af41e3423d

View file

@ -4656,7 +4656,11 @@ static int do_read(struct client *client)
size = client->message->length - idx;
}
while (true) {
if ((r = recv(client->source->fd, data, size, MSG_DONTWAIT)) < 0) {
r = recv(client->source->fd, data, size, MSG_DONTWAIT);
if (r == 0 && size != 0) {
res = -EPIPE;
goto exit;
} else if (r < 0) {
if (errno == EINTR)
continue;
res = -errno;