From 52afd8588d07cc063e4a7e0fe9ace129de1e7a7a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 19 Aug 2016 17:49:59 +0100 Subject: fix updates resend by reEnqueing, that got broken down the line --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f580e5a..78043bd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4221,26 +4221,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!canUseImproved && !canUseCompressed) { + ObjectUpdatePacket.ObjectDataBlock ablock; if (update.Entity is ScenePresence) - { - ObjectUpdatePacket.ObjectDataBlock ablock = - CreateAvatarUpdateBlock((ScenePresence)update.Entity); - objectUpdateBlocks.Value.Add(ablock); - maxUpdatesBytes -= ablock.Length; - } + ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); else - { - ObjectUpdatePacket.ObjectDataBlock ablock = - CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); - objectUpdateBlocks.Value.Add(ablock); - maxUpdatesBytes -= ablock.Length; - } + ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); + objectUpdateBlocks.Value.Add(ablock); + objectUpdates.Value.Add(update); + maxUpdatesBytes -= ablock.Length; + } else if (!canUseImproved) { ObjectUpdateCompressedPacket.ObjectDataBlock ablock = CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags); compressedUpdateBlocks.Value.Add(ablock); + compressedUpdates.Value.Add(update); maxUpdatesBytes -= ablock.Length; } else @@ -4251,6 +4247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); terseAgentUpdateBlocks.Value.Add(ablock); + terseAgentUpdates.Value.Add(update); maxUpdatesBytes -= ablock.Length; } else @@ -4259,6 +4256,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); terseUpdateBlocks.Value.Add(ablock); + terseUpdates.Value.Add(update); maxUpdatesBytes -= ablock.Length; } } @@ -4290,7 +4288,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); + OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); } if (objectUpdateBlocks.IsValueCreated) @@ -4305,7 +4303,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true); + OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); } if (compressedUpdateBlocks.IsValueCreated) @@ -4320,7 +4318,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true); + OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); } if (terseUpdateBlocks.IsValueCreated) -- cgit v1.1 From 991dd5f4712f7f6b61b4953f3f388f85992db67b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Aug 2016 06:56:13 +0100 Subject: first step changing Object Select code --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 117 +++++---------------- 1 file changed, 28 insertions(+), 89 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 78043bd..5b39cc5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2882,18 +2882,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAsset(AssetRequestToClient req) { + if (req.AssetInf == null) + { + m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset is null", + LogHeader); + return; + } + if (req.AssetInf.Data == null) { m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } + int WearableOut = 0; bool isWearable = false; - if (req.AssetInf != null) - isWearable = - ((AssetType) req.AssetInf.Type == + isWearable = ((AssetType) req.AssetInf.Type == AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); @@ -3013,7 +3019,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ParcelID = parcelID; reply.Data.OwnerID = land.OwnerID; reply.Data.Name = Utils.StringToBytes(land.Name); - if (land != null && land.Description != null && land.Description != String.Empty) + if (land.Description != null && land.Description != String.Empty) reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); else reply.Data.Desc = new Byte[0]; @@ -4241,24 +4247,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { + ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock; if (update.Entity is ScenePresence) { // ALL presence updates go into a special list - ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = - CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); + ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); terseAgentUpdateBlocks.Value.Add(ablock); terseAgentUpdates.Value.Add(update); - maxUpdatesBytes -= ablock.Length; } else { // Everything else goes here - ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = - CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); + ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); terseUpdateBlocks.Value.Add(ablock); terseUpdates.Value.Add(update); - maxUpdatesBytes -= ablock.Length; } + maxUpdatesBytes -= ablock.Length; } #endregion Block Construction @@ -5442,22 +5446,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP Quaternion rotation; byte[] textureEntry; - if (entity is ScenePresence) + if (avatar) { ScenePresence presence = (ScenePresence)entity; position = presence.OffsetPosition; + velocity = presence.Velocity; + acceleration = Vector3.Zero; rotation = presence.Rotation; angularVelocity = presence.AngularVelocity; - rotation = presence.Rotation; // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); attachPoint = presence.State; collisionPlane = presence.CollisionPlane; - velocity = presence.Velocity; - acceleration = Vector3.Zero; if (sendTexture) { @@ -7708,20 +7711,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } #endregion - + List thisSelection = new List(); ObjectSelect handlerObjectSelect = null; uint objID; - for (int i = 0; i < incomingselect.ObjectData.Length; i++) + handlerObjectSelect = OnObjectSelect; + if (handlerObjectSelect != null) { - objID = incomingselect.ObjectData[i].ObjectLocalID; - if (!SelectedObjects.Contains(objID)) - SelectedObjects.Add(objID); - - handlerObjectSelect = OnObjectSelect; - if (handlerObjectSelect != null) + for (int i = 0; i < incomingselect.ObjectData.Length; i++) { - handlerObjectSelect(objID, this); + objID = incomingselect.ObjectData[i].ObjectLocalID; + if (!SelectedObjects.Contains(objID)) + SelectedObjects.Add(objID); + thisSelection.Add(objID); } + + handlerObjectSelect(thisSelection, this); } return true; } @@ -7967,6 +7971,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP touchArgs.Add(arg); } } + handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, grabUpdate.ObjectData.GrabPosition, this, touchArgs); } @@ -12407,72 +12412,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// /// - // TODO: Convert old handler to use new method -/* - protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) - { - AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; - AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); - - if (cachedtex.AgentData.SessionID != SessionId) - return false; - - - - // TODO: don't create new blocks if recycling an old packet - cachedresp.AgentData.AgentID = AgentId; - cachedresp.AgentData.SessionID = m_sessionId; - cachedresp.AgentData.SerialNum = m_cachedTextureSerial; - m_cachedTextureSerial++; - cachedresp.WearableData = - new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; - - int maxWearablesLoop = cachedtex.WearableData.Length; - if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) - maxWearablesLoop = AvatarWearable.MAX_WEARABLES; - - // Find the cached baked textures for this user, if they're available - - IAssetService cache = m_scene.AssetService; - IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); - - WearableCacheItem[] cacheItems = null; - - if (bakedTextureModule != null && cache != null) - { - ScenePresence p = m_scene.GetScenePresence(AgentId); - if (p.Appearance != null) - { - if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) - { - try - { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; - } - catch (Exception) - { - cacheItems = null; - } - - } - else if (p.Appearance.WearableCacheItems != null) - { - cacheItems = p.Appearance.WearableCacheItems; - } - } - } - - CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; - if (handlerCachedTextureRequest != null) - { - handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); - } - - return true; - } -*/ protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) { -- cgit v1.1 From 90fc4183dcad341f9e77c08069ec890bbbd61f80 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Aug 2016 07:12:50 +0100 Subject: suspend the use of SelectedObjects list. It is not threadSafe and is not in use (possible cant even be used) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5b39cc5..47869bd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7720,8 +7720,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < incomingselect.ObjectData.Length; i++) { objID = incomingselect.ObjectData[i].ObjectLocalID; - if (!SelectedObjects.Contains(objID)) - SelectedObjects.Add(objID); thisSelection.Add(objID); } @@ -7748,8 +7746,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) { objID = incomingdeselect.ObjectData[i].ObjectLocalID; - if (SelectedObjects.Contains(objID)) - SelectedObjects.Remove(objID); handlerObjectDeselect = OnObjectDeselect; if (handlerObjectDeselect != null) -- cgit v1.1 From d5f376a4b10ffdb5acc17d4e350a0a523ba0e9f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Aug 2016 09:51:34 +0100 Subject: send selected objects Proprieties udp part outside update queues and as a physics single caps message per selection request --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 47869bd..fad250b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2801,6 +2801,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendAgentGroupDataUpdate(AgentId,GroupMembership); } + public void SendSelectedPartsProprieties(List parts) + { + // udp part + ObjectPropertiesPacket packet = + (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); + ObjectPropertiesPacket.ObjectDataBlock[] ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[parts.Count]; + + int i = 0; + foreach(SceneObjectPart sop in parts) + ObjectData[i++] = CreateObjectPropertiesBlock(sop); + + packet.ObjectData = ObjectData; + packet.Header.Zerocoded = true; + // udp send splits this mega packets correctly + // mb later will avoid that to reduce gc stress + OutPacket(packet, ThrottleOutPacketType.Task, true); + + // caps physics part + IEventQueue eq = Scene.RequestModuleInterface(); + if(eq == null) + return; + + OSDArray array = new OSDArray(); + foreach(SceneObjectPart sop in parts) + { + OSDMap physinfo = new OSDMap(6); + physinfo["LocalID"] = sop.LocalId; + physinfo["Density"] = sop.Density; + physinfo["Friction"] = sop.Friction; + physinfo["GravityMultiplier"] = sop.GravityModifier; + physinfo["Restitution"] = sop.Restitution; + physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType; + array.Add(physinfo); + } + + OSDMap llsdBody = new OSDMap(1); + llsdBody.Add("ObjectData", array); + + eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); + } + + public void SendPartPhysicsProprieties(ISceneEntity entity) { SceneObjectPart part = (SceneObjectPart)entity; -- cgit v1.1