[PATCH 7/7] session: Let autoconnect handle service connecting

patrik.flykt at linux.intel.com patrik.flykt at linux.intel.com
Fri Nov 2 01:33:38 PDT 2012


From: Patrik Flykt <patrik.flykt at linux.intel.com>

Remove direct calls for service connecting and disconnecting when
configuring sessions. Update the session connecting to call service
autoconnect.
---
 src/session.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/session.c b/src/session.c
index f8d062b..5aa4259 100644
--- a/src/session.c
+++ b/src/session.c
@@ -837,18 +837,12 @@ static void free_session(struct connman_session *session)
 static void cleanup_session(gpointer user_data)
 {
 	struct connman_session *session = user_data;
-	struct session_info *info = session->info;
 
 	DBG("remove %s", session->session_path);
 
 	g_hash_table_destroy(session->service_hash);
 	g_sequence_free(session->service_list);
 
-	if (info->entry != NULL &&
-			info->entry->reason == CONNMAN_SESSION_REASON_CONNECT) {
-		__connman_service_disconnect(info->entry->service);
-	}
-
 	free_session(session);
 }
 
@@ -1019,7 +1013,6 @@ static gboolean call_disconnect(gpointer user_data)
 	 * service and can't do anything later on it
 	 */
 	DBG("disconnect service %p", service);
-	__connman_service_disconnect(service);
 
 	return FALSE;
 }
@@ -1030,7 +1023,6 @@ static gboolean call_connect(gpointer user_data)
 	struct connman_service *service = entry->service;
 
 	DBG("connect service %p", service);
-	__connman_service_connect(service);
 
 	return FALSE;
 }
@@ -1128,6 +1120,7 @@ static void select_and_connect(struct connman_session *session,
 
 	info->reason = reason;
 
+	__connman_service_auto_connect();
 	iter = g_sequence_get_begin_iter(session->service_list);
 
 	while (g_sequence_iter_is_end(iter) == FALSE) {
@@ -1832,8 +1825,6 @@ void __connman_session_set_mode(connman_bool_t enable)
 				DBUS_TYPE_BOOLEAN, &sessionmode);
 	}
 
-	if (sessionmode == TRUE)
-		__connman_service_disconnect_all();
 }
 
 static void service_add(struct connman_service *service,
-- 
1.7.10.4




More information about the connman mailing list