diff options
author | Felix Fietkau <nbd@nbd.name> | 2019-04-16 11:00:49 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-04-16 11:02:53 +0200 |
commit | 76ea27a627742c8a6c40261287d322b7656cc43d (patch) | |
tree | e65419626ef4301516bef98e56521b2e82ab3768 | |
parent | 4daab27d004fa604095923d5471a69283a84b034 (diff) | |
download | ubus-76ea27a627742c8a6c40261287d322b7656cc43d.tar.gz |
libubus: attempt to receive data before calling poll
Data is often already present here
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r-- | libubus-io.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libubus-io.c b/libubus-io.c index 887e88c..228af5c 100644 --- a/libubus-io.c +++ b/libubus-io.c @@ -174,9 +174,6 @@ static int recv_retry(struct ubus_context *ctx, struct iovec *iov, bool wait, in }; while (iov->iov_len > 0) { - if (wait) - wait_data(fd, false); - if (recv_fd) { msghdr.msg_control = &fd_buf; msghdr.msg_controllen = sizeof(fd_buf); @@ -210,6 +207,9 @@ static int recv_retry(struct ubus_context *ctx, struct iovec *iov, bool wait, in iov->iov_len -= bytes; iov->iov_base += bytes; total += bytes; + + if (iov->iov_len > 0) + wait_data(fd, false); } return total; |