Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH] Remove wifi service directories which are not
      provisioned and not autoconnect and non-favorite when connmand
      starts up. Add removed flag to prevent connmand from re-creating
      removed provision service directory. (Feng Wang)


----------------------------------------------------------------------

Message: 1
Date: Fri,  6 May 2016 14:37:27 -0700
From: Feng Wang <[email protected]>
To: [email protected]
Subject: [PATCH] Remove wifi service directories which are not
        provisioned and not autoconnect and non-favorite when connmand starts
        up. Add removed flag to prevent connmand from re-creating removed
        provision service directory.
Message-ID: <[email protected]>

---
 src/config.c  |  2 +-
 src/connman.h |  2 ++
 src/service.c | 33 ++++++++++++++++++++++++++++++---
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/config.c b/src/config.c
index dcbee06..88e35b1 100644
--- a/src/config.c
+++ b/src/config.c
@@ -186,7 +186,7 @@ static void unregister_service(gpointer data)
                        __connman_service_set_immutable(service, false);
                        __connman_service_set_config(service, NULL, NULL);
                        __connman_service_remove(service);
-
+                       __connman_service_set_removed(service, true);
                        /*
                         * Ethernet or gadget service cannot be removed by
                         * __connman_service_remove() so reset the ipconfig
diff --git a/src/connman.h b/src/connman.h
index e849ed8..0eb475b 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -697,6 +697,8 @@ int __connman_service_set_immutable(struct connman_service 
*service,
                                                bool immutable);
 int __connman_service_set_ignore(struct connman_service *service,
                                                bool ignore);
+int __connman_service_set_removed(struct connman_service *service,
+                                               bool removed);
 void __connman_service_set_search_domains(struct connman_service *service,
                                        char **domains);
 
diff --git a/src/service.c b/src/service.c
index 768426b..8231f4f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -125,6 +125,7 @@ struct connman_service {
        bool hidden_service;
        char *config_file;
        char *config_entry;
+       bool removed;
 };
 
 static bool allow_property_changed(struct connman_service *service);
@@ -4608,6 +4609,7 @@ static void service_initialize(struct connman_service 
*service)
        service->hidden = false;
 
        service->ignore = false;
+       service->removed = false;
 
        service->connect_reason = CONNMAN_SERVICE_CONNECT_REASON_NONE;
 
@@ -5023,6 +5025,17 @@ int __connman_service_set_ignore(struct connman_service 
*service,
        return 0;
 }
 
+int __connman_service_set_removed(struct connman_service *service,
+                                               bool removed)
+{
+       if (!service)
+               return -EINVAL;
+
+       service->removed = removed;
+
+       return 0;
+}
+
 void __connman_service_set_string(struct connman_service *service,
                                  const char *key, const char *value)
 {
@@ -6863,6 +6876,11 @@ void __connman_service_update_from_network(struct 
connman_network *network)
        if (!service->network)
                return;
 
+       if (service->removed) {
+               /* don't update/create removed provisioned service */
+               return;
+       }
+
        name = connman_network_get_string(service->network, "Name");
        if (g_strcmp0(service->name, name) != 0) {
                g_free(service->name);
@@ -6995,8 +7013,9 @@ static void remove_unprovisioned_services(void)
 {
        gchar **services;
        GKeyFile *keyfile, *configkeyfile;
-       char *file, *section;
+       char *file, *section, *autoconnect;
        int i = 0;
+       bool value;
 
        services = connman_storage_get_services();
        if (!services)
@@ -7012,9 +7031,17 @@ static void remove_unprovisioned_services(void)
 
                file = g_key_file_get_string(keyfile, services[i],
                                        "Config.file", NULL);
-               if (!file)
+               if (!file) {
+                       /* remove unprovisoned and Not autoconnect and 
non-favorite service directory */
+                       autoconnect = g_key_file_get_string(keyfile, 
services[i],
+                                                               "AutoConnect", 
NULL);
+                       value = g_key_file_get_boolean(keyfile, services[i], 
"Favorite", NULL);
+                       if (!autoconnect && !value) {
+                               __connman_storage_remove_service(services[i]);
+                       }
+                       g_free(autoconnect);
                        goto next;
-
+               }
                section = g_key_file_get_string(keyfile, services[i],
                                        "Config.ident", NULL);
                if (!section)
-- 
2.8.0.rc3.226.g39d4020



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 7, Issue 5
*************************************

Reply via email to