aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib/mm-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-07-25 10:15:38 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-25 11:44:09 +0200
commit8b863c5a4bd03a6b8ff668e25f750b51bc19ddbe (patch)
treeda899bc614913828136487ef91e9921a033b4c0d /libmm-glib/mm-modem.c
parent8f8bcd7724e8c75cf7e0460946c04624ce6ed46a (diff)
libmm-glib: don't change default DBus timeout when running Modem.Command()
Just warn if the default DBus timeout is shorter than the one being requested.
Diffstat (limited to 'libmm-glib/mm-modem.c')
-rw-r--r--libmm-glib/mm-modem.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/libmm-glib/mm-modem.c b/libmm-glib/mm-modem.c
index 99fbd8fc..db7d7299 100644
--- a/libmm-glib/mm-modem.c
+++ b/libmm-glib/mm-modem.c
@@ -1487,19 +1487,17 @@ 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);
+ if (g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)) < timeout)
+ g_warning ("Requested command timeout is shorter than the default DBus timeout");
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 *
@@ -1528,22 +1526,18 @@ 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);
- 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 (g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)) < timeout)
+ g_warning ("Requested command timeout is shorter than the default DBus timeout");
- if (!success)
+ if (!mm_gdbus_modem_call_command_sync (self,
+ cmd,
+ timeout,
+ &result,
+ cancellable,
+ error))
return NULL;
return result;