ubusd: fix build on non-linux systems without peercred support
[project/ubus.git] / libubus-req.c
index ebc5806..2197f2a 100644 (file)
@@ -153,6 +153,7 @@ int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req,
                        timeout = time_end - get_time_msec();
                        if (timeout <= 0) {
                                ubus_set_req_status(req, UBUS_STATUS_TIMEOUT);
+                               uloop_cancelled = cancelled;
                                break;
                        }
                }
@@ -174,7 +175,7 @@ int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req,
        if (!registered) {
                uloop_fd_delete(&ctx->sock);
 
-               if (ctx->stack_depth)
+               if (!ctx->stack_depth)
                        ctx->pending_timer.cb(&ctx->pending_timer);
        }