aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-12 18:45:03 +0000
committerJustin Clarke Casey2009-01-12 18:45:03 +0000
commitd4d2c1959481d6d5e04a646c0b34f954b1bc727d (patch)
tree1fc9425201a226b77805a4709200f5ded14738e4 /OpenSim/Region/ClientStack/LindenUDP
parent* Apply http://opensimulator.org/mantis/view.php?id=2913 (diff)
downloadopensim-SC_OLD-d4d2c1959481d6d5e04a646c0b34f954b1bc727d.zip
opensim-SC_OLD-d4d2c1959481d6d5e04a646c0b34f954b1bc727d.tar.gz
opensim-SC_OLD-d4d2c1959481d6d5e04a646c0b34f954b1bc727d.tar.bz2
opensim-SC_OLD-d4d2c1959481d6d5e04a646c0b34f954b1bc727d.tar.xz
* Extend PacketHandlerTest to fire in a packet.
* Can't test result yet since the Client thread handles it with unpredictable timing
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs14
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs17
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs3
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs8
5 files changed, 38 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
index b857163..6c26784 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
@@ -36,6 +36,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
36 public delegate void PacketDrop(Packet pack, Object id); 36 public delegate void PacketDrop(Packet pack, Object id);
37 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType); 37 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
38 38
39 /// <summary>
40 /// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks,
41 /// resends, pings, etc.)
42 /// </summary>
39 public interface ILLPacketHandler 43 public interface ILLPacketHandler
40 { 44 {
41 event PacketStats OnPacketStats; 45 event PacketStats OnPacketStats;
@@ -48,8 +52,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
48 bool ReliableIsImportant { get; set; } 52 bool ReliableIsImportant { get; set; }
49 int MaxReliableResends { get; set; } 53 int MaxReliableResends { get; set; }
50 54
55 /// <summary>
56 /// Initial handling of a received packet. It will be processed later in ProcessInPacket()
57 /// </summary>
58 /// <param name="packet"></param>
51 void InPacket(Packet packet); 59 void InPacket(Packet packet);
60
61 /// <summary>
62 /// Take action depending on the type and contents of an received packet.
63 /// </summary>
64 /// <param name="item"></param>
52 void ProcessInPacket(LLQueItem item); 65 void ProcessInPacket(LLQueItem item);
66
53 void ProcessOutPacket(LLQueItem item); 67 void ProcessOutPacket(LLQueItem item);
54 void OutPacket(Packet NewPack, 68 void OutPacket(Packet NewPack,
55 ThrottleOutPacketType throttlePacketType); 69 ThrottleOutPacketType throttlePacketType);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index c70163c..3243c2f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4109,7 +4109,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4109 m_PacketHandler.InPacket((Packet) NewPack); 4109 m_PacketHandler.InPacket((Packet) NewPack);
4110 } 4110 }
4111 4111
4112
4113 /// <summary> 4112 /// <summary>
4114 /// This is the starting point for sending a simulator packet out to the client. 4113 /// This is the starting point for sending a simulator packet out to the client.
4115 /// 4114 ///
@@ -4185,8 +4184,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4185 } 4184 }
4186 4185
4187 /// <summary> 4186 /// <summary>
4188 /// Entryway from the client to the simulator 4187 /// Entryway from the client to the simulator. All UDP packets from the client will end up here
4189 /// all UDP packets from the client will end up here
4190 /// </summary> 4188 /// </summary>
4191 /// <param name="Pack">OpenMetaverse.packet</param> 4189 /// <param name="Pack">OpenMetaverse.packet</param>
4192 public void ProcessInPacket(Packet Pack) 4190 public void ProcessInPacket(Packet Pack)
@@ -4483,6 +4481,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4483 } 4481 }
4484 } 4482 }
4485 break; 4483 break;
4484
4486 case PacketType.RezSingleAttachmentFromInv: 4485 case PacketType.RezSingleAttachmentFromInv:
4487 handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; 4486 handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
4488 if (handlerRezSingleAttachment != null) 4487 if (handlerRezSingleAttachment != null)
@@ -4493,6 +4492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4493 } 4492 }
4494 4493
4495 break; 4494 break;
4495
4496 case PacketType.DetachAttachmentIntoInv: 4496 case PacketType.DetachAttachmentIntoInv:
4497 handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; 4497 handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv;
4498 if (handlerDetachAttachmentIntoInv != null) 4498 if (handlerDetachAttachmentIntoInv != null)
@@ -4505,6 +4505,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4505 handlerDetachAttachmentIntoInv(itemID, this); 4505 handlerDetachAttachmentIntoInv(itemID, this);
4506 } 4506 }
4507 break; 4507 break;
4508
4508 case PacketType.ObjectAttach: 4509 case PacketType.ObjectAttach:
4509 if (OnObjectAttach != null) 4510 if (OnObjectAttach != null)
4510 { 4511 {
@@ -4520,10 +4521,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4520 } 4521 }
4521 } 4522 }
4522 } 4523 }
4523
4524 break; 4524 break;
4525
4525 case PacketType.ObjectDetach: 4526 case PacketType.ObjectDetach:
4526
4527 ObjectDetachPacket dett = (ObjectDetachPacket)Pack; 4527 ObjectDetachPacket dett = (ObjectDetachPacket)Pack;
4528 for (int j = 0; j < dett.ObjectData.Length; j++) 4528 for (int j = 0; j < dett.ObjectData.Length; j++)
4529 { 4529 {
@@ -4535,8 +4535,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4535 } 4535 }
4536 4536
4537 } 4537 }
4538
4539 break; 4538 break;
4539
4540 case PacketType.ObjectDrop: 4540 case PacketType.ObjectDrop:
4541 ObjectDropPacket dropp = (ObjectDropPacket)Pack; 4541 ObjectDropPacket dropp = (ObjectDropPacket)Pack;
4542 for (int j = 0; j < dropp.ObjectData.Length; j++) 4542 for (int j = 0; j < dropp.ObjectData.Length; j++)
@@ -4549,6 +4549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4549 } 4549 }
4550 } 4550 }
4551 break; 4551 break;
4552
4552 case PacketType.SetAlwaysRun: 4553 case PacketType.SetAlwaysRun:
4553 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; 4554 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
4554 4555
@@ -4557,6 +4558,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4557 handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); 4558 handlerSetAlwaysRun(this, run.AgentData.AlwaysRun);
4558 4559
4559 break; 4560 break;
4561
4560 case PacketType.CompleteAgentMovement: 4562 case PacketType.CompleteAgentMovement:
4561 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; 4563 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
4562 if (handlerCompleteMovementToRegion != null) 4564 if (handlerCompleteMovementToRegion != null)
@@ -4566,6 +4568,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4566 handlerCompleteMovementToRegion = null; 4568 handlerCompleteMovementToRegion = null;
4567 4569
4568 break; 4570 break;
4571
4569 case PacketType.AgentUpdate: 4572 case PacketType.AgentUpdate:
4570 if (OnAgentUpdate != null) 4573 if (OnAgentUpdate != null)
4571 { 4574 {
@@ -4594,6 +4597,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4594 //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa); 4597 //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
4595 } 4598 }
4596 break; 4599 break;
4600
4597 case PacketType.AgentAnimation: 4601 case PacketType.AgentAnimation:
4598 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; 4602 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
4599 4603
@@ -4620,6 +4624,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4620 } 4624 }
4621 } 4625 }
4622 break; 4626 break;
4627
4623 case PacketType.AgentRequestSit: 4628 case PacketType.AgentRequestSit:
4624 if (OnAgentRequestSit != null) 4629 if (OnAgentRequestSit != null)
4625 { 4630 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index 7b102ec..97d75e1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -524,7 +524,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
524 else if (packet.Type == PacketType.StartPingCheck) 524 else if (packet.Type == PacketType.StartPingCheck)
525 { 525 {
526 StartPingCheckPacket startPing = (StartPingCheckPacket)packet; 526 StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
527 CompletePingCheckPacket endPing = (CompletePingCheckPacket)PacketPool.Instance.GetPacket(PacketType.CompletePingCheck); 527 CompletePingCheckPacket endPing
528 = (CompletePingCheckPacket)PacketPool.Instance.GetPacket(PacketType.CompletePingCheck);
528 529
529 endPing.PingID.PingID = startPing.PingID.PingID; 530 endPing.PingID.PingID = startPing.PingID.PingID;
530 OutPacket(endPing, ThrottleOutPacketType.Task); 531 OutPacket(endPing, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
index 5fd3619..9f8383c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
@@ -36,6 +36,10 @@ using OpenSim.Framework.Communications.Cache;
36 36
37namespace OpenSim.Region.ClientStack.LindenUDP 37namespace OpenSim.Region.ClientStack.LindenUDP
38{ 38{
39 /// <summary>
40 /// This class sets up new client stacks. It also handles the immediate distribution of incoming packets to
41 /// client stacks
42 /// </summary>
39 public class LLPacketServer 43 public class LLPacketServer
40 { 44 {
41// private static readonly log4net.ILog m_log 45// private static readonly log4net.ILog m_log
@@ -185,9 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
185 public virtual void CloseCircuit(uint circuitcode) 189 public virtual void CloseCircuit(uint circuitcode)
186 { 190 {
187 m_networkHandler.RemoveClientCircuit(circuitcode); 191 m_networkHandler.RemoveClientCircuit(circuitcode);
188
189 // XXX: Why is this commented out? Possibly because close mechanisms are so tangled right now
190 //m_scene.ClientManager.CloseAllAgents(circuitcode);
191 } 192 }
192 193
193 /// <summary> 194 /// <summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
index 305a620..ac5175c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
@@ -27,7 +27,9 @@
27 27
28using Nini.Config; 28using Nini.Config;
29using NUnit.Framework; 29using NUnit.Framework;
30using NUnit.Framework.SyntaxHelpers;
30using OpenMetaverse; 31using OpenMetaverse;
32using OpenMetaverse.Packets;
31using OpenSim.Framework; 33using OpenSim.Framework;
32using OpenSim.Region.ClientStack.LindenUDP; 34using OpenSim.Region.ClientStack.LindenUDP;
33using OpenSim.Tests.Common.Mock; 35using OpenSim.Tests.Common.Mock;
@@ -63,7 +65,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
63 AgentCircuitManager acm; 65 AgentCircuitManager acm;
64 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); 66 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
65 67
66 new LLPacketHandler(new TestClient(agent), testLLPacketServer, new ClientStackUserSettings()); 68 ILLPacketHandler packetHandler
69 = new LLPacketHandler(new TestClient(agent), testLLPacketServer, new ClientStackUserSettings());
70
71 packetHandler.InPacket(new AgentAnimationPacket());
72 //Assert.That(Is.Not.Null(packetHandler.PacketQueue.Dequeue()));
67 } 73 }
68 74
69 /// <summary> 75 /// <summary>