void AOnlineBeaconHost::DisconnectClient(AOnlineBeaconClient* ClientActor)
{
	if (ClientActor && ClientActor->GetConnectionState() != EBeaconConnectionState::Closed && !ClientActor->IsPendingKill())
	{
		ClientActor->SetConnectionState(EBeaconConnectionState::Closed);

		UNetConnection* Connection = ClientActor->GetNetConnection();

		UE_LOG(LogBeacon, Log, TEXT("DisconnectClient for %s. UNetConnection %s UNetDriver %s State %d"), 
			*GetNameSafe(ClientActor), 
			*GetNameSafe(Connection), 
			Connection ? *GetNameSafe(Connection->Driver) : TEXT("null"),
			Connection ? Connection->State : -1);

		// Closing the connection will start the chain of events leading to the removal from lists and destruction of the actor
		if (Connection && Connection->State != USOCK_Closed)
		{
			Connection->FlushNet(true);
			Connection->Close();
		}
	}
}