Remove default ntpd server
authorSamuel Ortiz <sameo@linux.intel.com>
Tue, 1 Jun 2010 00:16:35 +0000 (02:16 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 1 Jun 2010 00:19:24 +0000 (02:19 +0200)
Default ntpd servers should be defined by plugins. Now the MeeGo one
sets a default server instead of hardcoding it from the ntpd plugin.

plugins/meego.c
plugins/ntpd.c

index 49978fa..717b220 100644 (file)
 #endif
 
 #define CONNMAN_API_SUBJECT_TO_CHANGE
+#include <connman/timeserver.h>
 #include <connman/plugin.h>
 
+#define MEEGO_NTP_SERVER "ntp.meego.com"
+
 static int meego_init(void)
 {
-       return 0;
+       return connman_timeserver_append(MEEGO_NTP_SERVER);
 }
 
 static void meego_exit(void)
 {
+       connman_timeserver_remove(MEEGO_NTP_SERVER);
 }
 
 CONNMAN_PLUGIN_DEFINE(meego, "MeeGo features plugin", VERSION,
index 2ab3072..fa74ea8 100644 (file)
@@ -45,7 +45,6 @@ static GList *peers = NULL;
 static GList *pending_peers = NULL;
 
 #define NTPD_PORT 123
-#define DEFAULT_NTP_PEER "ntp.meego.com"
 
 struct ntpd_peer {
        char *server;
@@ -174,9 +173,6 @@ static int ntpdate(void)
 
        DBG("conf path %s", ntpdate->conf_path);
 
-       if (pending_peers == NULL && peers == NULL)
-               ntpdate_add_peer(ntpdate, DEFAULT_NTP_PEER);
-
        for (list = pending_peers; list; list = list->next) {
                peer = list->data;
 
@@ -216,6 +212,10 @@ static void ntpd_sync(void)
 
        DBG("");
 
+       if (g_list_length(pending_peers) == 0 &&
+                       g_list_length(peers) == 0)
+               return;
+
        if (!ntpd_running()) {
                ntpdate();
                return;