[SPIN] change the ntp update logic 48/74548/3
authorNiraj Kumar Goit <niraj.g@samsung.com>
Tue, 14 Jun 2016 17:35:55 +0000 (23:05 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Tue, 14 Jun 2016 14:30:29 +0000 (07:30 -0700)
desc : add the resolved server list into time_server list. It is only
using the first item of timeserver. Not use gateway for ntp server
if enabled WLAN_ALWAYS_POWERED.

Change-Id: I2f55ade5b7208a7f893516b817d4ff6bffa62a04
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
packaging/connman.spec
src/timeserver.c

index 23b8d52..a988b8c 100755 (executable)
@@ -109,6 +109,10 @@ VPN_CFLAGS+=" -DTIZEN_EXT -lsmack -Werror"
 %if 0%{?sec_product_feature_profile_wearable}
        CFLAGS+=" -DTIZEN_WEARABLE"
 %endif
+
+%if 0%{?sec_product_feature_wlan_always_powered}
+       CFLAGS+=" -DTIZEN_ALWAYS_POWERED"
+%endif
 %endif
 
 chmod +x bootstrap
index 8b9afb1..90f648c 100755 (executable)
@@ -88,6 +88,15 @@ static void resolv_result(GResolvResultStatus status, char **results,
 {
        int i;
 
+#if defined TIZEN_EXT
+       gchar *server = NULL;
+
+       server = (gchar *)user_data;
+       ts_list = g_slist_append(ts_list, server);
+
+       DBG("added server %s", server);
+#endif
+
        DBG("status %d", status);
 
        if (status == G_RESOLV_RESULT_STATUS_SUCCESS) {
@@ -148,8 +157,13 @@ void __connman_timeserver_sync_next()
 
        DBG("Resolving timeserver %s", ts_current);
 
+#if defined TIZEN_EXT
+       resolv_id = g_resolv_lookup_hostname(resolv, ts_current,
+                                               resolv_result, ts_current);
+#else
        resolv_id = g_resolv_lookup_hostname(resolv, ts_current,
                                                resolv_result, NULL);
+#endif
 
        return;
 }
@@ -179,13 +193,21 @@ GSList *__connman_timeserver_add_list(GSList *server_list,
 GSList *__connman_timeserver_get_all(struct connman_service *service)
 {
        GSList *list = NULL;
+#if !defined TIZEN_ALWAYS_POWERED
        struct connman_network *network;
+#endif
        char **timeservers;
        char **service_ts;
        char **service_ts_config;
+#if !defined TIZEN_ALWAYS_POWERED
        const char *service_gw;
+#endif
        char **fallback_ts;
+#if !defined TIZEN_ALWAYS_POWERED
        int index, i;
+#else
+       int i;
+#endif
 
        if (__connman_clock_timeupdates() == TIME_UPDATES_MANUAL)
                return NULL;
@@ -204,6 +226,7 @@ GSList *__connman_timeserver_get_all(struct connman_service *service)
        for (i = 0; service_ts && service_ts[i]; i++)
                list = __connman_timeserver_add_list(list, service_ts[i]);
 
+#if !defined TIZEN_ALWAYS_POWERED
        network = __connman_service_get_network(service);
        if (network) {
                index = connman_network_get_index(network);
@@ -214,6 +237,7 @@ GSList *__connman_timeserver_get_all(struct connman_service *service)
                if (service_gw)
                        list = __connman_timeserver_add_list(list, service_gw);
        }
+#endif
 
        /* Then add Global Timeservers to the list */
        timeservers = load_timeservers();