aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-17 21:08:15 +0100
committerJustin Clark-Casey (justincc)2012-10-17 21:08:15 +0100
commit2ed59ad8ac3ec836517b60580f13ab37102a0c67 (patch)
treed0c4c99b06a83108064a8ed8621f0f858b304a2a /OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
parentminor: Make BasicCircuitTests.SetUp() call overriden base method instead of i... (diff)
downloadopensim-SC_OLD-2ed59ad8ac3ec836517b60580f13ab37102a0c67.zip
opensim-SC_OLD-2ed59ad8ac3ec836517b60580f13ab37102a0c67.tar.gz
opensim-SC_OLD-2ed59ad8ac3ec836517b60580f13ab37102a0c67.tar.bz2
opensim-SC_OLD-2ed59ad8ac3ec836517b60580f13ab37102a0c67.tar.xz
If RecycleBaseUDPPackets = true, also pool IncomingPackets to reduce memory churn
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs25
1 files changed, 24 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 42247ca..286d931 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -168,6 +168,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
168 /// <summary>Flag to signal when clients should send pings</summary> 168 /// <summary>Flag to signal when clients should send pings</summary>
169 protected bool m_sendPing; 169 protected bool m_sendPing;
170 170
171 private Pool<IncomingPacket> m_incomingPacketPool;
172
171 private int m_defaultRTO = 0; 173 private int m_defaultRTO = 0;
172 private int m_maxRTO = 0; 174 private int m_maxRTO = 0;
173 private int m_ackTimeout = 0; 175 private int m_ackTimeout = 0;
@@ -274,6 +276,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
274 276
275 m_throttle = new TokenBucket(null, sceneThrottleBps); 277 m_throttle = new TokenBucket(null, sceneThrottleBps);
276 ThrottleRates = new ThrottleRates(configSource); 278 ThrottleRates = new ThrottleRates(configSource);
279
280 if (UsePools)
281 m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500);
277 } 282 }
278 283
279 public void Start() 284 public void Start()
@@ -1012,8 +1017,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1012 1017
1013 #endregion Ping Check Handling 1018 #endregion Ping Check Handling
1014 1019
1020 IncomingPacket incomingPacket;
1021
1015 // Inbox insertion 1022 // Inbox insertion
1016 packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); 1023 if (UsePools)
1024 {
1025 incomingPacket = m_incomingPacketPool.GetObject();
1026 incomingPacket.Client = (LLClientView)client;
1027 incomingPacket.Packet = packet;
1028 }
1029 else
1030 {
1031 incomingPacket = new IncomingPacket((LLClientView)client, packet);
1032 }
1033
1034 packetInbox.Enqueue(incomingPacket);
1017 } 1035 }
1018 1036
1019 #region BinaryStats 1037 #region BinaryStats
@@ -1283,7 +1301,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1283 } 1301 }
1284 1302
1285 if (packetInbox.Dequeue(100, ref incomingPacket)) 1303 if (packetInbox.Dequeue(100, ref incomingPacket))
1304 {
1286 ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket); 1305 ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket);
1306
1307 if (UsePools)
1308 m_incomingPacketPool.ReturnObject(incomingPacket);
1309 }
1287 } 1310 }
1288 catch (Exception ex) 1311 catch (Exception ex)
1289 { 1312 {