diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 65e8b5f7c2..ffb3d1d5fd 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -263,7 +263,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (ret)
{
//if so then send packet to the packetserver
- //m_log.DebugFormat("[UDPSERVER]: For endpoint {0} got packet {1}", epSender, packet.Type);
+ //m_log.DebugFormat(
+ // "[UDPSERVER]: For circuit {0} {1} got packet {2}", circuit, epSender, packet.Type);
m_packetServer.InPacket(circuit, packet);
}
@@ -300,7 +301,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
/// The exception that has triggered the reset. Can be null if there was no exception.
///
- private void ResetServerEndPoint(Exception e)
+ protected void ResetServerEndPoint(Exception e)
{
try
{
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
index 6210d0c378..dc1c63d444 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
@@ -26,6 +26,7 @@
*/
using System.Net;
+using System.Threading;
using log4net;
using Nini.Config;
using NUnit.Framework;
@@ -81,7 +82,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
}
///
- /// Set up a client for tests which aren't concerned with this process itself
+ /// Set up a client for tests which aren't concerned with this process itself and where only one client is being
+ /// tested
///
///
///
@@ -92,18 +94,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
-
+
+ AddClient(circuitCode, epSender, myAgentUuid, mySessionUuid, testLLUDPServer, acm);
+ }
+
+ ///
+ /// Set up a client for tests which aren't concerned with this process itself
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected void AddClient(
+ uint circuitCode, EndPoint epSender, UUID agentId, UUID sessionId,
+ TestLLUDPServer testLLUDPServer, AgentCircuitManager acm)
+ {
AgentCircuitData acd = new AgentCircuitData();
- acd.AgentID = myAgentUuid;
- acd.SessionID = mySessionUuid;
+ acd.AgentID = agentId;
+ acd.SessionID = sessionId;
UseCircuitCodePacket uccp = new UseCircuitCodePacket();
UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
= new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock();
uccpCcBlock.Code = circuitCode;
- uccpCcBlock.ID = myAgentUuid;
- uccpCcBlock.SessionID = mySessionUuid;
+ uccpCcBlock.ID = agentId;
+ uccpCcBlock.SessionID = sessionId;
uccp.CircuitCode = uccpCcBlock;
acm.AddNewCircuit(circuitCode, acd);
@@ -181,7 +199,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
[Test]
public void TestRemoveClient()
{
- uint myCircuitCode = 123457;
+ uint myCircuitCode = 123457;
TestLLUDPServer testLLUDPServer;
TestLLPacketServer testLLPacketServer;
@@ -241,21 +259,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
[Test]
public void TestExceptionOnBeginReceive()
{
- /*
MockScene scene = new MockScene();
uint circuitCodeA = 130000;
EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
+ UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300");
+ UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
+
uint circuitCodeB = 130001;
EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
+ UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301");
+ UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
TestLLUDPServer testLLUDPServer;
TestLLPacketServer testLLPacketServer;
AgentCircuitManager acm;
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
- AddClient(circuitCodeA, epA, testLLUDPServer, acm);
- AddClient(circuitCodeB, epB, testLLUDPServer, acm);
- */
+ AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
+ AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm);
+
+ testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet1"), epA);
+ testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet2"), epB);
+ testLLUDPServer.LoadReceiveWithBeginException(epA);
+ testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(2, "packet3"), epB);
+ testLLUDPServer.ReceiveData(null);
+
+ Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3));
+ Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
index 002b493006..67b8f420f1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
@@ -52,7 +52,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
reusedEpSender = tuple.Sender;
- throw new SocketException();
+ ResetServerEndPoint(new SocketException());
+ ReceiveData(null);
}
}
@@ -60,13 +61,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
numBytes = 0;
+ //System.Console.WriteLine("Queue size " + m_chunksToLoad.Count);
+
if (m_chunksToLoad.Count <= 0)
return false;
ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
RecvBuffer = tuple.Data;
numBytes = tuple.Data.Length;
- epSender = tuple.Sender;
+ epSender = tuple.Sender;
return true;
}