diff options
author | John Crispin <john@phrozen.org> | 2018-02-14 08:47:03 +0100 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-02-14 09:00:51 +0100 |
commit | 66347ec742eddf2bdffa21549f49d00b7be8cb9a (patch) | |
tree | 5d6d3d1a2b6b15a93fda1ff2205ae2a8c3a18633 /log | |
parent | 975a258cde472dd3fd863e37bf57a268c92c6366 (diff) | |
download | ubox-66347ec742eddf2bdffa21549f49d00b7be8cb9a.tar.gz |
logrea: move the code setting up the request blob out of the main loop
Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'log')
-rw-r--r-- | log/logread.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/log/logread.c b/log/logread.c index cc962db..fa24132 100644 --- a/log/logread.c +++ b/log/logread.c @@ -353,6 +353,14 @@ int main(int argc, char **argv) } } + blob_buf_init(&b, 0); + blobmsg_add_u8(&b, "stream", 1); + blobmsg_add_u8(&b, "oneshot", !log_follow); + if (lines) + blobmsg_add_u32(&b, "lines", lines); + else if (log_follow) + blobmsg_add_u32(&b, "lines", 0); + /* ugly ugly ugly ... we need a real reconnect logic */ do { ret = ubus_lookup_id(ctx, "log", &id); @@ -364,14 +372,7 @@ int main(int argc, char **argv) logread_setup_output(); - blob_buf_init(&b, 0); - blobmsg_add_u8(&b, "stream", 1); - blobmsg_add_u8(&b, "oneshot", !log_follow); - if (lines) - blobmsg_add_u32(&b, "lines", lines); - else if (log_follow) - blobmsg_add_u32(&b, "lines", 0); - ubus_invoke_async(ctx, id, "read", b.head, &req); + ubus_invoke_async(ctx, id, "read", b.head, &req); req.fd_cb = logread_fd_cb; ubus_complete_request_async(ctx, &req); |