aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-11-05 23:56:55 +0000
committerUbitUmarov2016-11-05 23:56:55 +0000
commit6bc76860d185ba6296f268373ccfea6375fff611 (patch)
treec39a51b9cd411a198be1f93fbc96a4bab0260241 /OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
parentsome types may already be native in MOD_Api ConvertFromLSL (diff)
downloadopensim-SC-6bc76860d185ba6296f268373ccfea6375fff611.zip
opensim-SC-6bc76860d185ba6296f268373ccfea6375fff611.tar.gz
opensim-SC-6bc76860d185ba6296f268373ccfea6375fff611.tar.bz2
opensim-SC-6bc76860d185ba6296f268373ccfea6375fff611.tar.xz
avoid a null ref, few changes to udp updates send
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs30
1 files changed, 10 insertions, 20 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index 4e68a9b..246f003 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
166 /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary> 166 /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
167 private int m_packetsSentReported; 167 private int m_packetsSentReported;
168 /// <summary>Holds the Environment.TickCount value of when the next OnQueueEmpty can be fired</summary> 168 /// <summary>Holds the Environment.TickCount value of when the next OnQueueEmpty can be fired</summary>
169 private int m_nextOnQueueEmpty = 1; 169 private double m_nextOnQueueEmpty = 0;
170 170
171 /// <summary>Throttle bucket for this agent's connection</summary> 171 /// <summary>Throttle bucket for this agent's connection</summary>
172 private readonly AdaptiveTokenBucket m_throttleClient; 172 private readonly AdaptiveTokenBucket m_throttleClient;
@@ -771,7 +771,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
771 RTO = Math.Min(RTO * 2, m_maxRTO); 771 RTO = Math.Min(RTO * 2, m_maxRTO);
772 } 772 }
773 773
774 const int MIN_CALLBACK_MS = 20; 774 const double MIN_CALLBACK_MS = 20.0;
775 private bool m_isQueueEmptyRunning;
775 776
776 /// <summary> 777 /// <summary>
777 /// Does an early check to see if this queue empty callback is already 778 /// Does an early check to see if this queue empty callback is already
@@ -782,35 +783,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
782 { 783 {
783 if (!m_isQueueEmptyRunning) 784 if (!m_isQueueEmptyRunning)
784 { 785 {
785 int start = Environment.TickCount & Int32.MaxValue; 786 if (!HasUpdates(categories))
787 return;
786 788
789 double start = Util.GetTimeStampMS();
787 if (start < m_nextOnQueueEmpty) 790 if (start < m_nextOnQueueEmpty)
788 return; 791 return;
789 792
790 m_isQueueEmptyRunning = true; 793 m_isQueueEmptyRunning = true;
791
792 m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; 794 m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
793 if (m_nextOnQueueEmpty == 0)
794 m_nextOnQueueEmpty = 1;
795 795
796 if (HasUpdates(categories)) 796 // Asynchronously run the callback
797 { 797 if (m_udpServer.OqrEngine.IsRunning)
798 if (!m_udpServer.OqrEngine.IsRunning) 798 m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
799 {
800 // Asynchronously run the callback
801 Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
802 }
803 else
804 {
805 m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
806 }
807 }
808 else 799 else
809 m_isQueueEmptyRunning = false; 800 Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
810 } 801 }
811 } 802 }
812 803
813 private bool m_isQueueEmptyRunning;
814 804
815 805
816 /// <summary> 806 /// <summary>