aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorUbitUmarov2018-11-25 18:38:37 +0000
committerUbitUmarov2018-11-25 18:38:37 +0000
commitd179b2dda1b4a378c18c431d2f51d437c443ce6b (patch)
tree0c4f1363571462b518bc719c8b28567a23c87b5d /OpenSim/Region/ClientStack
parentupdate contributors (diff)
downloadopensim-SC-d179b2dda1b4a378c18c431d2f51d437c443ce6b.zip
opensim-SC-d179b2dda1b4a378c18c431d2f51d437c443ce6b.tar.gz
opensim-SC-d179b2dda1b4a378c18c431d2f51d437c443ce6b.tar.bz2
opensim-SC-d179b2dda1b4a378c18c431d2f51d437c443ce6b.tar.xz
avoid data references stuck in packet pools
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs85
2 files changed, 48 insertions, 47 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 1f779ce..059a705 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -466,7 +466,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
466 466
467 m_circuitManager = circuitManager; 467 m_circuitManager = circuitManager;
468 int sceneThrottleBps = 0; 468 int sceneThrottleBps = 0;
469 bool usePools = false; 469// bool usePools = false;
470 470
471 IConfig config = configSource.Configs["ClientStack.LindenUDP"]; 471 IConfig config = configSource.Configs["ClientStack.LindenUDP"];
472 if (config != null) 472 if (config != null)
@@ -497,8 +497,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
497 if (packetConfig != null) 497 if (packetConfig != null)
498 { 498 {
499 PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); 499 PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
500 PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); 500// PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
501 usePools = packetConfig.GetBoolean("RecycleBaseUDPPackets", usePools); 501// usePools = packetConfig.GetBoolean("RecycleBaseUDPPackets", usePools);
502 } 502 }
503 503
504 #region BinaryStats 504 #region BinaryStats
@@ -896,7 +896,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
896 LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting, UnackedPacketMethod method) 896 LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting, UnackedPacketMethod method)
897 { 897 {
898 // CoarseLocationUpdate packets cannot be split in an automated way 898 // CoarseLocationUpdate packets cannot be split in an automated way
899 if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting) 899 if (allowSplitting && packet.Type == PacketType.CoarseLocationUpdate)
900 allowSplitting = false; 900 allowSplitting = false;
901 901
902// bool packetQueued = false; 902// bool packetQueued = false;
@@ -1055,7 +1055,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1055 public void SendPing(LLUDPClient udpClient) 1055 public void SendPing(LLUDPClient udpClient)
1056 { 1056 {
1057 StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); 1057 StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
1058 pc.Header.Reliable = false;
1059 1058
1060 pc.PingID.PingID = (byte)udpClient.CurrentPingSequence++; 1059 pc.PingID.PingID = (byte)udpClient.CurrentPingSequence++;
1061 // We *could* get OldestUnacked, but it would hurt performance and not provide any benefit 1060 // We *could* get OldestUnacked, but it would hurt performance and not provide any benefit
@@ -1963,7 +1962,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1963 { 1962 {
1964 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 1963 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
1965 1964
1966
1967 client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 1965 client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
1968 client.OnLogout += LogoutHandler; 1966 client.OnLogout += LogoutHandler;
1969 client.DebugPacketLevel = DefaultClientPacketDebugLevel; 1967 client.DebugPacketLevel = DefaultClientPacketDebugLevel;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
index f585bea..9b94a29 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
@@ -105,7 +105,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
105 { 105 {
106 // defaults 106 // defaults
107 RecyclePackets = true; 107 RecyclePackets = true;
108 RecycleDataBlocks = true; 108 // RecycleDataBlocks = true;
109 RecycleDataBlocks = false;
109 } 110 }
110 111
111 /// <summary> 112 /// <summary>
@@ -198,60 +199,62 @@ namespace OpenSim.Region.ClientStack.LindenUDP
198 /// <param name="packet"></param> 199 /// <param name="packet"></param>
199 public void ReturnPacket(Packet packet) 200 public void ReturnPacket(Packet packet)
200 { 201 {
201 if (RecycleDataBlocks) 202 if (!RecyclePackets)
203 return;
204
205 bool trypool = false;
206 PacketType type = packet.Type;
207
208 switch (type)
202 { 209 {
203 switch (packet.Type) 210 case PacketType.ObjectUpdate:
204 { 211 ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
205 case PacketType.ObjectUpdate:
206 ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
207 212
213 if (RecycleDataBlocks)
214 {
208 foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData) 215 foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData)
209 ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod); 216 ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod);
217 }
210 218
211 oup.ObjectData = null; 219 oup.ObjectData = null;
212 break; 220 trypool = true;
221 break;
213 222
214 case PacketType.ImprovedTerseObjectUpdate: 223 case PacketType.ImprovedTerseObjectUpdate:
215 ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet; 224 ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
216 225
226 if (RecycleDataBlocks)
227 {
217 foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData) 228 foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData)
218 ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod); 229 ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod);
230 }
219 231
220 itoup.ObjectData = null; 232 itoup.ObjectData = null;
221 break; 233 trypool = true;
222 } 234 break;
235
236 case PacketType.AgentUpdate:
237 case PacketType.PacketAck:
238 trypool = true;
239 break;
240 default:
241 return;
223 } 242 }
224 243
225 if (RecyclePackets) 244 if(!trypool)
245 return;
246
247 lock (pool)
226 { 248 {
227 switch (packet.Type) 249 if (!pool.ContainsKey(type))
250 {
251 pool[type] = new Stack<Packet>();
252 }
253
254 if ((pool[type]).Count < 50)
228 { 255 {
229 // List pooling packets here 256// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type);
230 case PacketType.AgentUpdate: 257 pool[type].Push(packet);
231 case PacketType.PacketAck:
232 case PacketType.ObjectUpdate:
233 case PacketType.ImprovedTerseObjectUpdate:
234 lock (pool)
235 {
236 PacketType type = packet.Type;
237
238 if (!pool.ContainsKey(type))
239 {
240 pool[type] = new Stack<Packet>();
241 }
242
243 if ((pool[type]).Count < 50)
244 {
245// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type);
246
247 pool[type].Push(packet);
248 }
249 }
250 break;
251
252 // Other packets wont pool
253 default:
254 return;
255 } 258 }
256 } 259 }
257 } 260 }