aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTom Grimshaw2010-07-17 15:08:59 -0700
committerTom Grimshaw2010-07-17 15:08:59 -0700
commitfabe2206db37be39a90254da8a7fff973f2dd977 (patch)
treead91ef82e987e34f9746559342518610140b469d
parentRevert 233c872.. "* Call client.Start() sunchronously. Calling thos async avo... (diff)
downloadopensim-SC_OLD-fabe2206db37be39a90254da8a7fff973f2dd977.zip
opensim-SC_OLD-fabe2206db37be39a90254da8a7fff973f2dd977.tar.gz
opensim-SC_OLD-fabe2206db37be39a90254da8a7fff973f2dd977.tar.bz2
opensim-SC_OLD-fabe2206db37be39a90254da8a7fff973f2dd977.tar.xz
Ensure that packets do NOT get delivered to a client before the modules that can deal with the client's response have finished loading.
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs9
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs10
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs23
3 files changed, 41 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 754127d..a9f9d60 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -334,6 +334,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
334// protected HashSet<uint> m_attachmentsSent; 334// protected HashSet<uint> m_attachmentsSent;
335 335
336 private int m_moneyBalance; 336 private int m_moneyBalance;
337 private bool m_deliverPackets = true;
337 private int m_animationSequenceNumber = 1; 338 private int m_animationSequenceNumber = 1;
338 private bool m_SendLogoutPacketWhenClosing = true; 339 private bool m_SendLogoutPacketWhenClosing = true;
339 private AgentUpdateArgs lastarg; 340 private AgentUpdateArgs lastarg;
@@ -378,6 +379,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
378 get { return m_startpos; } 379 get { return m_startpos; }
379 set { m_startpos = value; } 380 set { m_startpos = value; }
380 } 381 }
382 public bool DeliverPackets
383 {
384 get { return m_deliverPackets; }
385 set {
386 m_deliverPackets = value;
387 m_udpClient.m_deliverPackets = value;
388 }
389 }
381 public UUID AgentId { get { return m_agentId; } } 390 public UUID AgentId { get { return m_agentId; } }
382 public UUID ActiveGroupId { get { return m_activeGroupID; } } 391 public UUID ActiveGroupId { get { return m_activeGroupID; } }
383 public string ActiveGroupName { get { return m_activeGroupName; } } 392 public string ActiveGroupName { get { return m_activeGroupName; } }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 6232c48..eebbfa5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -149,6 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
149 149
150 private int m_defaultRTO = 3000; 150 private int m_defaultRTO = 3000;
151 private int m_maxRTO = 60000; 151 private int m_maxRTO = 60000;
152 public bool m_deliverPackets = true;
152 153
153 /// <summary> 154 /// <summary>
154 /// Default constructor 155 /// Default constructor
@@ -389,6 +390,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
389 if (category >= 0 && category < m_packetOutboxes.Length) 390 if (category >= 0 && category < m_packetOutboxes.Length)
390 { 391 {
391 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; 392 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
393
394 if (m_deliverPackets == false)
395 {
396 queue.Enqueue(packet);
397 return true;
398 }
399
392 TokenBucket bucket = m_throttleCategories[category]; 400 TokenBucket bucket = m_throttleCategories[category];
393 401
394 if (bucket.RemoveTokens(packet.Buffer.DataLength)) 402 if (bucket.RemoveTokens(packet.Buffer.DataLength))
@@ -419,6 +427,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
419 /// <returns>True if any packets were sent, otherwise false</returns> 427 /// <returns>True if any packets were sent, otherwise false</returns>
420 public bool DequeueOutgoing() 428 public bool DequeueOutgoing()
421 { 429 {
430 if (m_deliverPackets == false) return false;
431
422 OutgoingPacket packet; 432 OutgoingPacket packet;
423 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; 433 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
424 TokenBucket bucket; 434 TokenBucket bucket;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index cda461c..3b63bcd 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -900,7 +900,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
900 900
901 // Start the IClientAPI 901 // Start the IClientAPI
902 // Spin it off so that it doesn't clog up the LLUDPServer 902 // Spin it off so that it doesn't clog up the LLUDPServer
903 Util.FireAndForget(delegate(object o) { client.Start(); }); 903
904 //First, and very importantly:
905 //
906 //Set our DeliverPackets flag in the client to *false*
907 //this will prevent us from missing important messages
908 //before the modules are bound
909 client.DeliverPackets = false;
910
911 Util.FireAndForget(
912 delegate
913 {
914 try
915 {
916 client.Start();
917 }
918 finally
919 {
920 //Now, release the hounds. er, packets.
921 client.DeliverPackets = true;
922 }
923 }
924 );
904 } 925 }
905 else 926 else
906 { 927 {