diff options
author | Nishant Chaprana <n.chaprana@samsung.com> | 2021-09-27 14:28:46 +0530 |
---|---|---|
committer | Nishant Chaprana <n.chaprana@samsung.com> | 2021-09-27 14:28:46 +0530 |
commit | 8c14611e5820596b1e6859b1d4031558df5a6a51 (patch) | |
tree | f397c0f9b2d901a737accfb25e0ea94b06387093 | |
parent | a59bbbe9a1a926103d4408fa1d44d61a05cf76a3 (diff) | |
download | connman-tizen_6.0.tar.gz connman-tizen_6.0.tar.bz2 connman-tizen_6.0.zip |
Reply all multiple/simultaenous SetDevicePower method callsubmit/tizen_6.0/20210927.130905accepted/tizen/6.0/unified/20210928.125129tizen_6.0accepted/tizen_6.0_unified
This patch fixes an issue where Multiple/Simultaenous SetDevicePower
method calls are made and reply is sent to only last dbus caller.
Change-Id: I4466444edc3222f0baf9d6530ad244b7fc5ff235
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
-rwxr-xr-x | src/device.c | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/src/device.c b/src/device.c index 801400f2..0dfe28fb 100755 --- a/src/device.c +++ b/src/device.c @@ -76,18 +76,30 @@ struct connman_device { time_t last_user_selection_time; char *last_user_selection_ident; char *last_connected_ident; - DBusMessage *pending_reply; + GList *pending_reply_list; /* List of DBusMessage* for async reply to multiple + * device power dbus calls, which are made before + * connman_device_set_powered(). + */ int max_scan_ssids; bool is_5_0_ghz_supported; #endif }; +#if defined TIZEN_EXT +static void __clear_pending_trigger(gpointer data, gpointer user_data) +{ + DBusMessage *msg = (DBusMessage *)data; + dbus_message_unref(msg); +} +#endif + static void clear_pending_trigger(struct connman_device *device) { #if defined TIZEN_EXT - if (device->pending_reply) { - dbus_message_unref(device->pending_reply); - device->pending_reply = NULL; + if (device->pending_reply_list) { + g_list_foreach(device->pending_reply_list, __clear_pending_trigger, NULL); + g_list_free(device->pending_reply_list); + device->pending_reply_list = NULL; } #endif if (device->pending_timeout > 0) { @@ -197,6 +209,20 @@ static bool device_has_service_type(struct connman_device *device, return service_type == device_service_type; } +#if defined TIZEN_EXT +static void __device_pending_reset(gpointer data, gpointer user_data) +{ + DBusMessage *msg = (DBusMessage *)data; + DBusMessage *reply; + + reply = __connman_error_failed(msg, ETIMEDOUT); + if (reply) + g_dbus_send_message(connection, reply); + + dbus_message_unref(msg); +} +#endif + static gboolean device_pending_reset(gpointer user_data) { struct connman_device *device = user_data; @@ -207,13 +233,10 @@ static gboolean device_pending_reset(gpointer user_data) DBusMessage *reply; /* Power request timed out, send ETIMEDOUT. */ - if (device->pending_reply) { - reply = __connman_error_failed(device->pending_reply, ETIMEDOUT); - if (reply) - g_dbus_send_message(connection, reply); - - dbus_message_unref(device->pending_reply); - device->pending_reply = NULL; + if (device->pending_reply_list) { + g_list_foreach(device->pending_reply_list, __device_pending_reset, NULL); + g_list_free(device->pending_reply_list); + device->pending_reply_list = NULL; } #endif /* Power request timedout, reset power pending state. */ @@ -496,13 +519,19 @@ static void device_send_changed(const char *ifname, enum connman_service_type ty dbus_message_unref(signal); } +static void __device_send_reply(gpointer data, gpointer user_data) +{ + DBusMessage *msg = (DBusMessage *)data; + g_dbus_send_reply(connection, msg, DBUS_TYPE_INVALID); + dbus_message_unref(msg); +} + static void device_send_reply(struct connman_device *device) { - if (device->pending_reply) { - g_dbus_send_reply(connection, - device->pending_reply, DBUS_TYPE_INVALID); - dbus_message_unref(device->pending_reply); - device->pending_reply = NULL; + if (device->pending_reply_list) { + g_list_foreach(device->pending_reply_list, __device_send_reply, NULL); + g_list_free(device->pending_reply_list); + device->pending_reply_list = NULL; } } #endif @@ -1200,7 +1229,7 @@ struct connman_network *connman_device_get_default_network( void connman_device_set_pending_reply(struct connman_device *device, DBusMessage *msg) { - device->pending_reply = dbus_message_ref(msg); + device->pending_reply_list = g_list_prepend(device->pending_reply_list, dbus_message_ref(msg)); } void connman_device_send_connected_signal(struct connman_device *device, |