diff options
author | UbitUmarov | 2016-11-05 23:56:55 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-05 23:56:55 +0000 |
commit | 6bc76860d185ba6296f268373ccfea6375fff611 (patch) | |
tree | c39a51b9cd411a198be1f93fbc96a4bab0260241 | |
parent | some types may already be native in MOD_Api ConvertFromLSL (diff) | |
download | opensim-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
3 files changed, 19 insertions, 48 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 17e4400..276b367 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4632,28 +4632,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4632 | 4632 | ||
4633 | void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) | 4633 | void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) |
4634 | { | 4634 | { |
4635 | // if (!m_udpServer.IsRunningOutbound) | ||
4636 | // return; | ||
4637 | |||
4638 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) | 4635 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) |
4639 | { | 4636 | { |
4640 | // if (!m_udpServer.IsRunningOutbound) | ||
4641 | // return; | ||
4642 | /* | ||
4643 | if (m_maxUpdates == 0 || m_LastQueueFill == 0) | ||
4644 | { | ||
4645 | m_maxUpdates = m_udpServer.PrimUpdatesPerCallback; | ||
4646 | } | ||
4647 | else | ||
4648 | { | ||
4649 | if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200) | ||
4650 | m_maxUpdates += 5; | ||
4651 | else | ||
4652 | m_maxUpdates = m_maxUpdates >> 1; | ||
4653 | } | ||
4654 | m_maxUpdates = Util.Clamp<Int32>(m_maxUpdates,10,500); | ||
4655 | m_LastQueueFill = Util.EnvironmentTickCount(); | ||
4656 | */ | ||
4657 | int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30); | 4637 | int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30); |
4658 | 4638 | ||
4659 | if (m_entityUpdates.Count > 0) | 4639 | if (m_entityUpdates.Count > 0) |
@@ -4669,23 +4649,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4669 | 4649 | ||
4670 | internal bool HandleHasUpdates(ThrottleOutPacketTypeFlags categories) | 4650 | internal bool HandleHasUpdates(ThrottleOutPacketTypeFlags categories) |
4671 | { | 4651 | { |
4672 | bool hasUpdates = false; | ||
4673 | |||
4674 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) | 4652 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) |
4675 | { | 4653 | { |
4676 | if (m_entityUpdates.Count > 0) | 4654 | if (m_entityUpdates.Count > 0) |
4677 | hasUpdates = true; | 4655 | return true; |
4678 | else if (m_entityProps.Count > 0) | 4656 | if (m_entityProps.Count > 0) |
4679 | hasUpdates = true; | 4657 | return true; |
4680 | } | 4658 | } |
4681 | 4659 | ||
4682 | if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) | 4660 | if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) |
4683 | { | 4661 | { |
4684 | if (ImageManager.HasUpdates()) | 4662 | if (ImageManager.HasUpdates()) |
4685 | hasUpdates = true; | 4663 | return true; |
4686 | } | 4664 | } |
4687 | 4665 | ||
4688 | return hasUpdates; | 4666 | return false; |
4689 | } | 4667 | } |
4690 | 4668 | ||
4691 | public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) | 4669 | public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) |
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> |
diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs index b8c90cd..5c791e6 100644 --- a/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs | |||
@@ -120,12 +120,15 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
120 | 120 | ||
121 | public XmlNode RequestSnapshotData(XmlDocument nodeFactory) | 121 | public XmlNode RequestSnapshotData(XmlDocument nodeFactory) |
122 | { | 122 | { |
123 | XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); | ||
123 | ILandChannel landChannel = m_scene.LandChannel; | 124 | ILandChannel landChannel = m_scene.LandChannel; |
125 | if(landChannel == null) | ||
126 | return parent; | ||
127 | |||
124 | List<ILandObject> parcels = landChannel.AllParcels(); | 128 | List<ILandObject> parcels = landChannel.AllParcels(); |
125 | 129 | ||
126 | IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); | 130 | IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); |
127 | 131 | ||
128 | XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); | ||
129 | if (parcels != null) | 132 | if (parcels != null) |
130 | { | 133 | { |
131 | 134 | ||