diff options
author | Nathan Williams <njw@chromium.org> | 2012-02-28 12:52:34 -0500 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-16 14:53:18 +0100 |
commit | b6203ab425651e78fdab0219b686c5e24a1bc661 (patch) | |
tree | 81360ca222719beb302bb07f3cd9c2de9506a113 | |
parent | 6f22eb6a635a9c2f132df1da3082949dc4ef826b (diff) |
libmm-glib: set the gdbus timeout to a value longer than that remote operation timeout
Lets commands like "mmcli -m 0 --command-timeout=60 --command='+COPS=?'" work,
instead of tripping over the 25-second gdbus default timeout first.
Change-Id: I67034423ca5ab08a07ecf3c9e313082d4860ffb3
-rw-r--r-- | libmm-glib/mm-modem.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/libmm-glib/mm-modem.c b/libmm-glib/mm-modem.c index a27f6c29..8157f4e6 100644 --- a/libmm-glib/mm-modem.c +++ b/libmm-glib/mm-modem.c @@ -1458,14 +1458,19 @@ mm_modem_command (MMModem *self, GAsyncReadyCallback callback, gpointer user_data) { + gint old_timeout; + g_return_if_fail (MM_GDBUS_IS_MODEM (self)); + old_timeout = g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)); + g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), (timeout + 1) * 1000); mm_gdbus_modem_call_command (self, cmd, timeout, cancellable, callback, user_data); + g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), old_timeout); } gchar * @@ -1494,15 +1499,22 @@ mm_modem_command_sync (MMModem *self, GError **error) { gchar *result; + gboolean success; + gint old_timeout; g_return_val_if_fail (MM_GDBUS_IS_MODEM (self), NULL); - if (!mm_gdbus_modem_call_command_sync (self, - cmd, - timeout, - &result, - cancellable, - error)) + old_timeout = g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)); + g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), (timeout + 1) * 1000); + success = mm_gdbus_modem_call_command_sync (self, + cmd, + timeout, + &result, + cancellable, + error); + g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), old_timeout); + + if (!success) return NULL; return result; |