diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 25 |
2 files changed, 30 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs index 1b8535c..e22670b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs | |||
@@ -45,7 +45,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
45 | public Packet Packet; | 45 | public Packet Packet; |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Default constructor | 48 | /// No arg constructor. |
49 | /// </summary> | ||
50 | public IncomingPacket() {} | ||
51 | |||
52 | /// <summary> | ||
53 | /// Constructor | ||
49 | /// </summary> | 54 | /// </summary> |
50 | /// <param name="client">Reference to the client this packet came from</param> | 55 | /// <param name="client">Reference to the client this packet came from</param> |
51 | /// <param name="packet">Packet data</param> | 56 | /// <param name="packet">Packet data</param> |
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 | { |