[UBUS_STATUS_NOT_SUPPORTED] = "Operation not supported",
[UBUS_STATUS_UNKNOWN_ERROR] = "Unknown error",
[UBUS_STATUS_CONNECTION_FAILED] = "Connection failed",
+ [UBUS_STATUS_NO_MEMORY] = "Out of memory",
+ [UBUS_STATUS_PARSE_ERROR] = "Parsing message data failed",
+ [UBUS_STATUS_SYSTEM_ERROR] = "System error",
};
struct blob_buf b __hidden = {};
break;
}
+ ctx->stack_depth++;
ubus_process_obj_msg(ctx, buf, fd);
+ ctx->stack_depth--;
break;
case UBUS_MSG_MONITOR:
if (ctx->monitor_cb)
struct ubus_context *ctx = container_of(timeout, struct ubus_context, pending_timer);
struct ubus_pending_msg *pending;
- while (!ctx->stack_depth && !list_empty(&ctx->pending)) {
+ while (!list_empty(&ctx->pending)) {
+ if (ctx->stack_depth)
+ break;
+
pending = list_first_entry(&ctx->pending, struct ubus_pending_msg, list);
list_del(&pending->list);
ubus_process_msg(ctx, &pending->hdr, -1);
struct blob_attr **attr;
req = container_of(ureq, struct ubus_lookup_request, req);
- attr = ubus_parse_msg(msg);
+ attr = ubus_parse_msg(msg, blob_raw_len(msg));
if (!attr[UBUS_ATTR_OBJID] || !attr[UBUS_ATTR_OBJPATH] ||
!attr[UBUS_ATTR_OBJTYPE])
struct blob_attr **attr;
uint32_t *id = req->priv;
- attr = ubus_parse_msg(msg);
+ attr = ubus_parse_msg(msg, blob_raw_len(msg));
if (!attr[UBUS_ATTR_OBJID])
return;
ctx->connection_lost = ubus_default_connection_lost;
ctx->pending_timer.cb = ubus_process_pending_msg;
- ctx->msgbuf.data = calloc(UBUS_MSG_CHUNK_SIZE, sizeof(char));
+ ctx->msgbuf.data = calloc(1, UBUS_MSG_CHUNK_SIZE);
if (!ctx->msgbuf.data)
return -1;
ctx->msgbuf_data_len = UBUS_MSG_CHUNK_SIZE;
INIT_LIST_HEAD(&ctx->requests);
INIT_LIST_HEAD(&ctx->pending);
+ INIT_LIST_HEAD(&ctx->auto_subscribers);
avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
if (ubus_reconnect(ctx, path)) {
free(ctx->msgbuf.data);
blob_buf_free(&b);
if (!ctx)
return;
+ uloop_fd_delete(&ctx->sock);
close(ctx->sock.fd);
uloop_timeout_cancel(&ctx->pending_timer);
free(ctx->msgbuf.data);