* Cache packed throttle data to avoid repeated allocations in CheckForSignificantMovement()
* Removed a lock on "return m_neighbours.Count" in GetInaccurateNeighborCount(). Dictionary<>.Count by itself does not benefit from lockingslimupdates
parent
cde3c20ba3
commit
36afd0bfd1
|
@ -144,6 +144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <summary>A reference to the LLUDPServer that is managing this client</summary>
|
||||
private readonly LLUDPServer m_udpServer;
|
||||
|
||||
/// <summary>Caches packed throttle information</summary>
|
||||
private byte[] m_packedThrottles;
|
||||
|
||||
private int m_defaultRTO = 3000;
|
||||
private int m_maxRTO = 60000;
|
||||
|
||||
|
@ -350,21 +353,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture];
|
||||
bucket.DripRate = texture;
|
||||
bucket.MaxBurst = texture;
|
||||
|
||||
// Reset the packed throttles cached data
|
||||
m_packedThrottles = null;
|
||||
}
|
||||
|
||||
public byte[] GetThrottlesPacked()
|
||||
{
|
||||
byte[] data = new byte[7 * 4];
|
||||
int i = 0;
|
||||
byte[] data = m_packedThrottles;
|
||||
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)(m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate) +
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate), 0, data, i, 4); i += 4;
|
||||
if (data == null)
|
||||
{
|
||||
data = new byte[7 * 4];
|
||||
int i = 0;
|
||||
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)(m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate) +
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate), 0, data, i, 4); i += 4;
|
||||
|
||||
m_packedThrottles = data;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -1132,10 +1132,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public int GetInaccurateNeighborCount()
|
||||
{
|
||||
lock (m_neighbours)
|
||||
{
|
||||
return m_neighbours.Count;
|
||||
}
|
||||
return m_neighbours.Count;
|
||||
}
|
||||
|
||||
// This is the method that shuts down the scene.
|
||||
|
|
Loading…
Reference in New Issue