free(cl);
}
-static void
-client_notify_write(struct ustream *s, int bytes)
-{
-}
-
static void client_notify_state(struct ustream *s)
{
client_close(s);
struct log_head *l;
int count = 0;
int fds[2];
+ int ret;
if (msg) {
blobmsg_parse(&read_policy, 1, &tb, blob_data(msg), blob_len(msg));
}
ubus_request_set_fd(ctx, req, fds[0]);
cl = calloc(1, sizeof(*cl));
- cl->s.stream.notify_write = client_notify_write;
cl->s.stream.notify_state = client_notify_state;
cl->fd = fds[1];
ustream_fd_init(&cl->s, cl->fd);
blobmsg_add_u32(&b, "source", l->source);
blobmsg_add_u64(&b, "time", l->ts.tv_sec * 1000LL);
l = log_list(count, l);
- if (ustream_write(&cl->s.stream, (void *) b.head, blob_len(b.head) + sizeof(struct blob_attr), false) <= 0)
+ ret = ustream_write(&cl->s.stream, (void *) b.head, blob_len(b.head) + sizeof(struct blob_attr), false);
+ blob_buf_free(&b);
+ if (ret < 0)
break;
}
return 0;