* Test to ensure that the udp server stays active after receiving a SocketException on BeginReceive
parent
17e43dcc0f
commit
29691a3d36
|
@ -263,7 +263,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
//if so then send packet to the packetserver
|
//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);
|
m_packetServer.InPacket(circuit, packet);
|
||||||
}
|
}
|
||||||
|
@ -300,7 +301,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name="e">
|
/// <param name="e">
|
||||||
/// The exception that has triggered the reset. Can be null if there was no exception.
|
/// The exception that has triggered the reset. Can be null if there was no exception.
|
||||||
/// </param>
|
/// </param>
|
||||||
private void ResetServerEndPoint(Exception e)
|
protected void ResetServerEndPoint(Exception e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@ -81,7 +82,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="circuitCode"></param>
|
/// <param name="circuitCode"></param>
|
||||||
/// <param name="epSender"></param>
|
/// <param name="epSender"></param>
|
||||||
|
@ -93,17 +95,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||||
UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
|
UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
|
||||||
|
|
||||||
|
AddClient(circuitCode, epSender, myAgentUuid, mySessionUuid, testLLUDPServer, acm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set up a client for tests which aren't concerned with this process itself
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="circuitCode"></param>
|
||||||
|
/// <param name="epSender"></param>
|
||||||
|
/// <param name="agentId"></param>
|
||||||
|
/// <param name="sessionId"></param>
|
||||||
|
/// <param name="testLLUDPServer"></param>
|
||||||
|
/// <param name="acm"></param>
|
||||||
|
protected void AddClient(
|
||||||
|
uint circuitCode, EndPoint epSender, UUID agentId, UUID sessionId,
|
||||||
|
TestLLUDPServer testLLUDPServer, AgentCircuitManager acm)
|
||||||
|
{
|
||||||
AgentCircuitData acd = new AgentCircuitData();
|
AgentCircuitData acd = new AgentCircuitData();
|
||||||
acd.AgentID = myAgentUuid;
|
acd.AgentID = agentId;
|
||||||
acd.SessionID = mySessionUuid;
|
acd.SessionID = sessionId;
|
||||||
|
|
||||||
UseCircuitCodePacket uccp = new UseCircuitCodePacket();
|
UseCircuitCodePacket uccp = new UseCircuitCodePacket();
|
||||||
|
|
||||||
UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
|
UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
|
||||||
= new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock();
|
= new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock();
|
||||||
uccpCcBlock.Code = circuitCode;
|
uccpCcBlock.Code = circuitCode;
|
||||||
uccpCcBlock.ID = myAgentUuid;
|
uccpCcBlock.ID = agentId;
|
||||||
uccpCcBlock.SessionID = mySessionUuid;
|
uccpCcBlock.SessionID = sessionId;
|
||||||
uccp.CircuitCode = uccpCcBlock;
|
uccp.CircuitCode = uccpCcBlock;
|
||||||
|
|
||||||
acm.AddNewCircuit(circuitCode, acd);
|
acm.AddNewCircuit(circuitCode, acd);
|
||||||
|
@ -241,21 +259,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void TestExceptionOnBeginReceive()
|
public void TestExceptionOnBeginReceive()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
MockScene scene = new MockScene();
|
MockScene scene = new MockScene();
|
||||||
|
|
||||||
uint circuitCodeA = 130000;
|
uint circuitCodeA = 130000;
|
||||||
EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
|
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;
|
uint circuitCodeB = 130001;
|
||||||
EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
|
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;
|
TestLLUDPServer testLLUDPServer;
|
||||||
TestLLPacketServer testLLPacketServer;
|
TestLLPacketServer testLLPacketServer;
|
||||||
AgentCircuitManager acm;
|
AgentCircuitManager acm;
|
||||||
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
|
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
|
||||||
AddClient(circuitCodeA, epA, testLLUDPServer, acm);
|
AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
|
||||||
AddClient(circuitCodeB, epB, 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,7 +52,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
{
|
{
|
||||||
ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
|
ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
|
||||||
reusedEpSender = tuple.Sender;
|
reusedEpSender = tuple.Sender;
|
||||||
throw new SocketException();
|
ResetServerEndPoint(new SocketException());
|
||||||
|
ReceiveData(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +61,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
{
|
{
|
||||||
numBytes = 0;
|
numBytes = 0;
|
||||||
|
|
||||||
|
//System.Console.WriteLine("Queue size " + m_chunksToLoad.Count);
|
||||||
|
|
||||||
if (m_chunksToLoad.Count <= 0)
|
if (m_chunksToLoad.Count <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue