aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorMelanie2011-02-07 22:26:09 +0100
committerMelanie2011-02-07 22:26:09 +0100
commit8c20f94939347d504c175ca7afb6b456188cdf2c (patch)
treec11023fbc6e701b44128d2b54bd024abd912a1b3 /OpenSim/Region/ClientStack
parentPrevent a nonexistent inventory item from throwing an exception (diff)
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-8c20f94939347d504c175ca7afb6b456188cdf2c.zip
opensim-SC_OLD-8c20f94939347d504c175ca7afb6b456188cdf2c.tar.gz
opensim-SC_OLD-8c20f94939347d504c175ca7afb6b456188cdf2c.tar.bz2
opensim-SC_OLD-8c20f94939347d504c175ca7afb6b456188cdf2c.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs45
3 files changed, 44 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index f1fdbc5..d6159cd 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -122,6 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
122 public int PacketsReceived; 122 public int PacketsReceived;
123 /// <summary>Number of packets sent to this client</summary> 123 /// <summary>Number of packets sent to this client</summary>
124 public int PacketsSent; 124 public int PacketsSent;
125 /// <summary>Number of packets resent to this client</summary>
126 public int PacketsResent;
125 /// <summary>Total byte count of unacked packets sent to this client</summary> 127 /// <summary>Total byte count of unacked packets sent to this client</summary>
126 public int UnackedBytes; 128 public int UnackedBytes;
127 129
@@ -257,9 +259,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
257 public string GetStats() 259 public string GetStats()
258 { 260 {
259 return string.Format( 261 return string.Format(
260 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}", 262 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}",
263 PacketsReceived,
261 PacketsSent, 264 PacketsSent,
262 PacketsReceived, 265 PacketsResent,
263 UnackedBytes, 266 UnackedBytes,
264 m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count, 267 m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count,
265 m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count, 268 m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count,
@@ -449,13 +452,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
449 /// an outgoing packet from each, obeying the throttling bucket limits 452 /// an outgoing packet from each, obeying the throttling bucket limits
450 /// </summary> 453 /// </summary>
451 /// 454 ///
455 /// <remarks>
452 /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower 456 /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower
453 /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have 457 /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have
454 /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the 458 /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the
455 /// wind queue). 459 /// wind queue).
456 /// 460 ///
457 /// <remarks>This function is only called from a synchronous loop in the 461 /// This function is only called from a synchronous loop in the
458 /// UDPServer so we don't need to bother making this thread safe</remarks> 462 /// UDPServer so we don't need to bother making this thread safe
463 /// </remarks>
464 ///
459 /// <returns>True if any packets were sent, otherwise false</returns> 465 /// <returns>True if any packets were sent, otherwise false</returns>
460 public bool DequeueOutgoing() 466 public bool DequeueOutgoing()
461 { 467 {
@@ -486,7 +492,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
486 m_udpServer.SendPacketFinal(nextPacket); 492 m_udpServer.SendPacketFinal(nextPacket);
487 m_nextPackets[i] = null; 493 m_nextPackets[i] = null;
488 packetSent = true; 494 packetSent = true;
489 this.PacketsSent++;
490 } 495 }
491 } 496 }
492 else 497 else
@@ -503,7 +508,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
503 // Send the packet 508 // Send the packet
504 m_udpServer.SendPacketFinal(packet); 509 m_udpServer.SendPacketFinal(packet);
505 packetSent = true; 510 packetSent = true;
506 this.PacketsSent++;
507 } 511 }
508 else 512 else
509 { 513 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 703176c..cfcc057 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -506,7 +506,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
506 506
507 // Bump up the resend count on this packet 507 // Bump up the resend count on this packet
508 Interlocked.Increment(ref outgoingPacket.ResendCount); 508 Interlocked.Increment(ref outgoingPacket.ResendCount);
509 //Interlocked.Increment(ref Stats.ResentPackets);
510 509
511 // Requeue or resend the packet 510 // Requeue or resend the packet
512 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) 511 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false))
@@ -582,6 +581,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
582 udpClient.NeedAcks.Add(outgoingPacket); 581 udpClient.NeedAcks.Add(outgoingPacket);
583 } 582 }
584 } 583 }
584 else
585 {
586 Interlocked.Increment(ref udpClient.PacketsResent);
587 }
585 588
586 #endregion Sequence Number Assignment 589 #endregion Sequence Number Assignment
587 590
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 9d40688..d762bef 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -141,31 +141,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP
141 private void ProcessQueues() 141 private void ProcessQueues()
142 { 142 {
143 // Process all the pending adds 143 // Process all the pending adds
144
144 OutgoingPacket pendingAdd; 145 OutgoingPacket pendingAdd;
145 while (m_pendingAdds.TryDequeue(out pendingAdd)) 146 if (m_pendingAdds != null)
146 m_packets[pendingAdd.SequenceNumber] = pendingAdd; 147 {
148 while (m_pendingAdds.TryDequeue(out pendingAdd))
149 {
150 if (pendingAdd != null && m_packets != null)
151 {
152 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
153 }
154 }
155 }
147 156
148 // Process all the pending removes, including updating statistics and round-trip times 157 // Process all the pending removes, including updating statistics and round-trip times
149 PendingAck pendingRemove; 158 PendingAck pendingRemove;
150 OutgoingPacket ackedPacket; 159 OutgoingPacket ackedPacket;
151 while (m_pendingRemoves.TryDequeue(out pendingRemove)) 160 if (m_pendingRemoves != null)
152 { 161 {
153 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 162 while (m_pendingRemoves.TryDequeue(out pendingRemove))
154 { 163 {
155 m_packets.Remove(pendingRemove.SequenceNumber); 164 if (m_pendingRemoves != null && m_packets != null)
156
157 // Update stats
158 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
159
160 if (!pendingRemove.FromResend)
161 { 165 {
162 // Calculate the round-trip time for this packet and its ACK 166 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
163 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; 167 {
164 if (rtt > 0) 168 m_packets.Remove(pendingRemove.SequenceNumber);
165 ackedPacket.Client.UpdateRoundTrip(rtt); 169
170 // Update stats
171 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
172
173 if (!pendingRemove.FromResend)
174 {
175 // Calculate the round-trip time for this packet and its ACK
176 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
177 if (rtt > 0)
178 ackedPacket.Client.UpdateRoundTrip(rtt);
179 }
180 }
166 } 181 }
167 } 182 }
168 } 183 }
169 } 184 }
170 } 185 }
171} \ No newline at end of file 186}