* Extend PacketHandlerTest to fire in a packet.

* Can't test result yet since the Client thread handles it with unpredictable timing
0.6.2-post-fixes
Justin Clarke Casey 2009-01-12 18:45:03 +00:00
parent fb8faa8336
commit d4d2c19594
6 changed files with 46 additions and 19 deletions

View File

@ -36,6 +36,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public delegate void PacketDrop(Packet pack, Object id);
public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
/// <summary>
/// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks,
/// resends, pings, etc.)
/// </summary>
public interface ILLPacketHandler
{
event PacketStats OnPacketStats;
@ -48,8 +52,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bool ReliableIsImportant { get; set; }
int MaxReliableResends { get; set; }
/// <summary>
/// Initial handling of a received packet. It will be processed later in ProcessInPacket()
/// </summary>
/// <param name="packet"></param>
void InPacket(Packet packet);
/// <summary>
/// Take action depending on the type and contents of an received packet.
/// </summary>
/// <param name="item"></param>
void ProcessInPacket(LLQueItem item);
void ProcessOutPacket(LLQueItem item);
void OutPacket(Packet NewPack,
ThrottleOutPacketType throttlePacketType);

View File

@ -4109,7 +4109,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_PacketHandler.InPacket((Packet) NewPack);
}
/// <summary>
/// This is the starting point for sending a simulator packet out to the client.
///
@ -4185,8 +4184,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
/// <summary>
/// Entryway from the client to the simulator
/// all UDP packets from the client will end up here
/// Entryway from the client to the simulator. All UDP packets from the client will end up here
/// </summary>
/// <param name="Pack">OpenMetaverse.packet</param>
public void ProcessInPacket(Packet Pack)
@ -4483,6 +4481,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
break;
case PacketType.RezSingleAttachmentFromInv:
handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
if (handlerRezSingleAttachment != null)
@ -4493,6 +4492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case PacketType.DetachAttachmentIntoInv:
handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv;
if (handlerDetachAttachmentIntoInv != null)
@ -4505,6 +4505,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerDetachAttachmentIntoInv(itemID, this);
}
break;
case PacketType.ObjectAttach:
if (OnObjectAttach != null)
{
@ -4520,10 +4521,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
}
break;
case PacketType.ObjectDetach:
case PacketType.ObjectDetach:
ObjectDetachPacket dett = (ObjectDetachPacket)Pack;
for (int j = 0; j < dett.ObjectData.Length; j++)
{
@ -4535,8 +4535,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
break;
case PacketType.ObjectDrop:
ObjectDropPacket dropp = (ObjectDropPacket)Pack;
for (int j = 0; j < dropp.ObjectData.Length; j++)
@ -4549,6 +4549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
break;
case PacketType.SetAlwaysRun:
SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
@ -4557,6 +4558,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerSetAlwaysRun(this, run.AgentData.AlwaysRun);
break;
case PacketType.CompleteAgentMovement:
handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
if (handlerCompleteMovementToRegion != null)
@ -4566,6 +4568,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerCompleteMovementToRegion = null;
break;
case PacketType.AgentUpdate:
if (OnAgentUpdate != null)
{
@ -4594,6 +4597,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
}
break;
case PacketType.AgentAnimation:
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
@ -4620,6 +4624,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
break;
case PacketType.AgentRequestSit:
if (OnAgentRequestSit != null)
{

View File

@ -524,7 +524,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else if (packet.Type == PacketType.StartPingCheck)
{
StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
CompletePingCheckPacket endPing = (CompletePingCheckPacket)PacketPool.Instance.GetPacket(PacketType.CompletePingCheck);
CompletePingCheckPacket endPing
= (CompletePingCheckPacket)PacketPool.Instance.GetPacket(PacketType.CompletePingCheck);
endPing.PingID.PingID = startPing.PingID.PingID;
OutPacket(endPing, ThrottleOutPacketType.Task);

View File

@ -36,6 +36,10 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Region.ClientStack.LindenUDP
{
/// <summary>
/// This class sets up new client stacks. It also handles the immediate distribution of incoming packets to
/// client stacks
/// </summary>
public class LLPacketServer
{
// private static readonly log4net.ILog m_log
@ -185,9 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual void CloseCircuit(uint circuitcode)
{
m_networkHandler.RemoveClientCircuit(circuitcode);
// XXX: Why is this commented out? Possibly because close mechanisms are so tangled right now
//m_scene.ClientManager.CloseAllAgents(circuitcode);
}
/// <summary>

View File

@ -27,7 +27,9 @@
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Tests.Common.Mock;
@ -63,7 +65,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
AgentCircuitManager acm;
SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
new LLPacketHandler(new TestClient(agent), testLLPacketServer, new ClientStackUserSettings());
ILLPacketHandler packetHandler
= new LLPacketHandler(new TestClient(agent), testLLPacketServer, new ClientStackUserSettings());
packetHandler.InPacket(new AgentAnimationPacket());
//Assert.That(Is.Not.Null(packetHandler.PacketQueue.Dequeue()));
}
/// <summary>

View File

@ -343,6 +343,14 @@ namespace OpenSim.Tests.Common.Mock
set { }
}
private uint m_circuitCode;
public uint CircuitCode
{
get { return m_circuitCode; }
set { m_circuitCode = value; }
}
/// <summary>
/// Constructor
/// </summary>
@ -753,14 +761,6 @@ namespace OpenSim.Tests.Common.Mock
{
}
private uint m_circuitCode;
public uint CircuitCode
{
get { return m_circuitCode; }
set { m_circuitCode = value; }
}
public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
{