give up on Lazy<T>

0.9.1.0-post-fixes
UbitUmarov 2019-01-21 13:15:11 +00:00
parent 237cf1ced6
commit 611cfc83d6
3 changed files with 70 additions and 62 deletions

View File

@ -185,7 +185,6 @@ namespace OpenSim.Framework
newMap[ind++] = m_heightmap[xx, yy]; newMap[ind++] = m_heightmap[xx, yy];
return newMap; return newMap;
} }
public TerrainData Clone() public TerrainData Clone()

View File

@ -44,11 +44,11 @@ using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
using AssetLandmark = OpenSim.Framework.AssetLandmark; using AssetLandmark = OpenSim.Framework.AssetLandmark;
using RegionFlags = OpenMetaverse.RegionFlags; using Caps = OpenSim.Framework.Capabilities.Caps;
using PermissionMask = OpenSim.Framework.PermissionMask; using PermissionMask = OpenSim.Framework.PermissionMask;
using RegionFlags = OpenMetaverse.RegionFlags;
namespace OpenSim.Region.ClientStack.LindenUDP namespace OpenSim.Region.ClientStack.LindenUDP
{ {
@ -1169,7 +1169,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(GATRP, ThrottleOutPacketType.Task); OutPacket(GATRP, ThrottleOutPacketType.Task);
} }
public virtual bool CanSendLayerData() public virtual bool CanSendLayerData()
{ {
int n = m_udpClient.GetPacketsQueuedCount(ThrottleOutPacketType.Land); int n = m_udpClient.GetPacketsQueuedCount(ThrottleOutPacketType.Land);
@ -4093,21 +4092,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ResendPrimUpdate(update); ResendPrimUpdate(update);
} }
private List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = new List<ObjectUpdatePacket.ObjectDataBlock>();
private List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = new List<ObjectUpdateCompressedPacket.ObjectDataBlock>();
private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseAgentUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
private void ProcessEntityUpdates(int maxUpdatesBytes) private void ProcessEntityUpdates(int maxUpdatesBytes)
{ {
if (!IsActive) if (!IsActive)
return; return;
OpenSim.Framework.Lazy<List<EntityUpdate>> objectUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = null;
OpenSim.Framework.Lazy<List<EntityUpdate>> compressedUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null;
OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseUpdateBlocks = null;
OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseAgentUpdateBlocks = null;
OpenSim.Framework.Lazy<List<SceneObjectPart>> ObjectAnimationUpdates = new OpenSim.Framework.Lazy<List<SceneObjectPart>>(); List<EntityUpdate> objectUpdates = null;
List<EntityUpdate> compressedUpdates = null;
List<EntityUpdate> terseUpdates = null;
List<EntityUpdate> terseAgentUpdates = null;
List<SceneObjectPart> ObjectAnimationUpdates = null;
// Check to see if this is a flush // Check to see if this is a flush
if (maxUpdatesBytes <= 0) if (maxUpdatesBytes <= 0)
@ -4284,7 +4282,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SceneObjectPart sop = (SceneObjectPart)update.Entity; SceneObjectPart sop = (SceneObjectPart)update.Entity;
if ( sop.Animations != null) if ( sop.Animations != null)
{ {
ObjectAnimationUpdates.Value.Add(sop); if(ObjectAnimationUpdates == null)
ObjectAnimationUpdates = new List<SceneObjectPart>();
ObjectAnimationUpdates.Add(sop);
maxUpdatesBytes -= 32 * sop.Animations.Count + 16; maxUpdatesBytes -= 32 * sop.Animations.Count + 16;
} }
} }
@ -4344,14 +4344,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (update.Entity is ScenePresence) if (update.Entity is ScenePresence)
{ {
// ALL presence updates go into a special list // ALL presence updates go into a special list
if (terseAgentUpdateBlocks == null)
{
terseAgentUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
terseAgentUpdates = new List<EntityUpdate>();
}
terseAgentUpdateBlocks.Add(ablock); terseAgentUpdateBlocks.Add(ablock);
terseAgentUpdates.Value.Add(update); terseAgentUpdates.Add(update);
} }
else else
{ {
// Everything else goes here // Everything else goes here
if (terseAgentUpdateBlocks == null)
{
terseAgentUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
terseAgentUpdates = new List<EntityUpdate>();
}
terseUpdateBlocks.Add(ablock); terseUpdateBlocks.Add(ablock);
terseUpdates.Value.Add(update); terseUpdates.Add(update);
} }
maxUpdatesBytes -= ablock.Length; maxUpdatesBytes -= ablock.Length;
} }
@ -4362,8 +4372,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
else else
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp); ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
if(objectUpdateBlocks == null)
{
objectUpdateBlocks = new List<ObjectUpdatePacket.ObjectDataBlock>();
objectUpdates = new List<EntityUpdate>();
}
objectUpdateBlocks.Add(ablock); objectUpdateBlocks.Add(ablock);
objectUpdates.Value.Add(update); objectUpdates.Add(update);
maxUpdatesBytes -= ablock.Length; maxUpdatesBytes -= ablock.Length;
} }
@ -4379,7 +4394,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
if (terseAgentUpdateBlocks.Count > 0) if (terseAgentUpdateBlocks!= null)
{ {
ImprovedTerseObjectUpdatePacket packet ImprovedTerseObjectUpdatePacket packet
= (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
@ -4388,10 +4403,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.ObjectData = terseAgentUpdateBlocks.ToArray(); packet.ObjectData = terseAgentUpdateBlocks.ToArray();
terseAgentUpdateBlocks.Clear(); terseAgentUpdateBlocks.Clear();
OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates, oPacket); });
} }
if (objectUpdateBlocks.Count > 0) if (objectUpdateBlocks != null)
{ {
ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
@ -4399,10 +4414,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.ObjectData = objectUpdateBlocks.ToArray(); packet.ObjectData = objectUpdateBlocks.ToArray();
objectUpdateBlocks.Clear(); objectUpdateBlocks.Clear();
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates, oPacket); });
} }
if (compressedUpdateBlocks.Count > 0) if (compressedUpdateBlocks != null)
{ {
ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
@ -4410,10 +4425,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.ObjectData = compressedUpdateBlocks.ToArray(); packet.ObjectData = compressedUpdateBlocks.ToArray();
compressedUpdateBlocks.Clear(); compressedUpdateBlocks.Clear();
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates, oPacket); });
} }
if (terseUpdateBlocks.Count > 0) if (terseUpdateBlocks != null)
{ {
ImprovedTerseObjectUpdatePacket packet = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( ImprovedTerseObjectUpdatePacket packet = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
PacketType.ImprovedTerseObjectUpdate); PacketType.ImprovedTerseObjectUpdate);
@ -4422,10 +4437,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.ObjectData = terseUpdateBlocks.ToArray(); packet.ObjectData = terseUpdateBlocks.ToArray();
terseUpdateBlocks.Clear(); terseUpdateBlocks.Clear();
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates, oPacket); });
} }
foreach (SceneObjectPart sop in ObjectAnimationUpdates.Value) if(ObjectAnimationUpdates != null)
{
foreach (SceneObjectPart sop in ObjectAnimationUpdates)
{ {
if (sop.Animations == null) if (sop.Animations == null)
continue; continue;
@ -4454,7 +4471,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ani.AnimationList[i].AnimID = ids[i]; ani.AnimationList[i].AnimID = ids[i];
ani.AnimationList[i].AnimSequenceID = seqs[i]; ani.AnimationList[i].AnimSequenceID = seqs[i];
} }
OutPacket(ani, ThrottleOutPacketType.Task); OutPacket(ani, ThrottleOutPacketType.Task, true);
}
} }
#endregion Packet Sending #endregion Packet Sending
@ -5750,14 +5768,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Don't send texture entry for avatars here - this is accomplished via the AvatarAppearance packet // Don't send texture entry for avatars here - this is accomplished via the AvatarAppearance packet
update.TextureEntry = Utils.EmptyBytes; update.TextureEntry = Utils.EmptyBytes;
// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes;
/* all this flags seem related to prims and not avatars. This allow for wrong viewer side move of a avatar in prim edition mode (anv mantis 854)
update.UpdateFlags = (uint)(
PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner |
PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer |
PrimFlags.ObjectOwnerModify);
*/
update.UpdateFlags = 0; update.UpdateFlags = 0;
return update; return update;

View File

@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes.Types;
using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModules.SharedBase;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
namespace OpenSim.Region.Framework.Scenes namespace OpenSim.Region.Framework.Scenes
{ {