aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorBlueWall2011-01-27 08:53:57 -0500
committerBlueWall2011-01-27 08:53:57 -0500
commitd89d9d1b1310d494fbb7712057eab8a196e10a04 (patch)
tree62834b7f5954aa8f013a159ee2fc3ccee385e673 /OpenSim/Region/ClientStack
parentMake FireAndForgetWrapper a singleton class (diff)
parentMake it work (diff)
downloadopensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.zip
opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.gz
opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.bz2
opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.xz
Merge branch 'master' of /home/opensim/src/OpenSim/Core
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs18
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs47
4 files changed, 39 insertions, 50 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index ee4f04e..5dab1bc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -368,6 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
368 #region Properties 368 #region Properties
369 369
370 public LLUDPClient UDPClient { get { return m_udpClient; } } 370 public LLUDPClient UDPClient { get { return m_udpClient; } }
371 public LLUDPServer UDPServer { get { return m_udpServer; } }
371 public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } } 372 public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } }
372 public UUID SecureSessionId { get { return m_secureSessionId; } } 373 public UUID SecureSessionId { get { return m_secureSessionId; } }
373 public IScene Scene { get { return m_scene; } } 374 public IScene Scene { get { return m_scene; } }
@@ -3465,9 +3466,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3465 ani.AnimationList[i].AnimSequenceID = seqs[i]; 3466 ani.AnimationList[i].AnimSequenceID = seqs[i];
3466 3467
3467 ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock(); 3468 ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock();
3468 ani.AnimationSourceList[i].ObjectID = objectIDs[i]; 3469 if (objectIDs[i].Equals(sourceAgentId))
3469 if (objectIDs[i] == UUID.Zero) 3470 ani.AnimationSourceList[i].ObjectID = UUID.Zero;
3470 ani.AnimationSourceList[i].ObjectID = sourceAgentId; 3471 else
3472 ani.AnimationSourceList[i].ObjectID = objectIDs[i];
3471 } 3473 }
3472 ani.Header.Reliable = false; 3474 ani.Header.Reliable = false;
3473 OutPacket(ani, ThrottleOutPacketType.Task); 3475 OutPacket(ani, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index e02783a..d4c3307 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -256,18 +256,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
256 public string GetStats() 256 public string GetStats()
257 { 257 {
258 return string.Format( 258 return string.Format(
259 "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}", 259 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}",
260 PacketsSent, 260 PacketsSent,
261 PacketsReceived, 261 PacketsReceived,
262 UnackedBytes, 262 UnackedBytes,
263 m_throttleCategories[(int)ThrottleOutPacketType.Resend].Content, 263 m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count,
264 m_throttleCategories[(int)ThrottleOutPacketType.Land].Content, 264 m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count,
265 m_throttleCategories[(int)ThrottleOutPacketType.Wind].Content, 265 m_packetOutboxes[(int)ThrottleOutPacketType.Wind].Count,
266 m_throttleCategories[(int)ThrottleOutPacketType.Cloud].Content, 266 m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count,
267 m_throttleCategories[(int)ThrottleOutPacketType.Task].Content, 267 m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count,
268 m_throttleCategories[(int)ThrottleOutPacketType.Texture].Content, 268 m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count,
269 m_throttleCategories[(int)ThrottleOutPacketType.Asset].Content, 269 m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count,
270 m_throttleCategories[(int)ThrottleOutPacketType.State].Content); 270 m_packetOutboxes[(int)ThrottleOutPacketType.State].Count);
271 } 271 }
272 272
273 public void SendPacketStats() 273 public void SendPacketStats()
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index e54cfc2..df8ddbb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -114,8 +114,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
114 //private UDPClientCollection m_clients = new UDPClientCollection(); 114 //private UDPClientCollection m_clients = new UDPClientCollection();
115 /// <summary>Bandwidth throttle for this UDP server</summary> 115 /// <summary>Bandwidth throttle for this UDP server</summary>
116 protected TokenBucket m_throttle; 116 protected TokenBucket m_throttle;
117
117 /// <summary>Bandwidth throttle rates for this UDP server</summary> 118 /// <summary>Bandwidth throttle rates for this UDP server</summary>
118 protected ThrottleRates m_throttleRates; 119 public ThrottleRates ThrottleRates { get; private set; }
120
119 /// <summary>Manages authentication for agent circuits</summary> 121 /// <summary>Manages authentication for agent circuits</summary>
120 private AgentCircuitManager m_circuitManager; 122 private AgentCircuitManager m_circuitManager;
121 /// <summary>Reference to the scene this UDP server is attached to</summary> 123 /// <summary>Reference to the scene this UDP server is attached to</summary>
@@ -226,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
226 #endregion BinaryStats 228 #endregion BinaryStats
227 229
228 m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps); 230 m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps);
229 m_throttleRates = new ThrottleRates(configSource); 231 ThrottleRates = new ThrottleRates(configSource);
230 } 232 }
231 233
232 public void Start() 234 public void Start()
@@ -585,8 +587,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
585 587
586 // Stats tracking 588 // Stats tracking
587 Interlocked.Increment(ref udpClient.PacketsSent); 589 Interlocked.Increment(ref udpClient.PacketsSent);
588 if (isReliable)
589 Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
590 590
591 // Put the UDP payload on the wire 591 // Put the UDP payload on the wire
592 AsyncBeginSend(buffer); 592 AsyncBeginSend(buffer);
@@ -859,9 +859,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
859 // Acknowledge the UseCircuitCode packet 859 // Acknowledge the UseCircuitCode packet
860 SendAckImmediate(remoteEndPoint, packet.Header.Sequence); 860 SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
861 861
862 m_log.DebugFormat( 862// m_log.DebugFormat(
863 "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 863// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
864 buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 864// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
865 } 865 }
866 866
867 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber) 867 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
@@ -924,7 +924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
924 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) 924 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
925 { 925 {
926 // Create the LLUDPClient 926 // Create the LLUDPClient
927 LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 927 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
928 IClientAPI existingClient; 928 IClientAPI existingClient;
929 929
930 if (!m_scene.TryGetClient(agentID, out existingClient)) 930 if (!m_scene.TryGetClient(agentID, out existingClient))
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 4cb4aee..9d40688 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Threading;
31using OpenMetaverse; 32using OpenMetaverse;
32 33
33namespace OpenSim.Region.ClientStack.LindenUDP 34namespace OpenSim.Region.ClientStack.LindenUDP
@@ -77,6 +78,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
77 public void Add(OutgoingPacket packet) 78 public void Add(OutgoingPacket packet)
78 { 79 {
79 m_pendingAdds.Enqueue(packet); 80 m_pendingAdds.Enqueue(packet);
81 Interlocked.Add(ref packet.Client.UnackedBytes, packet.Buffer.DataLength);
80 } 82 }
81 83
82 /// <summary> 84 /// <summary>
@@ -139,46 +141,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
139 private void ProcessQueues() 141 private void ProcessQueues()
140 { 142 {
141 // Process all the pending adds 143 // Process all the pending adds
142
143 OutgoingPacket pendingAdd; 144 OutgoingPacket pendingAdd;
144 if (m_pendingAdds != null) 145 while (m_pendingAdds.TryDequeue(out pendingAdd))
145 { 146 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
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 147
155 // Process all the pending removes, including updating statistics and round-trip times 148 // Process all the pending removes, including updating statistics and round-trip times
156 PendingAck pendingRemove; 149 PendingAck pendingRemove;
157 OutgoingPacket ackedPacket; 150 OutgoingPacket ackedPacket;
158 if (m_pendingRemoves != null) 151 while (m_pendingRemoves.TryDequeue(out pendingRemove))
159 { 152 {
160 while (m_pendingRemoves.TryDequeue(out pendingRemove)) 153 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
161 { 154 {
162 if (m_pendingRemoves != null && m_packets != null) 155 m_packets.Remove(pendingRemove.SequenceNumber);
156
157 // Update stats
158 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
159
160 if (!pendingRemove.FromResend)
163 { 161 {
164 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 162 // Calculate the round-trip time for this packet and its ACK
165 { 163 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
166 m_packets.Remove(pendingRemove.SequenceNumber); 164 if (rtt > 0)
167 165 ackedPacket.Client.UpdateRoundTrip(rtt);
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 }
179 } 166 }
180 } 167 }
181 } 168 }
182 } 169 }
183 } 170 }
184} 171} \ No newline at end of file