session: Pass struct connman_session to callback
authorGustavo F. Padovan <padovan@profusion.mobi>
Fri, 4 Mar 2011 00:06:33 +0000 (21:06 -0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 4 Mar 2011 11:03:03 +0000 (12:03 +0100)
src/session.c

index 49aed25..b192350 100644 (file)
@@ -160,16 +160,9 @@ static int session_disconnect(struct connman_session *session)
 
 static void owner_disconnect(DBusConnection *connection, void *user_data)
 {
-       struct connman_session *session;
-       char *owner = user_data;
-
-       DBG("%s died", owner);
+       struct connman_session *session = user_data;
 
-       session = g_hash_table_lookup(session_hash, owner);
-       if (session == NULL) {
-               connman_error("No session");
-               return;
-       }
+       DBG("%s died", session->owner);
 
        session_disconnect(session);
 }
@@ -257,7 +250,7 @@ struct connman_service *__connman_session_request(const char *bearer_name,
        session->bearer = bearer;
 
        session->watch = g_dbus_add_disconnect_watch(connection, session->owner,
-                                       owner_disconnect, session->owner, NULL);
+                                       owner_disconnect, session, NULL);
        return session->service;
 
 failed_bearer: