libubus: fix deferring invoke processing for non-uloop usage
authorFelix Fietkau <nbd@openwrt.org>
Tue, 24 Jun 2014 20:42:14 +0000 (22:42 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 25 Jun 2014 08:24:27 +0000 (10:24 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
libubus-req.c
libubus.c

index 7378a92405fe3d757536195351ecf2a22d519b6d..f24f033d9d65da38ebbd5dac53f2cce4a16b4df3 100644 (file)
@@ -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;
 }
 
index e852519c0c3d8faa1d711a26631518492b85f61e..1a550c126265aaa72ce4ba623d00dfb370773e29 100644 (file)
--- 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