Handle EINTR

non-odp-rdma
Vitaliy Filippov 2022-01-22 23:59:37 +03:00
parent 23e578b6a2
commit 9c3653b1e1
4 changed files with 10 additions and 10 deletions

View File

@ -381,7 +381,7 @@ again:
{
res = -errno;
}
if (res == -EAGAIN)
if (res == -EAGAIN || res == -EINTR)
{
res = 0;
}
@ -431,7 +431,7 @@ void http_co_t::submit_read()
{
res = -errno;
}
if (res == -EAGAIN)
if (res == -EAGAIN || res == -EINTR)
{
epoll_events = epoll_events & ~EPOLLIN;
}

View File

@ -67,7 +67,7 @@ bool osd_messenger_t::handle_read(int result, osd_client_t *cl)
}
return false;
}
if (result <= 0 && result != -EAGAIN)
if (result <= 0 && result != -EAGAIN && result != -EINTR)
{
// this is a client socket, so don't panic on error. just disconnect it
if (result != 0)
@ -77,7 +77,7 @@ bool osd_messenger_t::handle_read(int result, osd_client_t *cl)
stop_client(cl->peer_fd);
return false;
}
if (result == -EAGAIN || result < cl->read_iov.iov_len)
if (result == -EAGAIN || result == -EINTR || result < cl->read_iov.iov_len)
{
cl->read_ready--;
if (cl->read_ready > 0)

View File

@ -224,7 +224,7 @@ void osd_messenger_t::handle_send(int result, osd_client_t *cl)
}
return;
}
if (result < 0 && result != -EAGAIN)
if (result < 0 && result != -EAGAIN && result != -EINTR)
{
// this is a client socket, so don't panic. just disconnect it
fprintf(stderr, "Client %d socket write error: %d (%s). Disconnecting client\n", cl->peer_fd, -result, strerror(-result));

View File

@ -23,7 +23,7 @@ int read_blocking(int fd, void *read_buf, size_t remaining)
// EOF
return done;
}
else if (errno != EAGAIN && errno != EPIPE)
else if (errno != EINTR && errno != EAGAIN && errno != EPIPE)
{
perror("read");
exit(1);
@ -44,7 +44,7 @@ int write_blocking(int fd, void *write_buf, size_t remaining)
size_t r = write(fd, write_buf, remaining-done);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
if (errno != EINTR && errno != EAGAIN && errno != EPIPE)
{
perror("write");
exit(1);
@ -66,7 +66,7 @@ int readv_blocking(int fd, iovec *iov, int iovcnt)
ssize_t r = readv(fd, iov+v, iovcnt-v);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
if (errno != EINTR && errno != EAGAIN && errno != EPIPE)
{
perror("writev");
exit(1);
@ -101,7 +101,7 @@ int writev_blocking(int fd, iovec *iov, int iovcnt)
ssize_t r = writev(fd, iov+v, iovcnt-v);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
if (errno != EINTR && errno != EAGAIN && errno != EPIPE)
{
perror("writev");
exit(1);
@ -139,7 +139,7 @@ int sendv_blocking(int fd, iovec *iov, int iovcnt, int flags)
ssize_t r = sendmsg(fd, &msg, flags);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
if (errno != EINTR && errno != EAGAIN && errno != EPIPE)
{
perror("sendmsg");
exit(1);