From 279273b09a7bd2f81bf8f29fdf5fd92e8899f014 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Tue, 1 Jun 2010 02:16:35 +0200 Subject: [PATCH] Remove default ntpd server 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 | 6 +++++- plugins/ntpd.c | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/meego.c b/plugins/meego.c index 49978fa..717b220 100644 --- a/plugins/meego.c +++ b/plugins/meego.c @@ -24,15 +24,19 @@ #endif #define CONNMAN_API_SUBJECT_TO_CHANGE +#include #include +#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, diff --git a/plugins/ntpd.c b/plugins/ntpd.c index 2ab3072..fa74ea8 100644 --- a/plugins/ntpd.c +++ b/plugins/ntpd.c @@ -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; -- 2.7.4