join session "Access denied" (OnlineService)

This happen in my game.

1-I open two instances of the game
2-One instance is the host and another is the client
3-The client joins the session without problem
4-Server travel
5-Game
6-The game ends
7-Return to the main menu

Until now everything is perfect. I can repeat this process infinite times without problem and without closing the applications.

Now I want to change roles. The old client instance wants to be the new host and the old host wants to be the new client. In this point join session fails. I get the error “Access denied”.

Every time I return to the main munu I unregister the players and clean the session.

Does anyone know why this problem happens?

Thank you so much!!


EDITED


I found that the initial session is not completely deleted and that is why the old host cannot join the new session.

When I search for the new session the old session appears instead.

I am using this to destroy the session.

	auto Lambda = [](UE::Online::TOnlineResult<UE::Online::FLeaveSession> LeaveSessionResult)
	{
		if (!LeaveSessionResult.IsOk())
		{
			const FString Error = LeaveSessionResult.GetErrorValue().GetText().ToString();
			message::Error("FSessionCleaner::LeaveSession --> LeaveSessionResult is not Ok!! -->" + Error);
			return;
		}	
		message::Info("FSessionCleaner::LeaveSession -> DONE!!");
	};	

	UE::Online::FLeaveSession::Params Params = FLeaveSessionParams(Handler.GetAccountId(), DestroySession);
	UE::Online::TOnlineAsyncOpHandle<UE::Online::FLeaveSession> Handle = Handler.GetInterface()->LeaveSession( MoveTemp(Params) );
	Handle.OnComplete(Lambda);

It’s strange, because if after destroying the old session I don’t create a new one then it won’t find any session.

Only when I create a new one does the old session reappear.

Does this code have to be written somewhere special for it to work correctly?

I was using it in these functions:

APlayerController::OnNetCleanup(UNetConnection* Connection);
AGameMode::PostLogin(APlayerController* NewPlayer);

Any help is welcome!!
Thank you so much!!

Here are some possible solutions… but none of them work for me… maybe it’s because i’m using p2p … but they don’t work for me.

Is there a way to force the deletion of the cache where the sessions are stored?

I’ve been looking for a solution for three days. I appreciate any help.
Thank you so much!!