From 3869e0ca0774e8f17597db5b60bee97d21b5b1fa Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 24 Jun 2014 22:42:14 +0200 Subject: [PATCH] libubus: fix deferring invoke processing for non-uloop usage Signed-off-by: Felix Fietkau --- libubus-req.c | 6 +++++- libubus.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libubus-req.c b/libubus-req.c index 7378a92..f24f033 100644 --- a/libubus-req.c +++ b/libubus-req.c @@ -171,9 +171,13 @@ int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req, if (req->complete_cb) req->complete_cb(req, status); - if (!registered) + if (!registered) { uloop_fd_delete(&ctx->sock); + if (ctx->stack_depth) + ctx->pending_timer.cb(&ctx->pending_timer); + } + return status; } diff --git a/libubus.c b/libubus.c index e852519..1a550c1 100644 --- a/libubus.c +++ b/libubus.c @@ -81,7 +81,8 @@ ubus_queue_msg(struct ubus_context *ctx, struct ubus_msghdr *hdr) memcpy(&pending->hdr, hdr, sizeof(*hdr) + blob_raw_len(ubus_msghdr_data(hdr))); list_add(&pending->list, &ctx->pending); - uloop_timeout_set(&ctx->pending_timer, 1); + if (ctx->sock.registered) + uloop_timeout_set(&ctx->pending_timer, 1); } void __hidden -- 2.30.2