cli: allow modifying default DBus timeout with `--timeout'
By default 30s will be used for every operation.
This commit is contained in:
11
cli/mmcli.c
11
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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user