From 6eb3c9647e04d38f14e6c8d3e2d9b6922f2a43d1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 15 Feb 2017 11:35:35 +0100 Subject: [PATCH] cli: do not use default timeout for listen Default to listening for events forever unless -t is explicitly specified on the command line Signed-off-by: Felix Fietkau --- cli.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli.c b/cli.c index 624c089..1949a17 100644 --- a/cli.c +++ b/cli.c @@ -17,6 +17,7 @@ #include "libubus.h" static struct blob_buf b; +static int listen_timeout; static int timeout = 30; static bool simple_output = false; static int verbose = 0; @@ -171,7 +172,8 @@ static void do_listen(struct ubus_context *ctx, struct cli_listen_data *data) data->timeout.cb = listen_timeout; uloop_init(); ubus_add_uloop(ctx); - uloop_timeout_set(&data->timeout, timeout * 1000); + if (listen_timeout) + uloop_timeout_set(&data->timeout, listen_timeout * 1000); uloop_run(); uloop_done(); } @@ -585,6 +587,7 @@ int main(int argc, char **argv) ubus_socket = optarg; break; case 't': + listen_timeout = atoi(optarg); timeout = atoi(optarg); break; case 'S': -- 2.11.0