diff --git a/libipc/io.cpp b/libipc/io.cpp index 25dce02830ea06009dbcfd0ab8145ba910fb59c1..5dba16d9d5029d43b3e8b4d87d29feb243206620 100644 --- a/libipc/io.cpp +++ b/libipc/io.cpp @@ -145,6 +145,8 @@ void attempt_optimization(int fd, bool send) { // Configure localfd copy_bufsizes(fd, i.localfd); set_local_nonblocking(fd, i.non_blocking); + } else { + i.state = STATE_NOOPT; } } } @@ -168,6 +170,9 @@ ssize_t do_ipc_io(int fd, buf_t buf, size_t count, int flags, IOFunc IO, return ret; } + if (i.state == STATE_NOOPT) + return IO(fd, buf, count, flags); + // Otherwise, use original fd: size_t &bytes = get_byte_counter(i, send); ssize_t rem = (TRANS_THRESHOLD - bytes); @@ -293,6 +298,10 @@ ssize_t do_ipc_iov(int fd, const struct iovec *vec, int count, IOVFunc IO, return ret; } + if (i.state == STATE_NOOPT) { + return IO(fd, vec, count); + } + size_t bytes = 0; for (int i = 0; i < count; ++i) { // Overflow check... diff --git a/libipc/ipcreg_internal.h b/libipc/ipcreg_internal.h index 96cc3140476b18f718b78efc3131b6f5c35c1688..c3c071e2e5f01e1066fb5307c867f50096ed30c2 100644 --- a/libipc/ipcreg_internal.h +++ b/libipc/ipcreg_internal.h @@ -37,6 +37,7 @@ enum EndpointState { STATE_UNOPT, STATE_ID_EXCHANGE, STATE_OPTIMIZED, + STATE_NOOPT }; struct epoll_entry {