aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2015-02-23 20:51:25 +0100
committerAleksander Morgado <aleksander@aleksander.es>2015-02-23 20:51:25 +0100
commit575aec009e53b8f5161ca863ff6927e94eb7bbbf (patch)
tree123f17f4c10cfb5137ecefb82e4f971fbe3a521d /src
parente02d9a35b6170248ab7031e25b73eca1d6c0f08c (diff)
qmi-proxy: new '--no-exit' option
This new option will make the proxy to avoid exiting when no connected clients were found. Without this option, the proxy will end up exiting after 30s without a valid QmiDevice connected to the proxy, e.g.: $ sudo /usr/libexec/qmi-proxy --verbose [23 feb 2015, 20:48:35] [Debug] creating UNIX socket service... [23 feb 2015, 20:48:35] [Debug] starting UNIX socket service at 'qmi-proxy'... [23 feb 2015, 20:49:05] [Debug] UNIX socket service at 'qmi-proxy' stopped [23 feb 2015, 20:49:05] [Debug] exiting 'qmi-proxy'...
Diffstat (limited to 'src')
-rw-r--r--src/qmi-proxy/qmi-proxy.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/qmi-proxy/qmi-proxy.c b/src/qmi-proxy/qmi-proxy.c
index d7e2d1d..b7053b2 100644
--- a/src/qmi-proxy/qmi-proxy.c
+++ b/src/qmi-proxy/qmi-proxy.c
@@ -45,8 +45,13 @@ static guint timeout_id;
/* Main options */
static gboolean verbose_flag;
static gboolean version_flag;
+static gboolean no_exit_flag;
static GOptionEntry main_entries[] = {
+ { "no-exit", 0, 0, G_OPTION_ARG_NONE, &no_exit_flag,
+ "Don't exit after being idle without clients",
+ NULL
+ },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_flag,
"Run action with verbose logs, including the debug ones",
NULL
@@ -123,7 +128,7 @@ print_version_and_exit (void)
{
g_print ("\n"
PROGRAM_NAME " " PROGRAM_VERSION "\n"
- "Copyright (2013) Aleksander Morgado\n"
+ "Copyright (2013-2015) Aleksander Morgado\n"
"License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>\n"
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"
@@ -201,11 +206,14 @@ int main (int argc, char **argv)
exit (EXIT_FAILURE);
}
- proxy_n_clients_changed (proxy);
- g_signal_connect (proxy,
- "notify::" QMI_PROXY_N_CLIENTS,
- G_CALLBACK (proxy_n_clients_changed),
- NULL);
+ /* Don't exit the proxy when no clients are found */
+ if (!no_exit_flag) {
+ proxy_n_clients_changed (proxy);
+ g_signal_connect (proxy,
+ "notify::" QMI_PROXY_N_CLIENTS,
+ G_CALLBACK (proxy_n_clients_changed),
+ NULL);
+ }
/* Loop */
loop = g_main_loop_new (NULL, FALSE);