aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-12 01:39:37 +0100
committerJustin Clark-Casey (justincc)2012-10-12 01:39:37 +0100
commit21d0cbf7038cfb1b1010310a0f4b455cf9ab700d (patch)
tree8c5da5b12384379c57c8c424f2745ef7e02f1173 /OpenSim/Region/ClientStack/Linden
parentBulletSim: fix problem with some shapes (like cylinders) being implemented as... (diff)
downloadopensim-SC_OLD-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.zip
opensim-SC_OLD-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.tar.gz
opensim-SC_OLD-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.tar.bz2
opensim-SC_OLD-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.tar.xz
Add AgentUpdate to PacketPool. This is the most common inbound packet from viewers.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs21
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs4
3 files changed, 28 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 6d2cda5..e3f4679 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -100,9 +100,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
100 100
101 /// <summary>The measured resolution of Environment.TickCount</summary> 101 /// <summary>The measured resolution of Environment.TickCount</summary>
102 public readonly float TickCountResolution; 102 public readonly float TickCountResolution;
103
103 /// <summary>Number of prim updates to put on the queue each time the 104 /// <summary>Number of prim updates to put on the queue each time the
104 /// OnQueueEmpty event is triggered for updates</summary> 105 /// OnQueueEmpty event is triggered for updates</summary>
105 public readonly int PrimUpdatesPerCallback; 106 public readonly int PrimUpdatesPerCallback;
107
106 /// <summary>Number of texture packets to put on the queue each time the 108 /// <summary>Number of texture packets to put on the queue each time the
107 /// OnQueueEmpty event is triggered for textures</summary> 109 /// OnQueueEmpty event is triggered for textures</summary>
108 public readonly int TextureSendLimit; 110 public readonly int TextureSendLimit;
@@ -111,6 +113,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
111 //PacketEventDictionary packetEvents = new PacketEventDictionary(); 113 //PacketEventDictionary packetEvents = new PacketEventDictionary();
112 /// <summary>Incoming packets that are awaiting handling</summary> 114 /// <summary>Incoming packets that are awaiting handling</summary>
113 private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); 115 private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
116
114 /// <summary></summary> 117 /// <summary></summary>
115 //private UDPClientCollection m_clients = new UDPClientCollection(); 118 //private UDPClientCollection m_clients = new UDPClientCollection();
116 /// <summary>Bandwidth throttle for this UDP server</summary> 119 /// <summary>Bandwidth throttle for this UDP server</summary>
@@ -121,28 +124,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
121 124
122 /// <summary>Manages authentication for agent circuits</summary> 125 /// <summary>Manages authentication for agent circuits</summary>
123 private AgentCircuitManager m_circuitManager; 126 private AgentCircuitManager m_circuitManager;
127
124 /// <summary>Reference to the scene this UDP server is attached to</summary> 128 /// <summary>Reference to the scene this UDP server is attached to</summary>
125 protected Scene m_scene; 129 protected Scene m_scene;
130
126 /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> 131 /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary>
127 private Location m_location; 132 private Location m_location;
133
128 /// <summary>The size of the receive buffer for the UDP socket. This value 134 /// <summary>The size of the receive buffer for the UDP socket. This value
129 /// is passed up to the operating system and used in the system networking 135 /// is passed up to the operating system and used in the system networking
130 /// stack. Use zero to leave this value as the default</summary> 136 /// stack. Use zero to leave this value as the default</summary>
131 private int m_recvBufferSize; 137 private int m_recvBufferSize;
138
132 /// <summary>Flag to process packets asynchronously or synchronously</summary> 139 /// <summary>Flag to process packets asynchronously or synchronously</summary>
133 private bool m_asyncPacketHandling; 140 private bool m_asyncPacketHandling;
141
134 /// <summary>Tracks whether or not a packet was sent each round so we know 142 /// <summary>Tracks whether or not a packet was sent each round so we know
135 /// whether or not to sleep</summary> 143 /// whether or not to sleep</summary>
136 private bool m_packetSent; 144 private bool m_packetSent;
137 145
138 /// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary> 146 /// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary>
139 private int m_elapsedMSSinceLastStatReport = 0; 147 private int m_elapsedMSSinceLastStatReport = 0;
148
140 /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> 149 /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary>
141 private int m_tickLastOutgoingPacketHandler; 150 private int m_tickLastOutgoingPacketHandler;
151
142 /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> 152 /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary>
143 private int m_elapsedMSOutgoingPacketHandler; 153 private int m_elapsedMSOutgoingPacketHandler;
154
144 /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary> 155 /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary>
145 private int m_elapsed100MSOutgoingPacketHandler; 156 private int m_elapsed100MSOutgoingPacketHandler;
157
146 /// <summary>Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed</summary> 158 /// <summary>Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed</summary>
147 private int m_elapsed500MSOutgoingPacketHandler; 159 private int m_elapsed500MSOutgoingPacketHandler;
148 160
@@ -739,7 +751,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
739 751
740 try 752 try
741 { 753 {
742 packet = Packet.BuildPacket(buffer.Data, ref packetEnd, 754// packet = Packet.BuildPacket(buffer.Data, ref packetEnd,
755// // Only allocate a buffer for zerodecoding if the packet is zerocoded
756// ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null);
757 packet = PacketPool.Instance.GetPacket(buffer.Data, ref packetEnd,
743 // Only allocate a buffer for zerodecoding if the packet is zerocoded 758 // Only allocate a buffer for zerodecoding if the packet is zerocoded
744 ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); 759 ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null);
745 } 760 }
@@ -754,11 +769,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
754 769
755 return; // Drop short packet 770 return; // Drop short packet
756 } 771 }
757 catch(Exception e) 772 catch (Exception e)
758 { 773 {
759 if (m_malformedCount < 100) 774 if (m_malformedCount < 100)
760 m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); 775 m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString());
776
761 m_malformedCount++; 777 m_malformedCount++;
778
762 if ((m_malformedCount % 100000) == 0) 779 if ((m_malformedCount % 100000) == 0)
763 m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); 780 m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount);
764 } 781 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
index a8a1bfe..052d334 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
@@ -90,6 +90,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
90 StatsManager.RegisterStat(m_blocksReusedStat); 90 StatsManager.RegisterStat(m_blocksReusedStat);
91 } 91 }
92 92
93 /// <summary>
94 /// Gets a packet of the given type.
95 /// </summary>
96 /// <param name='type'></param>
97 /// <returns>Guaranteed to always return a packet, whether from the pool or newly constructed.</returns>
93 public Packet GetPacket(PacketType type) 98 public Packet GetPacket(PacketType type)
94 { 99 {
95 m_packetsReusedStat.Consequent++; 100 m_packetsReusedStat.Consequent++;
@@ -160,7 +165,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
160 { 165 {
161 PacketType type = GetType(bytes); 166 PacketType type = GetType(bytes);
162 167
163 Array.Clear(zeroBuffer, 0, zeroBuffer.Length); 168// Array.Clear(zeroBuffer, 0, zeroBuffer.Length);
164 169
165 int i = 0; 170 int i = 0;
166 Packet packet = GetPacket(type); 171 Packet packet = GetPacket(type);
@@ -207,6 +212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
207 switch (packet.Type) 212 switch (packet.Type)
208 { 213 {
209 // List pooling packets here 214 // List pooling packets here
215 case PacketType.AgentUpdate:
210 case PacketType.PacketAck: 216 case PacketType.PacketAck:
211 case PacketType.ObjectUpdate: 217 case PacketType.ObjectUpdate:
212 case PacketType.ImprovedTerseObjectUpdate: 218 case PacketType.ImprovedTerseObjectUpdate:
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
index 109a8e1..fa9378c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
43 /// This will contain basic tests for the LindenUDP client stack 43 /// This will contain basic tests for the LindenUDP client stack
44 /// </summary> 44 /// </summary>
45 [TestFixture] 45 [TestFixture]
46 public class BasicCircuitTests 46 public class BasicCircuitTests : OpenSimTestCase
47 { 47 {
48 private Scene m_scene; 48 private Scene m_scene;
49 private TestLLUDPServer m_udpServer; 49 private TestLLUDPServer m_udpServer;
@@ -143,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
143 public void TestAddClient() 143 public void TestAddClient()
144 { 144 {
145 TestHelpers.InMethod(); 145 TestHelpers.InMethod();
146// XmlConfigurator.Configure(); 146// TestHelpers.EnableLogging();
147 147
148 AddUdpServer(); 148 AddUdpServer();
149 149