return false;
len = blob_raw_len(&hdrbuf.data);
- if (len > ctx->msgbuf_data_len) {
+ 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
+ else if (ctx->msgbuf_reduction_counter > 0 && len < UBUS_MSG_CHUNK_SIZE)
+ len = !--ctx->msgbuf_reduction_counter ? UBUS_MSG_CHUNK_SIZE : -1;
+ else
len = -1;
if (len > -1) {
void __hidden ubus_handle_data(struct uloop_fd *u, unsigned int events)
{
struct ubus_context *ctx = container_of(u, struct ubus_context, sock);
- struct ubus_msghdr *hdr = &ctx->msgbuf.hdr;
int recv_fd = -1;
while (get_next_msg(ctx, &recv_fd)) {
- ubus_process_msg(ctx, hdr, recv_fd);
+ ubus_process_msg(ctx, &ctx->msgbuf, recv_fd);
if (uloop_cancelled)
break;
}