diff options
Diffstat (limited to 'src/vcl')
-rw-r--r-- | src/vcl/ldp.c | 21 | ||||
-rw-r--r-- | src/vcl/vcl_private.h | 4 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 34eba377451..a4151be9f2e 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -380,24 +380,19 @@ readv (int fd, const struct iovec * iov, int iovcnt) vlsh = ldp_fd_to_vlsh (fd); if (vlsh != VLS_INVALID_HANDLE) { - do + for (i = 0; i < iovcnt; ++i) { - for (i = 0; i < iovcnt; ++i) + rv = vls_read (vlsh, iov[i].iov_base, iov[i].iov_len); + if (rv <= 0) + break; + else { - rv = vls_read (vlsh, iov[i].iov_base, iov[i].iov_len); - if (rv < 0) + total += rv; + if (rv < iov[i].iov_len) break; - else - { - total += rv; - if (rv < iov[i].iov_len) - break; - } } } - while ((rv >= 0) && (total == 0)); - - if (rv < 0) + if (rv < 0 && total == 0) { errno = -rv; size = -1; diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h index d44d993e0a1..0cd6a6c7944 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -537,8 +537,8 @@ vcl_session_is_closing (vcl_session_t * s) static inline int vcl_session_closing_error (vcl_session_t * s) { - return s->session_state == STATE_DISCONNECT - ? VPPCOM_ECONNRESET : VPPCOM_ECONNABORTED; + /* Return 0 on closing sockets */ + return s->session_state == STATE_DISCONNECT ? VPPCOM_ECONNRESET : 0; } static inline int |