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:
parent
0fcf2d1441
commit
8a9585232e
@ -859,7 +859,7 @@ start:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
if (errno != EAGAIN && errno != EWOULDBLOCK) {
|
if (errno != EAGAIN && errno != EWOULDBLOCK && errno != ENOBUFS) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
goto error;
|
goto error;
|
||||||
} else if (stream->flags & UV_STREAM_BLOCKING) {
|
} else if (stream->flags & UV_STREAM_BLOCKING) {
|
||||||
|
|||||||
@ -237,8 +237,10 @@ static void uv__udp_sendmsg(uv_udp_t* handle) {
|
|||||||
size = sendmsg(handle->io_watcher.fd, &h, 0);
|
size = sendmsg(handle->io_watcher.fd, &h, 0);
|
||||||
} while (size == -1 && errno == EINTR);
|
} while (size == -1 && errno == EINTR);
|
||||||
|
|
||||||
if (size == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
|
if (size == -1) {
|
||||||
break;
|
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
req->status = (size == -1 ? -errno : size);
|
req->status = (size == -1 ? -errno : size);
|
||||||
|
|
||||||
@ -472,7 +474,7 @@ int uv__udp_try_send(uv_udp_t* handle,
|
|||||||
} while (size == -1 && errno == EINTR);
|
} while (size == -1 && errno == EINTR);
|
||||||
|
|
||||||
if (size == -1) {
|
if (size == -1) {
|
||||||
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
else
|
else
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user