diff options
author | Pekka Pessi <Pekka.Pessi@nokia.com> | 2011-01-18 17:13:51 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-01-18 16:16:49 +0100 |
commit | 5db8e213f1e203156fa7db237381a2e715e5788b (patch) | |
tree | 9e0de357db27dbf1af8472a2dca50641b09c7bd1 /plugins | |
parent | 39a35f57667d8fce6829dcc7dd34f4e3ad8bb65b (diff) | |
download | connman-5db8e213f1e203156fa7db237381a2e715e5788b.tar.gz connman-5db8e213f1e203156fa7db237381a2e715e5788b.tar.bz2 connman-5db8e213f1e203156fa7db237381a2e715e5788b.zip |
ofono: avoid extra SetProperty("Online") calls
Do not request SetProperty("Online") if the modem is already in desired
Online state.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ofono.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c index 9385f399..2af555d6 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -274,6 +274,16 @@ static void set_online_reply(DBusPendingCall *call, void *user_data) static int modem_change_online(char const *path, dbus_bool_t online) { + struct modem_data *modem = g_hash_table_lookup(modem_hash, path); + + if (modem == NULL) + return -ENODEV; + + if (modem->online == (gboolean)online) + return -EALREADY; + + modem->requested_online = (gboolean)online; + return set_property(path, OFONO_MODEM_INTERFACE, "Online", DBUS_TYPE_BOOLEAN, &online, set_online_reply, |