diff --git a/emper/io/Future.hpp b/emper/io/Future.hpp index 2de6e021c9bbef8391287ba460523e6de34c4534..b8728eba98179cc40c51e718ff8a9afe367616a3 100644 --- a/emper/io/Future.hpp +++ b/emper/io/Future.hpp @@ -164,10 +164,13 @@ class SendFuture : public Future { void submit() { if constexpr (emper::IO_TRY_SYSCALL) { - ssize_t res = ::send(fd, buf, len, offsetOrFlags | MSG_DONTWAIT); + // Only try to complete using a syscall if we have no dependencies + if (!dependency) { + ssize_t res = ::send(fd, buf, len, offsetOrFlags | MSG_DONTWAIT); - if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) { - complete(res > 0 ? res : -errno); + if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) { + complete(res > 0 ? res : -errno); + } } } @@ -186,10 +189,13 @@ class RecvFuture : public Future { void submit() { if constexpr (emper::IO_TRY_SYSCALL) { - ssize_t res = ::recv(fd, buf, len, offsetOrFlags | MSG_DONTWAIT); + // Only try to complete using a syscall if we have no dependencies + if (!dependency) { + ssize_t res = ::recv(fd, buf, len, offsetOrFlags | MSG_DONTWAIT); - if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) { - complete(res > 0 ? res : -errno); + if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) { + complete(res > 0 ? res : -errno); + } } }