#include "ubusd.h"
-static struct avl_tree clients;
+struct avl_tree clients;
static struct ubus_msg_buf *ubus_msg_unshare(struct ubus_msg_buf *ub)
{
if (cl->pending_msg_offset < sizeof(cl->hdrbuf))
goto out;
- if (blob_len(&cl->hdrbuf.data) + sizeof(cl->hdrbuf) > UBUS_MAX_MSGLEN)
+ if (blob_pad_len(&cl->hdrbuf.data) > UBUS_MAX_MSGLEN)
goto disconnect;
cl->pending_msg = ubus_msg_new(NULL, blob_raw_len(&cl->hdrbuf.data), false);
handle_client_disconnect(cl);
}
-struct ubus_client *ubusd_get_client_by_id(uint32_t id)
-{
- struct ubus_id *clid;
-
- clid = ubus_find_id(&clients, id);
- if (!clid)
- return NULL;
-
- return container_of(clid, struct ubus_client, id);
-}
-
static bool get_next_connection(int fd)
{
struct ubus_client *cl;
uloop_fd_add(&server_fd, ULOOP_READ | ULOOP_EDGE_TRIGGER);
uloop_run();
+ unlink(ubus_socket);
out:
uloop_done();