[Patch v2 10/12] timeserver: Remove connman_timeserver_[append/remove]

Alok Barsode alokbarsode at gmail.com
Fri Feb 3 10:26:04 PST 2012


From: Alok Barsode <alok.barsode at linux.intel.com>

We do not need to these anymore as we directly use the timeservers from
service.
---
 include/timeserver.h |    3 --
 src/service.c        |   31 ----------------------
 src/timeserver.c     |   68 --------------------------------------------------
 3 files changed, 0 insertions(+), 102 deletions(-)

diff --git a/include/timeserver.h b/include/timeserver.h
index e37fada..83ad557 100644
--- a/include/timeserver.h
+++ b/include/timeserver.h
@@ -36,9 +36,6 @@ extern "C" {
  * @short_description: Functions for handling time servers (including NTP)
  */
 
-int connman_timeserver_append(const char *server);
-int connman_timeserver_remove(const char *server);
-
 int __connman_timeserver_system_append(const char *server);
 int __connman_timeserver_system_remove(const char *server);
 
diff --git a/src/service.c b/src/service.c
index a61824f..b0acd5f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2252,33 +2252,6 @@ const char *connman_service_get_proxy_autoconfig(struct connman_service *service
 	return NULL;
 }
 
-static void update_timeservers(struct connman_service *service)
-{
-	int i;
-
-	if (service->timeservers == NULL)
-		return;
-
-	switch (service->state) {
-	case CONNMAN_SERVICE_STATE_UNKNOWN:
-	case CONNMAN_SERVICE_STATE_IDLE:
-	case CONNMAN_SERVICE_STATE_ASSOCIATION:
-	case CONNMAN_SERVICE_STATE_CONFIGURATION:
-		return;
-	case CONNMAN_SERVICE_STATE_FAILURE:
-	case CONNMAN_SERVICE_STATE_DISCONNECT:
-		for (i = 0; service->timeservers[i] != NULL; i++)
-			connman_timeserver_remove(service->timeservers[i]);
-		return;
-	case CONNMAN_SERVICE_STATE_READY:
-	case CONNMAN_SERVICE_STATE_ONLINE:
-		break;
-	}
-
-	for (i = 0; service->timeservers[i] != NULL; i++)
-		connman_timeserver_append(service->timeservers[i]);
-}
-
 int __connman_service_timeserver_append(struct connman_service *service,
 						const char *timeserver)
 {
@@ -2310,8 +2283,6 @@ int __connman_service_timeserver_append(struct connman_service *service,
 	service->timeservers[len] = g_strdup(timeserver);
 	service->timeservers[len + 1] = NULL;
 
-	update_timeservers(service);
-
 	return 0;
 }
 
@@ -2365,8 +2336,6 @@ int __connman_service_timeserver_remove(struct connman_service *service,
 	g_strfreev(service->timeservers);
 	service->timeservers = servers;
 
-	update_timeservers(service);
-
 	return 0;
 }
 
diff --git a/src/timeserver.c b/src/timeserver.c
index 7f6a9b5..0a268f5 100644
--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -127,74 +127,6 @@ void connman_timeserver_driver_unregister(struct connman_timeserver_driver *driv
 	driver_list = g_slist_remove(driver_list, driver);
 }
 
-/**
- * connman_timeserver_append:
- * @server: server address
- *
- * Append time server server address to current list
- */
-int connman_timeserver_append(const char *server)
-{
-	GSList *list;
-
-	DBG("server %s", server);
-
-	if (server == NULL)
-		return -EINVAL;
-
-	/* This server is already handled by a driver */
-	if (g_hash_table_lookup(server_hash, server))
-		return 0;
-
-	for (list = driver_list; list; list = list->next) {
-		struct connman_timeserver_driver *driver = list->data;
-		char *new_server;
-
-		if (driver->append == NULL)
-			continue;
-
-		new_server = g_strdup(server);
-		if (new_server == NULL)
-			return -ENOMEM;
-
-		if (driver->append(server) == 0) {
-			g_hash_table_insert(server_hash, new_server, driver);
-			return 0;
-		} else {
-			g_free(new_server);
-		}
-	}
-
-	return -ENOENT;
-}
-
-/**
- * connman_timeserver_remove:
- * @server: server address
- *
- * Remover time server server address from current list
- */
-int connman_timeserver_remove(const char *server)
-{
-	struct connman_timeserver_driver *driver;
-
-	DBG("server %s", server);
-
-	if (server == NULL)
-		return -EINVAL;
-
-	driver = g_hash_table_lookup(server_hash, server);
-	if (driver == NULL)
-		return -EINVAL;
-
-	g_hash_table_remove(server_hash, server);
-
-	if (driver->remove == NULL)
-		return -ENOENT;
-
-	return driver->remove(server);
-}
-
 /* Restart NTP procedure */
 static void connman_timeserver_restart()
 {
-- 
1.7.5.4




More information about the connman mailing list