avoid a null ref, few changes to udp updates send

melanie
UbitUmarov 2016-11-05 23:56:55 +00:00
parent 8cc8d15f95
commit 6bc76860d1
3 changed files with 19 additions and 48 deletions

View File

@ -4632,28 +4632,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
{
// if (!m_udpServer.IsRunningOutbound)
// return;
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
{
// if (!m_udpServer.IsRunningOutbound)
// return;
/*
if (m_maxUpdates == 0 || m_LastQueueFill == 0)
{
m_maxUpdates = m_udpServer.PrimUpdatesPerCallback;
}
else
{
if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200)
m_maxUpdates += 5;
else
m_maxUpdates = m_maxUpdates >> 1;
}
m_maxUpdates = Util.Clamp<Int32>(m_maxUpdates,10,500);
m_LastQueueFill = Util.EnvironmentTickCount();
*/
int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30);
if (m_entityUpdates.Count > 0)
@ -4669,23 +4649,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
internal bool HandleHasUpdates(ThrottleOutPacketTypeFlags categories)
{
bool hasUpdates = false;
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
{
if (m_entityUpdates.Count > 0)
hasUpdates = true;
else if (m_entityProps.Count > 0)
hasUpdates = true;
return true;
if (m_entityProps.Count > 0)
return true;
}
if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
{
if (ImageManager.HasUpdates())
hasUpdates = true;
return true;
}
return hasUpdates;
return false;
}
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)

View File

@ -166,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
private int m_packetsSentReported;
/// <summary>Holds the Environment.TickCount value of when the next OnQueueEmpty can be fired</summary>
private int m_nextOnQueueEmpty = 1;
private double m_nextOnQueueEmpty = 0;
/// <summary>Throttle bucket for this agent's connection</summary>
private readonly AdaptiveTokenBucket m_throttleClient;
@ -771,7 +771,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
RTO = Math.Min(RTO * 2, m_maxRTO);
}
const int MIN_CALLBACK_MS = 20;
const double MIN_CALLBACK_MS = 20.0;
private bool m_isQueueEmptyRunning;
/// <summary>
/// Does an early check to see if this queue empty callback is already
@ -782,35 +783,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (!m_isQueueEmptyRunning)
{
int start = Environment.TickCount & Int32.MaxValue;
if (!HasUpdates(categories))
return;
double start = Util.GetTimeStampMS();
if (start < m_nextOnQueueEmpty)
return;
m_isQueueEmptyRunning = true;
m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
if (m_nextOnQueueEmpty == 0)
m_nextOnQueueEmpty = 1;
if (HasUpdates(categories))
{
if (!m_udpServer.OqrEngine.IsRunning)
{
// Asynchronously run the callback
Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
}
else
{
m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
}
}
// Asynchronously run the callback
if (m_udpServer.OqrEngine.IsRunning)
m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
else
m_isQueueEmptyRunning = false;
Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
}
}
private bool m_isQueueEmptyRunning;
/// <summary>

View File

@ -120,12 +120,15 @@ namespace OpenSim.Region.DataSnapshot.Providers
public XmlNode RequestSnapshotData(XmlDocument nodeFactory)
{
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
ILandChannel landChannel = m_scene.LandChannel;
if(landChannel == null)
return parent;
List<ILandObject> parcels = landChannel.AllParcels();
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
if (parcels != null)
{