From 53f59e21154d6082a1ee1864a9dab86b5ef7f4ab Mon Sep 17 00:00:00 2001 From: Yu A Wang Date: Wed, 23 Nov 2011 22:04:17 -0500 Subject: [PATCH] technology: Save the pending reply only when the status is inprogress For ethernet device, there is no need to save a pending reply as the technology enablement is synchronous. Fixes BMC#24249 --- src/technology.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/technology.c b/src/technology.c index 4c816f6..cfa7972 100644 --- a/src/technology.c +++ b/src/technology.c @@ -848,7 +848,6 @@ int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg } if (msg != NULL) { - technology->pending_reply = dbus_message_ref(msg); /* * This is a bit of a trick. When msg is not NULL it means * thats technology_enable was invoked from the manager API. Hence we save @@ -881,14 +880,17 @@ int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg } done: - if (ret == 0) + if (ret == 0) { + g_dbus_send_reply(connection, msg, DBUS_TYPE_INVALID); return ret; + } if (msg != NULL) { - if (err == -EINPROGRESS) + if (err == -EINPROGRESS) { + technology->pending_reply = dbus_message_ref(msg); technology->pending_timeout = g_timeout_add_seconds(10, technology_pending_reply, technology); - else { + } else { reply = __connman_error_failed(msg, -err); if (reply != NULL) g_dbus_send_message(connection, reply); @@ -949,7 +951,6 @@ int __connman_technology_disable(enum connman_service_type type, DBusMessage *ms set_tethering(technology, FALSE); if (msg != NULL) { - technology->pending_reply = dbus_message_ref(msg); technology->enable_persistent = FALSE; save_state(technology); } @@ -965,14 +966,17 @@ int __connman_technology_disable(enum connman_service_type type, DBusMessage *ms } done: - if (ret == 0) + if (ret == 0) { + g_dbus_send_reply(connection, msg, DBUS_TYPE_INVALID); return ret; + } if (msg != NULL) { - if (err == -EINPROGRESS) + if (err == -EINPROGRESS) { + technology->pending_reply = dbus_message_ref(msg); technology->pending_timeout = g_timeout_add_seconds(10, technology_pending_reply, technology); - else { + } else { reply = __connman_error_failed(msg, -err); if (reply != NULL) g_dbus_send_message(connection, reply); -- 2.7.4