Ejemplo n.º 1
0
static void session_free(struct session_data *session)
{
	DBG("%p", session);

	if (session->agent)
		agent_release(session);

	if (session->watch)
		g_dbus_remove_watch(session->conn, session->watch);

	if (session->obex != NULL)
		gw_obex_close(session->obex);

	if (session->io != NULL) {
		g_io_channel_shutdown(session->io, TRUE, NULL);
		g_io_channel_unref(session->io);
	}

	if (session->path)
		session_unregistered(session);

	if (session->conn) {
		dbus_connection_unref(session->conn);
	}

	g_free(session->callback);
	g_free(session->path);
	g_free(session->owner);
	g_free(session);
}
Ejemplo n.º 2
0
static void session_free(struct obc_session *session)
{
	GSList *l = session->pending_calls;

	DBG("%p", session);

	while (l) {
		struct pending_req *req = l->data;
		l = l->next;

		session->pending_calls = g_slist_remove(session->pending_calls, req);
		pending_req_finalize(req);
	}

	if (session->agent) {
		obc_agent_release(session->agent);
		obc_agent_free(session->agent);
	}

	if (session->watch)
		g_dbus_remove_watch(session->conn, session->watch);

	if (session->obex != NULL)
		gw_obex_close(session->obex);

	if (session->io != NULL) {
		g_io_channel_shutdown(session->io, TRUE, NULL);
		g_io_channel_unref(session->io);
	}

	if (session->path)
		session_unregistered(session);

	if (session->conn)
		dbus_connection_unref(session->conn);

	if (session->conn_system)
		dbus_connection_unref(session->conn_system);

	sessions = g_slist_remove(sessions, session);

	g_free(session->adapter);
	g_free(session->callback);
	g_free(session->path);
	g_free(session->owner);
	g_free(session);
}