timeserver: Add Timeservers.Configuration to timeserver list
authorAlok Barsode <alok.barsode@linux.intel.com>
Thu, 5 Apr 2012 10:20:19 +0000 (13:20 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 5 Apr 2012 15:56:08 +0000 (18:56 +0300)
Add Timeservers.Configuration timerservers (if any) to the list of
timeservers for time correction query. Now the Order is
Timeserver.Config (via the user), service timeserver (via DHCP).
default gateway (system), global timeservers (via the user).

src/service.c
src/timeserver.c

index fd628e8..be576b6 100644 (file)
@@ -2842,6 +2842,8 @@ static DBusMessage *set_property(DBusConnection *conn,
                }
 
                service_save(service);
+
+               __connman_timeserver_sync(service);
        } else if (g_str_equal(name, "Domains.Configuration") == TRUE) {
                DBusMessageIter entry;
                GString *str;
index 9202df8..2558d99 100644 (file)
@@ -170,6 +170,7 @@ int __connman_timeserver_sync(struct connman_service *default_service)
        struct connman_network *network;
        char **timeservers;
        char **service_ts;
+       char **service_ts_config;
        const char *service_gw;
        int index, i;
 
@@ -198,6 +199,12 @@ int __connman_timeserver_sync(struct connman_service *default_service)
                ts_list = NULL;
        }
 
+       service_ts_config = connman_service_get_timeservers_config(service);
+
+       /* First add Service Timeservers.Configuration to the list */
+       for (i=0; service_ts_config != NULL && service_ts_config[i] != NULL; i++)
+               ts_list = g_slist_prepend(ts_list, g_strdup(service_ts_config[i]));
+
        service_ts = connman_service_get_timeservers(service);
 
        /* First add Service Timeservers via DHCP to the list */