diff --git a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs index b857163312..6c2678466c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs @@ -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); + /// + /// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks, + /// resends, pings, etc.) + /// public interface ILLPacketHandler { event PacketStats OnPacketStats; @@ -48,8 +52,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP bool ReliableIsImportant { get; set; } int MaxReliableResends { get; set; } + /// + /// Initial handling of a received packet. It will be processed later in ProcessInPacket() + /// + /// void InPacket(Packet packet); + + /// + /// Take action depending on the type and contents of an received packet. + /// + /// void ProcessInPacket(LLQueItem item); + void ProcessOutPacket(LLQueItem item); void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c70163c076..3243c2f684 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4109,7 +4109,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_PacketHandler.InPacket((Packet) NewPack); } - /// /// This is the starting point for sending a simulator packet out to the client. /// @@ -4185,8 +4184,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// - /// 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 /// /// OpenMetaverse.packet 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: - 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) { diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index 7b102ecf13..97d75e12ed 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs @@ -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); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs index 5fd36195d2..9f8383c24d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs @@ -36,6 +36,10 @@ using OpenSim.Framework.Communications.Cache; namespace OpenSim.Region.ClientStack.LindenUDP { + /// + /// This class sets up new client stacks. It also handles the immediate distribution of incoming packets to + /// client stacks + /// 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); } /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs index 305a62059f..ac5175cc98 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs @@ -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())); } /// diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index b5d6f6b311..41c2eb664d 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -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; } + } + /// /// Constructor /// @@ -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) {