Signed-off-by: Alexandru Ardelean <[email protected]>
---
 libubus-io.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libubus-io.c b/libubus-io.c
index 31dad27..2b25696 100644
--- a/libubus-io.c
+++ b/libubus-io.c
@@ -256,12 +256,9 @@ static bool get_next_msg(struct ubus_context *ctx, int 
*recv_fd)
        len = blob_raw_len(&hdrbuf.data);
        if (len > ctx->msgbuf_data_len) {
                ctx->msgbuf_reduction_counter = UBUS_MSGBUF_REDUCTION_INTERVAL;
-       } else if (ctx->msgbuf_data_len > UBUS_MSG_CHUNK_SIZE) {
-               if (ctx->msgbuf_reduction_counter > 0) {
-                       len = -1;
-                       --ctx->msgbuf_reduction_counter;
-               } else
-                       len = UBUS_MSG_CHUNK_SIZE;
+       } else
+       if (ctx->msgbuf_reduction_counter > 0 && len < UBUS_MSG_CHUNK_SIZE) {
+               len = (0 == --ctx->msgbuf_reduction_counter) ? 
UBUS_MSG_CHUNK_SIZE : -1;
        } else
                len = -1;
 
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to