From 8f8bcd7724e8c75cf7e0460946c04624ce6ed46a Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 25 Jul 2012 10:04:20 +0200 Subject: cli: allow modifying default DBus timeout with `--timeout' By default 30s will be used for every operation. --- cli/mmcli.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cli/mmcli.c') diff --git a/cli/mmcli.c b/cli/mmcli.c index 78284ca9..b05df9bc 100644 --- a/cli/mmcli.c +++ b/cli/mmcli.c @@ -45,6 +45,7 @@ static GCancellable *cancellable; static gboolean verbose_flag; static gboolean version_flag; static gboolean async_flag; +static gint timeout = 30; /* by default, use 30s for all operations */ static GOptionEntry main_entries[] = { { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_flag, @@ -59,6 +60,10 @@ static GOptionEntry main_entries[] = { "Use asynchronous methods", NULL }, + { "timeout", 0, 0, G_OPTION_ARG_INT, &timeout, + "Timeout for the operation", + "[SECONDS]" + }, { NULL } }; @@ -163,6 +168,12 @@ mmcli_force_sync_operation (void) } } +void +mmcli_force_operation_timeout (GDBusProxy *proxy) +{ + g_dbus_proxy_set_default_timeout (proxy, timeout * 1000); +} + gint main (gint argc, gchar **argv) { -- cgit v1.2.3-70-g09d2