unix: retry on ENOBUFS in sendmsg(2)

libuv retries when sendmsg(2) fails with EAGAIN or
EWOULDBLOCK. This commit adds similar functionality for
ENOBUFS.

PR-URL: https://github.com/libuv/libuv/pull/1573
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Kamil Rytarowski 2017-09-30 18:33:32 +02:00 committed by cjihrig
parent 0fcf2d1441
commit 8a9585232e
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
2 changed files with 6 additions and 4 deletions

View File

@ -859,7 +859,7 @@ start:
}
if (n < 0) {
if (errno != EAGAIN && errno != EWOULDBLOCK) {
if (errno != EAGAIN && errno != EWOULDBLOCK && errno != ENOBUFS) {
err = -errno;
goto error;
} else if (stream->flags & UV_STREAM_BLOCKING) {

View File

@ -237,8 +237,10 @@ static void uv__udp_sendmsg(uv_udp_t* handle) {
size = sendmsg(handle->io_watcher.fd, &h, 0);
} while (size == -1 && errno == EINTR);
if (size == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
break;
if (size == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
break;
}
req->status = (size == -1 ? -errno : size);
@ -472,7 +474,7 @@ int uv__udp_try_send(uv_udp_t* handle,
} while (size == -1 && errno == EINTR);
if (size == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK)
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
return -EAGAIN;
else
return -errno;