From d51c0bcb47e199489d8c05e3a552b477c98b0ec4 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 16 Jul 2009 10:03:28 +0200 Subject: [PATCH] Some service list updates should be not delayed --- src/connman.h | 2 +- src/profile.c | 7 ++++++- src/service.c | 12 ++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/connman.h b/src/connman.h index bfc7fdf..3a6bedd 100644 --- a/src/connman.h +++ b/src/connman.h @@ -64,7 +64,7 @@ void __connman_profile_list(DBusMessageIter *iter); const char *__connman_profile_active_ident(void); const char *__connman_profile_active_path(void); -void __connman_profile_changed(void); +void __connman_profile_changed(gboolean delayed); #include diff --git a/src/profile.c b/src/profile.c index 0f7c793..f6ab24b 100644 --- a/src/profile.c +++ b/src/profile.c @@ -96,7 +96,7 @@ static gboolean services_changed(gpointer user_data) return FALSE; } -void __connman_profile_changed(void) +void __connman_profile_changed(gboolean delayed) { DBG(""); @@ -110,6 +110,11 @@ void __connman_profile_changed(void) return; } + if (delayed == FALSE) { + services_changed(NULL); + return; + } + changed_timeout = g_timeout_add_seconds(2, services_changed, NULL); } diff --git a/src/service.c b/src/service.c index b01ebae..4674279 100644 --- a/src/service.c +++ b/src/service.c @@ -682,7 +682,7 @@ static DBusMessage *move_before(DBusConnection *conn, g_sequence_move(src, dst); - __connman_profile_changed(); + __connman_profile_changed(FALSE); return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } @@ -754,7 +754,7 @@ static void service_free(gpointer user_data) service->path = NULL; if (path != NULL) { - __connman_profile_changed(); + __connman_profile_changed(TRUE); g_dbus_unregister_interface(connection, path, CONNMAN_SERVICE_INTERFACE); @@ -919,7 +919,7 @@ int connman_service_set_favorite(struct connman_service *service, g_sequence_sort_changed(iter, service_compare, NULL); - __connman_profile_changed(); + __connman_profile_changed(FALSE); return 0; } @@ -1036,7 +1036,7 @@ int __connman_service_indicate_state(struct connman_service *service, if (iter != NULL) g_sequence_sort_changed(iter, service_compare, NULL); - __connman_profile_changed(); + __connman_profile_changed(FALSE); return 0; } @@ -1307,7 +1307,7 @@ static int service_register(struct connman_service *service) if (iter != NULL) g_sequence_sort_changed(iter, service_compare, NULL); - __connman_profile_changed(); + __connman_profile_changed(TRUE); return 0; } @@ -1595,7 +1595,7 @@ struct connman_service *__connman_service_create_from_network(struct connman_net if (service->path != NULL) { update_from_network(service, network); - __connman_profile_changed(); + __connman_profile_changed(TRUE); __connman_service_put(service); service = NULL; -- 2.7.4