diff options
author | Melanie Thielker | 2008-07-22 22:49:13 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-07-22 22:49:13 +0000 |
commit | e09ff343fb17269ff3f43dc44c31cfeee923c6b8 (patch) | |
tree | c9fe5a1e367e45bce6aa4a318b7262f4ee734033 /OpenSim/Region/ClientStack | |
parent | Change one packet optimization to cover a case where the resend (diff) | |
download | opensim-SC_OLD-e09ff343fb17269ff3f43dc44c31cfeee923c6b8.zip opensim-SC_OLD-e09ff343fb17269ff3f43dc44c31cfeee923c6b8.tar.gz opensim-SC_OLD-e09ff343fb17269ff3f43dc44c31cfeee923c6b8.tar.bz2 opensim-SC_OLD-e09ff343fb17269ff3f43dc44c31cfeee923c6b8.tar.xz |
Make QueuePacket() lock free. Eliminates an unneeded lock()
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index c4bc6c8..c09da9b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | |||
@@ -251,27 +251,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
251 | { | 251 | { |
252 | // Add acks to outgoing packets | 252 | // Add acks to outgoing packets |
253 | // | 253 | // |
254 | lock(m_PendingAcks) | 254 | if(m_PendingAcks.Count > 0) |
255 | { | 255 | { |
256 | if(m_PendingAcks.Count > 0) | 256 | int count = m_PendingAcks.Count; |
257 | { | 257 | if(count > 10) |
258 | int count = m_PendingAcks.Count; | 258 | count = 10; |
259 | if(count > 10) | 259 | packet.Header.AckList = new uint[count]; |
260 | count = 10; | 260 | |
261 | packet.Header.AckList = new uint[count]; | 261 | int i = 0; |
262 | 262 | ||
263 | int i = 0; | 263 | foreach (uint ack in new List<uint>(m_PendingAcks.Keys)) |
264 | 264 | { | |
265 | foreach (uint ack in new List<uint>(m_PendingAcks.Keys)) | 265 | packet.Header.AckList[i] = ack; |
266 | { | 266 | i++; |
267 | packet.Header.AckList[i] = ack; | 267 | m_PendingAcks.Remove(ack); |
268 | i++; | 268 | if (i >= 10) // That is how much space there is |
269 | m_PendingAcks.Remove(ack); | 269 | break; |
270 | if (i >= 10) // That is how much space there is | 270 | } |
271 | break; | 271 | } |
272 | } | ||
273 | } | ||
274 | } | ||
275 | 272 | ||
276 | packet.TickCount = System.Environment.TickCount; | 273 | packet.TickCount = System.Environment.TickCount; |
277 | 274 | ||