aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs13
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs21
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs36
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs51
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs4
5 files changed, 88 insertions, 37 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index e113c60..132546b 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden
94 94
95 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); 95 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);
96 96
97 scene.EventManager.OnNewClient += OnNewClient; 97// scene.EventManager.OnNewClient += OnNewClient;
98 98
99 // TODO: Leaving these open, or closing them when we 99 // TODO: Leaving these open, or closing them when we
100 // become a child is incorrect. It messes up TP in a big 100 // become a child is incorrect. It messes up TP in a big
@@ -102,6 +102,7 @@ namespace OpenSim.Region.ClientStack.Linden
102 // circuit is there. 102 // circuit is there.
103 103
104 scene.EventManager.OnClientClosed += ClientClosed; 104 scene.EventManager.OnClientClosed += ClientClosed;
105
105 scene.EventManager.OnMakeChildAgent += MakeChildAgent; 106 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
106 scene.EventManager.OnRegisterCaps += OnRegisterCaps; 107 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
107 108
@@ -226,16 +227,6 @@ namespace OpenSim.Region.ClientStack.Linden
226 227
227 #endregion 228 #endregion
228 229
229 private void OnNewClient(IClientAPI client)
230 {
231 //client.OnLogout += ClientClosed;
232 }
233
234// private void ClientClosed(IClientAPI client)
235// {
236// ClientClosed(client.AgentId);
237// }
238
239 private void ClientClosed(UUID agentID, Scene scene) 230 private void ClientClosed(UUID agentID, Scene scene)
240 { 231 {
241// m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); 232// m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 6ccabf1..d04bd96 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -47,6 +47,7 @@ using OpenSim.Region.Framework.Scenes;
47using OpenSim.Services.Interfaces; 47using OpenSim.Services.Interfaces;
48using Timer = System.Timers.Timer; 48using Timer = System.Timers.Timer;
49using AssetLandmark = OpenSim.Framework.AssetLandmark; 49using AssetLandmark = OpenSim.Framework.AssetLandmark;
50using RegionFlags = OpenMetaverse.RegionFlags;
50using Nini.Config; 51using Nini.Config;
51 52
52using System.IO; 53using System.IO;
@@ -3983,7 +3984,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3983 { 3984 {
3984 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; 3985 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3985 3986
3986 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3987 ImprovedTerseObjectUpdatePacket packet
3988 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
3987 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3989 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3988 packet.RegionData.TimeDilation = timeDilation; 3990 packet.RegionData.TimeDilation = timeDilation;
3989 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3991 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
@@ -4028,7 +4030,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4028 { 4030 {
4029 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; 4031 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
4030 4032
4031 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 4033 ImprovedTerseObjectUpdatePacket packet
4034 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
4035 PacketType.ImprovedTerseObjectUpdate);
4032 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4036 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4033 packet.RegionData.TimeDilation = timeDilation; 4037 packet.RegionData.TimeDilation = timeDilation;
4034 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 4038 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
@@ -4036,7 +4040,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4036 for (int i = 0; i < blocks.Count; i++) 4040 for (int i = 0; i < blocks.Count; i++)
4037 packet.ObjectData[i] = blocks[i]; 4041 packet.ObjectData[i] = blocks[i];
4038 4042
4039 OutPacket(packet, ThrottleOutPacketType.Task, true); 4043 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
4040 } 4044 }
4041 4045
4042 #endregion Packet Sending 4046 #endregion Packet Sending
@@ -5037,7 +5041,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5037 Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2; 5041 Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2;
5038 Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2; 5042 Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2;
5039 5043
5040 ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 5044 ImprovedTerseObjectUpdatePacket.ObjectDataBlock block
5045 = PacketPool.Instance.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
5046
5041 block.Data = data; 5047 block.Data = data;
5042 5048
5043 if (textureEntry != null && textureEntry.Length > 0) 5049 if (textureEntry != null && textureEntry.Length > 0)
@@ -11949,7 +11955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11949 logPacket = false; 11955 logPacket = false;
11950 11956
11951 if (DebugPacketLevel <= 50 11957 if (DebugPacketLevel <= 50
11952 & (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate)) 11958 && (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate))
11953 logPacket = false; 11959 logPacket = false;
11954 11960
11955 if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily) 11961 if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily)
@@ -12481,7 +12487,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12481 ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); 12487 ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
12482 12488
12483 12489
12484 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 12490 ImprovedTerseObjectUpdatePacket packet
12491 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
12492 PacketType.ImprovedTerseObjectUpdate);
12493
12485 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 12494 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
12486 packet.RegionData.TimeDilation = timeDilation; 12495 packet.RegionData.TimeDilation = timeDilation;
12487 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 12496 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index b3db064..97b79ce 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;
@@ -124,28 +126,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
124 126
125 /// <summary>Manages authentication for agent circuits</summary> 127 /// <summary>Manages authentication for agent circuits</summary>
126 private AgentCircuitManager m_circuitManager; 128 private AgentCircuitManager m_circuitManager;
129
127 /// <summary>Reference to the scene this UDP server is attached to</summary> 130 /// <summary>Reference to the scene this UDP server is attached to</summary>
128 protected Scene m_scene; 131 protected Scene m_scene;
132
129 /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> 133 /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary>
130 private Location m_location; 134 private Location m_location;
135
131 /// <summary>The size of the receive buffer for the UDP socket. This value 136 /// <summary>The size of the receive buffer for the UDP socket. This value
132 /// is passed up to the operating system and used in the system networking 137 /// is passed up to the operating system and used in the system networking
133 /// stack. Use zero to leave this value as the default</summary> 138 /// stack. Use zero to leave this value as the default</summary>
134 private int m_recvBufferSize; 139 private int m_recvBufferSize;
140
135 /// <summary>Flag to process packets asynchronously or synchronously</summary> 141 /// <summary>Flag to process packets asynchronously or synchronously</summary>
136 private bool m_asyncPacketHandling; 142 private bool m_asyncPacketHandling;
143
137 /// <summary>Tracks whether or not a packet was sent each round so we know 144 /// <summary>Tracks whether or not a packet was sent each round so we know
138 /// whether or not to sleep</summary> 145 /// whether or not to sleep</summary>
139 private bool m_packetSent; 146 private bool m_packetSent;
140 147
141 /// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary> 148 /// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary>
142 private int m_elapsedMSSinceLastStatReport = 0; 149 private int m_elapsedMSSinceLastStatReport = 0;
150
143 /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> 151 /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary>
144 private int m_tickLastOutgoingPacketHandler; 152 private int m_tickLastOutgoingPacketHandler;
153
145 /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> 154 /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary>
146 private int m_elapsedMSOutgoingPacketHandler; 155 private int m_elapsedMSOutgoingPacketHandler;
156
147 /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary> 157 /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary>
148 private int m_elapsed100MSOutgoingPacketHandler; 158 private int m_elapsed100MSOutgoingPacketHandler;
159
149 /// <summary>Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed</summary> 160 /// <summary>Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed</summary>
150 private int m_elapsed500MSOutgoingPacketHandler; 161 private int m_elapsed500MSOutgoingPacketHandler;
151 162
@@ -425,6 +436,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
425 byte[] data = packet.ToBytes(); 436 byte[] data = packet.ToBytes();
426 SendPacketData(udpClient, data, packet.Type, category, method); 437 SendPacketData(udpClient, data, packet.Type, category, method);
427 } 438 }
439
440 PacketPool.Instance.ReturnPacket(packet);
428 } 441 }
429 442
430 /// <summary> 443 /// <summary>
@@ -742,7 +755,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
742 755
743 try 756 try
744 { 757 {
745 packet = Packet.BuildPacket(buffer.Data, ref packetEnd, 758// packet = Packet.BuildPacket(buffer.Data, ref packetEnd,
759// // Only allocate a buffer for zerodecoding if the packet is zerocoded
760// ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null);
761 packet = PacketPool.Instance.GetPacket(buffer.Data, ref packetEnd,
746 // Only allocate a buffer for zerodecoding if the packet is zerocoded 762 // Only allocate a buffer for zerodecoding if the packet is zerocoded
747 ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); 763 ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null);
748 } 764 }
@@ -757,11 +773,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
757 773
758 return; // Drop short packet 774 return; // Drop short packet
759 } 775 }
760 catch(Exception e) 776 catch (Exception e)
761 { 777 {
762 if (m_malformedCount < 100) 778 if (m_malformedCount < 100)
763 m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); 779 m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString());
780
764 m_malformedCount++; 781 m_malformedCount++;
782
765 if ((m_malformedCount % 100000) == 0) 783 if ((m_malformedCount % 100000) == 0)
766 m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); 784 m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount);
767 } 785 }
@@ -1169,20 +1187,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1169 { 1187 {
1170 IClientAPI client = null; 1188 IClientAPI client = null;
1171 1189
1172 // In priciple there shouldn't be more than one thread here, ever. 1190 // We currently synchronize this code across the whole scene to avoid issues such as
1173 // But in case that happens, we need to synchronize this piece of code 1191 // http://opensimulator.org/mantis/view.php?id=5365 However, once locking per agent circuit can be done
1174 // because it's too important 1192 // consistently, this lock could probably be removed.
1175 lock (this) 1193 lock (this)
1176 { 1194 {
1177 if (!m_scene.TryGetClient(agentID, out client)) 1195 if (!m_scene.TryGetClient(agentID, out client))
1178 { 1196 {
1179 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 1197 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
1180 1198
1181 client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 1199 client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
1182 client.OnLogout += LogoutHandler; 1200 client.OnLogout += LogoutHandler;
1183 1201
1184 ((LLClientView)client).DisableFacelights = m_disableFacelights; 1202 ((LLClientView)client).DisableFacelights = m_disableFacelights;
1185 1203
1186 client.Start(); 1204 client.Start();
1187 } 1205 }
1188 } 1206 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
index fc9406b..71f6fe1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
33using log4net; 33using log4net;
34using OpenSim.Framework.Monitoring;
34 35
35namespace OpenSim.Region.ClientStack.LindenUDP 36namespace OpenSim.Region.ClientStack.LindenUDP
36{ 37{
@@ -43,17 +44,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
43 private bool packetPoolEnabled = true; 44 private bool packetPoolEnabled = true;
44 private bool dataBlockPoolEnabled = true; 45 private bool dataBlockPoolEnabled = true;
45 46
47 private PercentageStat m_packetsReusedStat = new PercentageStat(
48 "PacketsReused",
49 "Packets reused",
50 "clientstack",
51 "packetpool",
52 StatVerbosity.Debug,
53 "Number of packets reused out of all requests to the packet pool");
54
55 private PercentageStat m_blocksReusedStat = new PercentageStat(
56 "BlocksReused",
57 "Blocks reused",
58 "clientstack",
59 "packetpool",
60 StatVerbosity.Debug,
61 "Number of data blocks reused out of all requests to the packet pool");
62
46 /// <summary> 63 /// <summary>
47 /// Pool of packets available for reuse. 64 /// Pool of packets available for reuse.
48 /// </summary> 65 /// </summary>
49 private readonly Dictionary<PacketType, Stack<Packet>> pool = new Dictionary<PacketType, Stack<Packet>>(); 66 private readonly Dictionary<PacketType, Stack<Packet>> pool = new Dictionary<PacketType, Stack<Packet>>();
50 67
51 private static Dictionary<Type, Stack<Object>> DataBlocks = 68 private static Dictionary<Type, Stack<Object>> DataBlocks = new Dictionary<Type, Stack<Object>>();
52 new Dictionary<Type, Stack<Object>>();
53
54 static PacketPool()
55 {
56 }
57 69
58 public static PacketPool Instance 70 public static PacketPool Instance
59 { 71 {
@@ -72,8 +84,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
72 get { return dataBlockPoolEnabled; } 84 get { return dataBlockPoolEnabled; }
73 } 85 }
74 86
87 private PacketPool()
88 {
89 StatsManager.RegisterStat(m_packetsReusedStat);
90 StatsManager.RegisterStat(m_blocksReusedStat);
91 }
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>
75 public Packet GetPacket(PacketType type) 98 public Packet GetPacket(PacketType type)
76 { 99 {
100 m_packetsReusedStat.Consequent++;
101
77 Packet packet; 102 Packet packet;
78 103
79 if (!packetPoolEnabled) 104 if (!packetPoolEnabled)
@@ -89,6 +114,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
89 else 114 else
90 { 115 {
91 // Recycle old packages 116 // Recycle old packages
117 m_packetsReusedStat.Antecedent++;
118
92 packet = (pool[type]).Pop(); 119 packet = (pool[type]).Pop();
93 } 120 }
94 } 121 }
@@ -138,7 +165,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
138 { 165 {
139 PacketType type = GetType(bytes); 166 PacketType type = GetType(bytes);
140 167
141 Array.Clear(zeroBuffer, 0, zeroBuffer.Length); 168// Array.Clear(zeroBuffer, 0, zeroBuffer.Length);
142 169
143 int i = 0; 170 int i = 0;
144 Packet packet = GetPacket(type); 171 Packet packet = GetPacket(type);
@@ -185,6 +212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
185 switch (packet.Type) 212 switch (packet.Type)
186 { 213 {
187 // List pooling packets here 214 // List pooling packets here
215 case PacketType.AgentUpdate:
188 case PacketType.PacketAck: 216 case PacketType.PacketAck:
189 case PacketType.ObjectUpdate: 217 case PacketType.ObjectUpdate:
190 case PacketType.ImprovedTerseObjectUpdate: 218 case PacketType.ImprovedTerseObjectUpdate:
@@ -211,16 +239,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
211 } 239 }
212 } 240 }
213 241
214 public static T GetDataBlock<T>() where T: new() 242 public T GetDataBlock<T>() where T: new()
215 { 243 {
216 lock (DataBlocks) 244 lock (DataBlocks)
217 { 245 {
246 m_blocksReusedStat.Consequent++;
247
218 Stack<Object> s; 248 Stack<Object> s;
219 249
220 if (DataBlocks.TryGetValue(typeof(T), out s)) 250 if (DataBlocks.TryGetValue(typeof(T), out s))
221 { 251 {
222 if (s.Count > 0) 252 if (s.Count > 0)
253 {
254 m_blocksReusedStat.Antecedent++;
223 return (T)s.Pop(); 255 return (T)s.Pop();
256 }
224 } 257 }
225 else 258 else
226 { 259 {
@@ -231,7 +264,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
231 } 264 }
232 } 265 }
233 266
234 public static void ReturnDataBlock<T>(T block) where T: new() 267 public void ReturnDataBlock<T>(T block) where T: new()
235 { 268 {
236 if (block == null) 269 if (block == null)
237 return; 270 return;
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