break;
}
- ubus_process_obj_msg(ctx, buf);
+ ubus_process_obj_msg(ctx, buf, fd);
+ break;
+ case UBUS_MSG_MONITOR:
+ if (ctx->monitor_cb)
+ ctx->monitor_cb(ctx, buf->hdr.seq, buf->data);
break;
}
}
int ubus_connect_ctx(struct ubus_context *ctx, const char *path)
{
+ uloop_init();
memset(ctx, 0, sizeof(*ctx));
ctx->sock.fd = -1;
avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
if (ubus_reconnect(ctx, path)) {
free(ctx->msgbuf.data);
+ ctx->msgbuf.data = NULL;
return -1;
}
void ubus_shutdown(struct ubus_context *ctx)
{
blob_buf_free(&b);
+ if (!ctx)
+ return;
close(ctx->sock.fd);
+ uloop_timeout_cancel(&ctx->pending_timer);
free(ctx->msgbuf.data);
}