remove obsolete debug msgs
This commit is contained in:
parent
7d4fd754af
commit
4f8b3c8d46
1 changed files with 7 additions and 18 deletions
25
libubus.c
25
libubus.c
|
@ -657,36 +657,27 @@ struct ubus_context *ubus_connect(const char *path)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ctx->sock.fd = usock(USOCK_UNIX, path, NULL);
|
ctx->sock.fd = usock(USOCK_UNIX, path, NULL);
|
||||||
if (ctx->sock.fd < 0) {
|
if (ctx->sock.fd < 0)
|
||||||
DPRINTF("Failed to connect to server\n");
|
|
||||||
goto error_free;
|
goto error_free;
|
||||||
}
|
|
||||||
ctx->sock.cb = ubus_handle_data;
|
ctx->sock.cb = ubus_handle_data;
|
||||||
|
|
||||||
if (read(ctx->sock.fd, &hdr, sizeof(hdr)) != sizeof(hdr)) {
|
if (read(ctx->sock.fd, &hdr, sizeof(hdr)) != sizeof(hdr))
|
||||||
DPRINTF("Failed to read initial message data\n");
|
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
|
||||||
|
|
||||||
if (!ubus_validate_hdr(&hdr.hdr)) {
|
if (!ubus_validate_hdr(&hdr.hdr))
|
||||||
DPRINTF("Failed to validate initial message header\n");
|
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
|
||||||
|
|
||||||
if (hdr.hdr.type != UBUS_MSG_HELLO) {
|
if (hdr.hdr.type != UBUS_MSG_HELLO)
|
||||||
DPRINTF("Unexpected initial message\n");
|
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
|
||||||
|
|
||||||
buf = calloc(1, blob_raw_len(&hdr.data));
|
buf = calloc(1, blob_raw_len(&hdr.data));
|
||||||
if (!buf)
|
if (!buf)
|
||||||
goto error_close;
|
goto error_close;
|
||||||
|
|
||||||
memcpy(buf, &hdr.data, sizeof(hdr.data));
|
memcpy(buf, &hdr.data, sizeof(hdr.data));
|
||||||
if (read(ctx->sock.fd, blob_data(buf), blob_len(buf)) != blob_len(buf)) {
|
if (read(ctx->sock.fd, blob_data(buf), blob_len(buf)) != blob_len(buf))
|
||||||
DPRINTF("Failed to retrieve initial message data\n");
|
|
||||||
goto error_free_buf;
|
goto error_free_buf;
|
||||||
}
|
|
||||||
|
|
||||||
ctx->local_id = hdr.hdr.peer;
|
ctx->local_id = hdr.hdr.peer;
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -696,10 +687,8 @@ struct ubus_context *ubus_connect(const char *path)
|
||||||
INIT_LIST_HEAD(&ctx->requests);
|
INIT_LIST_HEAD(&ctx->requests);
|
||||||
avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
|
avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
|
||||||
|
|
||||||
if (!ctx->local_id) {
|
if (!ctx->local_id)
|
||||||
DPRINTF("Failed to get local peer id\n");
|
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue