From 91c2e53277078f2f32ee8057dbb57e29e1cba78b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 24 Oct 2008 19:40:45 +0000 Subject: [PATCH] * Change AddClient test such that we now successfully authenticate * The fact that the assert passed even when authentication failed reveals a bug in the code that will be corrected soonish --- OpenSim/Framework/AgentCircuitManager.cs | 2 +- .../ClientStack/LindenUDP/LLUDPServer.cs | 3 +-- .../LindenUDP/Tests/BasicCircuitTests.cs | 20 ++++++++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs index 027d0c69ac..a73e86d480 100644 --- a/OpenSim/Framework/AgentCircuitManager.cs +++ b/OpenSim/Framework/AgentCircuitManager.cs @@ -74,7 +74,7 @@ namespace OpenSim.Framework } /// - /// Add information about a new circuit. + /// Add information about a new circuit so that later on we can authenticate a new client session. /// /// /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index b786989755..2e9af74bdb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -395,8 +395,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP "[CLIENT]: Adding new circuit for agent {0}, circuit code {1}", useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code); - clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); - + clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); isNewCircuit = true; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs index 29f0c20107..c90aecf43d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs @@ -28,6 +28,7 @@ using System.Net; using log4net; using NUnit.Framework; +using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; using OpenSim.Framework.Communications; @@ -58,18 +59,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests [Test] public void TestAddClient() { + uint myCircuitCode = 123456; + UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); + UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); + TestLLUDPServer testLLUDPServer = new TestLLUDPServer(); ClientStackUserSettings userSettings = new ClientStackUserSettings(); + AgentCircuitManager acm = new AgentCircuitManager(); + AgentCircuitData acd = new AgentCircuitData(); + acd.AgentID = myAgentUuid; + acd.SessionID = mySessionUuid; + acm.AddNewCircuit(myCircuitCode, acd); + uint port = 666; - testLLUDPServer.Initialise(null, ref port, 0, false, userSettings, null, new AgentCircuitManager()); + testLLUDPServer.Initialise(null, ref port, 0, false, userSettings, null, acm); LLPacketServer packetServer = new LLPacketServer(testLLUDPServer, userSettings); testLLUDPServer.LocalScene = new MockScene(); UseCircuitCodePacket uccp = new UseCircuitCodePacket(); + UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock = new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock(); - uccpCcBlock.Code = 123456; + uccpCcBlock.Code = myCircuitCode; + uccpCcBlock.ID = myAgentUuid; + uccpCcBlock.SessionID = mySessionUuid; uccp.CircuitCode = uccpCcBlock; EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); @@ -78,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests testLLUDPServer.ReceiveData(null); Assert.IsFalse(testLLUDPServer.HasCircuit(101)); - Assert.IsTrue(testLLUDPServer.HasCircuit(123456)); + Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); } } }