aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-05 14:17:18 -0400
committerJonathan Freedman2010-10-05 14:17:18 -0400
commit8f1acb890ac49ea004bf43065ce8d3472bb27708 (patch)
tree07e4e5fc77f764232c958bdbf8f93f2651da1663 /OpenSim/Region/ClientStack
parentMerge branch 'master' of git://opensimulator.org/git/opensim (diff)
parentFormatting cleanup. (diff)
downloadopensim-SC_OLD-8f1acb890ac49ea004bf43065ce8d3472bb27708.zip
opensim-SC_OLD-8f1acb890ac49ea004bf43065ce8d3472bb27708.tar.gz
opensim-SC_OLD-8f1acb890ac49ea004bf43065ce8d3472bb27708.tar.bz2
opensim-SC_OLD-8f1acb890ac49ea004bf43065ce8d3472bb27708.tar.xz
Merge branch 'master' of git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs47
1 files changed, 31 insertions, 16 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index e43f7cf..4cb4aee 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -139,28 +139,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
139 private void ProcessQueues() 139 private void ProcessQueues()
140 { 140 {
141 // Process all the pending adds 141 // Process all the pending adds
142 OutgoingPacket pendingAdd;
143 while (m_pendingAdds.Dequeue(out pendingAdd))
144 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
145 142
143 OutgoingPacket pendingAdd;
144 if (m_pendingAdds != null)
145 {
146 while (m_pendingAdds.TryDequeue(out pendingAdd))
147 {
148 if (pendingAdd != null && m_packets != null)
149 {
150 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
151 }
152 }
153 }
154
146 // Process all the pending removes, including updating statistics and round-trip times 155 // Process all the pending removes, including updating statistics and round-trip times
147 PendingAck pendingRemove; 156 PendingAck pendingRemove;
148 OutgoingPacket ackedPacket; 157 OutgoingPacket ackedPacket;
149 while (m_pendingRemoves.Dequeue(out pendingRemove)) 158 if (m_pendingRemoves != null)
150 { 159 {
151 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 160 while (m_pendingRemoves.TryDequeue(out pendingRemove))
152 { 161 {
153 m_packets.Remove(pendingRemove.SequenceNumber); 162 if (m_pendingRemoves != null && m_packets != null)
154
155 // Update stats
156 System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
157
158 if (!pendingRemove.FromResend)
159 { 163 {
160 // Calculate the round-trip time for this packet and its ACK 164 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
161 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; 165 {
162 if (rtt > 0) 166 m_packets.Remove(pendingRemove.SequenceNumber);
163 ackedPacket.Client.UpdateRoundTrip(rtt); 167
168 // Update stats
169 System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
170
171 if (!pendingRemove.FromResend)
172 {
173 // Calculate the round-trip time for this packet and its ACK
174 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
175 if (rtt > 0)
176 ackedPacket.Client.UpdateRoundTrip(rtt);
177 }
178 }
164 } 179 }
165 } 180 }
166 } 181 }