From 1b8999b1300b7b9cb17d610c677496114b650d5a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Mar 2019 11:14:59 +0000 Subject: try to work around robust shutdown/quit blocking on mono --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 14e21a2..790aa99 100755 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -309,7 +309,8 @@ namespace OpenSim.Framework.Servers.HttpServer { Thread.ResetAbort(); // Shouldn't set this to 'false', the normal shutdown should cause things to exit - // m_running = false; + // but robust is still not normal neither is mono + m_running = false; } catch (Exception e) { -- cgit v1.1 From b82337de09b5e1e18f1df17cfe0c2123f062347f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Mar 2019 11:48:17 +0000 Subject: Robust: to tell main httpserver to stop on shutdown --- OpenSim/Server/Base/ServicesServerBase.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 900327a..422a8bc 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -250,6 +250,8 @@ namespace OpenSim.Server.Base } } + MainServer.Stop(); + MemoryWatchdog.Enabled = false; Watchdog.Enabled = false; WorkManager.Stop(); -- cgit v1.1 From f143dbc23fc5984728d32602f9602a4fcda35577 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Mar 2019 17:11:23 +0000 Subject: lludp direct encode object Properties update packets --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 327 +++++++++++++-------- 1 file changed, 199 insertions(+), 128 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ac041f5..181c4e2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5121,14 +5121,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,0,false,true)); } + static private readonly byte[] ObjectPropertyUpdateHeader = new byte[] { + Helpers.MSG_RELIABLE | Helpers.MSG_ZEROCODED, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 9 // ID (medium frequency) + }; + + static private readonly byte[] ObjectFamilyUpdateHeader = new byte[] { + Helpers.MSG_RELIABLE | Helpers.MSG_ZEROCODED, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 10 // ID (medium frequency) + }; + private void ProcessEntityPropertyRequests(int maxUpdateBytes) { - List<ObjectPropertiesFamilyPacket.ObjectDataBlock> objectFamilyBlocks = null; - List<ObjectPropertiesPacket.ObjectDataBlock> objectPropertiesBlocks = null; + List<ObjectPropertyUpdate> objectPropertiesUpdates = null; + List<ObjectPropertyUpdate> objectPropertiesFamilyUpdates = null; List<SceneObjectPart> needPhysics = null; - bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; - + // bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; + bool orderedDequeue = false; // for now EntityUpdate iupdate; while (maxUpdateBytes > 0) @@ -5153,11 +5167,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (update.Entity is SceneObjectPart) { SceneObjectPart sop = (SceneObjectPart)update.Entity; - ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesFamilyBlock(sop,update.Flags); - if(objectFamilyBlocks == null) - objectFamilyBlocks = new List<ObjectPropertiesFamilyPacket.ObjectDataBlock>(); - objectFamilyBlocks.Add(objPropDB); - maxUpdateBytes -= objPropDB.Length; + if(objectPropertiesFamilyUpdates == null) + objectPropertiesFamilyUpdates = new List<ObjectPropertyUpdate>(); + objectPropertiesFamilyUpdates.Add(update); + maxUpdateBytes -= 100; } } @@ -5169,58 +5182,107 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(needPhysics == null) needPhysics = new List<SceneObjectPart>(); needPhysics.Add(sop); - ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); - if(objectPropertiesBlocks == null) - objectPropertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); - objectPropertiesBlocks.Add(objPropDB); - maxUpdateBytes -= objPropDB.Length; + if(objectPropertiesUpdates == null) + objectPropertiesUpdates = new List<ObjectPropertyUpdate>(); + objectPropertiesUpdates.Add(update); + maxUpdateBytes -= 200; // aprox } } } - if (objectPropertiesBlocks != null) + if (objectPropertiesUpdates != null) { - ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); - packet.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[objectPropertiesBlocks.Count]; - for (int i = 0; i < objectPropertiesBlocks.Count; i++) - packet.ObjectData[i] = objectPropertiesBlocks[i]; + int blocks = objectPropertiesUpdates.Count; + //List<EntityUpdate> tau = new List<EntityUpdate>(30); - // Pass in the delegate so that if this packet needs to be resent, we send the current properties - // of the object rather than the properties when the packet was created - // HACK : Remove intelligent resending until it's fixed in core - //OutPacket(packet, ThrottleOutPacketType.Task, true, - // delegate(OutgoingPacket oPacket) - // { - // ResendPropertyUpdates(propertyUpdates.Value, oPacket); - // }); - OutPacket(packet, ThrottleOutPacketType.Task, true); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(ObjectPropertyUpdateHeader, 0, buf.Data, 0, 8); + + LLUDPZeroEncoder zc = new LLUDPZeroEncoder(buf.Data); + zc.Position = 8; + + zc.AddByte(1); // tmp block count + + int countposition = zc.Position - 1; + + int lastpos = 0; + int lastzc = 0; + + int count = 0; + foreach (EntityUpdate eu in objectPropertiesUpdates) + { + lastpos = zc.Position; + lastzc = zc.ZeroCount; + CreateObjectPropertiesBlock((SceneObjectPart)eu.Entity, zc); + if (zc.Position < LLUDPServer.MAXPAYLOAD) + { + //tau.Add(eu); + ++count; + --blocks; + } + else if (blocks > 0) + { + // we need more packets + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(buf.Data, 0, newbuf.Data, 0, countposition); // start is the same + + buf.Data[countposition] = (byte)count; + // get pending zeros at cut point + if (lastzc > 0) + { + buf.Data[lastpos++] = 0; + buf.Data[lastpos++] = (byte)lastzc; + } + buf.DataLength = lastpos; + + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, + // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + buf = newbuf; + zc.Data = buf.Data; + zc.ZeroCount = 0; + zc.Position = countposition + 1; + // im lazy now, just do last again + CreateObjectPropertiesBlock((SceneObjectPart)eu.Entity, zc); + + //tau = new List<EntityUpdate>(30); + //tau.Add(eu); + count = 1; + --blocks; + } + } + + if (count > 0) + { + buf.Data[countposition] = (byte)count; + buf.DataLength = zc.Finish(); + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, + // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + } } - if (objectFamilyBlocks != null) + if (objectPropertiesFamilyUpdates != null) { - // one packet per object block... uggh... - for (int i = 0; i < objectFamilyBlocks.Count; i++) + foreach (EntityUpdate eu in objectPropertiesFamilyUpdates) { - ObjectPropertiesFamilyPacket packet = - (ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(ObjectFamilyUpdateHeader, 0, buf.Data, 0, 8); - packet.ObjectData = objectFamilyBlocks[i]; + LLUDPZeroEncoder zc = new LLUDPZeroEncoder(buf.Data); + zc.Position = 8; - // Pass in the delegate so that if this packet needs to be resent, we send the current properties - // of the object rather than the properties when the packet was created -// List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); -// updates.Add(familyUpdates.Value[i]); - // HACK : Remove intelligent resending until it's fixed in core - //OutPacket(packet, ThrottleOutPacketType.Task, true, - // delegate(OutgoingPacket oPacket) - // { - // ResendPropertyUpdates(updates, oPacket); - // }); - OutPacket(packet, ThrottleOutPacketType.Task, true); + CreateObjectPropertiesFamilyBlock((SceneObjectPart)eu.Entity, eu.Flags, zc); + buf.DataLength = zc.Finish(); + //List<EntityUpdate> tau = new List<EntityUpdate>(1); + //tau.Add(new ObjectPropertyUpdate((ISceneEntity) eu, (uint)eu.Flags, true, false)); + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, + // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); } } - if(needPhysics != null) + if (needPhysics != null) { IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); if(eq != null) @@ -5245,101 +5307,110 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private ObjectPropertiesFamilyPacket.ObjectDataBlock CreateObjectPropertiesFamilyBlock(SceneObjectPart sop, PrimUpdateFlags requestFlags) + private void CreateObjectPropertiesFamilyBlock(SceneObjectPart sop, PrimUpdateFlags requestFlags, LLUDPZeroEncoder zc) { - ObjectPropertiesFamilyPacket.ObjectDataBlock block = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); + SceneObjectPart root = sop.ParentGroup.RootPart; - block.RequestFlags = (uint)requestFlags; - block.ObjectID = sop.UUID; + zc.AddUInt((uint)requestFlags); + zc.AddUUID(sop.UUID); if (sop.OwnerID == sop.GroupID) - block.OwnerID = UUID.Zero; + zc.AddZeros(16); else - block.OwnerID = sop.OwnerID; - block.GroupID = sop.GroupID; - block.BaseMask = sop.BaseMask; - block.OwnerMask = sop.OwnerMask; - block.GroupMask = sop.GroupMask; - block.EveryoneMask = sop.EveryoneMask; - block.NextOwnerMask = sop.NextOwnerMask; - - // TODO: More properties are needed in SceneObjectPart! - block.OwnershipCost = sop.OwnershipCost; - block.SaleType = sop.ObjectSaleType; - block.SalePrice = sop.SalePrice; - block.Category = sop.Category; - block.LastOwnerID = sop.LastOwnerID; - block.Name = Util.StringToBytes256(sop.Name); - block.Description = Util.StringToBytes256(sop.Description); + zc.AddUUID(sop.OwnerID); + zc.AddUUID(sop.GroupID); - return block; - } + zc.AddUInt(root.BaseMask); + zc.AddUInt(root.OwnerMask); + zc.AddUInt(root.GroupMask); + zc.AddUInt(root.EveryoneMask); + zc.AddUInt(root.NextOwnerMask); - private ObjectPropertiesPacket.ObjectDataBlock CreateObjectPropertiesBlock(SceneObjectPart sop) - { - //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); - // TODO: don't create new blocks if recycling an old packet + zc.AddZeros(4); // int ownership cost - ObjectPropertiesPacket.ObjectDataBlock block = - new ObjectPropertiesPacket.ObjectDataBlock(); + //sale info block + zc.AddByte(root.ObjectSaleType); + zc.AddInt(root.SalePrice); - block.ObjectID = sop.UUID; - block.Name = Util.StringToBytes256(sop.Name); - block.Description = Util.StringToBytes256(sop.Description); + zc.AddUInt(sop.Category); //Category - block.CreationDate = (ulong)sop.CreationDate * 1000000; // viewer wants date in microseconds - block.CreatorID = sop.CreatorID; - block.GroupID = sop.GroupID; - block.LastOwnerID = sop.LastOwnerID; - if (sop.OwnerID == sop.GroupID) - block.OwnerID = UUID.Zero; - else - block.OwnerID = sop.OwnerID; + zc.AddUUID(sop.LastOwnerID); - block.ItemID = sop.FromUserInventoryItemID; - block.FolderID = UUID.Zero; // sog.FromFolderID ?? - block.FromTaskID = UUID.Zero; // ??? - block.InventorySerial = (short)sop.InventorySerial; + //name + byte[] tmpbytes = Util.StringToBytes256(sop.Name); + zc.AddByte((byte)tmpbytes.Length); + zc.AddBytes(tmpbytes, tmpbytes.Length); - SceneObjectPart root = sop.ParentGroup.RootPart; - - block.TouchName = Util.StringToBytes256(root.TouchName); + //Description + tmpbytes = Util.StringToBytes256(sop.Description); + zc.AddByte((byte)tmpbytes.Length); + zc.AddBytes(tmpbytes, tmpbytes.Length); + } - // SL 3.3.4, at least, appears to read this information as a concatenated byte[] stream of UUIDs but - // it's not yet clear whether this is actually used. If this is done in the future then a pre-cached - // copy is really needed since it's less efficient to be constantly recreating this byte array. -// using (MemoryStream memStream = new MemoryStream()) -// { -// using (BinaryWriter binWriter = new BinaryWriter(memStream)) -// { -// for (int i = 0; i < sop.GetNumberOfSides(); i++) -// { -// Primitive.TextureEntryFace teFace = sop.Shape.Textures.FaceTextures[i]; -// -// UUID textureID; -// -// if (teFace != null) -// textureID = teFace.TextureID; -// else -// textureID = sop.Shape.Textures.DefaultTexture.TextureID; -// -// binWriter.Write(textureID.GetBytes()); -// } -// -// block.TextureID = memStream.ToArray(); -// } -// } - - block.TextureID = new byte[0]; // TextureID ??? - block.SitName = Util.StringToBytes256(root.SitName); - block.OwnerMask = root.OwnerMask; - block.NextOwnerMask = root.NextOwnerMask; - block.GroupMask = root.GroupMask; - block.EveryoneMask = root.EveryoneMask; - block.BaseMask = root.BaseMask; - block.SaleType = root.ObjectSaleType; - block.SalePrice = root.SalePrice; + private void CreateObjectPropertiesBlock(SceneObjectPart sop, LLUDPZeroEncoder zc) + { + SceneObjectPart root = sop.ParentGroup.RootPart; - return block; + zc.AddUUID(sop.UUID); + zc.AddUUID(sop.CreatorID); + if (sop.OwnerID == sop.GroupID) + zc.AddZeros(16); + else + zc.AddUUID(sop.OwnerID); + zc.AddUUID(sop.GroupID); + + zc.AddUInt64((ulong)sop.CreationDate * 1000000UL); + + zc.AddUInt(root.BaseMask); + zc.AddUInt(root.OwnerMask); + zc.AddUInt(root.GroupMask); + zc.AddUInt(root.EveryoneMask); + zc.AddUInt(root.NextOwnerMask); + + zc.AddZeros(4); // int ownership cost + + //sale info block + zc.AddByte(root.ObjectSaleType); + zc.AddInt(root.SalePrice); + + //aggregated perms we may will need to fix this + zc.AddByte(0); //AggregatePerms + zc.AddByte(0); //AggregatePermTextures; + zc.AddByte(0); //AggregatePermTexturesOwner + + //inventory info + zc.AddUInt(sop.Category); //Category + zc.AddInt16((short)sop.InventorySerial); + zc.AddUUID(sop.FromUserInventoryItemID); + zc.AddUUID(UUID.Zero); //FolderID + zc.AddUUID(UUID.Zero); //FromTaskID + + zc.AddUUID(sop.LastOwnerID); + + //name + byte[] tmpbytes = Util.StringToBytes256(sop.Name); + zc.AddByte((byte)tmpbytes.Length); + zc.AddBytes(tmpbytes, tmpbytes.Length); + + //Description + tmpbytes = Util.StringToBytes256(sop.Description); + zc.AddByte((byte)tmpbytes.Length); + zc.AddBytes(tmpbytes, tmpbytes.Length); + + // touch name + tmpbytes = Util.StringToBytes256(root.TouchName); + zc.AddByte((byte)tmpbytes.Length); + zc.AddBytes(tmpbytes, tmpbytes.Length); + + // sit name + tmpbytes = Util.StringToBytes256(root.SitName); + zc.AddByte((byte)tmpbytes.Length); + zc.AddBytes(tmpbytes, tmpbytes.Length); + + //texture ids block + // still not sending, not clear the impact on viewers, if any. + // does seem redundant + // to send we will need proper list of face texture ids without having to unpack texture entry all the time + zc.AddZeros(1); } #region Estate Data Sending Methods -- cgit v1.1 From 46dc9ebd4e9fa6deb218b9ebc0d95b63a2f08826 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Mar 2019 18:08:05 +0000 Subject: lludp: change zero encode of strings; limit them to what current viewers expect --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 180 +-------------------- .../ClientStack/Linden/UDP/LLUDPZeroEncoder.cs | 82 ++++++++++ 2 files changed, 90 insertions(+), 172 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 181c4e2..cb2d9e2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5336,14 +5336,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddUUID(sop.LastOwnerID); //name - byte[] tmpbytes = Util.StringToBytes256(sop.Name); - zc.AddByte((byte)tmpbytes.Length); - zc.AddBytes(tmpbytes, tmpbytes.Length); + zc.AddShortString(sop.Name, 64); //Description - tmpbytes = Util.StringToBytes256(sop.Description); - zc.AddByte((byte)tmpbytes.Length); - zc.AddBytes(tmpbytes, tmpbytes.Length); + zc.AddShortString(sop.Description, 128); } private void CreateObjectPropertiesBlock(SceneObjectPart sop, LLUDPZeroEncoder zc) @@ -5387,24 +5383,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddUUID(sop.LastOwnerID); //name - byte[] tmpbytes = Util.StringToBytes256(sop.Name); - zc.AddByte((byte)tmpbytes.Length); - zc.AddBytes(tmpbytes, tmpbytes.Length); + zc.AddShortString(sop.Name, 64); //Description - tmpbytes = Util.StringToBytes256(sop.Description); - zc.AddByte((byte)tmpbytes.Length); - zc.AddBytes(tmpbytes, tmpbytes.Length); + zc.AddShortString(sop.Description, 128); // touch name - tmpbytes = Util.StringToBytes256(root.TouchName); - zc.AddByte((byte)tmpbytes.Length); - zc.AddBytes(tmpbytes, tmpbytes.Length); + zc.AddShortString(root.TouchName, 9, 37); // sit name - tmpbytes = Util.StringToBytes256(root.SitName); - zc.AddByte((byte)tmpbytes.Length); - zc.AddBytes(tmpbytes, tmpbytes.Length); + zc.AddShortString(root.SitName, 9, 37); //texture ids block // still not sending, not clear the impact on viewers, if any. @@ -6349,150 +6337,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddZeros(lastzeros); } - protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp) - { - byte[] objectData = new byte[60]; - part.RelativePosition.ToBytes(objectData, 0); - part.Velocity.ToBytes(objectData, 12); - part.Acceleration.ToBytes(objectData, 24); - - Quaternion rotation = part.RotationOffset; - rotation.Normalize(); - rotation.ToBytes(objectData, 36); - part.AngularVelocity.ToBytes(objectData, 48); - - ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); - update.ClickAction = (byte)part.ClickAction; - update.CRC = 0; - update.ExtraParams = part.Shape.ExtraParams ?? Utils.EmptyBytes; - update.FullID = part.UUID; - update.ID = part.LocalId; - //update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated - //update.JointPivot = Vector3.Zero; - //update.JointType = 0; - update.Material = part.Material; - - if (part.ParentGroup.IsAttachment) - { - if (part.IsRoot) - { - update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID); - } - else - update.NameValue = Utils.EmptyBytes; - - int st = (int)part.ParentGroup.AttachmentPoint; - update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; - } - else - { - update.NameValue = Utils.EmptyBytes; - update.State = part.Shape.State; // not sure about this - } - - update.ObjectData = objectData; - update.ParentID = part.ParentID; - update.PathBegin = part.Shape.PathBegin; - update.PathCurve = part.Shape.PathCurve; - update.PathEnd = part.Shape.PathEnd; - update.PathRadiusOffset = part.Shape.PathRadiusOffset; - update.PathRevolutions = part.Shape.PathRevolutions; - update.PathScaleX = part.Shape.PathScaleX; - update.PathScaleY = part.Shape.PathScaleY; - update.PathShearX = part.Shape.PathShearX; - update.PathShearY = part.Shape.PathShearY; - update.PathSkew = part.Shape.PathSkew; - update.PathTaperX = part.Shape.PathTaperX; - update.PathTaperY = part.Shape.PathTaperY; - update.PathTwist = part.Shape.PathTwist; - update.PathTwistBegin = part.Shape.PathTwistBegin; - update.PCode = part.Shape.PCode; - update.ProfileBegin = part.Shape.ProfileBegin; - update.ProfileCurve = part.Shape.ProfileCurve; - - ushort profileBegin = part.Shape.ProfileBegin; - ushort profileHollow = part.Shape.ProfileHollow; - - if(part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack - { - update.ProfileCurve = (byte)(part.Shape.ProfileCurve & 0x0f); - // fix old values that confused viewers - if(profileBegin == 1) - profileBegin = 9375; - if(profileHollow == 1) - profileHollow = 27500; - // fix torus hole size Y that also confuse some viewers - if(update.ProfileCurve == (byte)ProfileShape.Circle && update.PathScaleY < 150) - update.PathScaleY = 150; - } - else - { - update.ProfileCurve = part.Shape.ProfileCurve; - } - - update.ProfileHollow = profileHollow; - update.ProfileBegin = profileBegin; - update.ProfileEnd = part.Shape.ProfileEnd; - update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes; - update.TextColor = part.GetTextColor().GetBytes(false); - update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes; - update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes; - update.Scale = part.Shape.Scale; - update.Text = Util.StringToBytes(part.Text, 255); - update.MediaURL = Util.StringToBytes(part.MediaUrl, 255); - - #region PrimFlags - - PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp); - - // Don't send the CreateSelected flag to everyone - flags &= ~PrimFlags.CreateSelected; - - if (sp.UUID == part.OwnerID) - { - if (part.CreateSelected) - { - // Only send this flag once, then unset it - flags |= PrimFlags.CreateSelected; - part.CreateSelected = false; - } - } - -// m_log.DebugFormat( -// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", -// data.Name, update.FullID, flags, update.ID); - - update.UpdateFlags = (uint)flags; - - #endregion PrimFlags - - bool hassound = part.Sound != UUID.Zero || part.SoundFlags != 0; - if (hassound) - { - update.Sound = part.Sound; - update.Gain = (float)part.SoundGain; - update.Radius = (float)part.SoundRadius; - update.Flags = part.SoundFlags; - } - - if(hassound || update.PSBlock.Length > 1) - update.OwnerID = part.OwnerID; - - switch ((PCode)part.Shape.PCode) - { - case PCode.Grass: - case PCode.Tree: - case PCode.NewTree: - update.Data = new byte[] { part.Shape.State }; - break; - default: - update.Data = Utils.EmptyBytes; - break; - } - - return update; - } - protected void CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp, LLUDPZeroEncoder zc) { // prepare data @@ -6725,10 +6569,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddZeros(5); else { - byte[] tbuf = Util.StringToBytes(part.Text, 254); - int len = tbuf.Length; - zc.AddByte((byte)len); - zc.AddBytes(tbuf, len); + zc.AddShortString(part.Text, 255); //textcolor byte[] tc = part.GetTextColor().GetBytes(false); @@ -6739,12 +6580,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part.MediaUrl == null || part.MediaUrl.Length == 0) zc.AddZeros(1); else - { - byte[] tbuf = Util.StringToBytes(part.MediaUrl, 255); - int len = tbuf.Length; - zc.AddByte((byte)len); - zc.AddBytes(tbuf, len); - } + zc.AddShortString(part.MediaUrl, 255); bool hasps = false; //particle system diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs index 8ed2cf1..0b008a9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs @@ -26,6 +26,7 @@ */ using System; +using System.Text; using OpenSim.Framework; using Nini.Config; using OpenMetaverse; @@ -275,5 +276,86 @@ namespace OpenSim.Region.ClientStack.LindenUDP v.ToBytes(m_tmp, 0); AddBytes(m_tmp, 16); } + + // maxlen <= 255 and includes null termination byte + public void AddShortString(string str, int maxlen) + { + if (String.IsNullOrEmpty(str)) + { + AddZeros(1); + return; + } + + --maxlen; // account for null term + bool NullTerm = str.EndsWith("\0"); + + byte[] data = Util.UTF8.GetBytes(str); + int len = data.Length; + if(NullTerm) + --len; + + if(len <= maxlen) + { + AddByte((byte)(len + 1)); + AddBytes(data, len); + AddZeros(1); + return; + } + + if ((data[maxlen] & 0x80) != 0) + { + while (maxlen > 0 && (data[maxlen] & 0xc0) != 0xc0) + maxlen--; + } + AddByte((byte)(maxlen + 1)); + AddBytes(data, maxlen); + AddZeros(1); + } + // maxlen <= 255 and includes null termination byte, maxchars == max len of utf8 source + public void AddShortString(string str, int maxchars, int maxlen) + { + if (String.IsNullOrEmpty(str)) + { + AddZeros(1); + return; + } + + --maxlen; // account for null term + bool NullTerm = false; + byte[] data; + + if (str.Length > maxchars) + { + data = Util.UTF8.GetBytes(str.Substring(0,maxchars)); + } + else + { + NullTerm = str.EndsWith("\0"); + data = Util.UTF8.GetBytes(str); + } + + int len = data.Length; + if (NullTerm) + --len; + + if (len <= maxlen) + { + AddByte((byte)(len + 1)); + AddBytes(data, len); + AddZeros(1); + return; + } + + if ((data[maxlen] & 0x80) != 0) + { + while (maxlen > 0 && (data[maxlen] & 0xc0) != 0xc0) + maxlen--; + } + + AddByte((byte)(maxlen + 1)); + AddBytes(data, maxlen); + AddZeros(1); + } + } } -- cgit v1.1 From e1c20a32ca414ce95e1f41e92956eab5ca17f342 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Mar 2019 18:17:50 +0000 Subject: LSL: limit sittext and touchtext to length current viewers cand display --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ab3562f..5dc6260 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7991,13 +7991,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetTouchText(string text) { m_host.AddScriptLPS(1); - m_host.TouchName = text; + if(text.Length <= 9) + m_host.TouchName = text; + else + m_host.TouchName = text.Substring(0, 9); } public void llSetSitText(string text) { m_host.AddScriptLPS(1); - m_host.SitName = text; + if (text.Length <= 9) + m_host.SitName = text; + else + m_host.SitName = text.Substring(0, 9); } public void llSetCameraEyeOffset(LSL_Vector offset) -- cgit v1.1 From 492ba8f644abf64704bcf35a4f3d3c7990833f00 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Mar 2019 19:21:44 +0000 Subject: minor cleanup --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 9 +------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 25 +--------------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index cb2d9e2..547c8a6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1815,14 +1815,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // An inventory descendents packet consists of a single agent section and an inventory details // section for each inventory item. The size of each inventory item is approximately 550 bytes. - // In theory, UDP has a maximum packet size of 64k, so it should be possible to send descendent - // packets containing metadata for in excess of 100 items. But in practice, there may be other - // factors (e.g. firewalls) restraining the maximum UDP packet size. See, - // - // http://opensimulator.org/mantis/view.php?id=226 - // - // for one example of this kind of thing. In fact, the Linden servers appear to only send about - // 6 to 7 items at a time, so let's stick with 6 + // limit to what may fit on MTU int MAX_ITEMS_PER_PACKET = 5; int MAX_FOLDERS_PER_PACKET = 6; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 2300800..780e8f8 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -279,11 +279,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// OnQueueEmpty event is triggered for textures</summary> public readonly int TextureSendLimit; - /// <summary>Handlers for incoming packets</summary> - //PacketEventDictionary packetEvents = new PacketEventDictionary(); - /// <summary>Incoming packets that are awaiting handling</summary> - //protected OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); - protected BlockingCollection<IncomingPacket> packetInbox = new BlockingCollection<IncomingPacket>(); /// <summary>Bandwidth throttle for this UDP server</summary> @@ -375,12 +370,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int IncomingOrphanedPacketCount { get; protected set; } /// <summary> - /// Queue some low priority but potentially high volume async requests so that they don't overwhelm available - /// threadpool threads. - /// </summary> -// public JobEngine IpahEngine { get; protected set; } - - /// <summary> /// Run queue empty processing within a single persistent thread. /// </summary> /// <remarks> @@ -557,12 +546,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Scene = (Scene)scene; m_location = new Location(Scene.RegionInfo.RegionHandle); -/* - IpahEngine - = new JobEngine( - string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name), - "INCOMING PACKET ASYNC HANDLING ENGINE"); -*/ + OqrEngine = new JobEngine( string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name), "OUTGOING QUEUE REFILL ENGINE"); @@ -844,13 +828,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP bool doZerocode = (data[0] & Helpers.MSG_ZEROCODED) != 0; bool doCopy = true; - // Frequency analysis of outgoing packet sizes shows a large clump of packets at each end of the spectrum. - // The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting - // there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here - // to accomodate for both common scenarios and provide ample room for ACK appending in both - //int bufferSize = (dataLength > 180) ? LLUDPServer.MTU : 200; - - //UDPPacketBuffer buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize); UDPPacketBuffer buffer = GetNewUDPBuffer(udpClient.RemoteEndPoint); // Zerocode if needed -- cgit v1.1 From 4a80802bec6574c54f534f83379a1b979dd9e20d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 00:38:49 +0000 Subject: lludp direct encode mapblockreply. Not bc its a high volume packet, but bc it needed work anyways --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 155 ++++++++++++++++----- 1 file changed, 117 insertions(+), 38 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 547c8a6..f2ebe2a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1561,56 +1561,135 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(newSimPack, ThrottleOutPacketType.Unknown); } - internal void SendMapBlockSplit(List<MapBlockData> mapBlocks, uint flag) + static private readonly byte[] MapBlockReplyHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 1, 153 // ID 409 (bigendian low frequency) + }; + + public void SendMapBlock(List<MapBlockData> mapBlocks, uint flags) { - MapBlockReplyPacket mapReply = (MapBlockReplyPacket)PacketPool.Instance.GetPacket(PacketType.MapBlockReply); - // TODO: don't create new blocks if recycling an old packet + int blocks = mapBlocks.Count; + ushort[] sizes = new ushort[2 * blocks]; + bool needSizes = false; + int sizesptr = 0; - MapBlockData[] mapBlocks2 = mapBlocks.ToArray(); + // check if we will need sizes block and get them aside + int count = 0; + ushort ut; + foreach (MapBlockData md in mapBlocks) + { + ut = md.SizeX; + sizes[count++] = ut; + if (ut > 256) + needSizes = true; - mapReply.AgentData.AgentID = AgentId; - mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks2.Length]; - mapReply.Size = new MapBlockReplyPacket.SizeBlock[mapBlocks2.Length]; - mapReply.AgentData.Flags = flag; - - for (int i = 0; i < mapBlocks2.Length; i++) - { - mapReply.Data[i] = new MapBlockReplyPacket.DataBlock(); - mapReply.Data[i].MapImageID = mapBlocks2[i].MapImageId; - //m_log.Warn(mapBlocks2[i].MapImageId.ToString()); - mapReply.Data[i].X = mapBlocks2[i].X; - mapReply.Data[i].Y = mapBlocks2[i].Y; - mapReply.Data[i].WaterHeight = mapBlocks2[i].WaterHeight; - mapReply.Data[i].Name = Utils.StringToBytes(mapBlocks2[i].Name); - mapReply.Data[i].RegionFlags = mapBlocks2[i].RegionFlags; - mapReply.Data[i].Access = mapBlocks2[i].Access; - mapReply.Data[i].Agents = mapBlocks2[i].Agents; - - mapReply.Size[i] = new MapBlockReplyPacket.SizeBlock(); - mapReply.Size[i].SizeX = mapBlocks2[i].SizeX; - mapReply.Size[i].SizeY = mapBlocks2[i].SizeY; + ut = md.SizeY; + sizes[count++] = ut; + if (ut > 256) + needSizes = true; } - OutPacket(mapReply, ThrottleOutPacketType.Land); - } - public void SendMapBlock(List<MapBlockData> mapBlocks, uint flag) - { - MapBlockData[] mapBlocks2 = mapBlocks.ToArray(); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; - int maxsend = 10; + //setup header and agentinfo block + Buffer.BlockCopy(MapBlockReplyHeader, 0, data, 0, 10); + AgentId.ToBytes(data, 10); // 26 + Utils.UIntToBytesSafepos(flags, data, 26); // 30 - //int packets = Math.Ceiling(mapBlocks2.Length / maxsend); + int countpos = 30; + int pos = 31; + int lastpos = 0; - List<MapBlockData> sendingBlocks = new List<MapBlockData>(); + int capacity = LLUDPServer.MAXPAYLOAD - pos; - for (int i = 0; i < mapBlocks2.Length; i++) + count = 0; + byte[] regionName = null; + + foreach (MapBlockData md in mapBlocks) { - sendingBlocks.Add(mapBlocks2[i]); - if (((i + 1) == mapBlocks2.Length) || (((i + 1) % maxsend) == 0)) + lastpos = pos; + + Utils.UInt16ToBytes(md.X, data, pos); pos += 2; + Utils.UInt16ToBytes(md.Y, data, pos); pos += 2; + regionName = Util.StringToBytes256(md.Name); + data[pos++] = (byte)regionName.Length; + if(regionName.Length > 0) + Buffer.BlockCopy(regionName, 0, data, pos, regionName.Length); pos += regionName.Length; + data[pos++] = md.Access; + Utils.UIntToBytesSafepos(md.RegionFlags, data, pos); pos += 4; + data[pos++] = md.WaterHeight; + data[pos++] = md.Agents; + md.MapImageId.ToBytes(data, pos); pos += 16; + + if(needSizes) + capacity -= 4; // 2 shorts per entry + + if(pos < capacity) { - SendMapBlockSplit(sendingBlocks, flag); - sendingBlocks = new List<MapBlockData>(); + ++count; + --blocks; } + else + { + // prepare next packet + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(MapBlockReplyHeader, 0, newbuf.Data, 0, 30); + + // copy the block we already did + int alreadyDone = pos - lastpos; + Buffer.BlockCopy(data, lastpos, newbuf.Data, 31, alreadyDone); // 30 is datablock size + + // finish current + data[countpos] = (byte)count; + if (needSizes) + { + data[lastpos++] = (byte)count; + while (--count >= 0) + { + Utils.UInt16ToBytes(sizes[sizesptr++], data, lastpos); lastpos += 2; + Utils.UInt16ToBytes(sizes[sizesptr++], data, lastpos); lastpos += 2; + } + } + else + data[lastpos++] = 0; + + buf.DataLength = lastpos; + // send it + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + + buf = newbuf; + data = buf.Data; + pos = alreadyDone + 31; + capacity = LLUDPServer.MAXPAYLOAD - pos; + if (needSizes) + capacity -= 4; // 2 shorts per entry + + count = 1; + --blocks; + } + } + regionName = null; + + if (count > 0) + { + data[countpos] = (byte)count; + if (needSizes) + { + data[pos++] = (byte)count; + while (--count >= 0) + { + Utils.UInt16ToBytes(sizes[sizesptr++], data, pos); pos += 2; + Utils.UInt16ToBytes(sizes[sizesptr++], data, pos); pos += 2; + } + } + else + data[pos++] = 0; + + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); } } -- cgit v1.1 From d8f9a007f4aa8e445baefc4210b3e454f006caca Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 14:30:53 +0000 Subject: bug fix on mapblockreply; direct encode mapitemreply just because.. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 118 +++++++++++++++------ 1 file changed, 85 insertions(+), 33 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f2ebe2a..83128d2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1561,17 +1561,97 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(newSimPack, ThrottleOutPacketType.Unknown); } + static private readonly byte[] MapBlockItemHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 1, 155 // ID 411 (low frequency bigendian) + }; + + public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) + { + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header and agentinfo block + Buffer.BlockCopy(MapBlockItemHeader, 0, data, 0, 10); + AgentId.ToBytes(data, 10); // 26 + Utils.UIntToBytesSafepos(flags, data, 26); // 30 + + //RequestData block + Utils.UIntToBytesSafepos(mapitemtype, data, 30); // 34 + + int countpos = 34; + int pos = 35; + int lastpos = 0; + + int capacity = LLUDPServer.MAXPAYLOAD - pos; + + int count = 0; + + mapItemReply mr; + for (int k = 0; k < replies.Length; ++k) + { + lastpos = pos; + mr = replies[k]; + + Utils.UIntToBytesSafepos(mr.x, data, pos); pos += 4; + Utils.UIntToBytesSafepos(mr.y, data, pos); pos += 4; + mr.id.ToBytes(data, pos); pos += 16; + Utils.IntToBytesSafepos(mr.Extra, data, pos); pos += 4; + Utils.IntToBytesSafepos(mr.Extra2, data, pos); pos += 4; + byte[] itemName = Util.StringToBytes256(mr.name); + data[pos++] = (byte)itemName.Length; + if (itemName.Length > 0) + Buffer.BlockCopy(itemName, 0, data, pos, itemName.Length); pos += itemName.Length; + + if (pos < capacity) + ++count; + else + { + // prepare next packet + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(data, 0, newbuf.Data, 0, 34); + + // copy the block we already did + int alreadyDone = pos - lastpos; + Buffer.BlockCopy(data, lastpos, newbuf.Data, 35, alreadyDone); // 34 is datablock size + + // finish current + data[countpos] = (byte)count; + + buf.DataLength = lastpos; + // send it + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + + buf = newbuf; + data = buf.Data; + pos = alreadyDone + 35; + capacity = LLUDPServer.MAXPAYLOAD - pos; + + count = 1; + } + } + + if (count > 0) + { + data[countpos] = (byte)count; + + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + } + } + static private readonly byte[] MapBlockReplyHeader = new byte[] { Helpers.MSG_RELIABLE, 0, 0, 0, 0, // sequence number 0, // extra - 0xff, 0xff, 1, 153 // ID 409 (bigendian low frequency) + 0xff, 0xff, 1, 153 // ID 409 (low frequency bigendian) }; public void SendMapBlock(List<MapBlockData> mapBlocks, uint flags) { - int blocks = mapBlocks.Count; - ushort[] sizes = new ushort[2 * blocks]; + ushort[] sizes = new ushort[2 * mapBlocks.Count]; bool needSizes = false; int sizesptr = 0; @@ -1606,7 +1686,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP int capacity = LLUDPServer.MAXPAYLOAD - pos; count = 0; - byte[] regionName = null; foreach (MapBlockData md in mapBlocks) { @@ -1614,7 +1693,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.UInt16ToBytes(md.X, data, pos); pos += 2; Utils.UInt16ToBytes(md.Y, data, pos); pos += 2; - regionName = Util.StringToBytes256(md.Name); + byte[] regionName = Util.StringToBytes256(md.Name); data[pos++] = (byte)regionName.Length; if(regionName.Length > 0) Buffer.BlockCopy(regionName, 0, data, pos, regionName.Length); pos += regionName.Length; @@ -1628,15 +1707,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP capacity -= 4; // 2 shorts per entry if(pos < capacity) - { ++count; - --blocks; - } else { // prepare next packet UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); - Buffer.BlockCopy(MapBlockReplyHeader, 0, newbuf.Data, 0, 30); + Buffer.BlockCopy(data, 0, newbuf.Data, 0, 30); // copy the block we already did int alreadyDone = pos - lastpos; @@ -1668,10 +1744,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP capacity -= 4; // 2 shorts per entry count = 1; - --blocks; } } - regionName = null; if (count > 0) { @@ -3477,28 +3551,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } - public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) - { - MapItemReplyPacket mirplk = new MapItemReplyPacket(); - mirplk.AgentData.AgentID = AgentId; - mirplk.RequestData.ItemType = mapitemtype; - mirplk.Data = new MapItemReplyPacket.DataBlock[replies.Length]; - for (int i = 0; i < replies.Length; i++) - { - MapItemReplyPacket.DataBlock mrdata = new MapItemReplyPacket.DataBlock(); - mrdata.X = replies[i].x; - mrdata.Y = replies[i].y; - mrdata.ID = replies[i].id; - mrdata.Extra = replies[i].Extra; - mrdata.Extra2 = replies[i].Extra2; - mrdata.Name = Utils.StringToBytes(replies[i].name); - mirplk.Data[i] = mrdata; - } - //m_log.Debug(mirplk.ToString()); - OutPacket(mirplk, ThrottleOutPacketType.Task); - - } - public void SendOfferCallingCard(UUID srcID, UUID transactionID) { // a bit special, as this uses AgentID to store the source instead -- cgit v1.1 From 5428b4799df0851d3091cf12f80bed6672bb09b3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 15:40:01 +0000 Subject: lludp: direct encode rest of send terseupdates --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 251 ++------------------- 1 file changed, 23 insertions(+), 228 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 83128d2..2b7a7ed 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4027,65 +4027,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } -/* - public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) - { -// m_log.DebugFormat("[LLCLIENTVIEW]: Sending animations for {0} to {1}", sourceAgentId, Name); - - AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); - // TODO: don't create new blocks if recycling an old packet - ani.Sender = new AvatarAnimationPacket.SenderBlock(); - ani.Sender.ID = sourceAgentId; - ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[animations.Length]; - ani.PhysicalAvatarEventList = new AvatarAnimationPacket.PhysicalAvatarEventListBlock[0]; - - //self animations - if (sourceAgentId == AgentId) - { - List<int> withobjects = new List<int>(animations.Length); - List<int> noobjects = new List<int>(animations.Length); - for(int i = 0; i < animations.Length; ++i) - { - if(objectIDs[i] == sourceAgentId || objectIDs[i] == UUID.Zero) - noobjects.Add(i); - else - withobjects.Add(i); - } - - ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[withobjects.Count]; - int k = 0; - foreach (int i in withobjects) - { - ani.AnimationList[k] = new AvatarAnimationPacket.AnimationListBlock(); - ani.AnimationList[k].AnimID = animations[i]; - ani.AnimationList[k].AnimSequenceID = seqs[i]; - ani.AnimationSourceList[k] = new AvatarAnimationPacket.AnimationSourceListBlock(); - ani.AnimationSourceList[k].ObjectID = objectIDs[i]; - k++; - } - foreach (int i in noobjects) - { - ani.AnimationList[k] = new AvatarAnimationPacket.AnimationListBlock(); - ani.AnimationList[k].AnimID = animations[i]; - ani.AnimationList[k].AnimSequenceID = seqs[i]; - k++; - } - } - else - { - ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[0]; - for (int i = 0; i < animations.Length; ++i) - { - ani.AnimationList[i] = new AvatarAnimationPacket.AnimationListBlock(); - ani.AnimationList[i].AnimID = animations[i]; - ani.AnimationList[i].AnimSequenceID = seqs[i]; - } - } - - OutPacket(ani, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); - } -*/ - static private readonly byte[] AvatarAnimationHeader = new byte[] { Helpers.MSG_RELIABLE, 0, 0, 0, 0, // sequence number @@ -4217,37 +4158,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendEntityTerseUpdateImmediate(ISceneEntity ent) { -// m_log.DebugFormat( -// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}", -// avatar.Name, avatar.UUID, Name, AgentId); - if (ent == null) return; - ImprovedTerseObjectUpdatePacket objupdate = - (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); - objupdate.Header.Zerocoded = true; + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); - objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); - objupdate.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + //setup header and regioninfo block + Buffer.BlockCopy(terseUpdateHeader, 0, buf.Data, 0, 7); + if (ent is ScenePresence) + Utils.UInt64ToBytesSafepos(((ScenePresence)ent).RegionHandle, buf.Data, 7); + else + Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); - if(ent is ScenePresence) - { - ScenePresence presence = ent as ScenePresence; - objupdate.RegionData.RegionHandle = presence.RegionHandle; - objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent); - } - else if(ent is SceneObjectPart) - { - SceneObjectPart part = ent as SceneObjectPart; - objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent); - } + Utils.UInt16ToBytes(Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f), buf.Data, 15); + buf.Data[17] = 1; - OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); + int pos = 18; + CreateImprovedTerseBlock(ent, buf.Data, ref pos, false); - // We need to record the avatar local id since the root prim of an attachment points to this. -// m_attachmentsSent.Add(avatar.LocalId); + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); } public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) @@ -5991,121 +5921,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity) - { - #region ScenePresence/SOP Handling - - bool avatar = (entity is ScenePresence); - uint localID = entity.LocalId; - uint attachPoint; - Vector4 collisionPlane; - Vector3 position, velocity, acceleration, angularVelocity; - Quaternion rotation; - - if (avatar) - { - ScenePresence presence = (ScenePresence)entity; - - position = presence.OffsetPosition; - velocity = presence.Velocity; - acceleration = Vector3.Zero; - rotation = presence.Rotation; - // tpvs can only see rotations around Z in some cases - if(!presence.Flying && !presence.IsSatOnObject) - { - rotation.X = 0f; - rotation.Y = 0f; - } - rotation.Normalize(); - angularVelocity = presence.AngularVelocity; - -// 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; - } - else - { - SceneObjectPart part = (SceneObjectPart)entity; - - attachPoint = part.ParentGroup.AttachmentPoint; - attachPoint = ((attachPoint % 16) * 16 + (attachPoint / 16)); -// m_log.DebugFormat( -// "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}", -// attachPoint, part.Name, part.LocalId, Name); - - collisionPlane = Vector4.Zero; - position = part.RelativePosition; - velocity = part.Velocity; - acceleration = part.Acceleration; - angularVelocity = part.AngularVelocity; - rotation = part.RotationOffset; - } - - #endregion ScenePresence/SOP Handling - - int pos = 0; - byte[] data = new byte[(avatar ? 60 : 44)]; - - // LocalID - Utils.UIntToBytes(localID, data, pos); - pos += 4; - - // Avatar/CollisionPlane - data[pos++] = (byte) attachPoint; - if (avatar) - { - data[pos++] = 1; - - if (collisionPlane == Vector4.Zero) - collisionPlane = Vector4.UnitW; - //m_log.DebugFormat("CollisionPlane: {0}",collisionPlane); - collisionPlane.ToBytes(data, pos); - pos += 16; - } - else - { - ++pos; - } - - // Position - position.ToBytes(data, pos); - pos += 12; - - // Velocity - ClampVectorForUint(ref velocity, 128f); - Utils.FloatToUInt16Bytes(velocity.X, 128.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(velocity.Y, 128.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(velocity.Z, 128.0f, data, pos); pos += 2; - - // Acceleration - ClampVectorForUint(ref acceleration, 64f); - Utils.FloatToUInt16Bytes(acceleration.X, 64.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(acceleration.Y, 64.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(acceleration.Z, 64.0f, data, pos); pos += 2; - - // Rotation - Utils.FloatToUInt16Bytes(rotation.X, 1.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(rotation.Y, 1.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(rotation.Z, 1.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(rotation.W, 1.0f, data, pos); pos += 2; - - // Angular Velocity - ClampVectorForUint(ref angularVelocity, 64f); - Utils.FloatToUInt16Bytes(angularVelocity.X, 64.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(angularVelocity.Y, 64.0f, data, pos); pos += 2; - Utils.FloatToUInt16Bytes(angularVelocity.Z, 64.0f, data, pos); pos += 2; - - ImprovedTerseObjectUpdatePacket.ObjectDataBlock block - = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); - - block.Data = data; - block.TextureEntry = Utils.EmptyBytes; - - return block; - } - protected void CreateImprovedTerseBlock(ISceneEntity entity, byte[] data, ref int pos, bool includeTexture) { #region ScenePresence/SOP Handling @@ -14027,38 +13842,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (p is ScenePresence) { -// m_log.DebugFormat( -// "[LLCLIENTVIEW]: Immediately sending terse agent update for {0} to {1} in {2}", -// p.Name, Name, Scene.Name); - - // It turns out to get the agent to stop flying, you have to feed it stop flying velocities - // There's no explicit message to send the client to tell it to stop flying.. it relies on the - // velocity, collision plane and avatar height - - // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air - // when the avatar stands up - - ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = - CreateImprovedTerseBlock(p); - -// const float TIME_DILATION = 1.0f; - ushort timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);; - - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( - PacketType.ImprovedTerseObjectUpdate); - - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - - packet.ObjectData[0] = block; + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); - OutPacket(packet, ThrottleOutPacketType.Task, true); + //setup header and regioninfo block + Buffer.BlockCopy(terseUpdateHeader, 0, buf.Data, 0, 7); + Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); + Utils.UInt16ToBytes(Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f), buf.Data, 15); + buf.Data[17] = 1; + int pos = 18; + CreateImprovedTerseBlock(p, buf.Data, ref pos, false); + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); } - - //ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, - // AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); } public void SendPlacesReply(UUID queryID, UUID transactionID, -- cgit v1.1 From 2ff5b322bec0242af40cf956e9de1622894e17f6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 17:44:34 +0000 Subject: lludp: direct encode CoarseLocationUpdate --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 65 +++++++++++++--------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2b7a7ed..9d5a7ba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4180,46 +4180,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); } + static private readonly byte[] CoarseLocationUpdateHeader = new byte[] { + 0, // no acks plz + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 6 // ID 6 (medium frequency) + }; + public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) { // We don't need to update inactive clients. if (!IsActive) return; - CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); - loc.Header.Reliable = false; + int totalLocations = Math.Min(CoarseLocations.Count, 60); + int totalAgents = Math.Min(users.Count, 60); + if(totalAgents > totalLocations) + totalAgents = totalLocations; - // Each packet can only hold around 60 avatar positions and the client clears the mini-map each time - // a CoarseLocationUpdate packet is received. Oh well. - int total = Math.Min(CoarseLocations.Count, 60); + int selfindex = -1; + int preyindex = -1; - CoarseLocationUpdatePacket.IndexBlock ib = new CoarseLocationUpdatePacket.IndexBlock(); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(CoarseLocationUpdateHeader, 0, buf.Data, 0, 8); + byte[] data = buf.Data; - loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; - loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; + data[8] = (byte)totalLocations; + int pos = 9; - int selfindex = -1; - for (int i = 0; i < total; i++) + for (int i = 0; i < totalLocations; ++i) { - CoarseLocationUpdatePacket.LocationBlock lb = - new CoarseLocationUpdatePacket.LocationBlock(); + data[pos++] = (byte)CoarseLocations[i].X; + data[pos++] = (byte)CoarseLocations[i].Y; + data[pos++] = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25f); + + if (i < totalAgents) + { + if (users[i] == AgentId) + selfindex = i; + //if (users[i] == PreyId) + // preyindex = -1; + } + } - lb.X = (byte)CoarseLocations[i].X; - lb.Y = (byte)CoarseLocations[i].Y; + Utils.Int16ToBytes((short)selfindex, data, pos); pos += 2; + Utils.Int16ToBytes((short)preyindex, data, pos); pos += 2; - lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25f); - loc.Location[i] = lb; - loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); - loc.AgentData[i].AgentID = users[i]; - if (users[i] == AgentId) - selfindex = i; + data[pos++] = (byte)totalAgents; + for (int i = 0; i < totalAgents; ++i) + { + users[i].ToBytes(data, pos); + pos += 16; } - ib.You = (short)selfindex; - ib.Prey = -1; - loc.Index = ib; - - OutPacket(loc, ThrottleOutPacketType.Task); + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); } #endregion Avatar Packet/Data Sending Methods -- cgit v1.1 From ee8ad3e69d01678006155bac8fc3efd254d1b438 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 02:02:40 +0000 Subject: lludp: direct encode AvatarAppearance --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 61 ++++++++++++++-------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9d5a7ba..4f4bb61 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3995,36 +3995,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } - public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) + static private readonly byte[] AvatarAppearanceHeader = new byte[] { + Helpers.MSG_RELIABLE | Helpers.MSG_ZEROCODED, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 0, 158 // ID 158 (low frequency bigendian) not zeroencoded + //0xff, 0xff, 0, 1, 158 // ID 158 (low frequency bigendian) zeroencoded + }; + + public void SendAppearance(UUID targetID, byte[] visualParams, byte[] textureEntry) { -// m_log.DebugFormat( -// "[LLCLIENTVIEW]: Sending avatar appearance for {0} with {1} bytes to {2} {3}", -// agentID, textureEntry.Length, Name, AgentId); + // doing post zero encode, because odds of beeing bad are not that low + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(AvatarAppearanceHeader, 0, buf.Data, 0, 10); + byte[] data = buf.Data; + int pos = 10; - AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); - // TODO: don't create new blocks if recycling an old packet - avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; - avp.ObjectData.TextureEntry = textureEntry; + //sender block + targetID.ToBytes(data, pos); pos += 16; + data[pos++] = 0;// is trial = false - AvatarAppearancePacket.VisualParamBlock avblock = null; - for (int i = 0; i < visualParams.Length; i++) + // objectdata block ie texture + int len = textureEntry.Length; + if (len == 0) + { + data[pos++] = 0; + data[pos++] = 0; + } + else { - avblock = new AvatarAppearancePacket.VisualParamBlock(); - avblock.ParamValue = visualParams[i]; - avp.VisualParam[i] = avblock; + data[pos++] = (byte)len; + data[pos++] = (byte)(len >> 8); + Buffer.BlockCopy(textureEntry, 0, data, pos, len); pos += len; } - avp.Sender.IsTrial = false; - avp.Sender.ID = agentID; - avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; - avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0]; + // visual parameters + len = visualParams.Length; + data[pos++] = (byte)len; + if(len > 0) + Buffer.BlockCopy(visualParams, 0, data, pos, len); pos += len; -// this need be use in future ? -// avp.AppearanceData[0].AppearanceVersion = 0; -// avp.AppearanceData[0].CofVersion = 0; + // no AppearanceData + data[pos++] = 0; + // no AppearanceHover + data[pos++] = 0; - //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority, null, false, true); } static private readonly byte[] AvatarAnimationHeader = new byte[] { -- cgit v1.1 From 8bb0c05825b2c974c07d4660003a1812223870a4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 18:16:38 +0000 Subject: lludp: direct encode PacketAck, StartPingCheck and CompletePingCheck --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 99 ++++++++++++++++------ 1 file changed, 73 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 780e8f8..79f5fe6 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -989,49 +989,96 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendPacketFinal(outgoingPacket); } + static private readonly byte[] PacketAckHeader = new byte[] { + 0, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 0xff, 0xfb // ID 65531 (low frequency bigendian) + }; + public void SendAcks(LLUDPClient udpClient) { - uint ack; + if(udpClient.PendingAcks.Count == 0) + return; + + UDPPacketBuffer buf = GetNewUDPBuffer(udpClient.RemoteEndPoint); + Buffer.BlockCopy(PacketAckHeader, 0, buf.Data, 0, 10); + byte[] data = buf.Data; + // count at position 10 + int pos = 11; - if (udpClient.PendingAcks.Dequeue(out ack)) + uint ack; + int count = 0; + while (udpClient.PendingAcks.Dequeue(out ack)) { - List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>(); - PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); - block.ID = ack; - blocks.Add(block); + Utils.UIntToBytes(ack, data, pos); pos += 4; + ++count; - while (udpClient.PendingAcks.Dequeue(out ack)) + if (count == 255) { - block = new PacketAckPacket.PacketsBlock(); - block.ID = ack; - blocks.Add(block); + data[10] = 255; + buf.DataLength = pos; + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); + + buf = GetNewUDPBuffer(udpClient.RemoteEndPoint); + Buffer.BlockCopy(PacketAckHeader, 0, buf.Data, 0, 10); + data = buf.Data; + pos = 11; + count = 0; } - - PacketAckPacket packet = new PacketAckPacket(); - packet.Header.Reliable = false; - packet.Packets = blocks.ToArray(); - - SendPacket(udpClient, packet, ThrottleOutPacketType.Unknown, true, null); + } + if (count > 0) + { + data[10] = (byte)count; + buf.DataLength = pos; + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); } } + static private readonly byte[] StartPingCheckHeader = new byte[] { + 0, + 0, 0, 0, 0, // sequence number + 0, // extra + 1 // ID 1 (high frequency) + }; + public void SendPing(LLUDPClient udpClient) { - StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); + UDPPacketBuffer buf = GetNewUDPBuffer(udpClient.RemoteEndPoint); + Buffer.BlockCopy(StartPingCheckHeader, 0, buf.Data, 0, 7); + byte[] data = buf.Data; + + data[7] = udpClient.CurrentPingSequence++; + // older seq number of our un ack packets, so viewers could clean deduplication lists TODO + //Utils.UIntToBytes(0, data, 8); + data[8] = 0; + data[9] = 0; + data[10] = 0; + data[11] = 0; - pc.PingID.PingID = (byte)udpClient.CurrentPingSequence++; - // We *could* get OldestUnacked, but it would hurt performance and not provide any benefit - pc.PingID.OldestUnacked = 0; + buf.DataLength = 12; + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); - SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); } + static private readonly byte[] CompletePingCheckHeader = new byte[] { + 0, + 0, 0, 0, 0, // sequence number + 0, // extra + 2 // ID 1 (high frequency) + }; + public void CompletePing(LLUDPClient udpClient, byte pingID) { - CompletePingCheckPacket completePing = new CompletePingCheckPacket(); - completePing.PingID.PingID = pingID; - SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false, null); + UDPPacketBuffer buf = GetNewUDPBuffer(udpClient.RemoteEndPoint); + Buffer.BlockCopy(CompletePingCheckHeader, 0, buf.Data, 0, 7); + byte[] data = buf.Data; + + data[7] = pingID; + + buf.DataLength = 8; + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); } public void HandleUnacked(LLClientView client) @@ -1121,8 +1168,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP int dataLength = buffer.DataLength; - // NOTE: I'm seeing problems with some viewers when ACKs are appended to zerocoded packets so I've disabled that here - if (!isZerocoded && !isResend && outgoingPacket.UnackedMethod == null) + // only append acks on plain reliable messages + if (flags == Helpers.MSG_RELIABLE && outgoingPacket.UnackedMethod == null) { // Keep appending ACKs until there is no room left in the buffer or there are // no more ACKs to append -- cgit v1.1 From 9ccca71c1b13ed4e12c739774ca703cfafed5480 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 19:00:02 +0000 Subject: remove redundant code --- OpenSim/Framework/IClientAPI.cs | 2 -- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 15 +-------------- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 8 ++++---- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 5 ----- OpenSim/Tests/Common/Mock/TestClient.cs | 4 ---- 6 files changed, 6 insertions(+), 30 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index d63136e..63e3782 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1097,8 +1097,6 @@ namespace OpenSim.Framework void SendCachedTextureResponse(ISceneEntity avatar, int serial, List<CachedTextureResponseArg> cachedTextures); - void SendStartPingCheck(byte seq); - /// <summary> /// Tell the client that an object has been deleted /// </summary> diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4f4bb61..1004b07 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1891,19 +1891,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(payPriceReply, ThrottleOutPacketType.Task); } - public void SendStartPingCheck(byte seq) - { - StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); - pc.Header.Reliable = false; - - pc.PingID.PingID = seq; - // We *could* get OldestUnacked, but it would hurt performance and not provide any benefit - pc.PingID.OldestUnacked = 0; - - OutPacket(pc, ThrottleOutPacketType.Unknown); - UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); - } - public void SendKillObject(List<uint> localIDs) { // foreach (uint id in localIDs) @@ -8236,7 +8223,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleAgentResume(IClientAPI sender, Packet Pack) { m_udpClient.IsPaused = false; - SendStartPingCheck(m_udpClient.CurrentPingSequence++); + m_udpServer.SendPing(m_udpClient); return true; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 2981337..303f505 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -195,7 +195,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private float m_burstTime; - public int m_lastStartpingTimeMS; + public double m_lastStartpingTimeMS; public int m_pingMS; public int PingTimeMS diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 79f5fe6..25e4de5 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1059,7 +1059,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.DataLength = 12; SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); - udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); + udpClient.m_lastStartpingTimeMS = Util.GetTimeStampMS(); } static private readonly byte[] CompletePingCheckHeader = new byte[] { @@ -1506,11 +1506,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else if (packet.Type == PacketType.CompletePingCheck) { - int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); - int c = udpClient.m_pingMS; + double t = Util.GetTimeStampMS() - udpClient.m_lastStartpingTimeMS; + double c = udpClient.m_pingMS; c = 800 * c + 200 * t; c /= 1000; - udpClient.m_pingMS = c; + udpClient.m_pingMS = (int)c; return; } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 0fc724b..fb195e7 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -967,11 +967,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendStartPingCheck(byte seq) - { - - } - public void SendKillObject(List<uint> localID) { diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index de9ab98..022ebdf 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -576,10 +576,6 @@ namespace OpenSim.Tests.Common { } - public virtual void SendStartPingCheck(byte seq) - { - } - public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) { } -- cgit v1.1 From b9987b41837e00f21873e14df0cbf7e60377308a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 21:37:21 +0000 Subject: stop sending some useless small packets --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1004b07..39e2d39 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4184,6 +4184,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); } + //UUID m_courseLocationPrey = UUID.Zero; + bool m_couseLocationLastEmpty = false; + static private readonly byte[] CoarseLocationUpdateHeader = new byte[] { 0, // no acks plz 0, 0, 0, 0, // sequence number @@ -4198,6 +4201,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; int totalLocations = Math.Min(CoarseLocations.Count, 60); + if(totalLocations == 0) + { + if(m_couseLocationLastEmpty) + return; + m_couseLocationLastEmpty = true; + } + else + m_couseLocationLastEmpty = false; + int totalAgents = Math.Min(users.Count, 60); if(totalAgents > totalLocations) totalAgents = totalLocations; @@ -4205,6 +4217,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP int selfindex = -1; int preyindex = -1; + //bool doprey = m_courseLocationPrey != UUID.Zero; + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); Buffer.BlockCopy(CoarseLocationUpdateHeader, 0, buf.Data, 0, 8); byte[] data = buf.Data; @@ -4222,8 +4236,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (users[i] == AgentId) selfindex = i; - //if (users[i] == PreyId) - // preyindex = -1; + //if (doprey && users[i] == m_courseLocationPrey) + // preyindex = i; } } @@ -7534,15 +7548,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP TrackAgentPacket TrackAgent = (TrackAgentPacket)Packet; + if(TrackAgent.AgentData.AgentID != AgentId || TrackAgent.AgentData.SessionID != SessionId) + return false; + TrackAgentUpdate TrackAgentHandler = OnTrackAgent; if (TrackAgentHandler != null) { TrackAgentHandler(this, TrackAgent.AgentData.AgentID, TrackAgent.TargetData.PreyID); - return true; } - return false; +// else +// m_courseLocationPrey = TrackAgent.TargetData.PreyID; + return true; } private bool HandlerRezObject(IClientAPI sender, Packet Pack) -- cgit v1.1 From 84187975bdfc4a877fb1f6a2c193d8227d3c258a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 18:03:22 +0000 Subject: lludp AgentMovementComplete enconding --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 64 ++++++++++++---------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 39e2d39..ab5790c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -332,7 +332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private readonly UUID m_secureSessionId; protected readonly UUID m_agentId; private readonly uint m_circuitCode; - private readonly byte[] m_channelVersion = Utils.EmptyBytes; + private readonly byte[] m_regionChannelVersion = Utils.EmptyBytes; private readonly IGroupsModule m_GroupsModule; // private int m_cachedTextureSerial; @@ -531,7 +531,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_assetService = m_scene.RequestModuleInterface<IAssetService>(); m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); ImageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); - m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion()); + m_regionChannelVersion = Util.StringToBytes1024(scene.GetSimulatorVersion()); m_agentId = agentId; m_sessionId = sessionId; m_secureSessionId = sessionInfo.LoginInfo.SecureSession; @@ -865,32 +865,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(handshake, ThrottleOutPacketType.Unknown); } + static private readonly byte[] AgentMovementCompleteHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 0, 250 // ID 250 (low frequency bigendian) + }; public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { + // reset agent update args m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; m_thisAgentUpdateArgs.lastUpdateTS = 0; m_thisAgentUpdateArgs.ControlFlags = 0; - AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); - mov.SimData.ChannelVersion = m_channelVersion; - mov.AgentData.SessionID = m_sessionId; - mov.AgentData.AgentID = AgentId; - mov.Data.RegionHandle = regInfo.RegionHandle; - mov.Data.Timestamp = (uint)Util.UnixTimeSinceEpoch(); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header + Buffer.BlockCopy(AgentMovementCompleteHeader, 0, data, 0, 10); + + //AgentData block + AgentId.ToBytes(data, 10); // 26 + SessionId.ToBytes(data, 26); // 42 + //Data block if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) + m_startpos.ToBytes(data, 42); //54 + else + pos.ToBytes(data, 42); //54 + look.ToBytes(data, 54); // 66 + Utils.UInt64ToBytesSafepos(regInfo.RegionHandle, data, 66); // 74 + Utils.UIntToBytesSafepos((uint)Util.UnixTimeSinceEpoch(), data, 74); //78 + + //SimData + int len = m_regionChannelVersion.Length; + if(len == 0) { - mov.Data.Position = m_startpos; + data[78] = 0; + data[79] = 0; } else { - mov.Data.Position = pos; + data[78] = (byte)len; + data[79] = (byte)(len >> 8); + Buffer.BlockCopy(m_regionChannelVersion, 0, data, 80, len); } - mov.Data.LookAt = look; - // Hack to get this out immediately and skip the throttles - OutPacket(mov, ThrottleOutPacketType.Unknown); + buf.DataLength = 80 + len; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); } public void SendChatMessage( @@ -4265,20 +4288,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// </summary> public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { -/* - if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) - { - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); - - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f); - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false); - OutPacket(packet, ThrottleOutPacketType.Unknown, true); - return; - } -*/ if (entity is SceneObjectPart) { SceneObjectPart p = (SceneObjectPart)entity; @@ -4297,7 +4306,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - //double priority = m_prioritizer.GetUpdatePriority(this, entity); uint priority = m_prioritizer.GetUpdatePriority(this, entity); lock (m_entityUpdates.SyncRoot) -- cgit v1.1 From 6fd7b931b1a7dade8604fb0356fc6e0058fd5135 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 18:58:07 +0000 Subject: lludp ChatFromSimulator enconding; some simplification --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 89 +++++++++++++++------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 30 ++++++-- 2 files changed, 87 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ab5790c..97b2c5c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -913,24 +913,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP } buf.DataLength = 80 + len; - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); } - public void SendChatMessage( - string message, byte type, Vector3 fromPos, string fromName, - UUID fromAgentID, UUID ownerID, byte source, byte audible) + static private readonly byte[] ChatFromSimulatorHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 0, 139 // ID 139 (low frequency bigendian) + }; + + public void SendChatMessage(string message, byte chattype, Vector3 fromPos, string fromName, + UUID sourceID, UUID ownerID, byte sourcetype, byte audible) { - ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); - reply.ChatData.Audible = audible; - reply.ChatData.Message = Util.StringToBytes1024(message); - reply.ChatData.ChatType = type; - reply.ChatData.SourceType = source; - reply.ChatData.Position = fromPos; - reply.ChatData.FromName = Util.StringToBytes256(fromName); - reply.ChatData.OwnerID = ownerID; - reply.ChatData.SourceID = fromAgentID; + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header + Buffer.BlockCopy(ChatFromSimulatorHeader, 0, data, 0, 10); + + byte[] fname = Util.StringToBytes256(fromName); + int len = fname.Length; + int pos = 11; + if (len == 0) + data[10] = 0; + else + { + data[10] = (byte)len; + Buffer.BlockCopy(fname, 0, data, 11, len); + pos += len; + } + + sourceID.ToBytes(data, pos); pos += 16; + ownerID.ToBytes(data, pos); pos += 16; + data[pos++] = sourcetype; + data[pos++] = chattype; + data[pos++] = audible; + fromPos.ToBytes(data, pos); pos += 12; + + byte[] msg = Util.StringToBytes1024(message); + len = msg.Length; + if (len == 0) + { + data[pos++] = 0; + data[pos++] = 0; + } + else + { + data[pos++] = (byte)len; + data[pos++] = (byte)(len >> 8); + Buffer.BlockCopy(msg, 0, data, pos, len); pos += len; + } - OutPacket(reply, ThrottleOutPacketType.Unknown); + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); } /// <summary> @@ -1336,7 +1372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[9] = (byte)(datasize >> 8); buf.DataLength = bitpack.BytePos + 1; - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); // start another buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); @@ -1364,7 +1400,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[9] = (byte)(datasize >> 8); buf.DataLength = bitpack.BytePos + 1; - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); } catch (Exception e) @@ -1645,7 +1681,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.DataLength = lastpos; // send it - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); buf = newbuf; data = buf.Data; @@ -1661,7 +1697,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[countpos] = (byte)count; buf.DataLength = pos; - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); } } @@ -1757,7 +1793,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.DataLength = lastpos; // send it - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); buf = newbuf; data = buf.Data; @@ -1786,7 +1822,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[pos++] = 0; buf.DataLength = pos; - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); } } @@ -4122,8 +4158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[pos++] = 0; // no physical avatar events buf.DataLength = pos; - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority, - null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } public void SendObjectAnimations(UUID[] animations, int[] seqs, UUID senderId) @@ -4180,7 +4215,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP CreatePrimUpdateBlock(ent as SceneObjectPart, (ScenePresence)SceneAgent, zc); buf.DataLength = zc.Finish(); - m_udpServer.SendUDPPacket(m_udpClient, buf, ptype , null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ptype); } public void SendEntityTerseUpdateImmediate(ISceneEntity ent) @@ -4275,7 +4310,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } buf.DataLength = pos; - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } #endregion Avatar Packet/Data Sending Methods @@ -5332,7 +5367,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); buf = newbuf; zc.Data = buf.Data; zc.ZeroCount = 0; @@ -5353,7 +5388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.DataLength = zc.Finish(); //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } } @@ -5373,7 +5408,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //tau.Add(new ObjectPropertyUpdate((ISceneEntity) eu, (uint)eu.Flags, true, false)); //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 25e4de5..465a4d0 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -970,7 +970,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { bool highPriority = false; - if(zerocode) + if (zerocode) buffer = ZeroEncode(buffer); if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0) @@ -989,6 +989,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendPacketFinal(outgoingPacket); } + public void SendUDPPacket(LLUDPClient udpClient, UDPPacketBuffer buffer, ThrottleOutPacketType category) + { + bool highPriority = false; + + if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0) + { + category = (ThrottleOutPacketType)((int)category & 127); + highPriority = true; + } + + OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null); + + // If we were not provided a method for handling unacked, use the UDPServer default method + if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0) + outgoingPacket.UnackedMethod = delegate (OutgoingPacket oPacket) { ResendUnacked(oPacket); }; + + if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false, highPriority)) + SendPacketFinal(outgoingPacket); + } + static private readonly byte[] PacketAckHeader = new byte[] { 0, 0, 0, 0, 0, // sequence number @@ -1018,7 +1038,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { data[10] = 255; buf.DataLength = pos; - SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown); buf = GetNewUDPBuffer(udpClient.RemoteEndPoint); Buffer.BlockCopy(PacketAckHeader, 0, buf.Data, 0, 10); @@ -1031,7 +1051,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { data[10] = (byte)count; buf.DataLength = pos; - SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown); } } @@ -1057,7 +1077,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[11] = 0; buf.DataLength = 12; - SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown); udpClient.m_lastStartpingTimeMS = Util.GetTimeStampMS(); } @@ -1078,7 +1098,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[7] = pingID; buf.DataLength = 8; - SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); + SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown); } public void HandleUnacked(LLClientView client) -- cgit v1.1 From 606d09670958c59b1b2daf75064ca36a17df248c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 21:04:42 +0000 Subject: lludp ImprovedInstantMessage enconding --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 115 +++++++++++++++++---- 1 file changed, 93 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 97b2c5c..a44185a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -973,34 +973,105 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Send an instant message to this client /// </summary> // + + static private readonly byte[] ImprovedInstantMessageHeader = new byte[] { + Helpers.MSG_RELIABLE, //| Helpers.MSG_ZEROCODED, not doing spec zeroencode on this + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 0, 254 // ID 139 (low frequency bigendian) + }; + public void SendInstantMessage(GridInstantMessage im) { - if (((Scene)(m_scene)).Permissions.CanInstantMessage(new UUID(im.fromAgentID), new UUID(im.toAgentID))) + UUID fromAgentID = new UUID(im.fromAgentID); + UUID toAgentID = new UUID(im.toAgentID); + + if (!m_scene.Permissions.CanInstantMessage(fromAgentID, toAgentID)) + return; + + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header + Buffer.BlockCopy(ImprovedInstantMessageHeader, 0, data, 0, 10); + + //agentdata block + fromAgentID.ToBytes(data, 10); // 26 + UUID.Zero.ToBytes(data, 26); // 42 sessionID zero?? TO check + + int pos = 42; + + //MessageBlock + data[pos++] = (byte)((im.fromGroup) ? 1 : 0); + toAgentID.ToBytes(data, pos); pos += 16; + Utils.UIntToBytesSafepos(im.ParentEstateID, data, pos); pos += 4; + (new UUID(im.RegionID)).ToBytes(data, pos); pos += 16; + (im.Position).ToBytes(data, pos); pos += 12; + data[pos++] = im.offline; + data[pos++] = im.dialog; + + // this is odd + if (im.imSessionID == UUID.Zero.Guid) + (fromAgentID ^ toAgentID).ToBytes(data, pos); + else + (new UUID(im.imSessionID)).ToBytes(data, pos); + + pos += 16; + + Utils.UIntToBytesSafepos(im.timestamp, data, pos); pos += 4; + + byte[] tmp = Util.StringToBytes256(im.fromAgentName); + int len = tmp.Length; + data[pos++] = (byte)len; + if(len > 0) + Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; + + tmp = Util.StringToBytes1024(im.message); + len = tmp.Length; + if (len == 0) + { + data[pos++] = 0; + data[pos++] = 0; + } + else { - ImprovedInstantMessagePacket msg - = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); + data[pos++] = (byte)len; + data[pos++] = (byte)(len >> 8); + Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; + } - msg.AgentData.AgentID = new UUID(im.fromAgentID); - msg.AgentData.SessionID = UUID.Zero; - msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName); - msg.MessageBlock.Dialog = im.dialog; - msg.MessageBlock.FromGroup = im.fromGroup; - // this is odd - if (im.imSessionID == UUID.Zero.Guid) - msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID); + tmp = im.binaryBucket; + if(tmp == null) + { + data[pos++] = 0; + data[pos++] = 0; + } + else + { + len = tmp.Length; + if (len == 0) + { + data[pos++] = 0; + data[pos++] = 0; + } else - msg.MessageBlock.ID = new UUID(im.imSessionID); - msg.MessageBlock.Offline = im.offline; - msg.MessageBlock.ParentEstateID = im.ParentEstateID; - msg.MessageBlock.Position = im.Position; - msg.MessageBlock.RegionID = new UUID(im.RegionID); - msg.MessageBlock.Timestamp = im.timestamp; - msg.MessageBlock.ToAgentID = new UUID(im.toAgentID); - msg.MessageBlock.Message = Util.StringToBytes1024(im.message); - msg.MessageBlock.BinaryBucket = im.binaryBucket; - - OutPacket(msg, ThrottleOutPacketType.Task); + { + data[pos++] = (byte)len; + data[pos++] = (byte)(len >> 8); + Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; + } } + + //EstateBlock does not seem in use TODO + //Utils.UIntToBytesSafepos(m_scene.RegionInfo.EstateSettings.EstateID, data, pos); pos += 4; + data[pos++] = 0; + data[pos++] = 0; + data[pos++] = 0; + data[pos++] = 0; + + buf.DataLength = pos; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); } public void SendGenericMessage(string method, UUID invoice, List<string> message) -- cgit v1.1 From 37619443a7e184722577cf6d914c5f505fd1dfbd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 22:19:23 +0000 Subject: lludp GenericMessage enconding --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 154 ++++++++++++++++++--- 1 file changed, 132 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a44185a..a9a5630 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1074,44 +1074,154 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); } + static private readonly byte[] GenericMessageHeader = new byte[] { + Helpers.MSG_RELIABLE, //| Helpers.MSG_ZEROCODED, not doing spec zeroencode on this + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 1, 5 // ID 261 (low frequency bigendian) + }; + public void SendGenericMessage(string method, UUID invoice, List<string> message) { - GenericMessagePacket gmp = new GenericMessagePacket(); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; - gmp.AgentData.AgentID = AgentId; - gmp.AgentData.SessionID = m_sessionId; - gmp.AgentData.TransactionID = invoice; + //setup header + Buffer.BlockCopy(GenericMessageHeader, 0, data, 0, 10); - gmp.MethodData.Method = Util.StringToBytes256(method); - gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; - int i = 0; - foreach (string val in message) + //agentdata block + m_agentId.ToBytes(data, 10); // 26 + m_sessionId.ToBytes(data, 26); // 42 sessionID zero?? TO check + UUID.Zero.ToBytes(data, 42); // 58 + + int pos = 58; + + //method block + byte[] tmp = Util.StringToBytes256(method); + int len = tmp.Length; + data[pos++] = (byte)len; + if (len > 0) + Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; + invoice.ToBytes(data, pos); pos += 16; + + //ParamList block + if (message.Count == 0) { - gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); - gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); + data[pos++] = 0; + buf.DataLength = pos; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + return; } - OutPacket(gmp, ThrottleOutPacketType.Task); + int countpos = pos; + ++pos; + + int count = 0; + foreach (string val in message) + { + tmp = Util.StringToBytes256(val); + len = tmp.Length; + + if (pos + len >= LLUDPServer.MAXPAYLOAD) + { + data[countpos] = (byte)count; + buf.DataLength = pos; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); + + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(data, 0, newbuf.Data, 0, countpos); + pos = countpos + 1; + data = buf.Data; + count = 1; + } + else + ++count; + + data[pos++] = (byte)len; + if (len > 0) + Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; + } + if (count > 0) + { + data[countpos] = (byte)count; + buf.DataLength = pos; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + } } public void SendGenericMessage(string method, UUID invoice, List<byte[]> message) { - GenericMessagePacket gmp = new GenericMessagePacket(); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; - gmp.AgentData.AgentID = AgentId; - gmp.AgentData.SessionID = m_sessionId; - gmp.AgentData.TransactionID = invoice; + //setup header + Buffer.BlockCopy(GenericMessageHeader, 0, data, 0, 10); - gmp.MethodData.Method = Util.StringToBytes256(method); - gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; - int i = 0; - foreach (byte[] val in message) + //agentdata block + m_agentId.ToBytes(data, 10); // 26 + m_sessionId.ToBytes(data, 26); // 42 sessionID zero?? TO check + UUID.Zero.ToBytes(data, 42); // 58 + + int pos = 58; + + //method block + byte[] tmp = Util.StringToBytes256(method); + int len = tmp.Length; + data[pos++] = (byte)len; + if (len > 0) + Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; + invoice.ToBytes(data, pos); pos += 16; + + //ParamList block + if (message.Count == 0) { - gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); - gmp.ParamList[i++].Parameter = val; + data[pos++] = 0; + buf.DataLength = pos; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + return; } - OutPacket(gmp, ThrottleOutPacketType.Task); + int countpos = pos; + ++pos; + + int count = 0; + foreach (byte[] val in message) + { + len = val.Length; + if(len > 255) + len = 255; + + if (pos + len >= LLUDPServer.MAXPAYLOAD) + { + data[countpos] = (byte)count; + buf.DataLength = pos; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); + + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(data, 0, newbuf.Data, 0, countpos); + pos = countpos + 1; + data = buf.Data; + count = 1; + } + else + ++count; + + data[pos++] = (byte)len; + if (len > 0) + Buffer.BlockCopy(val, 0, data, pos, len); pos += len; + } + if (count > 0) + { + data[countpos] = (byte)count; + buf.DataLength = pos; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + } } public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) -- cgit v1.1 From f17dba9925d299f59c6707953832d3ebd3e739f4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 22:26:02 +0000 Subject: oops --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a9a5630..96ad930 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1132,8 +1132,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); Buffer.BlockCopy(data, 0, newbuf.Data, 0, countpos); - pos = countpos + 1; + buf = newbuf; data = buf.Data; + pos = countpos + 1; count = 1; } else @@ -1204,8 +1205,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); Buffer.BlockCopy(data, 0, newbuf.Data, 0, countpos); - pos = countpos + 1; + buf = newbuf; data = buf.Data; + pos = countpos + 1; count = 1; } else -- cgit v1.1 From ee0eef5ee080aaee1f85c206c6f781c816f84c94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 22:29:15 +0000 Subject: also fix the ThrottleOutPacketType --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 96ad930..e3d04b5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1109,8 +1109,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { data[pos++] = 0; buf.DataLength = pos; - //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); return; } @@ -1148,8 +1148,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { data[countpos] = (byte)count; buf.DataLength = pos; - //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } } @@ -1181,8 +1181,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { data[pos++] = 0; buf.DataLength = pos; - //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); return; } @@ -1221,8 +1221,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { data[countpos] = (byte)count; buf.DataLength = pos; - //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); - m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } } -- cgit v1.1 From 199d4a1bd02c5e782db65a320b6965388ded1fb6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 23:36:49 +0000 Subject: lludp ReplyTaskInventory, SendXferPacket and AbortXfer enconding --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 91 +++++++++++++++++----- 1 file changed, 73 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e3d04b5..0d78654 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2724,34 +2724,89 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(scriptcontrol, ThrottleOutPacketType.Task); } + static private readonly byte[] ReplyTaskInventoryHeader = new byte[] { + Helpers.MSG_RELIABLE, //| Helpers.MSG_ZEROCODED, not doing spec zeroencode on this + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 1, 34 // ID 90 (low frequency bigendian) + }; + public void SendTaskInventory(UUID taskID, short serial, byte[] fileName) { - ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket)PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory); - replytask.InventoryData.TaskID = taskID; - replytask.InventoryData.Serial = serial; - replytask.InventoryData.Filename = fileName; -// OutPacket(replytask, ThrottleOutPacketType.Task); - OutPacket(replytask, ThrottleOutPacketType.Asset); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header + Buffer.BlockCopy(ReplyTaskInventoryHeader, 0, data, 0, 10); + + taskID.ToBytes(data, 10); // 26 + Utils.Int16ToBytes(serial, data, 26); // 28 + data[28] = (byte)fileName.Length; + if(data[28] > 0) + Buffer.BlockCopy(fileName, 0, data, 29, data[28]); + + buf.DataLength = 29 + data[28]; + //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } - public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) + + static private readonly byte[] SendXferPacketHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 18 // ID (high frequency bigendian) + }; + + public void SendXferPacket(ulong xferID, uint packet, byte[] payload, bool isTaskInventory) { - ThrottleOutPacketType type = ThrottleOutPacketType.Asset; -// if (isTaskInventory) -// type = ThrottleOutPacketType.Task; + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; - SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); - sendXfer.XferID.ID = xferID; - sendXfer.XferID.Packet = packet; - sendXfer.DataPacket.Data = data; - OutPacket(sendXfer, type); + //setup header + Buffer.BlockCopy(SendXferPacketHeader, 0, data, 0, 7); + + Utils.UInt64ToBytesSafepos(xferID, data, 7); // 15 + Utils.UIntToBytesSafepos(packet, data, 15); // 19 + int len = payload.Length; + if (len > LLUDPServer.MAXPAYLOAD) // should never happen + len = LLUDPServer.MAXPAYLOAD; + if (len == 0) + { + data[19] = 0; + data[20] = 0; + } + else + { + data[19] = (byte)len; + data[20] = (byte)(len >> 8); + Buffer.BlockCopy(payload, 0, data, 21, len); + } + + buf.DataLength = 21 + len; + m_udpServer.SendUDPPacket(m_udpClient, buf, isTaskInventory ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); } + static private readonly byte[] AbortXferHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 0, 157 // ID 157 (low frequency bigendian) + }; + public void SendAbortXferPacket(ulong xferID) { - AbortXferPacket xferItem = (AbortXferPacket)PacketPool.Instance.GetPacket(PacketType.AbortXfer); - xferItem.XferID.ID = xferID; - OutPacket(xferItem, ThrottleOutPacketType.Asset); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header + Buffer.BlockCopy(AbortXferHeader, 0, data, 0, 10); + + Utils.UInt64ToBytesSafepos(xferID, data, 10); // 18 + Utils.IntToBytesSafepos(0, data, 18); // 22 reason TODO + + buf.DataLength = 22; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Asset); } public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, -- cgit v1.1 From c2086e6257bbf63c4b4edf56729bdf78e4ce3195 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 00:47:45 +0000 Subject: add a few extra checks for viewers animated objects support, to avoid timming issues --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 465a4d0..2f73454 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1710,8 +1710,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_pendingCache.Remove(endPoint); } - client.CheckViewerCaps(); - m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets while (queue.Count > 0) @@ -1727,6 +1725,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // circuit code to the existing child agent. This is not particularly obvious. SendAckImmediate(endPoint, uccp.Header.Sequence); + client.CheckViewerCaps(); + // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1c5d23d..e663055 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2180,6 +2180,9 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + // recheck to reduce timing issues + ControllingClient.CheckViewerCaps(); + bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; int delayctnr = Util.EnvironmentTickCount(); @@ -4040,6 +4043,9 @@ namespace OpenSim.Region.Framework.Scenes } } + // recheck to reduce timing issues + ControllingClient.CheckViewerCaps(); + SendOtherAgentsAvatarFullToMe(); if(m_scene.ObjectsCullingByDistance) -- cgit v1.1 From 6dde1aaa1482a111b80fd87d836c0537e7edd509 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:00:36 +0000 Subject: try save a few ns on parcel overlays --- .../CoreModules/World/Land/LandManagementModule.cs | 228 +++++++++++++-------- 1 file changed, 143 insertions(+), 85 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 8c327d8..c57e7bb 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -998,6 +998,39 @@ namespace OpenSim.Region.CoreModules.World.Land } } + public ILandObject GetLandObjectinLandUnits(int x, int y) + { + if (m_landList.Count == 0 || m_landIDList == null) + return null; + + lock (m_landIDList) + { + try + { + return m_landList[m_landIDList[x, y]]; + } + catch (IndexOutOfRangeException) + { + return null; + } + } + } + + public int GetLandObjectIDinLandUnits(int x, int y) + { + lock (m_landIDList) + { + try + { + return m_landIDList[x, y]; + } + catch (IndexOutOfRangeException) + { + return -1; + } + } + } + // Create a 'parcel is here' bitmap for the parcel identified by the passed landID private bool[,] CreateBitmapForID(int landID) { @@ -1282,18 +1315,9 @@ namespace OpenSim.Region.CoreModules.World.Land #region Parcel Updating /// <summary> - /// Send the parcel overlay blocks to the client. We send the overlay packets - /// around a location and limited by the 'parcelLayerViewDistance'. This number - /// is usually 128 and the code is arranged so it sends all the parcel overlay - /// information for a whole region if the region is legacy sized (256x256). If - /// the region is larger, only the parcel layer information is sent around - /// the point specified. This reduces the problem of parcel layer information - /// blocks increasing exponentially as region size increases. + /// Send the parcel overlay blocks to the client. /// </summary> /// <param name="remote_client">The object representing the client</param> - /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param> - /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param> - /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> public void SendParcelOverlay(IClientAPI remote_client) { if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) @@ -1301,99 +1325,133 @@ namespace OpenSim.Region.CoreModules.World.Land const int LAND_BLOCKS_PER_PACKET = 1024; + int curID; + int southID; + byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; int byteArrayCount = 0; int sequenceID = 0; + int sx = (int)m_scene.RegionInfo.RegionSizeX / LandUnit; + byte curByte; + byte tmpByte; + // Layer data is in LandUnit (4m) chunks - for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += LandUnit) + for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / LandUnit; ++y) { - for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += LandUnit) + for (int x = 0; x < sx;) { - byte tempByte = 0; //This represents the byte for the current 4x4 + curID = GetLandObjectIDinLandUnits(x,y); + if(curID < 0) + continue; - ILandObject currentParcelBlock = GetLandObject(x, y); + ILandObject currentParcel = GetLandObject(curID); + if (currentParcel == null) + continue; - if (currentParcelBlock != null) + // types + if (currentParcel.LandData.OwnerID == remote_client.AgentId) { - // types - if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) - { - //Owner Flag - tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_REQUESTER; - } - else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) - { - tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_GROUP; - } - else if (currentParcelBlock.LandData.SalePrice > 0 && - (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || - currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) - { - //Sale type - tempByte = (byte)LandChannel.LAND_TYPE_IS_FOR_SALE; - } - else if (currentParcelBlock.LandData.OwnerID == UUID.Zero) - { - //Public type - tempByte = (byte)LandChannel.LAND_TYPE_PUBLIC; // this does nothing, its zero - } - // LAND_TYPE_IS_BEING_AUCTIONED still unsuported - else - { - //Other Flag - tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_OTHER; - } + //Owner Flag + curByte = LandChannel.LAND_TYPE_OWNED_BY_REQUESTER; + } + else if (currentParcel.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcel.LandData.GroupID)) + { + curByte = LandChannel.LAND_TYPE_OWNED_BY_GROUP; + } + else if (currentParcel.LandData.SalePrice > 0 && + (currentParcel.LandData.AuthBuyerID == UUID.Zero || + currentParcel.LandData.AuthBuyerID == remote_client.AgentId)) + { + //Sale type + curByte = LandChannel.LAND_TYPE_IS_FOR_SALE; + } + else if (currentParcel.LandData.OwnerID == UUID.Zero) + { + //Public type + curByte = LandChannel.LAND_TYPE_PUBLIC; // this does nothing, its zero + } + // LAND_TYPE_IS_BEING_AUCTIONED still unsuported + else + { + //Other + curByte = LandChannel.LAND_TYPE_OWNED_BY_OTHER; + } - // now flags - // border control + // now flags + // local sound + if ((currentParcel.LandData.Flags & (uint)ParcelFlags.SoundLocal) != 0) + curByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND; - ILandObject westParcel = null; - ILandObject southParcel = null; - if (x > 0) - { - westParcel = GetLandObject((x - 1), y); - } - if (y > 0) - { - southParcel = GetLandObject(x, (y - 1)); - } + // hide avatars + if (!currentParcel.LandData.SeeAVs) + curByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS; - if (x == 0) - { - tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST; - } - else if (westParcel != null && westParcel != currentParcelBlock) - { - tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST; - } + // border flags for current + if (y == 0) + { + curByte |= LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; + tmpByte = curByte; + } + else + { + tmpByte = curByte; + southID = GetLandObjectIDinLandUnits(x, (y - 1)); + if (southID > 0 && southID != curID) + tmpByte |= LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; + } + + tmpByte |= LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST; + byteArray[byteArrayCount] = tmpByte; + byteArrayCount++; - if (y == 0) + if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) + { + remote_client.SendLandParcelOverlay(byteArray, sequenceID); + byteArrayCount = 0; + sequenceID++; + byteArray = new byte[LAND_BLOCKS_PER_PACKET]; + } + // keep adding while on same parcel, checking south border + if (y == 0) + { + // all have south border and that is already on curByte + while (++x < sx && GetLandObjectIDinLandUnits(x, y) == curID) { - tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; + byteArray[byteArrayCount] = curByte; + byteArrayCount++; + if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) + { + remote_client.SendLandParcelOverlay(byteArray, sequenceID); + byteArrayCount = 0; + sequenceID++; + byteArray = new byte[LAND_BLOCKS_PER_PACKET]; + } } - else if (southParcel != null && southParcel != currentParcelBlock) + } + else + { + while (++x < sx && GetLandObjectIDinLandUnits(x, y) == curID) { - tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; - } - - // local sound - if ((currentParcelBlock.LandData.Flags & (uint)ParcelFlags.SoundLocal) != 0) - tempByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND; - - // hide avatars - if (!currentParcelBlock.LandData.SeeAVs) - tempByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS; - + // need to check south one by one + southID = GetLandObjectIDinLandUnits(x, (y - 1)); + if (southID > 0 && southID != curID) + { + tmpByte = curByte; + tmpByte |= LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; + byteArray[byteArrayCount] = tmpByte; + } + else + byteArray[byteArrayCount] = curByte; - byteArray[byteArrayCount] = tempByte; - byteArrayCount++; - if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) - { - remote_client.SendLandParcelOverlay(byteArray, sequenceID); - byteArrayCount = 0; - sequenceID++; - byteArray = new byte[LAND_BLOCKS_PER_PACKET]; + byteArrayCount++; + if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) + { + remote_client.SendLandParcelOverlay(byteArray, sequenceID); + byteArrayCount = 0; + sequenceID++; + byteArray = new byte[LAND_BLOCKS_PER_PACKET]; + } } } } -- cgit v1.1 From 1c6be0fae39e3de9e449f7da67381a63746f1702 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:10:08 +0000 Subject: ooops --- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index c57e7bb..d693d21 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1397,7 +1397,7 @@ namespace OpenSim.Region.CoreModules.World.Land { tmpByte = curByte; southID = GetLandObjectIDinLandUnits(x, (y - 1)); - if (southID > 0 && southID != curID) + if (southID >= 0 && southID != curID) tmpByte |= LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; } @@ -1435,7 +1435,7 @@ namespace OpenSim.Region.CoreModules.World.Land { // need to check south one by one southID = GetLandObjectIDinLandUnits(x, (y - 1)); - if (southID > 0 && southID != curID) + if (southID >= 0 && southID != curID) { tmpByte = curByte; tmpByte |= LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; -- cgit v1.1 From 182977a872f837a29f936964d8df55942187261a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:38:43 +0000 Subject: do not send parceloverlay on crossings (may be bad, or not) --- OpenSim/Framework/ILandChannel.cs | 2 +- OpenSim/Region/CoreModules/World/Land/LandChannel.cs | 4 ++-- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 5 +++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++---- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index e5ea596..0efd908 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -98,6 +98,6 @@ namespace OpenSim.Region.Framework.Interfaces void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); - void sendClientInitialLandInfo(IClientAPI remoteClient); + void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true); } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 993b782..eaa5292 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -247,11 +247,11 @@ namespace OpenSim.Region.CoreModules.World.Land m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime); } } - public void sendClientInitialLandInfo(IClientAPI remoteClient) + public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true) { if (m_landManagementModule != null) { - m_landManagementModule.sendClientInitialLandInfo(remoteClient); + m_landManagementModule.sendClientInitialLandInfo(remoteClient, overlay); } } #endregion diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d693d21..c7b45ef 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -491,7 +491,7 @@ namespace OpenSim.Region.CoreModules.World.Land return; } - public void sendClientInitialLandInfo(IClientAPI remoteClient) + public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true) { ScenePresence avatar; @@ -507,7 +507,8 @@ namespace OpenSim.Region.CoreModules.World.Land avatar.currentParcelUUID = over.LandData.GlobalID; over.SendLandUpdateToClient(avatar.ControllingClient); } - SendParcelOverlay(remoteClient); + if(overlay) + SendParcelOverlay(remoteClient); } public void SendLandUpdate(ScenePresence avatar, ILandObject over) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e663055..a67d701 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2244,11 +2244,12 @@ namespace OpenSim.Region.Framework.Scenes // start sending terrain patchs if (!gotCrossUpdate) Scene.SendLayerData(ControllingClient); + + // send initial land overlay and parcel + ILandChannel landch = m_scene.LandChannel; + if (landch != null) + landch.sendClientInitialLandInfo(client, !gotCrossUpdate); } - // send initial land overlay and parcel - ILandChannel landch = m_scene.LandChannel; - if (landch != null) - landch.sendClientInitialLandInfo(client); if (!IsChildAgent) { diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index cb16f55..87cbede 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -119,6 +119,6 @@ namespace OpenSim.Tests.Common public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} - public void sendClientInitialLandInfo(IClientAPI remoteClient) { } + public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true) { } } } \ No newline at end of file -- cgit v1.1 From b10a3ba0232031a1daac2a972478b7c34b7ec7ff Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:52:57 +0000 Subject: take the deafult on the parameter overlay --- OpenSim/Framework/ILandChannel.cs | 2 +- OpenSim/Region/CoreModules/World/Land/LandChannel.cs | 2 +- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 0efd908..6f4a07a 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -98,6 +98,6 @@ namespace OpenSim.Region.Framework.Interfaces void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); - void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true); + void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay); } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index eaa5292..9e687eb 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -247,7 +247,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime); } } - public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true) + public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay) { if (m_landManagementModule != null) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index c7b45ef..b67cad7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -491,7 +491,7 @@ namespace OpenSim.Region.CoreModules.World.Land return; } - public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true) + public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay) { ScenePresence avatar; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a67d701..f010035 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4040,7 +4040,7 @@ namespace OpenSim.Region.Framework.Scenes ILandChannel landch = m_scene.LandChannel; if (landch != null) { - landch.sendClientInitialLandInfo(ControllingClient); + landch.sendClientInitialLandInfo(ControllingClient, true); } } diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 87cbede..b5227aa 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -119,6 +119,6 @@ namespace OpenSim.Tests.Common public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} - public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay = true) { } + public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay) { } } } \ No newline at end of file -- cgit v1.1 From 132d8be9cc9d27175ad771dbb93d5822cbd5b513 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 07:22:24 +0000 Subject: UnAckedBytes are in KB --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0d78654..0cba495 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5414,6 +5414,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendSimStats(SimStats stats) { + stats.StatsBlock[15].StatValue /= 1024; // UnAckedBytes are in KB SimStatsPacket pack = new SimStatsPacket(); pack.Region = new SimStatsPacket.RegionBlock(); pack.Region.RegionX = stats.RegionX; -- cgit v1.1 From 71361f61f41d0a37efcf4f9637b1270a13d7a47c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 08:52:14 +0000 Subject: lludp SimStats encoding --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 51 ++++++++++++++++------ 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0cba495..41f40da 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5412,21 +5412,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(PacketPool.Instance.GetPacket(PacketType.DisableSimulator), ThrottleOutPacketType.Unknown); } + static private readonly byte[] SimStatsHeader = new byte[] { + 0, + 0, 0, 0, 0, // sequence number + 0, // extra + 0xff, 0xff, 0, 140 // ID 140 (low frequency bigendian) + }; + public void SendSimStats(SimStats stats) { - stats.StatsBlock[15].StatValue /= 1024; // UnAckedBytes are in KB - SimStatsPacket pack = new SimStatsPacket(); - pack.Region = new SimStatsPacket.RegionBlock(); - pack.Region.RegionX = stats.RegionX; - pack.Region.RegionY = stats.RegionY; - pack.Region.RegionFlags = stats.RegionFlags; - pack.Region.ObjectCapacity = stats.ObjectCapacity; - //pack.Region = //stats.RegionBlock; - pack.Stat = stats.StatsBlock; - - pack.Header.Reliable = false; - pack.RegionInfo = new SimStatsPacket.RegionInfoBlock[0]; - OutPacket(pack, ThrottleOutPacketType.Task); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header + Buffer.BlockCopy(SimStatsHeader, 0, data, 0, 10); + + // Region Block + Utils.UIntToBytesSafepos(stats.RegionX, data, 10); + Utils.UIntToBytesSafepos(stats.RegionY, data, 14); + Utils.UIntToBytesSafepos(stats.RegionFlags, data, 18); + Utils.UIntToBytesSafepos(stats.ObjectCapacity, data, 22); // 26 + + // stats + data[26] = (byte)stats.StatsBlock.Length; + int pos = 27; + + for(int i = 0; i< stats.StatsBlock.Length; ++i) + { + Utils.UIntToBytesSafepos(stats.StatsBlock[i].StatID, data, pos); pos += 4; + Utils.FloatToBytesSafepos(stats.StatsBlock[i].StatValue, data, pos); pos += 4; + } + + //no PID + Utils.IntToBytesSafepos(0, data, pos); pos += 4; + + // no regioninfo (extended flags) + data[pos++] = 0; // = 1; + //Utils.UInt64ToBytesSafepos(RegionFlagsExtended, data, pos); pos += 8; + + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } private class ObjectPropertyUpdate : EntityUpdate -- cgit v1.1 From a7927e9d7b6ad4357b3b6701b79ad9f48496888a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 09:44:13 +0000 Subject: lludp ObjectAnimation encoding --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 38 +++++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 41f40da..dd67e67 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4641,6 +4641,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP 15 // ID (high frequency) }; + static private readonly byte[] ObjectAnimationHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 30 // ID (high frequency) + }; + private void ProcessEntityUpdates(int maxUpdatesBytes) { if (!IsActive) @@ -5084,6 +5091,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (sop.Animations == null) continue; + SceneObjectGroup sog = sop.ParentGroup; if (sog == null || sog.IsDeleted) continue; @@ -5096,18 +5104,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP int[] seqs = null; int count = sop.GetAnimations(out ids, out seqs); - ObjectAnimationPacket ani = (ObjectAnimationPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAnimation); - ani.Sender = new ObjectAnimationPacket.SenderBlock(); - ani.Sender.ID = sop.UUID; - ani.AnimationList = new ObjectAnimationPacket.AnimationListBlock[count]; + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + //setup header + Buffer.BlockCopy(ObjectAnimationHeader, 0, data , 0, 7); + + // sender block + sop.UUID.ToBytes(data, 7); // 23 + + //animations block + if (count > 255) + count = 255; + + data[23] = (byte)count; - for(int i = 0; i< count; i++) + int pos = 24; + for(int i = 0; i < count; i++) { - ani.AnimationList[i] = new ObjectAnimationPacket.AnimationListBlock(); - ani.AnimationList[i].AnimID = ids[i]; - ani.AnimationList[i].AnimSequenceID = seqs[i]; + ids[i].ToBytes(data, pos); pos += 16; + Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; } - OutPacket(ani, ThrottleOutPacketType.Task, true); + + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); } } -- cgit v1.1 From 7884278097d49730606afca20cad60510a70269d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 10:29:48 +0000 Subject: try to avoid some useless full object updates --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 312ce26..edcdbd3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1038,8 +1038,8 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (m_text.Length > 256) // yes > 254 - return m_text.Substring(0, 256); + if (m_text.Length > 254) + return m_text.Substring(0, 254); return m_text; } set { m_text = value; } @@ -4004,9 +4004,10 @@ namespace OpenSim.Region.Framework.Scenes /// <param name="text"></param> public void SetText(string text) { - Text = text; + string oldtext = m_text; + m_text = text; - if (ParentGroup != null) + if (ParentGroup != null && oldtext != text) { ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); @@ -4021,11 +4022,18 @@ namespace OpenSim.Region.Framework.Scenes /// <param name="alpha"></param> public void SetText(string text, Vector3 color, double alpha) { + Color oldcolor = Color; + string oldtext = m_text; Color = Color.FromArgb((int) (alpha*0xff), (int) (color.X*0xff), (int) (color.Y*0xff), (int) (color.Z*0xff)); - SetText(text); + m_text = text; + if(ParentGroup != null && (oldcolor != Color || oldtext != m_text)) + { + ParentGroup.HasGroupChanged = true; + ScheduleFullUpdate(); + } } public void StoreUndoState(ObjectChangeType change) -- cgit v1.1 From c521ff394eb59bb5dfc767b3f8ebf7176b91685f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 10:59:01 +0000 Subject: recover the UnAckedBytes are in KB fix --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index dd67e67..5302fff 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5457,7 +5457,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP data[26] = (byte)stats.StatsBlock.Length; int pos = 27; - for(int i = 0; i< stats.StatsBlock.Length; ++i) + stats.StatsBlock[15].StatValue /= 1024; // unack is in KB + for (int i = 0; i< stats.StatsBlock.Length; ++i) { Utils.UIntToBytesSafepos(stats.StatsBlock[i].StatID, data, pos); pos += 4; Utils.FloatToBytesSafepos(stats.StatsBlock[i].StatValue, data, pos); pos += 4; -- cgit v1.1 From af35882eda75c1a406ec7a2890370380810bf19f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 13:00:11 +0000 Subject: prevent spurius acceleration values --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index edcdbd3..1a5e9d6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Framework.Scenes get { PhysicsActor actor = PhysActor; - if (actor != null) + if (actor != null && actor.IsPhysical) { m_acceleration = actor.Acceleration; } -- cgit v1.1 From fe6317f009cbdbe9b075c32584e1188cb59ddf94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 21:37:58 +0000 Subject: LSL update texture entry is heavy, set all parameters on same update --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 +-- .../Shared/Api/Implementation/LSL_Api.cs | 62 ++++++++++++++++++++-- bin/OpenSimDefaults.ini | 2 +- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1a5e9d6..cf9dfee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2338,10 +2338,7 @@ namespace OpenSim.Region.Framework.Scenes { ParentGroup.Scene.RemovePhysicalPrim(1); - Velocity = new Vector3(0, 0, 0); - Acceleration = new Vector3(0, 0, 0); - AngularVelocity = new Vector3(0, 0, 0); - APIDActive = false; + Stop(); if (pa.Phantom && !VolumeDetectActive) { @@ -4730,14 +4727,13 @@ namespace OpenSim.Region.Framework.Scenes if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none || (Shape.PathCurve == (byte)Extrusion.Flexible)) { + Stop(); if (pa != null) { if(wasUsingPhysics) ParentGroup.Scene.RemovePhysicalPrim(1); RemoveFromPhysics(); } - - Stop(); } else diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5dc6260..ba35b55 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2403,6 +2403,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(m_sleepMsOnSetLinkTexture); } + protected void SetTextureParams(SceneObjectPart part, string texture, double scaleU, double ScaleV, + double offsetU, double offsetV, double rotation, int face) + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + + UUID textureID = new UUID(); + + textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); + if (textureID == UUID.Zero) + { + if (!UUID.TryParse(texture, out textureID)) + return; + } + + Primitive.TextureEntry tex = part.Shape.Textures; + int nsides = GetNumberOfSides(part); + + if (face >= 0 && face < nsides) + { + Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); + texface.TextureID = textureID; + texface.RepeatU = (float)scaleU; + texface.RepeatV = (float)ScaleV; + texface.OffsetU = (float)offsetU; + texface.OffsetV = (float)offsetV; + texface.Rotation = (float)rotation; + tex.FaceTextures[face] = texface; + part.UpdateTextureEntry(tex); + return; + } + else if (face == ScriptBaseClass.ALL_SIDES) + { + for (uint i = 0; i < nsides; i++) + { + if (tex.FaceTextures[i] != null) + { + tex.FaceTextures[i].TextureID = textureID; + tex.FaceTextures[i].RepeatU = (float)scaleU; + tex.FaceTextures[i].RepeatV = (float)ScaleV; + tex.FaceTextures[i].OffsetU = (float)offsetU; + tex.FaceTextures[i].OffsetV = (float)offsetV; + tex.FaceTextures[i].Rotation = (float)rotation; + } + } + tex.DefaultTexture.TextureID = textureID; + tex.DefaultTexture.RepeatU = (float)scaleU; + tex.DefaultTexture.RepeatV = (float)ScaleV; + tex.DefaultTexture.OffsetU = (float)offsetU; + tex.DefaultTexture.OffsetV = (float)offsetV; + tex.DefaultTexture.Rotation = (float)rotation; + part.UpdateTextureEntry(tex); + return; + } + } + protected void SetTexture(SceneObjectPart part, string texture, int face) { if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) @@ -9728,11 +9784,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_List(); } - SetTexture(part, tex, face); - ScaleTexture(part, repeats.x, repeats.y, face); - OffsetTexture(part, offsets.x, offsets.y, face); - RotateTexture(part, rotation, face); - + SetTextureParams(part, tex, repeats.x, repeats.y, offsets.x, offsets.y, rotation, face); break; case ScriptBaseClass.PRIM_COLOR: diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index cede84d..20dbd2e 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -454,7 +454,7 @@ ; warp3D rendering height limits for prims (relative to rez position not bounding box) ; prims above RenderMaxHeight are excluded - ; valid values: 100 t0 4086 + ; valid values: 100 to 4086 ;RenderMaxHeight = 4086 ; prims below RenderMinHeight are excluded -- cgit v1.1 From 81ff118378863be6297016bef5a522ba0c76d1ca Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Mar 2019 14:41:19 +0000 Subject: lludp direct encode RegionHandshake --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 280 ++++++++++++--------- 1 file changed, 167 insertions(+), 113 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5302fff..aae4b87 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -817,52 +817,173 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar to Client - public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) - { - RegionHandshakePacket handshake = (RegionHandshakePacket)PacketPool.Instance.GetPacket(PacketType.RegionHandshake); - handshake.RegionInfo = new RegionHandshakePacket.RegionInfoBlock(); - handshake.RegionInfo.BillableFactor = args.billableFactor; - handshake.RegionInfo.IsEstateManager = args.isEstateManager; - handshake.RegionInfo.TerrainHeightRange00 = args.terrainHeightRange0; - handshake.RegionInfo.TerrainHeightRange01 = args.terrainHeightRange1; - handshake.RegionInfo.TerrainHeightRange10 = args.terrainHeightRange2; - handshake.RegionInfo.TerrainHeightRange11 = args.terrainHeightRange3; - handshake.RegionInfo.TerrainStartHeight00 = args.terrainStartHeight0; - handshake.RegionInfo.TerrainStartHeight01 = args.terrainStartHeight1; - handshake.RegionInfo.TerrainStartHeight10 = args.terrainStartHeight2; - handshake.RegionInfo.TerrainStartHeight11 = args.terrainStartHeight3; - handshake.RegionInfo.SimAccess = args.simAccess; - handshake.RegionInfo.WaterHeight = args.waterHeight; - - handshake.RegionInfo.RegionFlags = args.regionFlags; - handshake.RegionInfo.SimName = Util.StringToBytes256(args.regionName); - handshake.RegionInfo.SimOwner = args.SimOwner; - handshake.RegionInfo.TerrainBase0 = args.terrainBase0; - handshake.RegionInfo.TerrainBase1 = args.terrainBase1; - handshake.RegionInfo.TerrainBase2 = args.terrainBase2; - handshake.RegionInfo.TerrainBase3 = args.terrainBase3; - handshake.RegionInfo.TerrainDetail0 = args.terrainDetail0; - handshake.RegionInfo.TerrainDetail1 = args.terrainDetail1; - handshake.RegionInfo.TerrainDetail2 = args.terrainDetail2; - handshake.RegionInfo.TerrainDetail3 = args.terrainDetail3; - handshake.RegionInfo.CacheID = UUID.Random(); //I guess this is for the client to remember an old setting? - handshake.RegionInfo2 = new RegionHandshakePacket.RegionInfo2Block(); - handshake.RegionInfo2.RegionID = regionInfo.RegionID; - - handshake.RegionInfo3 = new RegionHandshakePacket.RegionInfo3Block(); - handshake.RegionInfo3.CPUClassID = 9; - handshake.RegionInfo3.CPURatio = 1; - - handshake.RegionInfo3.ColoName = Utils.EmptyBytes; - handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); - handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; - - handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[1]; - handshake.RegionInfo4[0] = new RegionHandshakePacket.RegionInfo4Block(); - handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags; - handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported - - OutPacket(handshake, ThrottleOutPacketType.Unknown); + // temporary here ( from estatemanagermodule) + private uint GetRegionFlags() + { + RegionFlags flags = RegionFlags.None; + + if (Scene.RegionInfo.RegionSettings.AllowDamage) + flags |= RegionFlags.AllowDamage; + if (Scene.RegionInfo.EstateSettings.AllowLandmark) + flags |= RegionFlags.AllowLandmark; + if (Scene.RegionInfo.EstateSettings.AllowSetHome) + flags |= RegionFlags.AllowSetHome; + if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) + flags |= RegionFlags.ResetHomeOnTeleport; + if (Scene.RegionInfo.RegionSettings.FixedSun) + flags |= RegionFlags.SunFixed; + // allow access override (was taxfree) + if (Scene.RegionInfo.RegionSettings.BlockTerraform) + flags |= RegionFlags.BlockTerraform; + if (!Scene.RegionInfo.RegionSettings.AllowLandResell) + flags |= RegionFlags.BlockLandResell; + if (Scene.RegionInfo.RegionSettings.Sandbox) + flags |= RegionFlags.Sandbox; + // nulllayer not used + if (Scene.RegionInfo.RegionSettings.Casino) + flags |= RegionFlags.SkipAgentAction; // redefined + if (Scene.RegionInfo.RegionSettings.GodBlockSearch) + flags |= RegionFlags.SkipUpdateInterestList; // redefined + if (Scene.RegionInfo.RegionSettings.DisableCollisions) + flags |= RegionFlags.SkipCollisions; + if (Scene.RegionInfo.RegionSettings.DisableScripts) + flags |= RegionFlags.SkipScripts; + if (Scene.RegionInfo.RegionSettings.DisablePhysics) + flags |= RegionFlags.SkipPhysics; + if (Scene.RegionInfo.EstateSettings.PublicAccess) + flags |= RegionFlags.ExternallyVisible; // ???? need revision + //MainlandVisible -> allow return enc object + //PublicAllowed -> allow return enc estate object + if (Scene.RegionInfo.EstateSettings.BlockDwell) + flags |= RegionFlags.BlockDwell; + if (Scene.RegionInfo.RegionSettings.BlockFly) + flags |= RegionFlags.NoFly; + if (Scene.RegionInfo.EstateSettings.AllowDirectTeleport) + flags |= RegionFlags.AllowDirectTeleport; + if (Scene.RegionInfo.EstateSettings.EstateSkipScripts) + flags |= RegionFlags.EstateSkipScripts; + if (Scene.RegionInfo.RegionSettings.RestrictPushing) + flags |= RegionFlags.RestrictPushObject; + if (Scene.RegionInfo.EstateSettings.DenyAnonymous) + flags |= RegionFlags.DenyAnonymous; + //DenyIdentified unused + //DenyTransacted unused + if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) + flags |= RegionFlags.AllowParcelChanges; + //AbuseEmailToEstateOwner -> block flyover + if (Scene.RegionInfo.EstateSettings.AllowVoice) + flags |= RegionFlags.AllowVoice; + if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) + flags |= RegionFlags.BlockParcelSearch; + if (Scene.RegionInfo.EstateSettings.DenyMinors) + flags |= RegionFlags.DenyAgeUnverified; + + return (uint)flags; + } + + // Region handshake may need a more detailed look + static private readonly byte[] RegionHandshakeHeader = new byte[] { + Helpers.MSG_RELIABLE | Helpers.MSG_ZEROCODED, + 0, 0, 0, 0, // sequence number + 0, // extra + //0xff, 0xff, 0, 148 // ID 148 (low frequency bigendian) + 0xff, 0xff, 0, 1, 148 // ID 148 (low frequency bigendian) zero encoded + }; + + public void SendRegionHandshake(RegionInfo _regionInfo, RegionHandshakeArgs args) + { + RegionInfo regionInfo = m_scene.RegionInfo; + RegionSettings regionSettings = regionInfo.RegionSettings; + EstateSettings es = regionInfo.EstateSettings; + + bool isEstateManager = m_scene.Permissions.IsEstateManager(AgentId); // go by oficial path + uint regionFlags = GetRegionFlags(); + + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(RegionHandshakeHeader, 0, buf.Data, 0, 11); + + // inline zeroencode + LLUDPZeroEncoder zc = new LLUDPZeroEncoder(buf.Data); + zc.Position = 11; + + //RegionInfo Block + //RegionFlags U32 + zc.AddUInt(regionFlags); + //SimAccess U8 + zc.AddByte(regionInfo.AccessLevel); + //SimName + zc.AddShortString(regionInfo.RegionName, 255); + //SimOwner + zc.AddUUID(es.EstateOwner); + //IsEstateManager + zc.AddByte((byte)(isEstateManager ? 1 : 0)); + //WaterHeight + zc.AddFloat((float)regionSettings.WaterHeight); // why is this a double ?? + //BillableFactor + zc.AddFloat(es.BillableFactor); + //CacheID + zc.AddUUID(regionInfo.RegionID); // needs review when we actuall support cache + //TerrainBase0 + //TerrainBase1 + //TerrainBase2 + //TerrainBase3 + // this seem not obsolete, sending zero uuids + // we should send the basic low resolution default ? + zc.AddZeros(16 * 4); + //TerrainDetail0 + zc.AddUUID(regionSettings.TerrainTexture1); + //TerrainDetail1 + zc.AddUUID(regionSettings.TerrainTexture2); + //TerrainDetail2 + zc.AddUUID(regionSettings.TerrainTexture3); + //TerrainDetail3 + zc.AddUUID(regionSettings.TerrainTexture4); + //TerrainStartHeight00 + zc.AddFloat((float)regionSettings.Elevation1SW); + //TerrainStartHeight01 + zc.AddFloat((float)regionSettings.Elevation1NW); + //TerrainStartHeight10 + zc.AddFloat((float)regionSettings.Elevation1SE); + //TerrainStartHeight11 + zc.AddFloat((float)regionSettings.Elevation1NE); + //TerrainHeightRange00 + zc.AddFloat((float)regionSettings.Elevation2SW); + //TerrainHeightRange01 + zc.AddFloat((float)regionSettings.Elevation2NW); + //TerrainHeightRange10 + zc.AddFloat((float)regionSettings.Elevation2SE); + //TerrainHeightRange11 + zc.AddFloat((float)regionSettings.Elevation2NE); + + //RegionInfo2 block + + //region ID + zc.AddUUID(regionInfo.RegionID); + + //RegionInfo3 block + + //CPUClassID + zc.AddInt(9); + //CPURatio + zc.AddInt(1); + // ColoName (string) + // ProductSKU (string) + // both empty strings + zc.AddZeros(2); + //ProductName + zc.AddShortString(regionInfo.RegionType, 255); + + //RegionInfo4 block + + //RegionFlagsExtended + zc.AddZeros(1); // we dont have this + //zc.AddByte(1); + //zc.AddUInt64(regionFlags); // we have nothing other base flags + //RegionProtocols + //zc.AddUInt64(0); // bit 0 signals server side texture baking" + + buf.DataLength = zc.Finish(); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); } static private readonly byte[] AgentMovementCompleteHeader = new byte[] { @@ -6418,73 +6539,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // total size 63 or 47 + (texture size + 4) } - protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) - { - Quaternion rotation = data.Rotation; - // tpvs can only see rotations around Z in some cases - if(!data.Flying && !data.IsSatOnObject) - { - rotation.X = 0f; - rotation.Y = 0f; - } - rotation.Normalize(); - -// m_log.DebugFormat( -// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); - - byte[] objectData = new byte[76]; - - //Vector3 velocity = Vector3.Zero; - Vector3 acceleration = Vector3.Zero; - Vector3 angularvelocity = Vector3.Zero; - - data.CollisionPlane.ToBytes(objectData, 0); - data.OffsetPosition.ToBytes(objectData, 16); - data.Velocity.ToBytes(objectData, 28); - acceleration.ToBytes(objectData, 40); - rotation.ToBytes(objectData, 52); - angularvelocity.ToBytes(objectData, 64); - - ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); - - update.Data = Utils.EmptyBytes; - update.ExtraParams = Utils.EmptyBytes; - update.FullID = data.UUID; - update.ID = data.LocalId; - update.Material = (byte)Material.Flesh; - update.MediaURL = Utils.EmptyBytes; - update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + - data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); - update.ObjectData = objectData; - - SceneObjectPart parentPart = data.ParentPart; - if (parentPart != null) - update.ParentID = parentPart.ParentGroup.LocalId; - else - update.ParentID = 0; - - update.PathCurve = 16; - update.PathScaleX = 100; - update.PathScaleY = 100; - update.PCode = (byte)PCode.Avatar; - update.ProfileCurve = 1; - update.PSBlock = Utils.EmptyBytes; - update.Scale = data.Appearance.AvatarSize; -// update.Scale.Z -= 0.2f; - - update.Text = Utils.EmptyBytes; - update.TextColor = new byte[4]; - - // Don't send texture anim for avatars - this has no meaning for them. - update.TextureAnim = Utils.EmptyBytes; - - // Don't send texture entry for avatars here - this is accomplished via the AvatarAppearance packet - update.TextureEntry = Utils.EmptyBytes; - update.UpdateFlags = 0; - - return update; - } - protected void CreateAvatarUpdateBlock(ScenePresence data, byte[] dest, ref int pos) { Quaternion rotation = data.Rotation; -- cgit v1.1 From d6b3413c6337f8409b78266ac987aac63a5f77e5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Mar 2019 15:09:53 +0000 Subject: RegionHandshake IS critical llupd protocol not to be done by odd modules --- OpenSim/Framework/EstateSettings.cs | 8 ++++---- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 8 +++++--- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 2 +- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 6 +----- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 1b5ebfa..1c0b97a 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -153,7 +153,7 @@ namespace OpenSim.Framework private bool m_DenyAnonymous = false; public bool DenyAnonymous { - get { return m_DenyAnonymous; } + get { return (DoDenyAnonymous && m_DenyAnonymous); } set { m_DenyAnonymous = value; } } @@ -233,7 +233,7 @@ namespace OpenSim.Framework private bool m_DenyMinors = false; public bool DenyMinors { - get { return m_DenyMinors; } + get { return (DoDenyMinors && m_DenyMinors); } set { m_DenyMinors = value; } } @@ -379,14 +379,14 @@ namespace OpenSim.Framework if (!HasAccess(avatarID)) { - if (DoDenyMinors && DenyMinors) + if (DenyMinors) { if ((userFlags & 32) == 0) { return true; } } - if (DoDenyAnonymous && DenyAnonymous) + if (DenyAnonymous) { if ((userFlags & 4) == 0) { diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 63e3782..0c5224b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1106,7 +1106,7 @@ namespace OpenSim.Framework // void SendPartFullUpdate(ISceneEntity ent, uint? parentID); void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); - void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); + void SendRegionHandshake(); /// <summary> /// Send chat to the viewer. diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index aae4b87..50bb9ba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -890,7 +890,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP 0xff, 0xff, 0, 1, 148 // ID 148 (low frequency bigendian) zero encoded }; - public void SendRegionHandshake(RegionInfo _regionInfo, RegionHandshakeArgs args) + + public void SendRegionHandshake() { RegionInfo regionInfo = m_scene.RegionInfo; RegionSettings regionSettings = regionInfo.RegionSettings; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 2f73454..c899428 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1725,11 +1725,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // circuit code to the existing child agent. This is not particularly obvious. SendAckImmediate(endPoint, uccp.Header.Sequence); - client.CheckViewerCaps(); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) { + client.SendRegionHandshake(); + + client.CheckViewerCaps(); + + // We only want to send initial data to new clients, not ones which are being converted from child to root. bool tp = (aCircuit.teleportFlags > 0); // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from if (!tp) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index fb195e7..59ce05a 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -932,7 +932,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize, new WearableCacheItem[0]); } - public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) + public void SendRegionHandshake() { m_log.Info("[IRCd ClientStack] Completing Handshake to Region"); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 9c13061..09f2a58 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -668,10 +668,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public virtual void SendStartPingCheck(byte seq) - { - } - public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) { } @@ -928,7 +924,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public virtual void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) + public virtual void SendRegionHandshake() { if (OnRegionHandShakeReply != null) { diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 022ebdf..bc6cb60 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -876,7 +876,7 @@ namespace OpenSim.Tests.Common { } - public virtual void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) + public virtual void SendRegionHandshake() { if (OnRegionHandShakeReply != null) { -- cgit v1.1 From 7211afb3b9193e23ee19225bd2f7ebfe8249bdd2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Mar 2019 15:12:56 +0000 Subject: missing file --- .../World/Estate/EstateManagementModule.cs | 86 +++++++--------------- 1 file changed, 27 insertions(+), 59 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index ac28cee..fd08721 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1518,42 +1518,7 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionHandshake(IClientAPI remoteClient) { - RegionHandshakeArgs args = new RegionHandshakeArgs(); - - args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(remoteClient.AgentId); - if (Scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && Scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) - args.isEstateManager = true; - - args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor; - args.terrainStartHeight0 = (float)Scene.RegionInfo.RegionSettings.Elevation1SW; - args.terrainHeightRange0 = (float)Scene.RegionInfo.RegionSettings.Elevation2SW; - args.terrainStartHeight1 = (float)Scene.RegionInfo.RegionSettings.Elevation1NW; - args.terrainHeightRange1 = (float)Scene.RegionInfo.RegionSettings.Elevation2NW; - args.terrainStartHeight2 = (float)Scene.RegionInfo.RegionSettings.Elevation1SE; - args.terrainHeightRange2 = (float)Scene.RegionInfo.RegionSettings.Elevation2SE; - args.terrainStartHeight3 = (float)Scene.RegionInfo.RegionSettings.Elevation1NE; - args.terrainHeightRange3 = (float)Scene.RegionInfo.RegionSettings.Elevation2NE; - args.simAccess = Scene.RegionInfo.AccessLevel; - args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight; - args.regionFlags = GetRegionFlags(); - args.regionName = Scene.RegionInfo.RegionName; - args.SimOwner = Scene.RegionInfo.EstateSettings.EstateOwner; - - args.terrainBase0 = UUID.Zero; - args.terrainBase1 = UUID.Zero; - args.terrainBase2 = UUID.Zero; - args.terrainBase3 = UUID.Zero; - args.terrainDetail0 = Scene.RegionInfo.RegionSettings.TerrainTexture1; - args.terrainDetail1 = Scene.RegionInfo.RegionSettings.TerrainTexture2; - args.terrainDetail2 = Scene.RegionInfo.RegionSettings.TerrainTexture3; - args.terrainDetail3 = Scene.RegionInfo.RegionSettings.TerrainTexture4; - -// m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 1 {0} for region {1}", args.terrainDetail0, Scene.RegionInfo.RegionName); -// m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 2 {0} for region {1}", args.terrainDetail1, Scene.RegionInfo.RegionName); -// m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 3 {0} for region {1}", args.terrainDetail2, Scene.RegionInfo.RegionName); -// m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 4 {0} for region {1}", args.terrainDetail3, Scene.RegionInfo.RegionName); - - remoteClient.SendRegionHandshake(Scene.RegionInfo,args); + remoteClient.SendRegionHandshake(); } public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) @@ -1673,7 +1638,6 @@ namespace OpenSim.Region.CoreModules.World.Estate client.OnRegionInfoRequest += HandleRegionInfoRequest; client.OnEstateCovenantRequest += HandleEstateCovenantRequest; client.OnLandStatRequest += HandleLandStatRequest; - sendRegionHandshake(client); } @@ -1681,39 +1645,43 @@ namespace OpenSim.Region.CoreModules.World.Estate { RegionFlags flags = RegionFlags.None; + if (Scene.RegionInfo.EstateSettings.AllowLandmark) + flags |= RegionFlags.AllowLandmark; + if (Scene.RegionInfo.EstateSettings.AllowSetHome) + flags |= RegionFlags.AllowSetHome; + if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) + flags |= RegionFlags.ResetHomeOnTeleport; if (Scene.RegionInfo.EstateSettings.FixedSun) flags |= RegionFlags.SunFixed; - if (Scene.RegionInfo.EstateSettings.PublicAccess) - flags |= (RegionFlags.PublicAllowed | - RegionFlags.ExternallyVisible); - if (Scene.RegionInfo.EstateSettings.AllowVoice) - flags |= RegionFlags.AllowVoice; + if (Scene.RegionInfo.EstateSettings.TaxFree) // this is now wrong means ALLOW_ACCESS_OVERRIDE + flags |= RegionFlags.TaxFree; + + if (Scene.RegionInfo.EstateSettings.PublicAccess) //?? + flags |= (RegionFlags.PublicAllowed | RegionFlags.ExternallyVisible); + + if (Scene.RegionInfo.EstateSettings.BlockDwell) + flags |= RegionFlags.BlockDwell; if (Scene.RegionInfo.EstateSettings.AllowDirectTeleport) flags |= RegionFlags.AllowDirectTeleport; + if (Scene.RegionInfo.EstateSettings.EstateSkipScripts) + flags |= RegionFlags.EstateSkipScripts; + if (Scene.RegionInfo.EstateSettings.DenyAnonymous) flags |= RegionFlags.DenyAnonymous; - if (Scene.RegionInfo.EstateSettings.DenyIdentified) + if (Scene.RegionInfo.EstateSettings.DenyIdentified) // unused? flags |= RegionFlags.DenyIdentified; - if (Scene.RegionInfo.EstateSettings.DenyTransacted) + if (Scene.RegionInfo.EstateSettings.DenyTransacted) // unused? flags |= RegionFlags.DenyTransacted; - if (Scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) - flags |= RegionFlags.AbuseEmailToEstateOwner; - if (Scene.RegionInfo.EstateSettings.BlockDwell) - flags |= RegionFlags.BlockDwell; - if (Scene.RegionInfo.EstateSettings.EstateSkipScripts) - flags |= RegionFlags.EstateSkipScripts; - if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) - flags |= RegionFlags.ResetHomeOnTeleport; - if (Scene.RegionInfo.EstateSettings.TaxFree) - flags |= RegionFlags.TaxFree; - if (Scene.RegionInfo.EstateSettings.AllowLandmark) - flags |= RegionFlags.AllowLandmark; if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) flags |= RegionFlags.AllowParcelChanges; - if (Scene.RegionInfo.EstateSettings.AllowSetHome) - flags |= RegionFlags.AllowSetHome; + if (Scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) // now is block fly + flags |= RegionFlags.AbuseEmailToEstateOwner; + if (Scene.RegionInfo.EstateSettings.AllowVoice) + flags |= RegionFlags.AllowVoice; + + if (Scene.RegionInfo.EstateSettings.DenyMinors) - flags |= (RegionFlags)(1 << 30); + flags |= RegionFlags.DenyAgeUnverified; return (uint)flags; } -- cgit v1.1 From b1cf06796f498be162ae8e3dedca2ae9d8af9bda Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 06:21:57 +0000 Subject: do send flag PrimFlags.InventoryEmpty --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cf9dfee..6fb0eed 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2478,7 +2478,10 @@ namespace OpenSim.Region.Framework.Scenes // if (m_parentGroup == null || m_parentGroup.RootPart == this) // f &= ~(PrimFlags.Touch | PrimFlags.Money); - return (uint)Flags | (uint)LocalFlags; + uint eff = (uint)Flags | (uint)LocalFlags; + if(m_inventory == null || m_inventory.Count == 0) + eff = (uint)PrimFlags.InventoryEmpty; + return eff; } // some of this lines need be moved to other place later -- cgit v1.1 From cfbd34f618b8e1debd701aab3d51163942f08310 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 06:52:18 +0000 Subject: add some code for compressed updates, but disabled, since more changes are needed elsewhere --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 407 ++++++++++++++++++--- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 +- 2 files changed, 363 insertions(+), 54 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 50bb9ba..662e5ad 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4770,6 +4770,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP 30 // ID (high frequency) }; + static private readonly byte[] CompressedObjectHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 13 // ID (high frequency) + }; + private void ProcessEntityUpdates(int maxUpdatesBytes) { if (!IsActive) @@ -4779,9 +4786,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (mysp == null) return; - // List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null; List<EntityUpdate> objectUpdates = null; - // List<EntityUpdate> compressedUpdates = null; + //List<EntityUpdate> compressedUpdates = null; List<EntityUpdate> terseUpdates = null; List<SceneObjectPart> ObjectAnimationUpdates = null; @@ -4970,17 +4976,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(updateFlags == PrimUpdateFlags.None) continue; - /* - const PrimUpdateFlags canNotUseCompressedMask = - PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | - PrimUpdateFlags.CollisionPlane | PrimUpdateFlags.Joint; - - if ((updateFlags & canNotUseCompressedMask) != 0) - { - canUseCompressed = false; - } - */ - const PrimUpdateFlags canNotUseImprovedMask = ~( PrimUpdateFlags.AttachmentPoint | PrimUpdateFlags.Position | @@ -4996,19 +4991,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Block Construction - // TODO: Remove this once we can build compressed updates - /* - if (canUseCompressed) - { - ObjectUpdateCompressedPacket.ObjectDataBlock ablock = - CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags); - compressedUpdateBlocks.Add(ablock); - compressedUpdates.Value.Add(update); - maxUpdatesBytes -= ablock.Length; - } - else if (canUseImproved) - */ - if ((updateFlags & canNotUseImprovedMask) == 0) { if (terseUpdates == null) @@ -5031,16 +5013,47 @@ namespace OpenSim.Region.ClientStack.LindenUDP else { if (update.Entity is ScenePresence) + { maxUpdatesBytes -= 150; // crude estimation - else - maxUpdatesBytes -= 300; - if(objectUpdates == null) + if (objectUpdates == null) + { + objectUpdates = new List<EntityUpdate>(); + maxUpdatesBytes -= 18; + } + objectUpdates.Add(update); + } + else { - objectUpdates = new List<EntityUpdate>(); - maxUpdatesBytes -= 18; + SceneObjectPart part = (SceneObjectPart)update.Entity; + SceneObjectGroup grp = part.ParentGroup; + // minimal compress conditions, not enough ? + //if (grp.UsesPhysics || part.Velocity.LengthSquared() > 1e-8f || part.Acceleration.LengthSquared() > 1e-6f) + { + maxUpdatesBytes -= 150; // crude estimation + + if (objectUpdates == null) + { + objectUpdates = new List<EntityUpdate>(); + maxUpdatesBytes -= 18; + } + objectUpdates.Add(update); + } + //compress still disabled + /* + else + { + maxUpdatesBytes -= 150; // crude estimation + + if (compressedUpdates == null) + { + compressedUpdates = new List<EntityUpdate>(); + maxUpdatesBytes -= 18; + } + compressedUpdates.Add(update); + } + */ } - objectUpdates.Add(update); } #endregion Block Construction @@ -5067,7 +5080,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.Position = 7; zc.AddUInt64(m_scene.RegionInfo.RegionHandle); - zc.AddUInt16(Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f)); + zc.AddUInt16(timeDilation); zc.AddByte(1); // tmp block count @@ -5134,19 +5147,67 @@ namespace OpenSim.Region.ClientStack.LindenUDP delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); } } - -/* - if (compressedUpdateBlocks != null) + /* + if(compressedUpdates != null) { - ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = compressedUpdateBlocks.ToArray(); - compressedUpdateBlocks.Clear(); + List<EntityUpdate> tau = new List<EntityUpdate>(30); + + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + Buffer.BlockCopy(CompressedObjectHeader, 0, data , 0, 7); - OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates, oPacket); }); + Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, data, 7); // 15 + Utils.UInt16ToBytes(timeDilation, data, 15); // 17 + + int countposition = 17; // blocks count position + int pos = 18; + + int lastpos = 0; + + int count = 0; + foreach (EntityUpdate eu in compressedUpdates) + { + lastpos = pos; + CreateCompressedUpdateBlock((SceneObjectPart)eu.Entity, mysp, data, ref pos); + if (pos < LLUDPServer.MAXPAYLOAD) + { + tau.Add(eu); + ++count; + } + else + { + // we need more packets + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(buf.Data, 0, newbuf.Data, 0, countposition); // start is the same + + buf.Data[countposition] = (byte)count; + + buf.DataLength = lastpos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, + delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + + buf = newbuf; + data = buf.Data; + + pos = 18; + // im lazy now, just do last again + CreateCompressedUpdateBlock((SceneObjectPart)eu.Entity, mysp, data, ref pos); + tau = new List<EntityUpdate>(30); + tau.Add(eu); + count = 1; + } + } + + if (count > 0) + { + buf.Data[countposition] = (byte)count; + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, + delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + } } -*/ + */ if (terseUpdates != null) { int blocks = terseUpdates.Count; @@ -5305,7 +5366,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // } */ - public void ReprioritizeUpdates() + public void ReprioritizeUpdates() { lock (m_entityUpdates.SyncRoot) m_entityUpdates.Reprioritize(UpdatePriorityHandler); @@ -6986,10 +7047,262 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddZeros(lastzeros); } - protected ObjectUpdateCompressedPacket.ObjectDataBlock CreateCompressedUpdateBlock(SceneObjectPart part, PrimUpdateFlags updateFlags) + [Flags] + private enum CompressedFlags : uint + { + None = 0x00, + /// <summary>Unknown</summary> + ScratchPad = 0x01, + /// <summary>Whether the object has a TreeSpecies</summary> + Tree = 0x02, + /// <summary>Whether the object has floating text ala llSetText</summary> + HasText = 0x04, + /// <summary>Whether the object has an active particle system</summary> + HasParticles = 0x08, + /// <summary>Whether the object has sound attached to it</summary> + HasSound = 0x10, + /// <summary>Whether the object is attached to a root object or not</summary> + HasParent = 0x20, + /// <summary>Whether the object has texture animation settings</summary> + TextureAnimation = 0x40, + /// <summary>Whether the object has an angular velocity</summary> + HasAngularVelocity = 0x80, + /// <summary>Whether the object has a name value pairs string</summary> + HasNameValues = 0x100, + /// <summary>Whether the object has a Media URL set</summary> + MediaURL = 0x200 + } + + ///**** temp hack + private static Random rnd = new Random(); + + protected void CreateCompressedUpdateBlock(SceneObjectPart part, ScenePresence sp, byte[] dest, ref int pos) { - // TODO: Implement this - return null; + // prepare data + CompressedFlags cflags = CompressedFlags.None; + + // prim/update flags + + PrimFlags primflags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp); + // Don't send the CreateSelected flag to everyone + primflags &= ~PrimFlags.CreateSelected; + if (sp.UUID == part.OwnerID) + { + if (part.CreateSelected) + { + // Only send this flag once, then unset it + primflags |= PrimFlags.CreateSelected; + part.CreateSelected = false; + } + } + + // first is primFlags + Utils.UIntToBytesSafepos((uint)primflags, dest, pos); pos += 4; + + // datablock len to fill later + int lenpos = pos; + pos += 2; + + byte state = part.Shape.State; + PCode pcode = (PCode)part.Shape.PCode; + + bool hastree = false; + if (pcode == PCode.Grass || pcode == PCode.Tree || pcode == PCode.NewTree) + { + cflags |= CompressedFlags.Tree; + hastree = true; + } + + //NameValue and state + byte[] nv = null; + if (part.ParentGroup.IsAttachment) + { + if (part.IsRoot) + nv = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID); + + int st = (int)part.ParentGroup.AttachmentPoint; + state = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; + } + + bool hastext = part.Text != null && part.Text.Length > 0; + bool hassound = part.Sound != UUID.Zero || part.SoundFlags != 0; + bool hasps = part.ParticleSystem != null && part.ParticleSystem.Length > 1; + bool hastexanim = part.TextureAnimation != null && part.TextureAnimation.Length > 0; + bool hasangvel = part.AngularVelocity.LengthSquared() > 1e-8f; + bool hasmediaurl = part.MediaUrl != null && part.MediaUrl.Length > 1; + + if (hastext) + cflags |= CompressedFlags.HasText; + if (hasps) + cflags |= CompressedFlags.HasParticles; + if (hassound) + cflags |= CompressedFlags.HasSound; + if (part.ParentID != 0) + cflags |= CompressedFlags.HasParent; + if (hastexanim) + cflags |= CompressedFlags.TextureAnimation; + if (hasangvel) + cflags |= CompressedFlags.HasAngularVelocity; + if (hasmediaurl) + cflags |= CompressedFlags.MediaURL; + if (nv != null) + cflags |= CompressedFlags.HasNameValues; + + // filter out mesh faces hack + ushort profileBegin = part.Shape.ProfileBegin; + ushort profileHollow = part.Shape.ProfileHollow; + byte profileCurve = part.Shape.ProfileCurve; + byte pathScaleY = part.Shape.PathScaleY; + + if (part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack + { + profileCurve = (byte)(part.Shape.ProfileCurve & 0x0f); + // fix old values that confused viewers + if (profileBegin == 1) + profileBegin = 9375; + if (profileHollow == 1) + profileHollow = 27500; + // fix torus hole size Y that also confuse some viewers + if (profileCurve == (byte)ProfileShape.Circle && pathScaleY < 150) + pathScaleY = 150; + } + + part.UUID.ToBytes(dest, pos); pos += 16; + Utils.UIntToBytesSafepos(part.LocalId, dest, pos); pos += 4; + dest[pos++] = (byte)pcode; + dest[pos++] = state; + + ///**** temp hack + Utils.UIntToBytesSafepos((uint)rnd.Next(), dest, pos); pos += 4; //CRC needs fix or things will get crazy for now avoid caching + dest[pos++] = part.Material; + dest[pos++] = part.ClickAction; + part.Shape.Scale.ToBytes(dest, pos); pos += 12; + part.RelativePosition.ToBytes(dest, pos); pos += 12; + if(pcode == PCode.Grass) + Vector3.Zero.ToBytes(dest, pos); + else + { + Quaternion rotation = part.RotationOffset; + rotation.Normalize(); + rotation.ToBytes(dest, pos); + } + pos += 12; + + Utils.UIntToBytesSafepos((uint)cflags, dest, pos); pos += 4; + + if (hasps || hassound) + part.OwnerID.ToBytes(dest, pos); + else + UUID.Zero.ToBytes(dest, pos); + pos += 16; + + if (hasangvel) + { + part.AngularVelocity.ToBytes(dest, pos); pos += 12; + } + if (part.ParentID != 0) + { + Utils.UIntToBytesSafepos(part.ParentID, dest, pos); pos += 4; + } + if (hastree) + dest[pos++] = state; + if (hastext) + { + byte[] text = Util.StringToBytes256(part.Text); // must be null term + Buffer.BlockCopy(text, 0, dest, pos, text.Length); pos += text.Length; + byte[] tc = part.GetTextColor().GetBytes(false); + Buffer.BlockCopy(tc, 0, dest, pos, tc.Length); pos += tc.Length; + } + if (hasmediaurl) + { + byte[] mu = Util.StringToBytes256(part.MediaUrl); // must be null term + Buffer.BlockCopy(mu, 0, dest, pos, mu.Length); pos += mu.Length; + } + if (hasps) + { + byte[] ps = part.ParticleSystem; + Buffer.BlockCopy(ps, 0, dest, pos, ps.Length); pos += ps.Length; + } + byte[] ex = part.Shape.ExtraParams; + if (ex == null || ex.Length < 2) + dest[pos++] = 0; + else + { + Buffer.BlockCopy(ex, 0, dest, pos, ex.Length); pos += ex.Length; + } + if (hassound) + { + part.Sound.ToBytes(dest, pos); pos += 16; + Utils.FloatToBytesSafepos((float)part.SoundGain, dest, pos); pos += 4; + dest[pos++] = part.SoundFlags; + Utils.FloatToBytesSafepos((float)part.SoundRadius, dest, pos); pos += 4; + } + if (nv != null) + { + Buffer.BlockCopy(nv, 0, dest, pos, nv.Length); pos += nv.Length; + } + + dest[pos++] = part.Shape.PathCurve; + Utils.UInt16ToBytes(part.Shape.PathBegin, dest, pos); pos += 2; + Utils.UInt16ToBytes(part.Shape.PathEnd, dest, pos); pos += 2; + dest[pos++] = part.Shape.PathScaleX; + dest[pos++] = pathScaleY; + dest[pos++] = part.Shape.PathShearX; + dest[pos++] = part.Shape.PathShearY; + dest[pos++] = (byte)part.Shape.PathTwist; + dest[pos++] = (byte)part.Shape.PathTwistBegin; + dest[pos++] = (byte)part.Shape.PathRadiusOffset; + dest[pos++] = (byte)part.Shape.PathTaperX; + dest[pos++] = (byte)part.Shape.PathTaperY; + dest[pos++] = part.Shape.PathRevolutions; + dest[pos++] = (byte)part.Shape.PathSkew; + dest[pos++] = profileCurve; + Utils.UInt16ToBytes(profileBegin, dest, pos); pos += 2; + Utils.UInt16ToBytes(part.Shape.ProfileEnd, dest, pos); pos += 2; + Utils.UInt16ToBytes(profileHollow, dest, pos); pos += 2; + + byte[] te = part.Shape.TextureEntry; + if (te == null) + { + dest[pos++] = 0; + dest[pos++] = 0; + dest[pos++] = 0; + dest[pos++] = 0; + } + else + { + int len = te.Length & 0x7fff; + dest[pos++] = (byte)len; + dest[pos++] = (byte)(len >> 8); + dest[pos++] = 0; + dest[pos++] = 0; + Buffer.BlockCopy(te, 0, dest, pos, len); + pos += len; + } + if (hastexanim) + { + byte[] ta = part.TextureAnimation; + if (ta == null) + { + dest[pos++] = 0; + dest[pos++] = 0; + dest[pos++] = 0; + dest[pos++] = 0; + } + else + { + int len = ta.Length & 0x7fff; + dest[pos++] = (byte)len; + dest[pos++] = (byte)(len >> 8); + dest[pos++] = 0; + dest[pos++] = 0; + Buffer.BlockCopy(ta, 0, dest, pos, len); + pos += len; + } + } + int totlen = pos - lenpos - 2; + dest[lenpos++] = (byte)totlen; + dest[lenpos++] = (byte)(totlen >> 8); } public void SendNameReply(UUID profileId, string firstname, string lastname) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c899428..a0b3d21 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -466,8 +466,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f); ThrottleRates = new ThrottleRates(configSource); - Random rnd = new Random(Util.EnvironmentTickCount()); - // if (usePools) // EnablePools(); } @@ -1359,11 +1357,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (packet.Type == PacketType.UseCircuitCode) { // And if there is a UseCircuitCode pending, also drop it + lock (m_pendingCache) { if (m_pendingCache.Contains(endPoint)) { FreeUDPBuffer(buffer); + SendAckImmediate(endPoint, packet.Header.Sequence); // i hear you shutup return; } @@ -1372,6 +1372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Util.FireAndForget(HandleUseCircuitCode, new object[] { endPoint, packet }); FreeUDPBuffer(buffer); + SendAckImmediate(endPoint, packet.Header.Sequence); return; } } @@ -1720,11 +1721,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP queue = null; - // Send ack straight away to let the viewer know that the connection is active. - // The client will be null if it already exists (e.g. if on a region crossing the client sends a use - // circuit code to the existing child agent. This is not particularly obvious. - SendAckImmediate(endPoint, uccp.Header.Sequence); - if (client != null) { client.SendRegionHandshake(); -- cgit v1.1 From db191cd4e26c759a2a66946329f07cc52fe1cab3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 07:13:39 +0000 Subject: oops send flag PrimFlags.InventoryEmpty but do not override others --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6fb0eed..5c38bf3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2480,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes uint eff = (uint)Flags | (uint)LocalFlags; if(m_inventory == null || m_inventory.Count == 0) - eff = (uint)PrimFlags.InventoryEmpty; + eff |= (uint)PrimFlags.InventoryEmpty; return eff; } -- cgit v1.1 From d0052c817486a1691fc4e2e7027ac41240b966aa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 02:18:32 +0000 Subject: add more test code to make usage od compressed updates etc. Should be disable, but well many things can go wrong. --- OpenSim/Framework/IClientAPI.cs | 17 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 239 ++++++++---- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 9 +- .../World/Estate/EstateManagementModule.cs | 2 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 19 +- OpenSim/Region/Framework/Scenes/Scene.cs | 35 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 66 ++-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 399 +++++++++++++-------- .../Server/IRCClientView.cs | 4 +- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 4 +- OpenSim/Tests/Common/Mock/TestClient.cs | 4 +- 12 files changed, 499 insertions(+), 315 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0c5224b..5a5e5d0 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -602,16 +602,26 @@ namespace OpenSim.Framework { // we are on the new one if (m_flags.HasFlag(PrimUpdateFlags.CancelKill)) - m_flags = PrimUpdateFlags.FullUpdatewithAnim; + { + if (m_flags.HasFlag(PrimUpdateFlags.UpdateProbe)) + m_flags = PrimUpdateFlags.UpdateProbe; + else + m_flags = PrimUpdateFlags.FullUpdatewithAnim; + } } public virtual void Update(EntityUpdate oldupdate) { // we are on the new one PrimUpdateFlags updateFlags = oldupdate.Flags; + if (updateFlags.HasFlag(PrimUpdateFlags.UpdateProbe)) + updateFlags &= ~PrimUpdateFlags.UpdateProbe; if (m_flags.HasFlag(PrimUpdateFlags.CancelKill)) { - m_flags = PrimUpdateFlags.FullUpdatewithAnim; + if(m_flags.HasFlag(PrimUpdateFlags.UpdateProbe)) + m_flags = PrimUpdateFlags.UpdateProbe; + else + m_flags = PrimUpdateFlags.FullUpdatewithAnim; } else m_flags |= updateFlags; @@ -679,6 +689,7 @@ namespace OpenSim.Framework FullUpdatewithAnim = FullUpdate | Animations, + UpdateProbe = 0x10000000, // 1 << 28 SendInTransit = 0x20000000, // 1 << 29 CancelKill = 0x40000000, // 1 << 30 Kill = 0x80000000 // 1 << 31 @@ -805,7 +816,7 @@ namespace OpenSim.Framework event TeleportCancel OnTeleportCancel; event DeRezObject OnDeRezObject; event RezRestoreToWorld OnRezRestoreToWorld; - event Action<IClientAPI> OnRegionHandShakeReply; + event Action<IClientAPI, uint> OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; event Action<IClientAPI, bool> OnCompleteMovementToRegion; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 662e5ad..526783e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; public event ModifyTerrain OnModifyTerrain; - public event Action<IClientAPI> OnRegionHandShakeReply; + public event Action<IClientAPI, uint> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event SetAppearance OnSetAppearance; public event AvatarNowWearing OnAvatarNowWearing; @@ -392,6 +392,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected IAssetService m_assetService; + protected bool m_supportViewerCache = false; #endregion Class Members #region Properties @@ -552,6 +553,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP string name = string.Format("AsyncInUDP-{0}",m_agentId.ToString()); m_asyncPacketProcess = new JobEngine(name, name, 10000); IsActive = true; + + m_supportViewerCache = m_udpServer.SupportViewerObjectsCache; } #region Client Methods @@ -4777,6 +4780,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP 13 // ID (high frequency) }; + static private readonly byte[] ObjectUpdateCachedHeader = new byte[] { + Helpers.MSG_RELIABLE, + 0, 0, 0, 0, // sequence number + 0, // extra + 14 // ID (high frequency) + }; + private void ProcessEntityUpdates(int maxUpdatesBytes) { if (!IsActive) @@ -4786,8 +4796,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (mysp == null) return; + List<EntityUpdate> objectUpdates = null; - //List<EntityUpdate> compressedUpdates = null; + List<EntityUpdate> objectUpdateProbes = null; + List<EntityUpdate> compressedUpdates = null; List<EntityUpdate> terseUpdates = null; List<SceneObjectPart> ObjectAnimationUpdates = null; @@ -4799,6 +4811,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EntityUpdate update; + bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0 && mysp.IsChildAgent; // only on child agents bool doCulling = m_scene.ObjectsCullingByDistance; float cullingrange = 64.0f; Vector3 mypos = Vector3.Zero; @@ -4807,7 +4820,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bool orderedDequeue = false; // temporary off HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); - + bool useCompressUpdate = false; if (doCulling) { @@ -4834,15 +4847,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; + PrimUpdateFlags updateFlags = update.Flags; - if(updateFlags.HasFlag(PrimUpdateFlags.Kill)) + if (updateFlags.HasFlag(PrimUpdateFlags.Kill)) { m_killRecord.Add(update.Entity.LocalId); maxUpdatesBytes -= 30; continue; } + useCompressUpdate = false; + if (update.Entity is SceneObjectPart) { SceneObjectPart part = (SceneObjectPart)update.Entity; @@ -4928,10 +4943,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (dpos > maxview * maxview) continue; - GroupsNeedFullUpdate.Add(grp); - continue; + if (!viewerCache || !updateFlags.HasFlag(PrimUpdateFlags.UpdateProbe)) + { + GroupsNeedFullUpdate.Add(grp); + continue; + } + } + } + + if (updateFlags.HasFlag(PrimUpdateFlags.UpdateProbe)) + { + if (objectUpdateProbes == null) + { + objectUpdateProbes = new List<EntityUpdate>(); + maxUpdatesBytes -= 18; + } + objectUpdateProbes.Add(update); + maxUpdatesBytes -= 12; + continue; + } + + if (m_SupportObjectAnimations && updateFlags.HasFlag(PrimUpdateFlags.Animations)) + { + if (part.Animations != null) + { + if (ObjectAnimationUpdates == null) + ObjectAnimationUpdates = new List<SceneObjectPart>(); + ObjectAnimationUpdates.Add(part); + maxUpdatesBytes -= 20 * part.Animations.Count + 24; } } + if(viewerCache) + useCompressUpdate = grp.IsViewerCachable; } else if (update.Entity is ScenePresence) { @@ -4951,27 +4994,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region UpdateFlags to packet type conversion - // bool canUseCompressed = true; - - if (update.Entity is SceneObjectPart) - { - if (m_SupportObjectAnimations && updateFlags.HasFlag(PrimUpdateFlags.Animations)) - { - SceneObjectPart sop = (SceneObjectPart)update.Entity; - if ( sop.Animations != null) - { - if(ObjectAnimationUpdates == null) - ObjectAnimationUpdates = new List<SceneObjectPart>(); - ObjectAnimationUpdates.Add(sop); - maxUpdatesBytes -= 20 * sop.Animations.Count + 24; - } - } - } - else - { - // canUseCompressed = false; - } - updateFlags &= PrimUpdateFlags.FullUpdate; // clear other control bits already handled if(updateFlags == PrimUpdateFlags.None) continue; @@ -5025,34 +5047,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - SceneObjectPart part = (SceneObjectPart)update.Entity; - SceneObjectGroup grp = part.ParentGroup; - // minimal compress conditions, not enough ? - //if (grp.UsesPhysics || part.Velocity.LengthSquared() > 1e-8f || part.Acceleration.LengthSquared() > 1e-6f) + if (useCompressUpdate) { maxUpdatesBytes -= 150; // crude estimation - if (objectUpdates == null) + if (compressedUpdates == null) { - objectUpdates = new List<EntityUpdate>(); + compressedUpdates = new List<EntityUpdate>(); maxUpdatesBytes -= 18; } - objectUpdates.Add(update); + compressedUpdates.Add(update); } - //compress still disabled - /* else { maxUpdatesBytes -= 150; // crude estimation - if (compressedUpdates == null) + if (objectUpdates == null) { - compressedUpdates = new List<EntityUpdate>(); + objectUpdates = new List<EntityUpdate>(); maxUpdatesBytes -= 18; } - compressedUpdates.Add(update); + objectUpdates.Add(update); } - */ } } @@ -5147,7 +5163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); } } - /* + if(compressedUpdates != null) { List<EntityUpdate> tau = new List<EntityUpdate>(30); @@ -5168,8 +5184,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP int count = 0; foreach (EntityUpdate eu in compressedUpdates) { + SceneObjectPart sop = (SceneObjectPart)eu.Entity; + if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) + continue; lastpos = pos; - CreateCompressedUpdateBlock((SceneObjectPart)eu.Entity, mysp, data, ref pos); + CreateCompressedUpdateBlock(sop, mysp, data, ref pos); if (pos < LLUDPServer.MAXPAYLOAD) { tau.Add(eu); @@ -5207,7 +5226,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); } } - */ + + if (objectUpdateProbes != null) + { + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + Buffer.BlockCopy(ObjectUpdateCachedHeader, 0, data, 0, 7); + + Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, data, 7); // 15 + Utils.UInt16ToBytes(timeDilation, data, 15); // 17 + + int countposition = 17; // blocks count position + int pos = 18; + + int count = 0; + foreach (EntityUpdate eu in objectUpdateProbes) + { + SceneObjectPart sop = (SceneObjectPart)eu.Entity; + if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) + continue; + uint primflags = m_scene.Permissions.GenerateClientFlags(sop, mysp); + if (mysp.UUID != sop.OwnerID) + primflags &= ~(uint)PrimFlags.CreateSelected; + else + { + if (sop.CreateSelected) + primflags |= (uint)PrimFlags.CreateSelected; + else + primflags &= ~(uint)PrimFlags.CreateSelected; + } + + Utils.UIntToBytes(sop.LocalId, data, pos); pos += 4; + Utils.UIntToBytes((uint)sop.ParentGroup.PseudoCRC, data, pos); pos += 4; //WRONG + Utils.UIntToBytes(primflags, data, pos); pos += 4; + + if (pos < (LLUDPServer.MAXPAYLOAD - 12)) + ++count; + else + { + // we need more packets + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(buf.Data, 0, newbuf.Data, 0, countposition); // start is the same + + buf.Data[countposition] = (byte)count; + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + + buf = newbuf; + data = buf.Data; + pos = 18; + count = 0; + } + } + + if (count > 0) + { + buf.Data[countposition] = (byte)count; + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); + } + } + if (terseUpdates != null) { int blocks = terseUpdates.Count; @@ -5329,8 +5409,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP { lock (GroupsInView) GroupsInView.Add(grp); + PrimUpdateFlags flags = PrimUpdateFlags.CancelKill; + if(viewerCache && grp.IsViewerCachable) + flags |= PrimUpdateFlags.UpdateProbe; foreach (SceneObjectPart p in grp.Parts) - SendEntityUpdate(p, PrimUpdateFlags.CancelKill); + SendEntityUpdate(p, flags); } } @@ -5461,10 +5544,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(GroupsNeedFullUpdate.Count > 0) { - foreach(SceneObjectGroup grp in GroupsNeedFullUpdate) + bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0 && mysp.IsChildAgent; + foreach (SceneObjectGroup grp in GroupsNeedFullUpdate) { - foreach(SceneObjectPart p in grp.Parts) - SendEntityUpdate(p, PrimUpdateFlags.CancelKill); + PrimUpdateFlags flags = PrimUpdateFlags.CancelKill; + if (viewerCache && grp.IsViewerCachable) + flags |= PrimUpdateFlags.UpdateProbe; + foreach (SceneObjectPart p in grp.Parts) + SendEntityUpdate(p, flags); } } @@ -7173,7 +7260,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP dest[pos++] = state; ///**** temp hack - Utils.UIntToBytesSafepos((uint)rnd.Next(), dest, pos); pos += 4; //CRC needs fix or things will get crazy for now avoid caching + Utils.UIntToBytesSafepos((uint)part.ParentGroup.PseudoCRC, dest, pos); pos += 4; dest[pos++] = part.Material; dest[pos++] = part.ClickAction; part.Shape.Scale.ToBytes(dest, pos); pos += 12; @@ -8407,13 +8494,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } + public uint m_viewerHandShakeFlags = 0; + private bool HandlerRegionHandshakeReply(IClientAPI sender, Packet Pack) { - Action<IClientAPI> handlerRegionHandShakeReply = OnRegionHandShakeReply; - if (handlerRegionHandShakeReply != null) - { - handlerRegionHandShakeReply(this); - } + Action<IClientAPI, uint> handlerRegionHandShakeReply = OnRegionHandShakeReply; + if (handlerRegionHandShakeReply == null) + return true; // silence the warning + + RegionHandshakeReplyPacket rsrpkt = (RegionHandshakeReplyPacket)Pack; + if(rsrpkt.AgentData.AgentID != m_agentId || rsrpkt.AgentData.SessionID != m_sessionId) + return false; + + // regionHandSHake is a protocol message, but it is also seems to be the only way to update terrain textures + // in last case this should be ignored. + OnRegionHandShakeReply = null; + if(m_supportViewerCache) + m_viewerHandShakeFlags = rsrpkt.RegionInfo.Flags; + else + m_viewerHandShakeFlags = 0; + + handlerRegionHandShakeReply(this, m_viewerHandShakeFlags); return true; } @@ -8657,19 +8758,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) + private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { - m_log.DebugFormat("[LLClientView] HandleCompleteAgentMovement"); + //m_log.DebugFormat("[LLClientView] HandleCompleteAgentMovement"); Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion; - if (handlerCompleteMovementToRegion != null) - { - handlerCompleteMovementToRegion(sender, true); - } - else - m_log.Debug("HandleCompleteAgentMovement NULL handler"); + if (handlerCompleteMovementToRegion == null) + return false; + + CompleteAgentMovementPacket cmp = (CompleteAgentMovementPacket)Pack; + if(cmp.AgentData.AgentID != m_agentId || cmp.AgentData.SessionID != m_sessionId || cmp.AgentData.CircuitCode != m_circuitCode) + return false; - handlerCompleteMovementToRegion = null; + handlerCompleteMovementToRegion(sender, true); return true; } @@ -9141,6 +9242,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleRequestMultipleObjects(IClientAPI sender, Packet Pack) { + ObjectRequest handlerObjectRequest = OnObjectRequest; + if (handlerObjectRequest == null) + return false; + RequestMultipleObjectsPacket incomingRequest = (RequestMultipleObjectsPacket)Pack; #region Packet Session and User Check @@ -9149,16 +9254,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; #endregion - ObjectRequest handlerObjectRequest = null; - for (int i = 0; i < incomingRequest.ObjectData.Length; i++) - { - handlerObjectRequest = OnObjectRequest; - if (handlerObjectRequest != null) - { handlerObjectRequest(incomingRequest.ObjectData[i].ID, this); - } - } return true; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index a0b3d21..6032681 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -369,6 +369,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// </summary> public int IncomingOrphanedPacketCount { get; protected set; } + public bool SupportViewerObjectsCache = false; /// <summary> /// Run queue empty processing within a single persistent thread. /// </summary> @@ -433,6 +434,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_disableFacelights = config.GetBoolean("DisableFacelights", false); m_ackTimeout = 1000 * config.GetInt("AckTimeout", 60); m_pausedAckTimeout = 1000 * config.GetInt("PausedAckTimeout", 300); + SupportViewerObjectsCache = config.GetBoolean("SupportViewerObjectsCache", SupportViewerObjectsCache); } else { @@ -1724,14 +1726,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (client != null) { client.SendRegionHandshake(); - client.CheckViewerCaps(); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. - bool tp = (aCircuit.teleportFlags > 0); - // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from - if (!tp) - client.SceneAgent.SendInitialDataToMe(); } } else diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index fd08721..936f956 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -574,7 +574,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionHandshakeToAll(); - sendRegionInfoPacketToAll(); +// sendRegionInfoPacketToAll(); } private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 0c080d2..2995091 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -153,10 +153,23 @@ namespace OpenSim.Region.Framework.Scenes /// <param name="remoteClient"></param> public void RequestPrim(uint primLocalID, IClientAPI remoteClient) { - SceneObjectGroup sog = GetGroupByPrim(primLocalID); + SceneObjectPart part = GetSceneObjectPart(primLocalID); + if (part != null) + { + SceneObjectGroup sog = part.ParentGroup; + if(!sog.IsDeleted) + { + PrimUpdateFlags update = PrimUpdateFlags.FullUpdate; + if (sog.RootPart.Shape.MeshFlagEntry) + update = PrimUpdateFlags.FullUpdatewithAnim; + part.SendUpdate(remoteClient, update); + } + } + + //SceneObjectGroup sog = GetGroupByPrim(primLocalID); - if (sog != null) - sog.SendFullAnimUpdateToClient(remoteClient); + //if (sog != null) + //sog.SendFullAnimUpdateToClient(remoteClient); } /// <summary> diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7668a87..7d312e9 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -170,8 +170,6 @@ namespace OpenSim.Region.Framework.Scenes } private bool m_scripts_enabled; - public SynchronizeSceneHandler SynchronizeScene; - public bool ClampNegativeZ { get { return m_clampNegativeZ; } @@ -1006,11 +1004,9 @@ namespace OpenSim.Region.Framework.Scenes m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); - m_dontPersistBefore = - startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); + m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); m_dontPersistBefore *= 10000000; - m_persistAfter = - startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); + m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); @@ -1695,9 +1691,6 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysicsEnabled) physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime); - - if (SynchronizeScene != null) - SynchronizeScene(this); } tmpMS2 = Util.GetTimeStampMS(); @@ -1775,30 +1768,6 @@ namespace OpenSim.Region.Framework.Scenes // Region ready should always be set Ready = true; - - - IConfig restartConfig = m_config.Configs["RestartModule"]; - if (restartConfig != null) - { - string markerPath = restartConfig.GetString("MarkerPath", String.Empty); - - if (markerPath != String.Empty) - { - string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".ready"); - try - { - string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); - FileStream fs = File.Create(path); - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); - Byte[] buf = enc.GetBytes(pidstring); - fs.Write(buf, 0, buf.Length); - fs.Close(); - } - catch (Exception) - { - } - } - } } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7d5bbbf..0b38179 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -119,6 +119,21 @@ namespace OpenSim.Region.Framework.Scenes // private PrimCountTaintedDelegate handlerPrimCountTainted = null; + public bool IsViewerCachable + { + get + { + // needs more exclusion ? + return(Backup && !IsTemporary && !inTransit && !IsSelected && !UsesPhysics && !IsAttachmentCheckFull() && + !RootPart.Shape.MeshFlagEntry && // animations are not sent correctly for now + RootPart.KeyframeMotion == null && + (DateTime.UtcNow.Ticks - timeLastChanged > 36000000000) && //36000000000 is one hour + RootPart.Velocity.LengthSquared() < 1e8f && // should not be needed + RootPart.Acceleration.LengthSquared() < 1e4f // should not be needed + ); + } + } + /// <summary> /// Signal whether the non-inventory attributes of any prims in the group have changed /// since the group's last persistent backup @@ -128,7 +143,8 @@ namespace OpenSim.Region.Framework.Scenes private long timeLastChanged = 0; private long m_maxPersistTime = 0; private long m_minPersistTime = 0; -// private Random m_rand; + + public int PseudoCRC; /// <summary> /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage @@ -145,40 +161,26 @@ namespace OpenSim.Region.Framework.Scenes { if (value) { - if (Backup) - { m_scene.SceneGraph.FireChangeBackup(this); - } + + PseudoCRC = (int)(DateTime.UtcNow.Ticks); ; timeLastChanged = DateTime.UtcNow.Ticks; if (!m_hasGroupChanged) - timeFirstChanged = DateTime.UtcNow.Ticks; + timeFirstChanged = timeLastChanged; if (m_rootPart != null && m_scene != null) { -/* - if (m_rand == null) - { - byte[] val = new byte[16]; - m_rootPart.UUID.ToBytes(val, 0); - m_rand = new Random(BitConverter.ToInt32(val, 0)); - } - */ if (m_scene.GetRootAgentCount() == 0) { //If the region is empty, this change has been made by an automated process //and thus we delay the persist time by a random amount between 1.5 and 2.5. -// float factor = 1.5f + (float)(m_rand.NextDouble()); float factor = 2.0f; - m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); - m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); + m_maxPersistTime = (long)(m_scene.m_persistAfter * factor); + m_minPersistTime = (long)(m_scene.m_dontPersistBefore * factor); } else { - //If the region is not empty, we want to obey the minimum and maximum persist times - //but add a random factor so we stagger the object persistance a little -// m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 -// m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 m_maxPersistTime = m_scene.m_persistAfter; m_minPersistTime = m_scene.m_dontPersistBefore; } @@ -1330,6 +1332,7 @@ namespace OpenSim.Region.Framework.Scenes public SceneObjectGroup() { m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0; + PseudoCRC = (int)(DateTime.UtcNow.Ticks); } /// <summary> @@ -2441,6 +2444,21 @@ namespace OpenSim.Region.Framework.Scenes } } + public void SendUpdateProbes(IClientAPI remoteClient) + { + PrimUpdateFlags update = PrimUpdateFlags.UpdateProbe; + + RootPart.SendUpdate(remoteClient, update); + + SceneObjectPart[] parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + if (part != RootPart) + part.SendUpdate(remoteClient, update); + } + } + #region Copying /// <summary> @@ -2516,6 +2534,7 @@ namespace OpenSim.Region.Framework.Scenes } dupe.InvalidatePartsLinkMaps(); + dupe.PseudoCRC = (int)(DateTime.UtcNow.Ticks); m_dupeInProgress = false; return dupe; } @@ -2769,6 +2788,7 @@ namespace OpenSim.Region.Framework.Scenes } } + PseudoCRC = (int)(DateTime.UtcNow.Ticks); rpart.ScheduleFullUpdate(); } @@ -2808,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes part.ResetIDs(part.LinkNum); // Don't change link nums m_parts.Add(part.UUID, part); } + PseudoCRC = (int)(DateTime.UtcNow.Ticks); } } @@ -3117,7 +3138,6 @@ namespace OpenSim.Region.Framework.Scenes } } - // 'linkPart' == the root of the group being linked into this group SceneObjectPart linkPart = objectGroup.m_rootPart; @@ -3160,7 +3180,6 @@ namespace OpenSim.Region.Framework.Scenes axPos *= Quaternion.Conjugate(parentRot); linkPart.OffsetPosition = axPos; - // If there is only one SOP in a SOG, the LinkNum is zero. I.e., not a linkset. // Now that we know this SOG has at least two SOPs in it, the new root // SOP becomes the first in the linkset. @@ -3193,8 +3212,7 @@ namespace OpenSim.Region.Framework.Scenes linkPart.CreateSelected = true; - // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now - linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive, true); + linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive || RootPart.VolumeDetectActive, true); // If the added SOP is physical, also tell the physics engine about the link relationship. if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5c38bf3..4f3f83a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1179,9 +1179,10 @@ namespace OpenSim.Region.Framework.Scenes set { + string old = m_mediaUrl; m_mediaUrl = value; - if (ParentGroup != null) + if (ParentGroup != null && old != m_mediaUrl) ParentGroup.HasGroupChanged = true; } } @@ -1385,13 +1386,6 @@ namespace OpenSim.Region.Framework.Scenes } } - [XmlIgnore] - public bool IsOccupied // KF If an av is sittingon this prim - { - get { return m_occupied; } - set { m_occupied = value; } - } - /// <summary> /// ID of the avatar that is sat on us if we have a sit target. If there is no such avatar then is UUID.Zero /// </summary> @@ -2472,12 +2466,6 @@ namespace OpenSim.Region.Framework.Scenes public uint GetEffectiveObjectFlags() { - // Commenting this section of code out since it doesn't actually do anything, as enums are handled by - // value rather than reference -// PrimFlags f = _flags; -// if (m_parentGroup == null || m_parentGroup.RootPart == this) -// f &= ~(PrimFlags.Touch | PrimFlags.Money); - uint eff = (uint)Flags | (uint)LocalFlags; if(m_inventory == null || m_inventory.Count == 0) eff |= (uint)PrimFlags.InventoryEmpty; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f010035..e635841 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1212,7 +1212,9 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; ControllingClient.OnAutoPilotGo += MoveToTargetHandle; ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; -// ControllingClient.OnAgentFOV += HandleAgentFOV; + ControllingClient.OnRegionHandShakeReply += RegionHandShakeReply; + + // ControllingClient.OnAgentFOV += HandleAgentFOV; // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); @@ -1232,7 +1234,9 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; ControllingClient.OnAutoPilotGo -= MoveToTargetHandle; ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; -// ControllingClient.OnAgentFOV += HandleAgentFOV; + ControllingClient.OnRegionHandShakeReply -= RegionHandShakeReply; + + // ControllingClient.OnAgentFOV += HandleAgentFOV; } private void SetDirectionVectors() @@ -2126,56 +2130,54 @@ namespace OpenSim.Region.Framework.Scenes return; } - + if(IsChildAgent) + { + return; // how? + } //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - if(!haveGroupInformation && !IsChildAgent && !IsNPC) + if (!IsNPC) { - IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); - if (gm != null) - Grouptitle = gm.GetGroupTitle(m_uuid); + if (!haveGroupInformation && !IsNPC) + { + IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); + if (gm != null) + Grouptitle = gm.GetGroupTitle(m_uuid); - //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); - if (cof == null) - COF = UUID.Zero; - else - COF = cof.ID; + InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); + if (cof == null) + COF = UUID.Zero; + else + COF = cof.ID; - m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); - } + m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); + } - if (!string.IsNullOrEmpty(m_callbackURI)) - { - // We cannot sleep here since this would hold up the inbound packet processing thread, as - // CompleteMovement() is executed synchronously. However, it might be better to delay the release - // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete - // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this - // region as the current region, meaning that a close sent before then will fail the teleport. - // System.Threading.Thread.Sleep(2000); + if (!string.IsNullOrEmpty(m_callbackURI)) + { + // We cannot sleep here since this would hold up the inbound packet processing thread, as + // CompleteMovement() is executed synchronously. However, it might be better to delay the release + // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete + // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this + // region as the current region, meaning that a close sent before then will fail the teleport. + // System.Threading.Thread.Sleep(2000); - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_callbackURI); + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", + client.Name, client.AgentId, m_callbackURI); - UUID originID; + UUID originID; - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } } -// else -// { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}", -// client.Name, client.AgentId, m_scene.RegionInfo.RegionName); -// } - - // Tell the client that we're totally ready ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); @@ -2187,32 +2189,29 @@ namespace OpenSim.Region.Framework.Scenes int delayctnr = Util.EnvironmentTickCount(); - if (!IsChildAgent) + if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) { - if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) - { - ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); - } + ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); + } - // verify baked textures and cache - bool cachedbaked = false; + // verify baked textures and cache + bool cachedbaked = false; - if (IsNPC) - cachedbaked = true; - else - { - if (m_scene.AvatarFactory != null && !isHGTP) - cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); + if (IsNPC) + cachedbaked = true; + else + { + if (m_scene.AvatarFactory != null && !isHGTP) + cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); - // not sure we need this - if (!cachedbaked) - { - if (m_scene.AvatarFactory != null) - m_scene.AvatarFactory.QueueAppearanceSave(UUID); - } + // not sure we need this + if (!cachedbaked) + { + if (m_scene.AvatarFactory != null) + m_scene.AvatarFactory.QueueAppearanceSave(UUID); } - //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } + //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if(m_teleportFlags > 0) { @@ -2251,104 +2250,103 @@ namespace OpenSim.Region.Framework.Scenes landch.sendClientInitialLandInfo(client, !gotCrossUpdate); } - if (!IsChildAgent) - { - List<ScenePresence> allpresences = m_scene.GetScenePresences(); + List<ScenePresence> allpresences = m_scene.GetScenePresences(); - // send avatar object to all presences including us, so they cross it into region - // then hide if necessary + // send avatar object to all presences including us, so they cross it into region + // then hide if necessary - SendInitialAvatarDataToAllAgents(allpresences); + SendInitialAvatarDataToAllAgents(allpresences); - // send this look - SendAppearanceToAgent(this); + // send this look + SendAppearanceToAgent(this); - // send this animations + // send this animations - UUID[] animIDs = null; - int[] animseqs = null; - UUID[] animsobjs = null; + UUID[] animIDs = null; + int[] animseqs = null; + UUID[] animsobjs = null; - if (Animator != null) - Animator.GetArrays(out animIDs, out animseqs, out animsobjs); + if (Animator != null) + Animator.GetArrays(out animIDs, out animseqs, out animsobjs); - bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); + bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); - if (haveAnims) - SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); + if (haveAnims) + SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); - // we should be able to receive updates, etc - // so release them - m_inTransit = false; + // we should be able to receive updates, etc + // so release them + m_inTransit = false; - // send look and animations to others - // if not cached we send greys - // uncomented if will wait till avatar does baking - //if (cachedbaked) + // send look and animations to others + // if not cached we send greys + // uncomented if will wait till avatar does baking + //if (cachedbaked) + { + foreach (ScenePresence p in allpresences) { - foreach (ScenePresence p in allpresences) - { - if (p == this) - continue; + if (p == this) + continue; - if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) - continue; + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) + continue; - SendAppearanceToAgentNF(p); - if (haveAnims) - SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); - } - } // greys if + SendAppearanceToAgentNF(p); + if (haveAnims) + SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); + } + } // greys if - //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // attachments - if (IsNPC || IsRealLogin(m_teleportFlags)) - { - if (Scene.AttachmentsModule != null) - // Util.FireAndForget( - // o => - // { + // attachments + if (IsNPC || IsRealLogin(m_teleportFlags)) + { + if (Scene.AttachmentsModule != null) + // Util.FireAndForget( + // o => + // { - if (!IsNPC) + if (!IsNPC) + Scene.AttachmentsModule.RezAttachments(this); + else + Util.FireAndForget(x => + { Scene.AttachmentsModule.RezAttachments(this); - else - Util.FireAndForget(x => - { - Scene.AttachmentsModule.RezAttachments(this); - }); + }); - // }); - } - else + // }); + } + else + { + if (m_attachments.Count > 0) { - if (m_attachments.Count > 0) - { // m_log.DebugFormat( // "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); - foreach (SceneObjectGroup sog in m_attachments) - { - sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); - sog.ResumeScripts(); - } + foreach (SceneObjectGroup sog in m_attachments) + { + sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); + sog.ResumeScripts(); + } - foreach (ScenePresence p in allpresences) + foreach (ScenePresence p in allpresences) + { + if (p == this) { - if (p == this) - { - SendAttachmentsToAgentNF(this); - continue; - } + SendAttachmentsToAgentNF(this); + continue; + } - if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) - continue; + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) + continue; - SendAttachmentsToAgentNF(p); - } + SendAttachmentsToAgentNF(p); } } - + } + if(!IsNPC) + { //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if (openChildAgents) { @@ -2366,34 +2364,33 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them - } - //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // send the rest of the world - if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide) - SendInitialDataToMe(); + // send the rest of the world + if (m_teleportFlags > 0 | m_currentParcelHide) + SendInitialDataToMe(); - // priority uses avatar position only -// m_reprioritizationLastPosition = AbsolutePosition; -// m_reprioritizationLastDrawDistance = DrawDistance; -// m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it -// m_reprioritizationBusy = false; + // priority uses avatar position only + // m_reprioritizationLastPosition = AbsolutePosition; + // m_reprioritizationLastDrawDistance = DrawDistance; + // m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it + // m_reprioritizationBusy = false; - //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - if (!IsChildAgent && openChildAgents) - { - IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); - if (friendsModule != null) + if (openChildAgents) { - if(gotCrossUpdate) - friendsModule.IsNowRoot(this); - else - friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); + if (friendsModule != null) + { + if(gotCrossUpdate) + friendsModule.IsNowRoot(this); + else + friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + } + //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } - //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } } finally @@ -4024,10 +4021,100 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } + + public void RegionHandShakeReply (IClientAPI client, uint flags) + { + if(IsNPC) + return; + + bool selfappearance = (flags & 4) != 0; + bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty; + if(cacheCulling) + cacheEmpty = (flags & 2) != 0; + else + cacheEmpty = true; + + if (m_teleportFlags > 0) // only doing for child for now + return; + + lock (m_completeMovementLock) + { + if (SentInitialData) + return; + SentInitialData = true; + } + + Util.FireAndForget(delegate + { + Scene.SendLayerData(ControllingClient); + + ILandChannel landch = m_scene.LandChannel; + if (landch != null) + landch.sendClientInitialLandInfo(ControllingClient, true); + + // recheck to reduce timing issues + ControllingClient.CheckViewerCaps(); + + SendOtherAgentsAvatarFullToMe(); + /* + if (m_scene.ObjectsCullingByDistance && cacheCulling) + { + m_reprioritizationBusy = true; + m_reprioritizationLastPosition = AbsolutePosition; + m_reprioritizationLastDrawDistance = DrawDistance; + + ControllingClient.ReprioritizeUpdates(); + m_reprioritizationLastTime = Util.EnvironmentTickCount(); + m_reprioritizationBusy = false; + return; + } + */ + + EntityBase[] entities = Scene.Entities.GetEntities(); + if(cacheEmpty) + { + foreach (EntityBase e in entities) + { + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); + } + } + else + { + foreach (EntityBase e in entities) + { + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + { + SceneObjectGroup grp = e as SceneObjectGroup; + if(grp.IsViewerCachable) + grp.SendUpdateProbes(ControllingClient); + else + grp.SendFullAnimUpdateToClient(ControllingClient); + } + } + } + + m_reprioritizationLastPosition = AbsolutePosition; + m_reprioritizationLastDrawDistance = DrawDistance; + m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it + + m_reprioritizationBusy = false; + + }); + + } + public void SendInitialDataToMe() { // Send all scene object to the new client - SentInitialData = true; + lock (m_completeMovementLock) + { + if (SentInitialData) + return; + SentInitialData = true; + } + Util.FireAndForget(delegate { // we created a new ScenePresence (a new child agent) in a fresh region. @@ -4280,7 +4367,13 @@ namespace OpenSim.Region.Framework.Scenes if(IsDeleted || !ControllingClient.IsActive) return; - if(!SentInitialData) + bool needsendinitial = false; + lock(m_completeMovementLock) + { + needsendinitial = SentInitialData; + } + + if(!needsendinitial) { SendInitialDataToMe(); return; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 59ce05a..80baf82 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -699,7 +699,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event TeleportCancel OnTeleportCancel; public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; - public event Action<IClientAPI> OnRegionHandShakeReply; + public event Action<IClientAPI, uint> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action<IClientAPI, bool> OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; @@ -938,7 +938,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server if (OnRegionHandShakeReply != null) { - OnRegionHandShakeReply(this); + OnRegionHandShakeReply(this, 0); } if (OnCompleteMovementToRegion != null) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 09f2a58..a7ed7d1 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -319,7 +319,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; - public event Action<IClientAPI> OnRegionHandShakeReply; + public event Action<IClientAPI, uint> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action<IClientAPI, bool> OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; @@ -928,7 +928,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { if (OnRegionHandShakeReply != null) { - OnRegionHandShakeReply(this); + OnRegionHandShakeReply(this, 0); } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index bc6cb60..4fe2684 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -119,7 +119,7 @@ namespace OpenSim.Tests.Common public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; - public event Action<IClientAPI> OnRegionHandShakeReply; + public event Action<IClientAPI, uint> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action<IClientAPI, bool> OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; @@ -880,7 +880,7 @@ namespace OpenSim.Tests.Common { if (OnRegionHandShakeReply != null) { - OnRegionHandShakeReply(this); + OnRegionHandShakeReply(this, 0); } } -- cgit v1.1 From a9aba562b11d2b45eee0ad9edbae97167cf1ae8d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 02:24:32 +0000 Subject: pesty warning --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4f3f83a..ebb8eda 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -312,7 +312,6 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_sitTargetOrientation = Quaternion.Identity; private Vector3 m_sitTargetPosition; private string m_sitAnimation = "SIT"; - private bool m_occupied; // KF if any av is sitting on this prim private string m_text = String.Empty; private string m_touchName = String.Empty; private UndoRedoState m_UndoRedo = null; -- cgit v1.1 From 010d64dcd2d55850750b3c67ae901d7b183fd741 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 03:58:22 +0000 Subject: a bit more suicidal... --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 32 ++++++++++++---------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 526783e..9d606a6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4811,7 +4811,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EntityUpdate update; - bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0 && mysp.IsChildAgent; // only on child agents + bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0;// && mysp.IsChildAgent; // only on child agents bool doCulling = m_scene.ObjectsCullingByDistance; float cullingrange = 64.0f; Vector3 mypos = Vector3.Zero; @@ -5449,7 +5449,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // } */ - public void ReprioritizeUpdates() + public void ReprioritizeUpdates() { lock (m_entityUpdates.SyncRoot) m_entityUpdates.Reprioritize(UpdatePriorityHandler); @@ -5544,7 +5544,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(GroupsNeedFullUpdate.Count > 0) { - bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0 && mysp.IsChildAgent; + bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0;// && mysp.IsChildAgent; foreach (SceneObjectGroup grp in GroupsNeedFullUpdate) { PrimUpdateFlags flags = PrimUpdateFlags.CancelKill; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e635841..e35481f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2368,8 +2368,9 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // send the rest of the world - if (m_teleportFlags > 0 | m_currentParcelHide) - SendInitialDataToMe(); + if (m_teleportFlags > 0 || m_currentParcelHide) + //SendInitialDataToMe(); + SendOtherAgentsAvatarFullToMe(); // priority uses avatar position only // m_reprioritizationLastPosition = AbsolutePosition; @@ -4035,8 +4036,8 @@ namespace OpenSim.Region.Framework.Scenes else cacheEmpty = true; - if (m_teleportFlags > 0) // only doing for child for now - return; +// if (m_teleportFlags > 0) // only doing for child for now +// return; lock (m_completeMovementLock) { @@ -4047,18 +4048,21 @@ namespace OpenSim.Region.Framework.Scenes Util.FireAndForget(delegate { - Scene.SendLayerData(ControllingClient); + if (m_teleportFlags <= 0) + { + Scene.SendLayerData(ControllingClient); - ILandChannel landch = m_scene.LandChannel; - if (landch != null) - landch.sendClientInitialLandInfo(ControllingClient, true); + ILandChannel landch = m_scene.LandChannel; + if (landch != null) + landch.sendClientInitialLandInfo(ControllingClient, true); + + SendOtherAgentsAvatarFullToMe(); + } // recheck to reduce timing issues ControllingClient.CheckViewerCaps(); - SendOtherAgentsAvatarFullToMe(); - /* - if (m_scene.ObjectsCullingByDistance && cacheCulling) + if (m_scene.ObjectsCullingByDistance) { m_reprioritizationBusy = true; m_reprioritizationLastPosition = AbsolutePosition; @@ -4069,7 +4073,6 @@ namespace OpenSim.Region.Framework.Scenes m_reprioritizationBusy = false; return; } - */ EntityBase[] entities = Scene.Entities.GetEntities(); if(cacheEmpty) @@ -4367,18 +4370,19 @@ namespace OpenSim.Region.Framework.Scenes if(IsDeleted || !ControllingClient.IsActive) return; +/* bool needsendinitial = false; lock(m_completeMovementLock) { needsendinitial = SentInitialData; } - if(!needsendinitial) + if(needsendinitial) { SendInitialDataToMe(); return; } - +*/ if(m_reprioritizationBusy) return; -- cgit v1.1 From b6626739e2b74dc0f66888ab9f383bd39a574945 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 04:28:22 +0000 Subject: make the text enable option visible for testing --- bin/OpenSimDefaults.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 20dbd2e..0b56163 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -776,6 +776,8 @@ ; ;PausedAckTimeout = 300 + ; experimental feature, things may still go very wrong + ; SupportViewerObjectsCache = false [ClientStack.LindenCaps] ;; Long list of capabilities taken from -- cgit v1.1 From 9c322c93ccb3d4560bc3c1082c15ff9e01d6dda3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 08:04:23 +0000 Subject: fix particles encoding on compressedupdate --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9d606a6..2b288df 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7145,7 +7145,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// <summary>Whether the object has floating text ala llSetText</summary> HasText = 0x04, /// <summary>Whether the object has an active particle system</summary> - HasParticles = 0x08, + HasParticlesLegacy = 0x08, /// <summary>Whether the object has sound attached to it</summary> HasSound = 0x10, /// <summary>Whether the object is attached to a root object or not</summary> @@ -7157,7 +7157,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// <summary>Whether the object has a name value pairs string</summary> HasNameValues = 0x100, /// <summary>Whether the object has a Media URL set</summary> - MediaURL = 0x200 + MediaURL = 0x200, + HasParticlesNew = 0x400 } ///**** temp hack @@ -7218,10 +7219,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP bool hasangvel = part.AngularVelocity.LengthSquared() > 1e-8f; bool hasmediaurl = part.MediaUrl != null && part.MediaUrl.Length > 1; + bool haspsnew = false; if (hastext) cflags |= CompressedFlags.HasText; if (hasps) - cflags |= CompressedFlags.HasParticles; + { + if(part.ParticleSystem.Length > 86) + { + hasps= false; + cflags |= CompressedFlags.HasParticlesNew; + haspsnew = true; + } + else + cflags |= CompressedFlags.HasParticlesLegacy; + } if (hassound) cflags |= CompressedFlags.HasSound; if (part.ParentID != 0) @@ -7277,7 +7288,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.UIntToBytesSafepos((uint)cflags, dest, pos); pos += 4; - if (hasps || hassound) + if (hasps || haspsnew || hassound) part.OwnerID.ToBytes(dest, pos); else UUID.Zero.ToBytes(dest, pos); @@ -7387,6 +7398,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP pos += len; } } + + if (haspsnew) + { + byte[] ps = part.ParticleSystem; + Buffer.BlockCopy(ps, 0, dest, pos, ps.Length); pos += ps.Length; + } + int totlen = pos - lenpos - 2; dest[lenpos++] = (byte)totlen; dest[lenpos++] = (byte)(totlen >> 8); -- cgit v1.1 From 33986aea5e2ced1be33ef3b8d5c361742b17c427 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 23:32:39 +0000 Subject: mantis 8506: parse highlod mesh and compare its number of prim faces to the number of faces provided and warn mismatch --- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index eb1ab45..e293463 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -129,6 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden public int medLODSize; public int lowLODSize; public int lowestLODSize; + public int highLODsides; // normalized fee based on compressed data sizes public float costFee; // physics cost @@ -209,7 +210,7 @@ namespace OpenSim.Region.ClientStack.Linden ameshCostParam curCost = new ameshCostParam(); byte[] data = (byte[])resources.mesh_list.Array[i]; - if (!MeshCost(data, curCost,out curskeleton, out curAvatarPhys, out error)) + if (!MeshCost(data, curCost, out curskeleton, out curAvatarPhys, out error)) { return false; } @@ -259,6 +260,11 @@ namespace OpenSim.Region.ClientStack.Linden error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale"; return false; } + int nfaces = 0; + if(inst.Contains("face_list")) + { + nfaces = ((ArrayList)inst["face_list"]).Count; + } if (haveMeshs && inst.ContainsKey("mesh")) { @@ -275,6 +281,9 @@ namespace OpenSim.Region.ClientStack.Linden float sqdiam = scale.LengthSquared(); ameshCostParam curCost = meshsCosts[mesh]; + if(nfaces != curCost.highLODsides) + warning +="Warning: Uploaded number of faces ( "+ nfaces.ToString() +" ) does not match highlod number of faces ( "+ curCost.highLODsides.ToString() +" )\n"; + float mesh_streaming = streamingCost(curCost, sqdiam); meshcostdata.model_streaming_cost += mesh_streaming; @@ -339,6 +348,7 @@ namespace OpenSim.Region.ClientStack.Linden private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error) { cost.highLODSize = 0; + cost.highLODsides = 0; cost.medLODSize = 0; cost.lowLODSize = 0; cost.lowestLODSize = 0; @@ -430,7 +440,8 @@ namespace OpenSim.Region.ClientStack.Linden submesh_offset = -1; - // only look for LOD meshs sizes + int nsides = 0; + int lod_ntriangles = 0; if (map.ContainsKey("high_lod")) { @@ -440,6 +451,15 @@ namespace OpenSim.Region.ClientStack.Linden submesh_offset = tmpmap["offset"].AsInteger() + start; if (tmpmap.ContainsKey("size")) highlod_size = tmpmap["size"].AsInteger(); + + if (submesh_offset >= 0 && highlod_size > 0) + { + if (!submesh(data, submesh_offset, highlod_size, out lod_ntriangles, out nsides)) + { + error = "Model data parsing error"; + return false; + } + } } if (submesh_offset < 0 || highlod_size <= 0) @@ -483,6 +503,7 @@ namespace OpenSim.Region.ClientStack.Linden } cost.highLODSize = highlod_size; + cost.highLODsides = nsides; cost.medLODSize = medlod_size; cost.lowLODSize = lowlod_size; cost.lowestLODSize = lowestlod_size; @@ -495,6 +516,7 @@ namespace OpenSim.Region.ClientStack.Linden else if (map.ContainsKey("physics_shape")) // old naming tmpmap = (OSDMap)map["physics_shape"]; + int phys_nsides = 0; if(tmpmap != null) { if (tmpmap.ContainsKey("offset")) @@ -502,10 +524,9 @@ namespace OpenSim.Region.ClientStack.Linden if (tmpmap.ContainsKey("size")) physmesh_size = tmpmap["size"].AsInteger(); - if (submesh_offset >= 0 || physmesh_size > 0) + if (submesh_offset >= 0 && physmesh_size > 0) { - - if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles)) + if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles, out phys_nsides)) { error = "Model data parsing error"; return false; @@ -541,9 +562,10 @@ namespace OpenSim.Region.ClientStack.Linden } // parses a LOD or physics mesh component - private bool submesh(byte[] data, int offset, int size, out int ntriangles) + private bool submesh(byte[] data, int offset, int size, out int ntriangles, out int nsides) { ntriangles = 0; + nsides = 0; OSD decodedMeshOsd = new OSD(); byte[] meshBytes = new byte[size]; @@ -599,6 +621,7 @@ namespace OpenSim.Region.ClientStack.Linden } else return false; + nsides++; } } -- cgit v1.1 From 027750e98ff40b87d774dc6ad4700969b3714087 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 00:35:30 +0000 Subject: compact the trivial te case, a more complete one may be needed even beening heavy --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 10 +++++++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 92f5a2c..16178e6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1012,7 +1012,15 @@ namespace OpenSim.Region.ClientStack.Linden textureEntry.FaceTextures[face] = f; } - pbs.TextureEntry = textureEntry.GetBytes(); + + if(face_list.Count > 0) + { + int last = face_list.Count - 1; + // we do need a better te compacting code + textureEntry.DefaultTexture = textureEntry.FaceTextures[last]; + textureEntry.FaceTextures[last] = null; + pbs.TextureEntry = textureEntry.GetBytes(last); + } Vector3 position = inner_instance_list["position"].AsVector3(); Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ebb8eda..5e2204e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3883,15 +3883,15 @@ namespace OpenSim.Region.Framework.Scenes { if (Shape.SculptEntry && !ignoreSculpt) return PrimType.SCULPT; - - if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) + ProfileShape ps = (ProfileShape)(Shape.ProfileCurve & 0x07); + if (ps == ProfileShape.Square) { if (Shape.PathCurve == (byte)Extrusion.Straight) return PrimType.BOX; else if (Shape.PathCurve == (byte)Extrusion.Curve1) return PrimType.TUBE; } - else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) + else if (ps == ProfileShape.Circle) { if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) return PrimType.CYLINDER; @@ -3899,12 +3899,12 @@ namespace OpenSim.Region.Framework.Scenes else if (Shape.PathCurve == (byte)Extrusion.Curve1) return PrimType.TORUS; } - else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) + else if (ps == ProfileShape.HalfCircle) { if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) return PrimType.SPHERE; } - else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) + else if (ps == ProfileShape.EquilateralTriangle) { if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) return PrimType.PRISM; @@ -5124,7 +5124,13 @@ namespace OpenSim.Region.Framework.Scenes if (changeFlags == 0) return; - m_shape.TextureEntry = newTex.GetBytes(9); + // we do need better compacter do just the trivial case + if(nsides == 1 && newTex.FaceTextures[0] != null) + { + newTex.DefaultTexture = newTex.GetFace(0); + newTex.FaceTextures[0] = null; + } + m_shape.TextureEntry = newTex.GetBytes(nsides); TriggerScriptChangedEvent(changeFlags); ParentGroup.HasGroupChanged = true; ScheduleUpdate(PrimUpdateFlags.Textures); -- cgit v1.1 From 481d7156d16adc59da0ab82f0ae5d7b3c584e104 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 01:51:29 +0000 Subject: mantis 8505 ( and not 8506 by mistake on previus commit) remove the meshes numbre of sides warning. build prims with the number of sides of the high LOD submesh --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 33 +++++++++++++--------- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 13 +++------ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 16178e6..deeacf5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.Linden string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload, ref string error, ref int nextOwnerMask, ref int groupMask, ref int everyoneMask); + bool IsAtestUpload, ref string error, ref int nextOwnerMask, ref int groupMask, ref int everyoneMask, int[] meshesSides); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -529,6 +529,7 @@ namespace OpenSim.Region.ClientStack.Linden int nreqmeshs= 0; int nreqinstances = 0; bool IsAtestUpload = false; + int[] meshesSides = null; string assetName = llsdRequest.name; @@ -578,9 +579,8 @@ namespace OpenSim.Region.ClientStack.Linden string error; int modelcost; - if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, - meshcostdata, out error, ref warning)) + meshcostdata, out error, ref warning, out meshesSides)) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); resperror.message = error; @@ -668,7 +668,7 @@ namespace OpenSim.Region.ClientStack.Linden new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, - llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask); + llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask, meshesSides); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -713,7 +713,7 @@ namespace OpenSim.Region.ClientStack.Linden string assetType, int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, bool IsAtestUpload, ref string error, - ref int nextOwnerMask, ref int groupMask, ref int everyoneMask) + ref int nextOwnerMask, ref int groupMask, ref int everyoneMask, int[] meshesSides) { lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.processUpload; @@ -967,7 +967,12 @@ namespace OpenSim.Region.ClientStack.Linden { int meshindx = inner_instance_list["mesh"].AsInteger(); if (meshAssets.Count > meshindx) - pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]); + { + if(meshesSides != null && meshesSides.Length > meshindx) + pbs = PrimitiveBaseShape.CreateMesh(meshesSides[i], meshAssets[meshindx]); + else + pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]); + } } if(pbs == null) // fallback pbs = PrimitiveBaseShape.CreateBox(); @@ -1025,12 +1030,12 @@ namespace OpenSim.Region.ClientStack.Linden Vector3 position = inner_instance_list["position"].AsVector3(); Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); - // for now viwers do send fixed defaults - // but this may change -// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); byte physicsShapeType = (byte)PhysShapeType.convex; // default is simple convex -// int material = inner_instance_list["material"].AsInteger(); + if (inner_instance_list.ContainsKey("physics_shape_type")) + physicsShapeType = (byte)inner_instance_list["physics_shape_type"].AsInteger(); byte material = (byte)Material.Wood; + if (inner_instance_list.ContainsKey("material")) + material = (byte)inner_instance_list["material"].AsInteger(); SceneObjectPart prim = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); @@ -2014,13 +2019,13 @@ namespace OpenSim.Region.ClientStack.Linden private int m_nextOwnerMask; private int m_groupMask; private int m_everyoneMask; - + private int[] m_meshesSides; public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, IHttpServer httpServer, bool dumpAssetsToFile, int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload, int nextOwnerMask, int groupMask, int everyoneMask) + bool IsAtestUpload, int nextOwnerMask, int groupMask, int everyoneMask, int[] meshesSides) { m_assetName = assetName; m_assetDes = description; @@ -2048,6 +2053,8 @@ namespace OpenSim.Region.ClientStack.Linden m_nextOwnerMask = nextOwnerMask; m_groupMask = groupMask; m_everyoneMask = everyoneMask; + + m_meshesSides = meshesSides; } /// <summary> @@ -2088,7 +2095,7 @@ namespace OpenSim.Region.ClientStack.Linden { handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, - ref m_error, ref m_nextOwnerMask, ref m_groupMask, ref m_everyoneMask); + ref m_error, ref m_nextOwnerMask, ref m_groupMask, ref m_everyoneMask, m_meshesSides); } uploadComplete.new_next_owner_mask = m_nextOwnerMask; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index e293463..8844a0f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -145,11 +145,11 @@ namespace OpenSim.Region.ClientStack.Linden // avatarSkeleton if mesh includes a avatar skeleton // useAvatarCollider if we should use physics mesh for avatar public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, - LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) + LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning, out int[] meshesSides) { totalcost = 0; error = string.Empty; - + meshesSides = null; bool avatarSkeleton = false; if (resources == null || @@ -204,6 +204,7 @@ namespace OpenSim.Region.ClientStack.Linden if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) { numberMeshs = resources.mesh_list.Array.Count; + meshesSides = new int[numberMeshs]; for (int i = 0; i < numberMeshs; i++) { @@ -226,6 +227,7 @@ namespace OpenSim.Region.ClientStack.Linden } meshsCosts.Add(curCost); meshsfee += curCost.costFee; + meshesSides[i] = curCost.highLODsides; } haveMeshs = true; } @@ -260,11 +262,6 @@ namespace OpenSim.Region.ClientStack.Linden error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale"; return false; } - int nfaces = 0; - if(inst.Contains("face_list")) - { - nfaces = ((ArrayList)inst["face_list"]).Count; - } if (haveMeshs && inst.ContainsKey("mesh")) { @@ -281,8 +278,6 @@ namespace OpenSim.Region.ClientStack.Linden float sqdiam = scale.LengthSquared(); ameshCostParam curCost = meshsCosts[mesh]; - if(nfaces != curCost.highLODsides) - warning +="Warning: Uploaded number of faces ( "+ nfaces.ToString() +" ) does not match highlod number of faces ( "+ curCost.highLODsides.ToString() +" )\n"; float mesh_streaming = streamingCost(curCost, sqdiam); -- cgit v1.1 From b32b104996289b3e28c179b992cb5f44b6d1327a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 16:15:24 +0000 Subject: some more changes on objects sending --- OpenSim/Framework/ISceneAgent.cs | 8 --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 ++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 79 +++------------------- 3 files changed, 28 insertions(+), 86 deletions(-) diff --git a/OpenSim/Framework/ISceneAgent.cs b/OpenSim/Framework/ISceneAgent.cs index 5d70b83..43e1b08 100644 --- a/OpenSim/Framework/ISceneAgent.cs +++ b/OpenSim/Framework/ISceneAgent.cs @@ -70,14 +70,6 @@ namespace OpenSim.Framework AvatarAppearance Appearance { get; set; } /// <summary> - /// Send initial scene data to the client controlling this agent - /// </summary> - /// <remarks> - /// This includes scene object data and the appearance data of other avatars. - /// </remarks> - void SendInitialDataToMe(); - - /// <summary> /// Direction in which the scene presence is looking. /// </summary> /// <remarks>Will be Vector3.Zero for a child agent.</remarks> diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2b288df..601de61 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5544,17 +5544,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(GroupsNeedFullUpdate.Count > 0) { - bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0;// && mysp.IsChildAgent; - foreach (SceneObjectGroup grp in GroupsNeedFullUpdate) + bool sendProbes = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0 && (m_viewerHandShakeFlags & 2) == 0; + + if(sendProbes) + { + foreach (SceneObjectGroup grp in GroupsNeedFullUpdate) + { + PrimUpdateFlags flags = PrimUpdateFlags.CancelKill; + if (grp.IsViewerCachable) + flags |= PrimUpdateFlags.UpdateProbe; + foreach (SceneObjectPart p in grp.Parts) + SendEntityUpdate(p, flags); + } + } + else { + m_viewerHandShakeFlags &= ~2U; // nexttime send probes PrimUpdateFlags flags = PrimUpdateFlags.CancelKill; - if (viewerCache && grp.IsViewerCachable) - flags |= PrimUpdateFlags.UpdateProbe; - foreach (SceneObjectPart p in grp.Parts) - SendEntityUpdate(p, flags); + foreach (SceneObjectGroup grp in GroupsNeedFullUpdate) + { + foreach (SceneObjectPart p in grp.Parts) + SendEntityUpdate(p, flags); + } } } - CheckGroupsInViewBusy = false; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e35481f..9a879f7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1214,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; ControllingClient.OnRegionHandShakeReply += RegionHandShakeReply; - // ControllingClient.OnAgentFOV += HandleAgentFOV; + // ControllingClient.OnAgentFOV += HandleAgentFOV; // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); @@ -4022,12 +4022,18 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } - public void RegionHandShakeReply (IClientAPI client, uint flags) { if(IsNPC) return; + lock (m_completeMovementLock) + { + if (SentInitialData) + return; + SentInitialData = true; + } + bool selfappearance = (flags & 4) != 0; bool cacheCulling = (flags & 1) != 0; bool cacheEmpty; @@ -4036,16 +4042,6 @@ namespace OpenSim.Region.Framework.Scenes else cacheEmpty = true; -// if (m_teleportFlags > 0) // only doing for child for now -// return; - - lock (m_completeMovementLock) - { - if (SentInitialData) - return; - SentInitialData = true; - } - Util.FireAndForget(delegate { if (m_teleportFlags <= 0) @@ -4108,65 +4104,6 @@ namespace OpenSim.Region.Framework.Scenes } - public void SendInitialDataToMe() - { - // Send all scene object to the new client - lock (m_completeMovementLock) - { - if (SentInitialData) - return; - SentInitialData = true; - } - - Util.FireAndForget(delegate - { - // we created a new ScenePresence (a new child agent) in a fresh region. - // Request info about all the (root) agents in this region - // Note: This won't send data *to* other clients in that region (children don't send) - if (m_teleportFlags <= 0) - { - Scene.SendLayerData(ControllingClient); - - ILandChannel landch = m_scene.LandChannel; - if (landch != null) - { - landch.sendClientInitialLandInfo(ControllingClient, true); - } - } - - // recheck to reduce timing issues - ControllingClient.CheckViewerCaps(); - - SendOtherAgentsAvatarFullToMe(); - - if(m_scene.ObjectsCullingByDistance) - { - m_reprioritizationBusy = true; - m_reprioritizationLastPosition = AbsolutePosition; - m_reprioritizationLastDrawDistance = DrawDistance; - - ControllingClient.ReprioritizeUpdates(); - m_reprioritizationLastTime = Util.EnvironmentTickCount(); - m_reprioritizationBusy = false; - return; - } - - EntityBase[] entities = Scene.Entities.GetEntities(); - foreach (EntityBase e in entities) - { - if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) - ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); - } - - m_reprioritizationLastPosition = AbsolutePosition; - m_reprioritizationLastDrawDistance = DrawDistance; - m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it - - m_reprioritizationBusy = false; - - }); - } - /// <summary> /// Send avatar full data appearance and animations for all other root agents to this agent, this agent /// can be either a child or root -- cgit v1.1 From 5035de053a533bb0407fb8ad11c44351026f6cf8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Mar 2019 17:51:38 +0000 Subject: we should be able to zeroencode compressedupdates --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 456 +++++++++++++++++++-- 1 file changed, 425 insertions(+), 31 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 601de61..187b6fa 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4857,6 +4857,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } useCompressUpdate = false; + bool istree = false; if (update.Entity is SceneObjectPart) { @@ -4973,8 +4974,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP maxUpdatesBytes -= 20 * part.Animations.Count + 24; } } + if(viewerCache) useCompressUpdate = grp.IsViewerCachable; + + istree = (part.Shape.PCode == (byte)PCode.Grass || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Tree); } else if (update.Entity is ScenePresence) { @@ -5049,7 +5053,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (useCompressUpdate) { - maxUpdatesBytes -= 150; // crude estimation + if (istree) + maxUpdatesBytes -= 64; + else + maxUpdatesBytes -= 100; // crude estimation if (compressedUpdates == null) { @@ -5060,7 +5067,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - maxUpdatesBytes -= 150; // crude estimation + if (istree) + maxUpdatesBytes -= 70; + else + maxUpdatesBytes -= 150; // crude estimation if (objectUpdates == null) { @@ -5164,6 +5174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + /* no zero encode compressed updates if(compressedUpdates != null) { List<EntityUpdate> tau = new List<EntityUpdate>(30); @@ -5211,7 +5222,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP pos = 18; // im lazy now, just do last again - CreateCompressedUpdateBlock((SceneObjectPart)eu.Entity, mysp, data, ref pos); + CreateCompressedUpdateBlock(sop, mysp, data, ref pos); tau = new List<EntityUpdate>(30); tau.Add(eu); count = 1; @@ -5226,6 +5237,88 @@ namespace OpenSim.Region.ClientStack.LindenUDP delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); } } + */ + + if (compressedUpdates != null) + { + List<EntityUpdate> tau = new List<EntityUpdate>(30); + + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + Buffer.BlockCopy(CompressedObjectHeader, 0, data, 0, 7); + data[0] |= Helpers.MSG_ZEROCODED; + + LLUDPZeroEncoder zc = new LLUDPZeroEncoder(buf.Data); + zc.Position = 7; + + zc.AddUInt64(m_scene.RegionInfo.RegionHandle); + zc.AddUInt16(timeDilation); + + zc.AddByte(1); // tmp block count + + int countposition = zc.Position - 1; + + int lastpos = 0; + int lastzc = 0; + + int count = 0; + foreach (EntityUpdate eu in compressedUpdates) + { + SceneObjectPart sop = (SceneObjectPart)eu.Entity; + if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) + continue; + lastpos = zc.Position; + lastzc = zc.ZeroCount; + + CreateCompressedUpdateBlockZC(sop, mysp, zc); + if (zc.Position < LLUDPServer.MAXPAYLOAD) + { + tau.Add(eu); + ++count; + } + else + { + // we need more packets + UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(buf.Data, 0, newbuf.Data, 0, countposition); // start is the same + + buf.Data[countposition] = (byte)count; + // get pending zeros at cut point + if (lastzc > 0) + { + buf.Data[lastpos++] = 0; + buf.Data[lastpos++] = (byte)lastzc; + } + buf.DataLength = lastpos; + + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, + delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + + buf = newbuf; + zc.Data = buf.Data; + + data[0] |= Helpers.MSG_ZEROCODED; + + zc.ZeroCount = 0; + zc.Position = countposition + 1; + + // im lazy now, just do last again + CreateCompressedUpdateBlockZC(sop, mysp, zc); + tau = new List<EntityUpdate>(30); + tau.Add(eu); + count = 1; + } + } + + if (count > 0) + { + buf.Data[countposition] = (byte)count; + buf.DataLength = zc.Finish(); + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, + delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + } + } if (objectUpdateProbes != null) { @@ -7174,9 +7267,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP HasParticlesNew = 0x400 } - ///**** temp hack - private static Random rnd = new Random(); - + /* protected void CreateCompressedUpdateBlock(SceneObjectPart part, ScenePresence sp, byte[] dest, ref int pos) { // prepare data @@ -7197,13 +7288,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - // first is primFlags - Utils.UIntToBytesSafepos((uint)primflags, dest, pos); pos += 4; - - // datablock len to fill later - int lenpos = pos; - pos += 2; - byte state = part.Shape.State; PCode pcode = (PCode)part.Shape.PCode; @@ -7278,12 +7362,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP pathScaleY = 150; } + // first is primFlags + Utils.UIntToBytesSafepos((uint)primflags, dest, pos); pos += 4; + + // datablock len to fill later + int lenpos = pos; + pos += 2; + + // data block part.UUID.ToBytes(dest, pos); pos += 16; Utils.UIntToBytesSafepos(part.LocalId, dest, pos); pos += 4; dest[pos++] = (byte)pcode; dest[pos++] = state; - ///**** temp hack Utils.UIntToBytesSafepos((uint)part.ParentGroup.PseudoCRC, dest, pos); pos += 4; dest[pos++] = part.Material; dest[pos++] = part.ClickAction; @@ -7393,23 +7484,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (hastexanim) { byte[] ta = part.TextureAnimation; - if (ta == null) - { - dest[pos++] = 0; - dest[pos++] = 0; - dest[pos++] = 0; - dest[pos++] = 0; - } - else - { - int len = ta.Length & 0x7fff; - dest[pos++] = (byte)len; - dest[pos++] = (byte)(len >> 8); - dest[pos++] = 0; - dest[pos++] = 0; - Buffer.BlockCopy(ta, 0, dest, pos, len); - pos += len; - } + int len = ta.Length & 0x7fff; + dest[pos++] = (byte)len; + dest[pos++] = (byte)(len >> 8); + dest[pos++] = 0; + dest[pos++] = 0; + Buffer.BlockCopy(ta, 0, dest, pos, len); + pos += len; } if (haspsnew) @@ -7422,6 +7503,319 @@ namespace OpenSim.Region.ClientStack.LindenUDP dest[lenpos++] = (byte)totlen; dest[lenpos++] = (byte)(totlen >> 8); } + */ + + protected void CreateCompressedUpdateBlockZC(SceneObjectPart part, ScenePresence sp, LLUDPZeroEncoder zc) + { + // prepare data + CompressedFlags cflags = CompressedFlags.None; + + // prim/update flags + + PrimFlags primflags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp); + // Don't send the CreateSelected flag to everyone + primflags &= ~PrimFlags.CreateSelected; + if (sp.UUID == part.OwnerID) + { + if (part.CreateSelected) + { + // Only send this flag once, then unset it + primflags |= PrimFlags.CreateSelected; + part.CreateSelected = false; + } + } + + byte state = part.Shape.State; + PCode pcode = (PCode)part.Shape.PCode; + + // trees and grass are a lot more compact + if (pcode == PCode.Grass || pcode == PCode.Tree || pcode == PCode.NewTree) + { + // first is primFlags + zc.AddUInt((uint)primflags); + + // datablock len + zc.AddByte(113); + zc.AddZeros(1); + + // data block + zc.AddUUID(part.UUID); + zc.AddUInt(part.LocalId); + zc.AddByte((byte)pcode); + zc.AddByte(state); + + zc.AddUInt((uint)part.ParentGroup.PseudoCRC); + + zc.AddZeros(2); // material and click action + + zc.AddVector3(part.Shape.Scale); + zc.AddVector3(part.RelativePosition); + if (pcode == PCode.Grass) + zc.AddZeros(12); + else + { + Quaternion rotation = part.RotationOffset; + rotation.Normalize(); + zc.AddNormQuat(rotation); + } + + zc.AddUInt((uint)CompressedFlags.Tree); // cflags + + zc.AddZeros(16); // owner id + + zc.AddByte(state); // tree parameter + + zc.AddZeros(28); //extraparameters 1, pbs 23, texture 4 + + return; + } + + //NameValue and state + byte[] nv = null; + if (part.ParentGroup.IsAttachment) + { + if (part.IsRoot) + nv = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID); + + int st = (int)part.ParentGroup.AttachmentPoint; + state = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; + } + + bool hastext = false; + bool hassound = false; + bool hasps = false; + bool hastexanim = false; + bool hasangvel = false; + bool hasmediaurl = false; + bool haspsnew = false; + + int BlockLengh = 111; + + byte[] extraParamBytes = part.Shape.ExtraParams; + if (extraParamBytes == null || extraParamBytes.Length < 2) + { + ++BlockLengh; + extraParamBytes = null; + } + else + BlockLengh += extraParamBytes.Length; + + byte[] hoverText = null; + byte[] hoverTextColor = null; + if (part.Text != null && part.Text.Length > 0) + { + cflags |= CompressedFlags.HasText; + hoverText = Util.StringToBytes256(part.Text); + BlockLengh += hoverText.Length; + hoverTextColor = part.GetTextColor().GetBytes(false); + BlockLengh += hoverTextColor.Length; + hastext = true; + } + + if (part.ParticleSystem != null && part.ParticleSystem.Length > 1) + { + BlockLengh += part.ParticleSystem.Length; + if (part.ParticleSystem.Length > 86) + { + hasps = false; + cflags |= CompressedFlags.HasParticlesNew; + haspsnew = true; + } + else + { + cflags |= CompressedFlags.HasParticlesLegacy; + hasps = true; + } + } + + if (part.Sound != UUID.Zero || part.SoundFlags != 0) + { + BlockLengh += 25; + cflags |= CompressedFlags.HasSound; + hassound = true; + } + + if (part.ParentID != 0) + { + BlockLengh += 4; + cflags |= CompressedFlags.HasParent; + } + + if (part.TextureAnimation != null && part.TextureAnimation.Length > 0) + { + BlockLengh += part.TextureAnimation.Length + 4; + cflags |= CompressedFlags.TextureAnimation; + hastexanim = true; + } + + if (part.AngularVelocity.LengthSquared() > 1e-8f) + { + BlockLengh += 12; + cflags |= CompressedFlags.HasAngularVelocity; + hasangvel = true; + } + + byte[] mediaURLBytes = null; + if (part.MediaUrl != null && part.MediaUrl.Length > 1) + { + mediaURLBytes = Util.StringToBytes256(part.MediaUrl); // must be null term + BlockLengh += mediaURLBytes.Length; + cflags |= CompressedFlags.MediaURL; + hasmediaurl = true; + } + + if (nv != null) + { + BlockLengh += nv.Length; + cflags |= CompressedFlags.HasNameValues; + } + + byte[] textureEntry = part.Shape.TextureEntry; + if(textureEntry != null) + BlockLengh += textureEntry.Length; + + // filter out mesh faces hack + ushort profileBegin = part.Shape.ProfileBegin; + ushort profileHollow = part.Shape.ProfileHollow; + byte profileCurve = part.Shape.ProfileCurve; + byte pathScaleY = part.Shape.PathScaleY; + + if (part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack + { + profileCurve = (byte)(part.Shape.ProfileCurve & 0x0f); + // fix old values that confused viewers + if (profileBegin == 1) + profileBegin = 9375; + if (profileHollow == 1) + profileHollow = 27500; + // fix torus hole size Y that also confuse some viewers + if (profileCurve == (byte)ProfileShape.Circle && pathScaleY < 150) + pathScaleY = 150; + } + + + // first is primFlags + zc.AddUInt((uint)primflags); + + // datablock len + zc.AddByte((byte)BlockLengh); + zc.AddByte((byte)(BlockLengh >> 8)); + + // data block + zc.AddUUID(part.UUID); + zc.AddUInt(part.LocalId); + zc.AddByte((byte)pcode); + zc.AddByte(state); + + zc.AddUInt((uint)part.ParentGroup.PseudoCRC); + + zc.AddByte(part.Material); + zc.AddByte(part.ClickAction); + zc.AddVector3(part.Shape.Scale); + zc.AddVector3(part.RelativePosition); + if (pcode == PCode.Grass) + zc.AddZeros(12); + else + { + Quaternion rotation = part.RotationOffset; + rotation.Normalize(); + zc.AddNormQuat(rotation); + } + + zc.AddUInt((uint)cflags); + + if (hasps || haspsnew || hassound) + zc.AddUUID(part.OwnerID); + else + zc.AddZeros(16); + + if (hasangvel) + { + zc.AddVector3(part.AngularVelocity); + } + if (part.ParentID != 0) + { + zc.AddUInt(part.ParentID); + } + if (hastext) + { + zc.AddBytes(hoverText, hoverText.Length); + zc.AddBytes(hoverTextColor, hoverTextColor.Length); + } + if (hasmediaurl) + { + zc.AddBytes(mediaURLBytes, mediaURLBytes.Length); + } + if (hasps) + { + byte[] ps = part.ParticleSystem; + zc.AddBytes(ps, ps.Length); + } + if (extraParamBytes == null) + zc.AddZeros(1); + else + { + zc.AddBytes(extraParamBytes, extraParamBytes.Length); + } + if (hassound) + { + zc.AddUUID(part.Sound); + zc.AddFloat((float)part.SoundGain); + zc.AddByte(part.SoundFlags); + zc.AddFloat((float)part.SoundRadius); + } + if (nv != null) + { + zc.AddBytes(nv, nv.Length); + } + + zc.AddByte(part.Shape.PathCurve); + zc.AddUInt16(part.Shape.PathBegin); + zc.AddUInt16(part.Shape.PathEnd); + zc.AddByte(part.Shape.PathScaleX); + zc.AddByte(pathScaleY); + zc.AddByte(part.Shape.PathShearX); + zc.AddByte(part.Shape.PathShearY); + zc.AddByte((byte)part.Shape.PathTwist); + zc.AddByte((byte)part.Shape.PathTwistBegin); + zc.AddByte((byte)part.Shape.PathRadiusOffset); + zc.AddByte((byte)part.Shape.PathTaperX); + zc.AddByte((byte)part.Shape.PathTaperY); + zc.AddByte(part.Shape.PathRevolutions); + zc.AddByte((byte)part.Shape.PathSkew); + zc.AddByte(profileCurve); + zc.AddUInt16(profileBegin); + zc.AddUInt16(part.Shape.ProfileEnd); + zc.AddUInt16(profileHollow); + + if (textureEntry == null) + { + zc.AddZeros(4); + } + else + { + int len = textureEntry.Length; + zc.AddByte((byte)len); + zc.AddByte((byte)(len >> 8)); + zc.AddZeros(2); + zc.AddBytes(textureEntry, len); + } + if (hastexanim) + { + byte[] ta = part.TextureAnimation; + int len = ta.Length; + zc.AddByte((byte)len); + zc.AddByte((byte)(len >> 8)); + zc.AddZeros(2); + zc.AddBytes(ta, len); + } + + if (haspsnew) + { + byte[] ps = part.ParticleSystem; + zc.AddBytes(ps, ps.Length); + } + } public void SendNameReply(UUID profileId, string firstname, string lastname) { -- cgit v1.1 From 83fd05f13165477b82615c74a12f08b0a2bdfb05 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 02:04:11 +0000 Subject: timming issues on fast tp back to same region on new code --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 187b6fa..67c5e38 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -8931,9 +8931,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(rsrpkt.AgentData.AgentID != m_agentId || rsrpkt.AgentData.SessionID != m_sessionId) return false; - // regionHandSHake is a protocol message, but it is also seems to be the only way to update terrain textures - // in last case this should be ignored. - OnRegionHandShakeReply = null; if(m_supportViewerCache) m_viewerHandShakeFlags = rsrpkt.RegionInfo.Flags; else diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9a879f7..63eb29f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -6797,7 +6797,12 @@ namespace OpenSim.Region.Framework.Scenes } else { - GodController.HasMovedAway(); + lock (m_completeMovementLock) + { + GodController.HasMovedAway(); + SentInitialData = false; + } + List<ScenePresence> allpresences = m_scene.GetScenePresences(); foreach (ScenePresence p in allpresences) { -- cgit v1.1 From dad533fe1c5574f9c8813955030f1b0f9a1f078e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 06:43:22 +0000 Subject: timming issues on fast tp back to same region on new code --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 67c5e38..6b70922 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12700,6 +12700,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) { + UseCircuitCodePacket uccp = (UseCircuitCodePacket)Pack; + if(uccp.CircuitCode.ID == m_agentId && + uccp.CircuitCode.SessionID == m_sessionId && + uccp.CircuitCode.Code == m_circuitCode && + SceneAgent != null && + !((ScenePresence)SceneAgent).IsDeleted + ) + SendRegionHandshake(); // possible someone returning + return true; } -- cgit v1.1 From 5663e2c0c82756268c5a6aa767e6ca765c00e71d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 07:32:06 +0000 Subject: try another way --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6b70922..d21452f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12700,6 +12700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) { + /* UseCircuitCodePacket uccp = (UseCircuitCodePacket)Pack; if(uccp.CircuitCode.ID == m_agentId && uccp.CircuitCode.SessionID == m_sessionId && @@ -12708,8 +12709,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP !((ScenePresence)SceneAgent).IsDeleted ) SendRegionHandshake(); // possible someone returning - + */ return true; + } private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 6032681..b105d52 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1725,7 +1725,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (client != null) { - client.SendRegionHandshake(); + if(aCircuit.teleportFlags <= 0) + client.SendRegionHandshake(); client.CheckViewerCaps(); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 63eb29f..2145fcd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2179,6 +2179,7 @@ namespace OpenSim.Region.Framework.Scenes } } // Tell the client that we're totally ready + ControllingClient.SendRegionHandshake(); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); -- cgit v1.1 From 1847a42a861d6a0f575c56f566b947dfb21c1f03 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Mar 2019 00:02:24 +0000 Subject: changes on teleports v7 --- OpenSim/Framework/ChildAgentDataUpdate.cs | 16 ++-- .../EntityTransfer/EntityTransferModule.cs | 92 ++++++++-------------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 69 +++++++++------- 3 files changed, 84 insertions(+), 93 deletions(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index ee5007a..2d00296 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -398,7 +398,8 @@ namespace OpenSim.Framework // Scripted public ControllerData[] Controllers; - public string CallbackURI; + public string CallbackURI; // to remove + public string NewCallbackURI; // These two must have the same Count public List<ISceneObject> AttachmentObjects; @@ -528,6 +529,9 @@ namespace OpenSim.Framework if ((CallbackURI != null) && (!CallbackURI.Equals(""))) args["callback_uri"] = OSD.FromString(CallbackURI); + if ((NewCallbackURI != null) && (!NewCallbackURI.Equals(""))) + args["cb_uri"] = OSD.FromString(NewCallbackURI); + // Attachment objects for fatpack messages if (AttachmentObjects != null) { @@ -811,12 +815,7 @@ namespace OpenSim.Framework } // end of code to remove } -/* moved above - if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) - Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); - else - m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); -*/ + if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) { OSDArray controls = (OSDArray)(args["controllers"]); @@ -834,6 +833,9 @@ namespace OpenSim.Framework if (args["callback_uri"] != null) CallbackURI = args["callback_uri"].AsString(); + if (args["cb_uri"] != null) + NewCallbackURI = args["cb_uri"].AsString(); + // Attachment objects if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array) { diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9471c90..09b0dd6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -54,15 +54,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string LogHeader = "[ENTITY TRANSFER MODULE]"; - public const int DefaultMaxTransferDistance = 4095; public const bool WaitForAgentArrivedAtDestinationDefault = true; /// <summary> - /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. - /// </summary> - public int MaxTransferDistance { get; set; } - - /// <summary> /// If true then on a teleport, the source region waits for a callback from the destination region. If /// a callback fails to arrive within a set time then the user is pulled back into the source region. /// </summary> @@ -227,11 +221,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer WaitForAgentArrivedAtDestination = transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault); - MaxTransferDistance = transferConfig.GetInt("max_distance", DefaultMaxTransferDistance); - } - else - { - MaxTransferDistance = DefaultMaxTransferDistance; } m_entityTransferStateMachine = new EntityTransferStateMachine(this); @@ -640,29 +629,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } /// <summary> - /// Determines whether this instance is within the max transfer distance. - /// </summary> - /// <param name="sourceRegion"></param> - /// <param name="destRegion"></param> - /// <returns> - /// <c>true</c> if this instance is within max transfer distance; otherwise, <c>false</c>. - /// </returns> - private bool IsWithinMaxTeleportDistance(RegionInfo sourceRegion, GridRegion destRegion) - { - if(MaxTransferDistance == 0) - return true; - -// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); -// -// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", -// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); - - // Insanely, RegionLoc on RegionInfo is the 256m map co-ord whilst GridRegion.RegionLoc is the raw meters position. - return Math.Abs(sourceRegion.RegionLocX - destRegion.RegionCoordX) <= MaxTransferDistance - && Math.Abs(sourceRegion.RegionLocY - destRegion.RegionCoordY) <= MaxTransferDistance; - } - - /// <summary> /// Wraps DoTeleportInternal() and manages the transfer state. /// </summary> public void DoTeleport( @@ -722,18 +688,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer RegionInfo sourceRegion = sp.Scene.RegionInfo; - if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination)) - { - sp.ControllingClient.SendTeleportFailed( - string.Format( - "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", - finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY, - sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY, - MaxTransferDistance)); - - return; - } - ulong destinationHandle = finalDestination.RegionHandle; // Let's do DNS resolution only once in this process, please! @@ -1175,7 +1129,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.SenderWantsToWaitForRoot = true; - //SetCallbackURL(agent, sp.Scene.RegionInfo); + if(!sp.IsInLocalTransit) + SetNewCallbackURL(agent, sp.Scene.RegionInfo); // Reset the do not close flag. This must be done before the destination opens child connections (here // triggered by UpdateAgent) to avoid race conditions. However, we also want to reset it as late as possible @@ -1224,25 +1179,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.closeAllChildAgents(); else sp.CloseChildAgents(childRegionsToClose); + } - // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone - // goes by HG hook - if (NeedsClosing(reg, OutSideViewRange)) + // if far jump we do need to close anyways + if (NeedsClosing(reg, OutSideViewRange)) + { + int count = 60; + do { - if (!sp.Scene.IncomingPreCloseClient(sp)) - { - sp.IsInTransit = false; + Thread.Sleep(250); + if(sp.IsDeleted) return; - } + } while (--count > 0); - // viewers and target region take extra time to process the tp - Thread.Sleep(15000); + if (!sp.IsDeleted) + { m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport", sp.Name, Scene.Name); + "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport timeout", sp.Name, Scene.Name); sp.Scene.CloseAgent(sp.UUID, false); } - sp.IsInTransit = false; + return; } + // otherwise keep child + sp.IsInTransit = false; } /// <summary> @@ -1313,6 +1272,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + //m_log.DebugFormat( + // "[ENTITY TRANSFER MODULE]: Set release callback URL to {0} in {1}", + // agent.CallbackURI, region.RegionName); + } + + protected virtual void SetNewCallbackURL(AgentData agent, RegionInfo region) + { + agent.NewCallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; + m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Set release callback URL to {0} in {1}", agent.CallbackURI, region.RegionName); @@ -2488,7 +2456,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public void AgentArrivedAtDestination(UUID id) { - m_entityTransferStateMachine.SetAgentArrivedAtDestination(id); + ScenePresence sp = Scene.GetScenePresence(id); + if(sp == null || sp.IsDeleted || !sp.IsInTransit) + return; + + Scene.CloseAgent(sp.UUID, false); + m_entityTransferStateMachine.ResetFromTransit(id); // this needs cleanup + //m_entityTransferStateMachine.SetAgentArrivedAtDestination(id); } #endregion diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2145fcd..a95036c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -457,9 +457,10 @@ namespace OpenSim.Region.Framework.Scenes #region For teleports and crossings callbacks /// <summary> - /// In the V1 teleport protocol, the destination simulator sends ReleaseAgent to this address. + /// the destination simulator sends ReleaseAgent to this address, for very long range tps, HG. /// </summary> - private string m_callbackURI; + private string m_callbackURI; // to remove with v1 support + private string m_newCallbackURI; /// <summary> /// Records the region from which this presence originated, if not from login. @@ -2155,28 +2156,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); } - if (!string.IsNullOrEmpty(m_callbackURI)) - { - // We cannot sleep here since this would hold up the inbound packet processing thread, as - // CompleteMovement() is executed synchronously. However, it might be better to delay the release - // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete - // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this - // region as the current region, meaning that a close sent before then will fail the teleport. - // System.Threading.Thread.Sleep(2000); - - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_callbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } } // Tell the client that we're totally ready ControllingClient.SendRegionHandshake(); @@ -2381,6 +2360,37 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!string.IsNullOrEmpty(m_callbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", + client.Name, client.AgentId, m_callbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + else if (!string.IsNullOrEmpty(m_newCallbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", + client.Name, client.AgentId, m_newCallbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); + m_newCallbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + if (openChildAgents) { IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); @@ -4589,12 +4599,15 @@ namespace OpenSim.Region.Framework.Scenes byebyeRegions.Add(handle); else if(handle == curRegionHandle) { + continue; + /* RegionInfo curreg = m_scene.RegionInfo; if (Util.IsOutsideView(255, curreg.RegionLocX, newRegionX, curreg.RegionLocY, newRegionY, (int)curreg.RegionSizeX, (int)curreg.RegionSizeX, newRegionSizeX, newRegionSizeY)) { byebyeRegions.Add(handle); } + */ } else { @@ -4774,6 +4787,7 @@ namespace OpenSim.Region.Framework.Scenes public void CopyTo(AgentData cAgent, bool isCrossUpdate) { cAgent.CallbackURI = m_callbackURI; + cAgent.NewCallbackURI = m_newCallbackURI; cAgent.AgentID = UUID; cAgent.RegionID = Scene.RegionInfo.RegionID; @@ -4860,9 +4874,10 @@ namespace OpenSim.Region.Framework.Scenes private void CopyFrom(AgentData cAgent) { m_callbackURI = cAgent.CallbackURI; -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", -// Name, m_scene.RegionInfo.RegionName, m_callbackURI); + m_newCallbackURI = cAgent.NewCallbackURI; + // m_log.DebugFormat( + // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", + // Name, m_scene.RegionInfo.RegionName, m_callbackURI); GodController.SetState(cAgent.GodData); -- cgit v1.1 From 3644879677a53d1d18319b826050949a6950a2a9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Mar 2019 02:32:36 +0000 Subject: mantis 8508: ignore llAttachToAvatar if already attached --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ba35b55..45efa77 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3886,6 +3886,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_item.PermsGranter != m_host.OwnerID) return; + SceneObjectGroup grp = m_host.ParentGroup; + if (grp == null || grp.IsDeleted || grp.IsAttachment) + return; + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) AttachToAvatar(attachmentPoint); } -- cgit v1.1 From f6db9e044d56ed86d95d468980bef2c8acc4f1c8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Mar 2019 13:46:39 +0000 Subject: Yengine: fix scripts resume on attachments drop --- OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index 1b735e3..3743b7e 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -937,7 +937,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine lock(m_QueueLock) { m_Suspended = false; - if((m_EventQueue != null) && + m_DetachQuantum = 0; + if ((m_EventQueue != null) && (m_EventQueue.First != null) && (m_IState == XMRInstState.IDLE)) { -- cgit v1.1 From 6cf85a3db111c2f8e56dde8a05ff3cf13f5ecd14 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Mar 2019 12:07:49 +0000 Subject: a few more changes on initial objects send --- OpenSim/Framework/IClientAPI.cs | 4 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 ++++- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 124 ++------------------ .../Region/CoreModules/World/Land/LandObject.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 126 +++++++++++---------- .../Server/IRCClientView.cs | 11 +- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 9 +- OpenSim/Tests/Common/Mock/TestClient.cs | 9 +- 8 files changed, 119 insertions(+), 193 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5a5e5d0..8b1a982 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -816,7 +816,7 @@ namespace OpenSim.Framework event TeleportCancel OnTeleportCancel; event DeRezObject OnDeRezObject; event RezRestoreToWorld OnRezRestoreToWorld; - event Action<IClientAPI, uint> OnRegionHandShakeReply; + event Action<IClientAPI> OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; event Action<IClientAPI, bool> OnCompleteMovementToRegion; @@ -1511,6 +1511,6 @@ namespace OpenSim.Framework void SendAgentTerseUpdate(ISceneEntity presence); void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data); - void CheckViewerCaps(); + uint GetViewerCaps(); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d21452f..6859b83 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; public event ModifyTerrain OnModifyTerrain; - public event Action<IClientAPI, uint> OnRegionHandShakeReply; + public event Action<IClientAPI> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event SetAppearance OnSetAppearance; public event AvatarNowWearing OnAvatarNowWearing; @@ -8923,7 +8923,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandlerRegionHandshakeReply(IClientAPI sender, Packet Pack) { - Action<IClientAPI, uint> handlerRegionHandShakeReply = OnRegionHandShakeReply; + Action<IClientAPI> handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply == null) return true; // silence the warning @@ -8936,7 +8936,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP else m_viewerHandShakeFlags = 0; - handlerRegionHandShakeReply(this, m_viewerHandShakeFlags); + handlerRegionHandShakeReply(this); return true; } @@ -15364,15 +15364,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP return new HashSet<string>(m_inPacketsToDrop); } - public void CheckViewerCaps() + public uint GetViewerCaps() { m_SupportObjectAnimations = false; + uint ret; + if(m_supportViewerCache) + ret = m_viewerHandShakeFlags; + else + ret = m_viewerHandShakeFlags & 4; + if (m_scene.CapsModule != null) { Caps cap = m_scene.CapsModule.GetCapsForUser(CircuitCode); - if (cap != null && (cap.Flags & Caps.CapsFlags.ObjectAnim) != 0) - m_SupportObjectAnimations = true; + if(cap != null) + { + if((cap.Flags & Caps.CapsFlags.SentSeeds) != 0) + ret |= 0x1000; + if ((cap.Flags & Caps.CapsFlags.ObjectAnim) != 0) + { + m_SupportObjectAnimations = true; + ret |= 0x2000; + } + } } + return ret; // ??? } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b105d52..6746573 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1698,7 +1698,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // Now we know we can handle more data - Thread.Sleep(200); + //Thread.Sleep(200); // Obtain the pending queue and remove it from the cache Queue<UDPPacketBuffer> queue = null; @@ -1727,7 +1727,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if(aCircuit.teleportFlags <= 0) client.SendRegionHandshake(); - client.CheckViewerCaps(); } } else @@ -1743,8 +1742,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // m_log.DebugFormat( - // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", - // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); + // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", + // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); } catch (Exception e) @@ -1758,117 +1757,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP e.StackTrace); } } -/* - protected void HandleCompleteMovementIntoRegion(object o) - { - IPEndPoint endPoint = null; - IClientAPI client = null; - - try - { - object[] array = (object[])o; - endPoint = (IPEndPoint)array[0]; - CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1]; - - m_log.DebugFormat( - "[LLUDPSERVER]: Handling CompleteAgentMovement request from {0} in {1}", endPoint, Scene.Name); - - // Determine which agent this packet came from - // We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination - // simulator with no existing child presence, the viewer (at least LL 3.3.4) will send UseCircuitCode - // and then CompleteAgentMovement immediately without waiting for an ack. As we are now handling these - // packets asynchronously, we need to account for this thread proceeding more quickly than the - // UseCircuitCode thread. - int count = 40; - while (count-- > 0) - { - if (Scene.TryGetClient(endPoint, out client)) - { - if (!client.IsActive) - { - // This check exists to catch a condition where the client has been closed by another thread - // but has not yet been removed from the client manager (and possibly a new connection has - // not yet been established). - m_log.DebugFormat( - "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active yet. Waiting.", - endPoint, client.Name, Scene.Name); - } - else if (client.SceneAgent == null) - { - // This check exists to catch a condition where the new client has been added to the client - // manager but the SceneAgent has not yet been set in Scene.AddNewAgent(). If we are too - // eager, then the new ScenePresence may not have registered a listener for this messsage - // before we try to process it. - // XXX: A better long term fix may be to add the SceneAgent before the client is added to - // the client manager - m_log.DebugFormat( - "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client SceneAgent not set yet. Waiting.", - endPoint, client.Name, Scene.Name); - } - else - { - break; - } - } - else - { - m_log.DebugFormat( - "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} in {1} but no client exists yet. Waiting.", - endPoint, Scene.Name); - } - - Thread.Sleep(200); - } - - if (client == null) - { - m_log.DebugFormat( - "[LLUDPSERVER]: No client found for CompleteAgentMovement from {0} in {1} after wait. Dropping.", - endPoint, Scene.Name); - - return; - } - else if (!client.IsActive || client.SceneAgent == null) - { - // This check exists to catch a condition where the client has been closed by another thread - // but has not yet been removed from the client manager. - // The packet could be simply ignored but it is useful to know if this condition occurred for other debugging - // purposes. - m_log.DebugFormat( - "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active after wait. Dropping.", - endPoint, client.Name, Scene.Name); - - return; - } - - IncomingPacket incomingPacket1; - - // Inbox insertion - if (UsePools) - { - incomingPacket1 = m_incomingPacketPool.GetObject(); - incomingPacket1.Client = (LLClientView)client; - incomingPacket1.Packet = packet; - } - else - { - incomingPacket1 = new IncomingPacket((LLClientView)client, packet); - } - - packetInbox.Enqueue(incomingPacket1); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[LLUDPSERVER]: CompleteAgentMovement handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", - endPoint != null ? endPoint.ToString() : "n/a", - client != null ? client.Name : "unknown", - client != null ? client.AgentId.ToString() : "unknown", - e.Message, - e.StackTrace); - } - } -*/ /// <summary> /// Send an ack immediately to the given endpoint. @@ -1936,7 +1824,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (Scene.TryGetClient(agentID, out client)) { - if (client.SceneAgent != null) + if (client.SceneAgent != null && + client.CircuitCode == circuitCode && + client.SessionId == sessionID && + client.RemoteEndPoint == remoteEndPoint && + client.SceneAgent.ControllingClient.SecureSessionId == sessionInfo.LoginInfo.SecureSession) return client; Scene.CloseAgent(agentID, true); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 26500ab..094b0f5 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -1841,7 +1841,7 @@ namespace OpenSim.Region.CoreModules.World.Land UUID lgid = LandData.GlobalID; m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) { - if(sp.IsNPC || sp.IsLoggingIn || sp.IsDeleted || sp.currentParcelUUID != lgid) + if(sp.IsNPC || sp.IsDeleted || sp.currentParcelUUID != lgid) return; cur += (now - sp.ParcelDwellTickMS); sp.ParcelDwellTickMS = now; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a95036c..123b605 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -99,6 +99,8 @@ namespace OpenSim.Region.Framework.Scenes public bool IsViewerUIGod { get; set; } public bool IsGod { get; set; } + private bool m_gotRegionHandShake = false; + private PresenceType m_presenceType; public PresenceType PresenceType { @@ -288,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_lastRotation; private Vector3 m_lastVelocity; private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); - private bool SentInitialData = false; + private bool NeedInitialData = false; private int m_userFlags; public int UserFlags @@ -881,7 +883,6 @@ namespace OpenSim.Region.Framework.Scenes } public bool IsChildAgent { get; set; } - public bool IsLoggingIn { get; set; } /// <summary> /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero. @@ -1074,7 +1075,6 @@ namespace OpenSim.Region.Framework.Scenes AttachmentsSyncLock = new Object(); AllowMovement = true; IsChildAgent = true; - IsLoggingIn = false; m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); @@ -1307,7 +1307,6 @@ namespace OpenSim.Region.Framework.Scenes ParentPart = null; PrevSitOffset = Vector3.Zero; HandleForceReleaseControls(ControllingClient, UUID); // needs testing - IsLoggingIn = false; } else { @@ -1331,10 +1330,6 @@ namespace OpenSim.Region.Framework.Scenes } ParentUUID = UUID.Zero; } - else - { - IsLoggingIn = false; - } IsChildAgent = false; } @@ -2163,7 +2158,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // recheck to reduce timing issues - ControllingClient.CheckViewerCaps(); + ControllingClient.GetViewerCaps(); bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; @@ -2325,9 +2320,40 @@ namespace OpenSim.Region.Framework.Scenes } } } - if(!IsNPC) + //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!IsNPC) { - //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!string.IsNullOrEmpty(m_callbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", + client.Name, client.AgentId, m_callbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + else if (!string.IsNullOrEmpty(m_newCallbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", + client.Name, client.AgentId, m_newCallbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); + m_newCallbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + if (openChildAgents) { // Create child agents in neighbouring regions @@ -2360,36 +2386,6 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - if (!string.IsNullOrEmpty(m_callbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", - client.Name, client.AgentId, m_callbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } - else if (!string.IsNullOrEmpty(m_newCallbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_newCallbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); - m_newCallbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } if (openChildAgents) { @@ -3850,15 +3846,21 @@ namespace OpenSim.Region.Framework.Scenes public override void Update() { - if(IsChildAgent || IsDeleted) + if (IsDeleted) return; - CheckForBorderCrossing(); + if (NeedInitialData) + { + SendInitialData(); + return; + } - if (IsInTransit || IsLoggingIn) + if (IsChildAgent || IsInTransit) return; - if(m_movingToTarget) + CheckForBorderCrossing(); + + if (m_movingToTarget) { m_delayedStop = -1; Vector3 control = Vector3.Zero; @@ -4033,25 +4035,28 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } - public void RegionHandShakeReply (IClientAPI client, uint flags) + public void RegionHandShakeReply (IClientAPI client) { if(IsNPC) return; lock (m_completeMovementLock) { - if (SentInitialData) + if(m_gotRegionHandShake) return; - SentInitialData = true; + NeedInitialData = true; } + } + + private void SendInitialData() + { + uint flags = ControllingClient.GetViewerCaps(); + if((flags & 0x1000) == 0) // wait for seeds sending + return; + + NeedInitialData = false; bool selfappearance = (flags & 4) != 0; - bool cacheCulling = (flags & 1) != 0; - bool cacheEmpty; - if(cacheCulling) - cacheEmpty = (flags & 2) != 0; - else - cacheEmpty = true; Util.FireAndForget(delegate { @@ -4066,9 +4071,6 @@ namespace OpenSim.Region.Framework.Scenes SendOtherAgentsAvatarFullToMe(); } - // recheck to reduce timing issues - ControllingClient.CheckViewerCaps(); - if (m_scene.ObjectsCullingByDistance) { m_reprioritizationBusy = true; @@ -4081,6 +4083,13 @@ namespace OpenSim.Region.Framework.Scenes return; } + bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty; + if (cacheCulling) + cacheEmpty = (flags & 2) != 0; + else + cacheEmpty = true; + EntityBase[] entities = Scene.Entities.GetEntities(); if(cacheEmpty) { @@ -6816,7 +6825,8 @@ namespace OpenSim.Region.Framework.Scenes lock (m_completeMovementLock) { GodController.HasMovedAway(); - SentInitialData = false; + NeedInitialData = false; + m_gotRegionHandShake = false; } List<ScenePresence> allpresences = m_scene.GetScenePresences(); diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 80baf82..9f85185 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -699,7 +699,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event TeleportCancel OnTeleportCancel; public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; - public event Action<IClientAPI, uint> OnRegionHandShakeReply; + public event Action<IClientAPI> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action<IClientAPI, bool> OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; @@ -938,12 +938,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server if (OnRegionHandShakeReply != null) { - OnRegionHandShakeReply(this, 0); + OnRegionHandShakeReply(this); } if (OnCompleteMovementToRegion != null) { - OnCompleteMovementToRegion(this, true); + OnCompleteMovementToRegion(this, false); } } @@ -1773,7 +1773,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server return 0; } - public void CheckViewerCaps() { } + public uint GetViewerCaps() + { + return 0; + } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index a7ed7d1..954d336 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -319,7 +319,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; - public event Action<IClientAPI, uint> OnRegionHandShakeReply; + public event Action<IClientAPI> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action<IClientAPI, bool> OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; @@ -928,7 +928,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { if (OnRegionHandShakeReply != null) { - OnRegionHandShakeReply(this, 0); + OnRegionHandShakeReply(this); } } @@ -1384,7 +1384,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC return 0; } - public void CheckViewerCaps() { } + public uint GetViewerCaps() + { + return 0; + } } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 4fe2684..0af49f2 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -119,7 +119,7 @@ namespace OpenSim.Tests.Common public event DeRezObject OnDeRezObject; public event RezRestoreToWorld OnRezRestoreToWorld; - public event Action<IClientAPI, uint> OnRegionHandShakeReply; + public event Action<IClientAPI> OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action<IClientAPI, bool> OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; @@ -880,7 +880,7 @@ namespace OpenSim.Tests.Common { if (OnRegionHandShakeReply != null) { - OnRegionHandShakeReply(this, 0); + OnRegionHandShakeReply(this); } } @@ -1398,7 +1398,10 @@ namespace OpenSim.Tests.Common { } - public void CheckViewerCaps() { } + public uint GetViewerCaps() + { + return 0; + } } } -- cgit v1.1 From fa4716955eeab003cf7096b1736661c2fa676b94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Mar 2019 12:51:10 +0000 Subject: make 2 tests happy again --- OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs index 5457dc3..0e7be7d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs @@ -142,8 +142,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests // We must update the scenes in order to make the root new root agents trigger position updates in their // children. - sceneWest.Update(1); - sceneEast.Update(1); + sceneWest.Update(3); + sceneEast.Update(3); // Check child positions are correct. Assert.AreEqual( @@ -233,8 +233,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests // We must update the scenes in order to make the root new root agents trigger position updates in their // children. - sceneNorth.Update(1); - sceneSouth.Update(1); + sceneNorth.Update(3); + sceneSouth.Update(3); // Check child positions are correct. Assert.AreEqual( -- cgit v1.1 From 98be9969912921b67e1fd831fb567d18ad84823b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Mar 2019 12:56:23 +0000 Subject: missing file --- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 0af49f2..0031127 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -1400,7 +1400,7 @@ namespace OpenSim.Tests.Common public uint GetViewerCaps() { - return 0; + return 0x1000; } } -- cgit v1.1 From 4626f0850a6a8d65105d63dcf90a87b1d696f004 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 02:12:30 +0100 Subject: fix osSet/GetPrimitiveParams threat level --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index dabd399..7348499 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3780,7 +3780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) { - CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); + CheckThreatLevel(); InitLSL(); return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); @@ -3788,7 +3788,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) { - CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams"); + CheckThreatLevel(); InitLSL(); m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams"); -- cgit v1.1 From 89ac80189c16da5320518467b725405b8ecbd16f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 05:34:35 +0100 Subject: do clear MOAP on remove --- .../CoreModules/World/Media/Moap/MoapModule.cs | 41 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index f5aa40a..66a7df1 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -219,9 +219,13 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap lock (media) me = media[face]; - // TODO: Really need a proper copy constructor down in libopenmetaverse if (me != null) - me = MediaEntry.FromOSD(me.GetOSD()); + { + Primitive.TextureEntry te = part.Shape.Textures; + Primitive.TextureEntryFace teFace = te.GetFace((uint)face); + if (teFace != null && teFace.MediaFlags) + me = MediaEntry.FromOSD(me.GetOSD()); + } } // m_log.DebugFormat("[MOAP]: GetMediaEntry for {0} face {1} found {2}", part.Name, face, me); @@ -336,15 +340,40 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap return string.Empty; } - if (null == part.Shape.Media) + if (part.Shape.Media == null) return string.Empty; - ObjectMediaResponse resp = new ObjectMediaResponse(); + MediaEntry[] currentML = part.Shape.Media.ToArray(); + + int nentries = currentML.Length; + int nsides = part.GetNumberOfSides(); + if(nentries > nsides) + nentries = nsides; + Primitive.TextureEntry te = part.Shape.Textures; + bool isnull = true; + + for(int face = 0; face < nentries; ++face) + { + Primitive.TextureEntryFace teFace = te.GetFace((uint)face); + if(!teFace.MediaFlags) + currentML[face] = null; + else + isnull = false; + } + + if(isnull) + { + //remove the damm thing + part.Shape.Media = null; + part.MediaUrl = null; + return string.Empty; + } + + ObjectMediaResponse resp = new ObjectMediaResponse(); resp.PrimID = primId; - lock (part.Shape.Media) - resp.FaceMedia = part.Shape.Media.ToArray(); + resp.FaceMedia = currentML; resp.Version = part.MediaUrl; -- cgit v1.1 From 3a6d87da9519e0c3be3e6711d02301f72196bba7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 19:28:06 +0100 Subject: a few more changes on initial data sending --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 138 +++++++---------------- 1 file changed, 40 insertions(+), 98 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 123b605..2f26320 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2130,11 +2130,12 @@ namespace OpenSim.Region.Framework.Scenes { return; // how? } + //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if (!IsNPC) { - if (!haveGroupInformation && !IsNPC) + if (!haveGroupInformation) { IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); if (gm != null) @@ -2150,53 +2151,45 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); } - } - // Tell the client that we're totally ready - ControllingClient.SendRegionHandshake(); - ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); - //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // recheck to reduce timing issues - ControllingClient.GetViewerCaps(); + if (m_teleportFlags > 0) + gotCrossUpdate = false; // sanity check - bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; + if (!gotCrossUpdate) + RotateToLookAt(look); - int delayctnr = Util.EnvironmentTickCount(); + m_previusParcelHide = false; + m_previusParcelUUID = UUID.Zero; + m_currentParcelHide = false; + m_currentParcelUUID = UUID.Zero; + ParcelDwellTickMS = Util.GetTimeStampMS(); - if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) - { - ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); - } + m_inTransit = false; - // verify baked textures and cache - bool cachedbaked = false; + // Tell the client that we're ready to send rest + ControllingClient.SendRegionHandshake(); - if (IsNPC) - cachedbaked = true; - else + ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); + + bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; + + if(!IsNPC) { - if (m_scene.AvatarFactory != null && !isHGTP) - cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); + if( ParentPart != null && (crossingFlags & 0x08) != 0) + { + ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); + } - // not sure we need this - if (!cachedbaked) + // verify baked textures and cache + if (m_scene.AvatarFactory != null && !isHGTP) { - if (m_scene.AvatarFactory != null) + if (!m_scene.AvatarFactory.ValidateBakedTextureCache(this)) m_scene.AvatarFactory.QueueAppearanceSave(UUID); } } - //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - if(m_teleportFlags > 0) - { - gotCrossUpdate = false; // sanity check - if(Util.EnvironmentTickCountSubtract(delayctnr)< 500) - Thread.Sleep(500); // let viewers catch us - } - if(!gotCrossUpdate) - RotateToLookAt(look); + //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // HG if(isHGTP) @@ -2205,16 +2198,10 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement] HG"); } - m_previusParcelHide = false; - m_previusParcelUUID = UUID.Zero; - m_currentParcelHide = false; - m_currentParcelUUID = UUID.Zero; - ParcelDwellTickMS = Util.GetTimeStampMS(); - - if(!IsNPC) + if (!IsNPC) { GodController.SyncViewerState(); - + // start sending terrain patchs if (!gotCrossUpdate) Scene.SendLayerData(ControllingClient); @@ -2229,11 +2216,11 @@ namespace OpenSim.Region.Framework.Scenes // send avatar object to all presences including us, so they cross it into region // then hide if necessary - SendInitialAvatarDataToAllAgents(allpresences); // send this look - SendAppearanceToAgent(this); + if (!IsNPC) + SendAppearanceToAgent(this); // send this animations @@ -2246,13 +2233,9 @@ namespace OpenSim.Region.Framework.Scenes bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); - if (haveAnims) + if (!IsNPC && haveAnims) SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); - // we should be able to receive updates, etc - // so release them - m_inTransit = false; - // send look and animations to others // if not cached we send greys // uncomented if will wait till avatar does baking @@ -2272,33 +2255,16 @@ namespace OpenSim.Region.Framework.Scenes } } // greys if - //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // attachments if (IsNPC || IsRealLogin(m_teleportFlags)) { if (Scene.AttachmentsModule != null) - // Util.FireAndForget( - // o => - // { - - if (!IsNPC) - Scene.AttachmentsModule.RezAttachments(this); - else - Util.FireAndForget(x => - { - Scene.AttachmentsModule.RezAttachments(this); - }); - - // }); + Scene.AttachmentsModule.RezAttachments(this); } else { if (m_attachments.Count > 0) { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); - foreach (SceneObjectGroup sog in m_attachments) { sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); @@ -2320,7 +2286,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!IsNPC) { if (!string.IsNullOrEmpty(m_callbackURI)) @@ -2371,8 +2337,6 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them - //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // send the rest of the world if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); @@ -2384,9 +2348,6 @@ namespace OpenSim.Region.Framework.Scenes // m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it // m_reprioritizationBusy = false; - //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - if (openChildAgents) { IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); @@ -3718,10 +3679,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsChildAgent) return; -// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. sitAnimation = "SIT_GROUND_CONSTRAINED"; -// Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); -// TriggerScenePresenceUpdated(); SitGround = true; RemoveFromPhysicalScene(); @@ -3822,14 +3780,6 @@ namespace OpenSim.Region.Framework.Scenes direc.Z = 0; } - // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); -/* - lock(m_forceToApplyLock) - { - m_forceToApply = direc; - m_forceToApplyValid = true; - } -*/ TargetVelocity = direc; Animator.UpdateMovementAnimations(); } @@ -4054,7 +4004,12 @@ namespace OpenSim.Region.Framework.Scenes if((flags & 0x1000) == 0) // wait for seeds sending return; - NeedInitialData = false; + lock (m_completeMovementLock) + { + if(!NeedInitialData) + return; + NeedInitialData = false; + } bool selfappearance = (flags & 4) != 0; @@ -4327,19 +4282,6 @@ namespace OpenSim.Region.Framework.Scenes if(IsDeleted || !ControllingClient.IsActive) return; -/* - bool needsendinitial = false; - lock(m_completeMovementLock) - { - needsendinitial = SentInitialData; - } - - if(needsendinitial) - { - SendInitialDataToMe(); - return; - } -*/ if(m_reprioritizationBusy) return; -- cgit v1.1 From 9650cb87083ed40a55f5fc54c129e9ec18c93f46 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 20:31:35 +0100 Subject: remove a potencially dang. lock --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2f26320..0687da4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4004,7 +4004,7 @@ namespace OpenSim.Region.Framework.Scenes if((flags & 0x1000) == 0) // wait for seeds sending return; - lock (m_completeMovementLock) +// lock (m_completeMovementLock) { if(!NeedInitialData) return; -- cgit v1.1 From 939aff5c3ba6b667c22f371ec8250cd8ac9f8271 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 20:43:32 +0100 Subject: oops RegionHandShakeReply is not reentrant --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0687da4..cd630b8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3994,6 +3994,7 @@ namespace OpenSim.Region.Framework.Scenes { if(m_gotRegionHandShake) return; + m_gotRegionHandShake = true; NeedInitialData = true; } } -- cgit v1.1 From 190e2da672704068a0b9c1b4ea48e2b92ba9fdca Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 22:50:14 +0100 Subject: Yengine attachment drop, do set attachment ready event --- OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index 3743b7e..d237d2c 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -938,6 +938,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine { m_Suspended = false; m_DetachQuantum = 0; + m_DetachReady.Set(); if ((m_EventQueue != null) && (m_EventQueue.First != null) && (m_IState == XMRInstState.IDLE)) -- cgit v1.1 From 7110e988155943168c5cf55281f4c57961d1be9a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 23:31:18 +0100 Subject: rez npcs attachments async again --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd630b8..5faa764 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2259,7 +2259,17 @@ namespace OpenSim.Region.Framework.Scenes if (IsNPC || IsRealLogin(m_teleportFlags)) { if (Scene.AttachmentsModule != null) - Scene.AttachmentsModule.RezAttachments(this); + { + if(IsNPC) + { + Util.FireAndForget(x => + { + Scene.AttachmentsModule.RezAttachments(this); + }); + } + else + Scene.AttachmentsModule.RezAttachments(this); + } } else { -- cgit v1.1 From 772aa5234a144486d1b2dd1a70fd403cacb9b767 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 01:48:23 +0100 Subject: Yengine: clear events queue on reset. Also keep clearing all on state change. (Linked message events are deleted at sl) --- OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs index 7fc97e9..7ef1b9f 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs @@ -218,7 +218,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine // do not do llResetScript on entry if(eventCode == ScriptEventCode.state_entry && stateCode == 0) return; - ClearQueueExceptLinkMessages(); + // do clear the events queue on reset + ClearQueue(); + //ClearQueueExceptLinkMessages(); throw new ScriptResetException(); } @@ -583,6 +585,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine * Tell outer layers to cancel any event triggers, like llListen(), * then tell outer layers which events the new state has handlers for. * We also clear the event queue as per http://wiki.secondlife.com/wiki/State + * old scripts may want linked messages, but that is not as SL does now */ public override void StateChange() { @@ -595,7 +598,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine // Tell whoever cares which event handlers the new state has. m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(stateCode)); - // Clear out any old events from the queue. + // keep link messages + //ClearQueueExceptLinkMessages(); + // or Clear out all old events from the queue. lock(m_QueueLock) { m_EventQueue.Clear(); -- cgit v1.1 From 3327bed34b8edd37e293493da39d4f515850d92d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 12:46:03 +0100 Subject: fix tp set callback log message --- .../Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 09b0dd6..831c359 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1283,7 +1283,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Set release callback URL to {0} in {1}", - agent.CallbackURI, region.RegionName); + agent.NewCallbackURI, region.RegionName); } /// <summary> -- cgit v1.1 From 5dc7623e388827184e90220eceecdfd076d546a1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 13:18:40 +0100 Subject: change avatar arrival at hg destination handling --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 831c359..01b4f10 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1190,12 +1190,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Thread.Sleep(250); if(sp.IsDeleted) return; + if(!sp.IsInTransit) + break; } while (--count > 0); if (!sp.IsDeleted) { m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport timeout", sp.Name, Scene.Name); + "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport {2}", sp.Name, Scene.Name, sp.IsInTransit?"timeout":""); sp.Scene.CloseAgent(sp.UUID, false); } return; @@ -2460,7 +2462,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if(sp == null || sp.IsDeleted || !sp.IsInTransit) return; - Scene.CloseAgent(sp.UUID, false); + //Scene.CloseAgent(sp.UUID, false); + sp.IsInTransit = false; m_entityTransferStateMachine.ResetFromTransit(id); // this needs cleanup //m_entityTransferStateMachine.SetAgentArrivedAtDestination(id); } -- cgit v1.1 From 3b63699b9d9f26248af8e27b3ea183903bdeaa67 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 13:55:54 +0100 Subject: still issues on fast hg tps --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 01b4f10..fb2fd07 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1163,7 +1163,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } - m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); + //shut this up for now + m_entityTransferStateMachine.ResetFromTransit(sp.UUID); + + //m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); sp.HasMovedAway(!(OutSideViewRange || logout)); @@ -1181,6 +1184,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.CloseChildAgents(childRegionsToClose); } + // if far jump we do need to close anyways if (NeedsClosing(reg, OutSideViewRange)) { @@ -1194,6 +1198,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer break; } while (--count > 0); + if (!sp.IsDeleted) { m_log.DebugFormat( @@ -2464,7 +2469,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer //Scene.CloseAgent(sp.UUID, false); sp.IsInTransit = false; - m_entityTransferStateMachine.ResetFromTransit(id); // this needs cleanup //m_entityTransferStateMachine.SetAgentArrivedAtDestination(id); } -- cgit v1.1 From 7f55db72d2c2be3d0e3396dc8a4ba8ca1f504fd3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 13:58:41 +0100 Subject: Yengine: try fix changing scripts running state if the have long events --- OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs | 27 +++++++++- OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs | 27 +++++++++- OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs | 57 +++++++++++++++------- .../Region/ScriptEngine/YEngine/XMRScriptThread.cs | 8 ++- 4 files changed, 96 insertions(+), 23 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs index 6acc293..e1f8c4c 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs @@ -1535,15 +1535,38 @@ namespace OpenSim.Region.ScriptEngine.Yengine */ public void QueueToStart(XMRInstance inst) { - if(inst.m_IState != XMRInstState.ONSTARTQ) + if (inst.m_IState != XMRInstState.ONSTARTQ) throw new Exception("bad state"); - lock(m_StartQueue) + lock (m_StartQueue) m_StartQueue.InsertTail(inst); WakeUpOne(); } + public void QueueToYield(XMRInstance inst) + { + if (inst.m_IState != XMRInstState.ONYIELDQ) + throw new Exception("bad state"); + + lock (m_YieldQueue) + m_YieldQueue.InsertTail(inst); + + WakeUpOne(); + } + + public void RemoveFromSleep(XMRInstance inst) + { + lock (m_SleepQueue) + { + if (inst.m_IState != XMRInstState.ONSLEEPQ) + return; + + m_SleepQueue.Remove(inst); + inst.m_IState = XMRInstState.REMDFROMSLPQ; + } + } + /** * @brief A script may be sleeping, in which case we wake it. */ diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs index 12feb7b..ff8dae5 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs @@ -363,8 +363,33 @@ namespace OpenSim.Region.ScriptEngine.Yengine lock(m_QueueLock) { m_Running = value; - if(!value) + if(value) { + if (m_IState == XMRInstState.SUSPENDED && m_SuspendCount == 0) + { + if(eventCode != ScriptEventCode.None) + { + m_IState = XMRInstState.ONYIELDQ; + m_Engine.QueueToYield(this); + } + else if ((m_EventQueue != null) && (m_EventQueue.First != null)) + { + m_IState = XMRInstState.ONSTARTQ; + m_Engine.QueueToStart(this); + } + else + m_IState = XMRInstState.IDLE; + } + else if(m_SuspendCount != 0) + m_IState = XMRInstState.IDLE; + } + else + { + if(m_IState == XMRInstState.ONSLEEPQ) + { + m_Engine.RemoveFromSleep(this); + m_IState = XMRInstState.SUSPENDED; + } EmptyEventQueues(); } } diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index d237d2c..4f94c23 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -80,10 +80,21 @@ namespace OpenSim.Region.ScriptEngine.Yengine !m_HaveEventHandlers[(int)evc]) // don't bother if we don't have such a handler in any state return; - // Not running means we ignore any incoming events. - // But queue if still constructing because m_Running is not yet valid. + // Not running means we ignore any incoming events. + // But queue if still constructing because m_Running is not yet valid. + if(!m_Running && !construct) + { + if(m_IState == XMRInstState.SUSPENDED) + { + if(evc == ScriptEventCode.state_entry && m_EventQueue.Count == 0) + { + LinkedListNode<EventParams> llns = new LinkedListNode<EventParams>(evt); + m_EventQueue.AddFirst(llns); + } + } return; + } if(m_minEventDelay != 0) { @@ -250,13 +261,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine return XMRInstState.SUSPENDED; } - // Make sure we aren't being migrated in or out and prevent that - // whilst we are in here. If migration has it locked, don't call - // back right away, delay a bit so we don't get in infinite loop. + // Make sure we aren't being migrated in or out and prevent that + // whilst we are in here. If migration has it locked, don't call + // back right away, delay a bit so we don't get in infinite loop. m_RunOnePhase = "lock m_RunLock"; if(!Monitor.TryEnter(m_RunLock)) { - m_SleepUntil = now.AddMilliseconds(3); + m_SleepUntil = now.AddMilliseconds(15); m_RunOnePhase = "return was locked"; return XMRInstState.ONSLEEPQ; } @@ -273,6 +284,12 @@ namespace OpenSim.Region.ScriptEngine.Yengine return XMRInstState.DISPOSED; } + if(!m_Running) + { + m_RunOnePhase = "return is not running"; + return XMRInstState.SUSPENDED; + } + // Do some more of the last event if it didn't finish. if(this.eventCode != ScriptEventCode.None) { @@ -325,10 +342,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine if(m_EventQueue.First != null) { evt = m_EventQueue.First.Value; - if(m_DetachQuantum > 0) + evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), evt.EventName); + if (m_DetachQuantum > 0) { - evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), - evt.EventName); if(evc != ScriptEventCode.attach) { // This is the case where the attach event @@ -343,8 +359,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine } } m_EventQueue.RemoveFirst(); - evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), - evt.EventName); if((int)evc >= 0) m_EventCounts[(int)evc]--; } @@ -730,11 +744,14 @@ namespace OpenSim.Region.ScriptEngine.Yengine case XMRInstState.DISPOSED: return; - // Some other thread is already resetting it, let it finish. + // Some other thread is already resetting it, let it finish. case XMRInstState.RESETTING: return; + case XMRInstState.SUSPENDED: + break; + default: throw new Exception("bad state"); } @@ -744,17 +761,21 @@ namespace OpenSim.Region.ScriptEngine.Yengine { CheckRunLockInvariants(true); - // No other thread should have transitioned it from RESETTING. - if(m_IState != XMRInstState.RESETTING) - throw new Exception("bad state"); + // No other thread should have transitioned it from RESETTING. + if (m_IState != XMRInstState.SUSPENDED) + { + if (m_IState != XMRInstState.RESETTING) + throw new Exception("bad state"); - // Mark it idle now so it can get queued to process new stuff. - m_IState = XMRInstState.IDLE; + m_IState = XMRInstState.IDLE; + } - // Reset everything and queue up default's start_entry() event. + // Reset everything and queue up default's start_entry() event. ClearQueue(); ResetLocked("external Reset"); + // Mark it idle now so it can get queued to process new stuff. + CheckRunLockInvariants(true); } } diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs index 08c7e80..f68fd51 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs @@ -166,7 +166,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine if(inst == null) break; - if(inst.m_IState != XMRInstState.ONSTARTQ) + if (inst.m_IState == XMRInstState.SUSPENDED) + continue; + if (inst.m_IState != XMRInstState.ONSTARTQ) throw new Exception("bad state"); RunInstance(inst, tid); if(m_SuspendScriptThreadFlag || m_Exiting) @@ -187,7 +189,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine if(inst != null) { - if(inst.m_IState != XMRInstState.ONYIELDQ) + if (inst.m_IState == XMRInstState.SUSPENDED) + continue; + if (inst.m_IState != XMRInstState.ONYIELDQ) throw new Exception("bad state"); RunInstance(inst, tid); continue; -- cgit v1.1 From 2739b2f5cc633cb9d292b037a03c160be749777e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 18:12:17 +0100 Subject: mantis 8509: replace mesh gzip decompress --- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 8844a0f..adc8298 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -40,7 +40,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Framework.Capabilities; -using ComponentAce.Compression.Libs.zlib; +using System.IO.Compression; using OSDArray = OpenMetaverse.StructuredData.OSDArray; using OSDMap = OpenMetaverse.StructuredData.OSDMap; @@ -571,15 +571,15 @@ namespace OpenSim.Region.ClientStack.Linden { using (MemoryStream outMs = new MemoryStream()) { - using (ZOutputStream zOut = new ZOutputStream(outMs)) + using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) { - byte[] readBuffer = new byte[4096]; + byte[] readBuffer = new byte[2048]; + inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header int readLen = 0; - while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0) - { - zOut.Write(readBuffer, 0, readLen); - } - zOut.Flush(); + + while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) + outMs.Write(readBuffer, 0, readLen); + outMs.Seek(0, SeekOrigin.Begin); byte[] decompressedBuf = outMs.GetBuffer(); @@ -638,15 +638,15 @@ namespace OpenSim.Region.ClientStack.Linden { using (MemoryStream outMs = new MemoryStream()) { - using (ZOutputStream zOut = new ZOutputStream(outMs)) + using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) { - byte[] readBuffer = new byte[4096]; + byte[] readBuffer = new byte[2048]; + inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header int readLen = 0; - while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0) - { - zOut.Write(readBuffer, 0, readLen); - } - zOut.Flush(); + + while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) + outMs.Write(readBuffer, 0, readLen); + outMs.Seek(0, SeekOrigin.Begin); byte[] decompressedBuf = outMs.GetBuffer(); -- cgit v1.1 From ba66d2d3c125136171dc9fec34bb9d424a6a731d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 10:13:26 +0100 Subject: minor cleanup on mesh decompress code --- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 28 +++++++--------------- .../Meshing/Meshmerizer/Meshmerizer.cs | 16 ++++--------- .../PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 17 ++++--------- 3 files changed, 19 insertions(+), 42 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index adc8298..cf5f0ef 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -563,13 +563,11 @@ namespace OpenSim.Region.ClientStack.Linden nsides = 0; OSD decodedMeshOsd = new OSD(); - byte[] meshBytes = new byte[size]; - System.Buffer.BlockCopy(data, offset, meshBytes, 0, size); try { - using (MemoryStream inMs = new MemoryStream(meshBytes)) + using (MemoryStream outMs = new MemoryStream()) { - using (MemoryStream outMs = new MemoryStream()) + using (MemoryStream inMs = new MemoryStream(data, offset, size)) { using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) { @@ -579,13 +577,10 @@ namespace OpenSim.Region.ClientStack.Linden while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) outMs.Write(readBuffer, 0, readLen); - - outMs.Seek(0, SeekOrigin.Begin); - - byte[] decompressedBuf = outMs.GetBuffer(); - decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); } } + outMs.Seek(0, SeekOrigin.Begin); + decodedMeshOsd = OSDParser.DeserializeLLSDBinary(outMs); } } catch @@ -630,29 +625,24 @@ namespace OpenSim.Region.ClientStack.Linden nhulls = 1; OSD decodedMeshOsd = new OSD(); - byte[] meshBytes = new byte[size]; - System.Buffer.BlockCopy(data, offset, meshBytes, 0, size); try { - using (MemoryStream inMs = new MemoryStream(meshBytes)) + using (MemoryStream outMs = new MemoryStream(4 * size)) { - using (MemoryStream outMs = new MemoryStream()) + using (MemoryStream inMs = new MemoryStream(data, offset, size)) { using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) { - byte[] readBuffer = new byte[2048]; + byte[] readBuffer = new byte[8192]; inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header int readLen = 0; while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) outMs.Write(readBuffer, 0, readLen); - - outMs.Seek(0, SeekOrigin.Begin); - - byte[] decompressedBuf = outMs.GetBuffer(); - decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); } } + outMs.Seek(0, SeekOrigin.Begin); + decodedMeshOsd = OSDParser.DeserializeLLSDBinary(outMs); } } catch diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs index 0d4b6b9..de39d0e 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs @@ -597,28 +597,22 @@ namespace OpenSim.Region.PhysicsModule.Meshing { OSD decodedOsd = null; - using (MemoryStream inMs = new MemoryStream(meshBytes)) + using (MemoryStream outMs = new MemoryStream()) { - using (MemoryStream outMs = new MemoryStream()) + using (MemoryStream inMs = new MemoryStream(meshBytes)) { using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) { - byte[] readBuffer = new byte[2048]; + byte[] readBuffer = new byte[8192]; inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header int readLen = 0; while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) outMs.Write(readBuffer, 0, readLen); - - outMs.Flush(); - - outMs.Seek(0, SeekOrigin.Begin); - - byte[] decompressedBuf = outMs.GetBuffer(); - - decodedOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); } } + outMs.Seek(0, SeekOrigin.Begin); + decodedOsd = OSDParser.DeserializeLLSDBinary(outMs); } return decodedOsd; } diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index 6950f2d..8449596 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs @@ -425,31 +425,24 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing return false; // no mesh data in asset OSD decodedMeshOsd = new OSD(); - byte[] meshBytes = new byte[physSize]; - System.Buffer.BlockCopy(primShape.SculptData, physOffset, meshBytes, 0, physSize); - try { - using (MemoryStream inMs = new MemoryStream(meshBytes)) + using (MemoryStream outMs = new MemoryStream(4 * physSize)) { - using (MemoryStream outMs = new MemoryStream()) + using (MemoryStream inMs = new MemoryStream(primShape.SculptData, physOffset, physSize)) { using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) { - byte[] readBuffer = new byte[2048]; + byte[] readBuffer = new byte[8192]; inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header int readLen = 0; while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) outMs.Write(readBuffer, 0, readLen); - - outMs.Seek(0, SeekOrigin.Begin); - - byte[] decompressedBuf = outMs.GetBuffer(); - - decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); } } + outMs.Seek(0, SeekOrigin.Begin); + decodedMeshOsd = OSDParser.DeserializeLLSDBinary(outMs); } } catch (Exception e) -- cgit v1.1 From 1984cbdbe5beaa26b46cb9e03ddf6cbcaf56815b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 13:49:25 +0100 Subject: add extra delay before sending initial data --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5faa764..8c46211 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -290,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_lastRotation; private Vector3 m_lastVelocity; private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); - private bool NeedInitialData = false; + private int NeedInitialData = -1; private int m_userFlags; public int UserFlags @@ -3809,7 +3809,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsDeleted) return; - if (NeedInitialData) + if (NeedInitialData > 0) { SendInitialData(); return; @@ -4005,7 +4005,7 @@ namespace OpenSim.Region.Framework.Scenes if(m_gotRegionHandShake) return; m_gotRegionHandShake = true; - NeedInitialData = true; + NeedInitialData = 1; } } @@ -4017,15 +4017,21 @@ namespace OpenSim.Region.Framework.Scenes // lock (m_completeMovementLock) { - if(!NeedInitialData) + if(NeedInitialData < 0) + return; + + // give some extra time to make sure viewers did process seeds + if(++NeedInitialData < 4) // needs fix if update rate changes on heartbeat return; - NeedInitialData = false; } + NeedInitialData = -1; + bool selfappearance = (flags & 4) != 0; Util.FireAndForget(delegate { + m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); if (m_teleportFlags <= 0) { Scene.SendLayerData(ControllingClient); @@ -6778,7 +6784,7 @@ namespace OpenSim.Region.Framework.Scenes lock (m_completeMovementLock) { GodController.HasMovedAway(); - NeedInitialData = false; + NeedInitialData = -1; m_gotRegionHandShake = false; } -- cgit v1.1 From 8152e47a4a3a460590825e9475599075c9e31e9d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 15:10:42 +0100 Subject: change the point where child regions are closed/opened --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 160 ++++++++++++----------- 1 file changed, 83 insertions(+), 77 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8c46211..12887fb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2168,6 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; // Tell the client that we're ready to send rest + m_gotRegionHandShake = false; // allow it ControllingClient.SendRegionHandshake(); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); @@ -2299,54 +2300,6 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { - if (!string.IsNullOrEmpty(m_callbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", - client.Name, client.AgentId, m_callbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } - else if (!string.IsNullOrEmpty(m_newCallbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_newCallbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); - m_newCallbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } - - if (openChildAgents) - { - // Create child agents in neighbouring regions - IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); - if (m_agentTransfer != null) - { - m_agentTransfer.EnableChildAgents(this); - } - } - - m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; - m_lastChildAgentUpdatePosition = AbsolutePosition; - m_lastChildAgentUpdateDrawDistance = DrawDistance; - - m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; - m_childUpdatesBusy = false; // allow them - // send the rest of the world if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); @@ -4029,8 +3982,61 @@ namespace OpenSim.Region.Framework.Scenes bool selfappearance = (flags & 4) != 0; + // this should enqueued on the client processing job to save threads Util.FireAndForget(delegate { + if(!IsChildAgent) + { + // close v1 sender region obsolete + if (!string.IsNullOrEmpty(m_callbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE({0})]: Releasing {1} {2} with old callback to {3}", + Scene.RegionInfo.RegionName, Name, UUID, m_callbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + NeedInitialData = 4; + return; + } + // v0.7 close HG sender region + if (!string.IsNullOrEmpty(m_newCallbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE({0})]: Releasing {1} {2} with callback to {3}", + Scene.RegionInfo.RegionName, Name, UUID, m_newCallbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); + m_newCallbackURI = null; + NeedInitialData = 4; + return; + } + + // Create child agents in neighbouring regions + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); + if (m_agentTransfer != null) + { + m_agentTransfer.EnableChildAgents(this); + } + + m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; + m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_childUpdatesBusy = false; // allow them + } + m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); if (m_teleportFlags <= 0) { @@ -4052,46 +4058,46 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.ReprioritizeUpdates(); m_reprioritizationLastTime = Util.EnvironmentTickCount(); m_reprioritizationBusy = false; - return; } - - bool cacheCulling = (flags & 1) != 0; - bool cacheEmpty; - if (cacheCulling) - cacheEmpty = (flags & 2) != 0; else - cacheEmpty = true; - - EntityBase[] entities = Scene.Entities.GetEntities(); - if(cacheEmpty) { - foreach (EntityBase e in entities) + bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty; + if (cacheCulling) + cacheEmpty = (flags & 2) != 0; + else + cacheEmpty = true; + + EntityBase[] entities = Scene.Entities.GetEntities(); + if(cacheEmpty) { - if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) - ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); + foreach (EntityBase e in entities) + { + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); + } } - } - else - { - foreach (EntityBase e in entities) + else { - if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + foreach (EntityBase e in entities) { - SceneObjectGroup grp = e as SceneObjectGroup; - if(grp.IsViewerCachable) - grp.SendUpdateProbes(ControllingClient); - else - grp.SendFullAnimUpdateToClient(ControllingClient); + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + { + SceneObjectGroup grp = e as SceneObjectGroup; + if(grp.IsViewerCachable) + grp.SendUpdateProbes(ControllingClient); + else + grp.SendFullAnimUpdateToClient(ControllingClient); + } } } - } - - m_reprioritizationLastPosition = AbsolutePosition; - m_reprioritizationLastDrawDistance = DrawDistance; - m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it - m_reprioritizationBusy = false; + m_reprioritizationLastPosition = AbsolutePosition; + m_reprioritizationLastDrawDistance = DrawDistance; + m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it + m_reprioritizationBusy = false; + } }); } -- cgit v1.1 From 433e529512b20aed91412e0f8c0f02f38d422035 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 15:58:36 +0100 Subject: make tests happy again; try to speedup crossings --- .../Avatar/Chat/Tests/ChatModuleTests.cs | 16 ++++++++--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 31 +++++++++++++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs index 0e7be7d..e63629e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs @@ -142,8 +142,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests // We must update the scenes in order to make the root new root agents trigger position updates in their // children. - sceneWest.Update(3); - sceneEast.Update(3); + sceneWest.Update(4); + sceneEast.Update(4); + sp1.DrawDistance += 64; + sp2.DrawDistance += 64; + sceneWest.Update(2); + sceneEast.Update(2); // Check child positions are correct. Assert.AreEqual( @@ -233,8 +237,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests // We must update the scenes in order to make the root new root agents trigger position updates in their // children. - sceneNorth.Update(3); - sceneSouth.Update(3); + sceneNorth.Update(4); + sceneSouth.Update(4); + sp1.DrawDistance += 64; + sp2.DrawDistance += 64; + sceneNorth.Update(2); + sceneSouth.Update(2); // Check child positions are correct. Assert.AreEqual( diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 12887fb..c71d20d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2168,8 +2168,11 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; // Tell the client that we're ready to send rest - m_gotRegionHandShake = false; // allow it - ControllingClient.SendRegionHandshake(); + if (!gotCrossUpdate) + { + m_gotRegionHandShake = false; // allow it if not a crossing + ControllingClient.SendRegionHandshake(); + } ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); @@ -2300,6 +2303,22 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { + if(gotCrossUpdate) + { + // Create child agents in neighbouring regions + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); + if (m_agentTransfer != null) + { + m_agentTransfer.EnableChildAgents(this); + } + + m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; + m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_childUpdatesBusy = false; // allow them + } // send the rest of the world if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); @@ -4001,8 +4020,8 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); m_callbackURI = null; - NeedInitialData = 4; - return; + //NeedInitialData = 4; + //return; } // v0.7 close HG sender region if (!string.IsNullOrEmpty(m_newCallbackURI)) @@ -4018,8 +4037,8 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); m_newCallbackURI = null; - NeedInitialData = 4; - return; + //NeedInitialData = 4; + //return; } // Create child agents in neighbouring regions -- cgit v1.1 From e7f0131509c33e0af55d361f476f2c270aedb152 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 17:05:47 +0100 Subject: another test.... --- .../Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs index abf8c48..7c3eab1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs @@ -155,11 +155,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests sp1SceneA.AbsolutePosition = so1StartPos; sp1SceneA.HandleAgentRequestSit(sp1SceneA.ControllingClient, sp1SceneA.UUID, so1.UUID, Vector3.Zero); + sceneA.Update(4); + sceneB.Update(4); // Cross sceneA.SceneGraph.UpdatePrimGroupPosition( so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient); // crossing is async + sceneA.Update(4); + sceneB.Update(4); Thread.Sleep(500); SceneObjectGroup so1PostCross; @@ -171,6 +175,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); sceneBTc.CompleteMovement(); + sceneA.Update(4); + sceneB.Update(4); + Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); @@ -188,6 +195,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests sceneB.SceneGraph.UpdatePrimGroupPosition( so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient); + sceneA.Update(4); + sceneB.Update(4); // crossing is async Thread.Sleep(500); -- cgit v1.1 From b458c5a9b4ffeff738d4e854bdf81e70427845fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 17:26:06 +0100 Subject: another test.... --- .../Scenes/Tests/ScenePresenceTeleportTests.cs | 41 ++++++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 94e6b99..676d7eb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -212,6 +212,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); sp.AbsolutePosition = new Vector3(30, 31, 32); + sceneA.Update(4); + sceneB.Update(4); + List<TestClient> destinationTestClients = new List<TestClient>(); EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( (TestClient)sp.ControllingClient, destinationTestClients); @@ -224,11 +227,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests (uint)TeleportFlags.ViaLocation); // Assert.That(sceneA.GetScenePresence(userId), Is.Null); + sceneA.Update(4); + sceneB.Update(4); ScenePresence sceneBSp = sceneB.GetScenePresence(userId); Assert.That(sceneBSp, Is.Not.Null); Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); - Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); + Assert.That(sceneBSp.AbsolutePosition.X, Is.EqualTo(teleportPosition.X)); + Assert.That(sceneBSp.AbsolutePosition.Y, Is.EqualTo(teleportPosition.Y)); //Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); //Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -239,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera // position instead). -// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); + // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); } /// <summary> @@ -310,7 +316,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sceneASp = sceneA.GetScenePresence(userId); Assert.That(sceneASp, Is.Not.Null); Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); - Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); + Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -369,6 +376,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); sp.AbsolutePosition = preTeleportPosition; + sceneA.Update(4); + sceneB.Update(4); + // Make sceneB refuse CreateAgent sceneB.LoginsEnabled = false; @@ -379,14 +389,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests teleportLookAt, (uint)TeleportFlags.ViaLocation); -// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); + // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); + + sceneA.Update(4); + sceneB.Update(4); Assert.That(sceneB.GetScenePresence(userId), Is.Null); ScenePresence sceneASp = sceneA.GetScenePresence(userId); Assert.That(sceneASp, Is.Not.Null); Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); - Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); + Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -458,6 +472,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); sp.AbsolutePosition = preTeleportPosition; + sceneA.Update(4); + sceneB.Update(4); + sceneA.RequestTeleportLocation( sp.ControllingClient, sceneB.RegionInfo.RegionHandle, @@ -468,13 +485,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate // communication with the destination region. But this is a very non-obvious way of doing it - really we // should be forced to expicitly set this up. + sceneA.Update(4); + sceneB.Update(4); Assert.That(sceneB.GetScenePresence(userId), Is.Null); ScenePresence sceneASp = sceneA.GetScenePresence(userId); Assert.That(sceneASp, Is.Not.Null); Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); - Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); + Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -614,6 +634,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); + sceneA.Update(4); + sceneB.Update(4); + Assert.That(beforeSceneASp, Is.Not.Null); Assert.That(beforeSceneASp.IsChildAgent, Is.False); @@ -638,6 +661,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests teleportLookAt, (uint)TeleportFlags.ViaLocation); + sceneA.Update(4); + sceneB.Update(4); + ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); Assert.That(afterSceneASp, Is.Not.Null); Assert.That(afterSceneASp.IsChildAgent, Is.True); @@ -646,7 +672,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(afterSceneBSp, Is.Not.Null); Assert.That(afterSceneBSp.IsChildAgent, Is.False); Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); - Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); + Assert.That(afterSceneBSp.AbsolutePosition.X, Is.EqualTo(teleportPosition.X)); + Assert.That(afterSceneBSp.AbsolutePosition.Y, Is.EqualTo(teleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); -- cgit v1.1 From 8e094887cd72fb878a5ac33bcb2fd95fcf771462 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 20:27:56 +0100 Subject: change avatars sending point --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c71d20d..2c20da6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2193,9 +2193,6 @@ namespace OpenSim.Region.Framework.Scenes } } - //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - // HG if(isHGTP) { // ControllingClient.SendNameReply(m_uuid, Firstname, Lastname); @@ -2244,6 +2241,7 @@ namespace OpenSim.Region.Framework.Scenes // if not cached we send greys // uncomented if will wait till avatar does baking //if (cachedbaked) + { foreach (ScenePresence p in allpresences) { @@ -2257,7 +2255,7 @@ namespace OpenSim.Region.Framework.Scenes if (haveAnims) SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); } - } // greys if + } // attachments if (IsNPC || IsRealLogin(m_teleportFlags)) @@ -2305,6 +2303,8 @@ namespace OpenSim.Region.Framework.Scenes { if(gotCrossUpdate) { + SendOtherAgentsAvatarFullToMe(); + // Create child agents in neighbouring regions IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); if (m_agentTransfer != null) @@ -2318,11 +2318,13 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them + } + // send the rest of the world - if (m_teleportFlags > 0 || m_currentParcelHide) + //if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); - SendOtherAgentsAvatarFullToMe(); + //SendOtherAgentsAvatarFullToMe(); // priority uses avatar position only // m_reprioritizationLastPosition = AbsolutePosition; @@ -4064,10 +4066,10 @@ namespace OpenSim.Region.Framework.Scenes ILandChannel landch = m_scene.LandChannel; if (landch != null) landch.sendClientInitialLandInfo(ControllingClient, true); - - SendOtherAgentsAvatarFullToMe(); } + SendOtherAgentsAvatarFullToMe(); + if (m_scene.ObjectsCullingByDistance) { m_reprioritizationBusy = true; -- cgit v1.1 From 15b6d8c1477e6a294819bf5c0c510d909997fb8f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 00:50:54 +0100 Subject: send agent view range to new child agents --- OpenSim/Framework/AgentCircuitData.cs | 6 ++++++ OpenSim/Framework/AgentCircuitManager.cs | 4 +++- OpenSim/Framework/IClientAPI.cs | 1 + OpenSim/Framework/Login.cs | 2 ++ OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +++ .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 3 ++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++++++- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 2 ++ OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 ++ OpenSim/Tests/Common/Mock/TestClient.cs | 2 ++ 10 files changed, 31 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 5a9eeb5..330a41e 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -173,6 +173,7 @@ namespace OpenSim.Framework /// Position the Agent's Avatar starts in the region /// </summary> public Vector3 startpos; + public float startfar = -1.0f; public Dictionary<string, object> ServiceURLs; @@ -219,6 +220,8 @@ namespace OpenSim.Framework args["channel"] = OSD.FromString(Channel); args["mac"] = OSD.FromString(Mac); args["id0"] = OSD.FromString(Id0); + if(startfar > 0) + args["far"] = OSD.FromReal(startfar); if (Appearance != null) { @@ -327,6 +330,9 @@ namespace OpenSim.Framework if (args["start_pos"] != null) Vector3.TryParse(args["start_pos"].AsString(), out startpos); + if(args["far"] != null) + startfar = (float)args["far"].AsReal(); + //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos); try diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs index b6e48b4..2cd11ff 100644 --- a/OpenSim/Framework/AgentCircuitManager.cs +++ b/OpenSim/Framework/AgentCircuitManager.cs @@ -79,6 +79,7 @@ namespace OpenSim.Framework user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; user.LoginInfo.BaseFolder = validcircuit.BaseFolder; user.LoginInfo.StartPos = validcircuit.startpos; + user.LoginInfo.StartFar = (float)validcircuit.startfar; } else { @@ -175,7 +176,8 @@ namespace OpenSim.Framework { m_agentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; m_agentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; - m_agentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; + m_agentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; + m_agentCircuits[(uint)agentData.circuitcode].startfar = agentData.startfar; // Updated for when we don't know them before calling Scene.NewUserConnection m_agentCircuits[(uint) agentData.circuitcode].SecureSessionID = agentData.SecureSessionID; diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8b1a982..b395f39 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -707,6 +707,7 @@ namespace OpenSim.Framework public interface IClientAPI { Vector3 StartPos { get; set; } + float StartFar { get; set; } UUID AgentId { get; } diff --git a/OpenSim/Framework/Login.cs b/OpenSim/Framework/Login.cs index 54a6654..b8a24ea 100644 --- a/OpenSim/Framework/Login.cs +++ b/OpenSim/Framework/Login.cs @@ -42,11 +42,13 @@ namespace OpenSim.Framework public UUID SecureSession = UUID.Zero; public UUID Session; public Vector3 StartPos; + public float StartFar; public AvatarAppearance Appearance; public Login() { StartPos = new Vector3(128, 128, 70); + StartFar = -1; } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6859b83..5ffea62 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -408,6 +408,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_startpos; } set { m_startpos = value; } } + public float StartFar { get; set; } + public bool DeliverPackets { get { return m_deliverPackets; } @@ -540,6 +542,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_firstName = sessionInfo.LoginInfo.First; m_lastName = sessionInfo.LoginInfo.Last; m_startpos = sessionInfo.LoginInfo.StartPos; + StartFar = sessionInfo.LoginInfo.StartFar; m_udpServer = udpServer; m_udpClient = udpClient; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index fb2fd07..6b3e8c4 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1946,6 +1946,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, region); + agent.startfar = sp.DrawDistance; agent.child = true; agent.Appearance = new AvatarAppearance(); agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; @@ -2105,7 +2106,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.child = true; agent.Appearance = new AvatarAppearance(); agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; - + agent.startfar = sp.DrawDistance; if (currentAgentCircuit != null) { agent.ServiceURLs = currentAgentCircuit.ServiceURLs; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2c20da6..be593ad 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1079,7 +1079,14 @@ namespace OpenSim.Region.Framework.Scenes Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); PresenceType = type; - DrawDistance = world.DefaultDrawDistance; + m_drawDistance = client.StartFar; + if(m_drawDistance > 32) + { + if(m_drawDistance > world.MaxDrawDistance) + m_drawDistance = world.MaxDrawDistance; + } + else + m_drawDistance = world.DefaultDrawDistance; RegionHandle = world.RegionInfo.RegionHandle; ControllingClient = client; Firstname = ControllingClient.FirstName; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 9f85185..16be1c8 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -524,6 +524,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server set { } } + public float StartFar { get; set; } + public bool TryGet<T>(out T iface) { iface = default(T); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 954d336..b2a9716 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -562,6 +562,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC set { } } + public float StartFar { get; set; } + public virtual UUID AgentId { get { return m_uuid; } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 0031127..3cd5253 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -369,6 +369,8 @@ namespace OpenSim.Tests.Common set { } } + public float StartFar { get; set; } + public virtual UUID AgentId { get { return m_agentId; } -- cgit v1.1 From 42414bfa551d8039bd5fb4ae9c7054c4bb67d599 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 15:07:15 +0100 Subject: mantis 8512: add proposed detection of VS2019 to runprebuild (both this and vs2019 untested by me --- runprebuild.bat | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/runprebuild.bat b/runprebuild.bat index e2b6832..3ee1648 100755 --- a/runprebuild.bat +++ b/runprebuild.bat @@ -5,22 +5,27 @@ bin\Prebuild.exe /target vs2015 setlocal ENABLEEXTENSIONS set VALUE_NAME=MSBuildToolsPath +rem Try to find VS2019 +for %%e in (Enterprise Professional Community) do ( + if exist "%PROGRAMS%\Microsoft Visual Studio\2019\%%e\MSBuild\Current\Bin\MSBuild.exe" ( + + set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2019\%%e\MSBuild\Current\Bin\" + goto :found + ) +) rem try find vs2017 if "%PROCESSOR_ARCHITECTURE%"=="x86" set PROGRAMS=%ProgramFiles% if defined ProgramFiles(x86) set PROGRAMS=%ProgramFiles(x86)% for %%e in (Enterprise Professional Community) do ( - if exist "%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\MSBuild.exe" ( set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\" goto :found ) - ) - rem We have to use grep or find to locate the correct line, because reg query spits rem out 4 lines before Windows 7 but 2 lines after Windows 7. rem We use grep if it's on the path; otherwise we use the built-in find command -- cgit v1.1 From 07796d5ccfc8b5a8df0a50d6f4678a9c13847318 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 18:52:28 +0100 Subject: change region cacheid on restart. This should not be needed in future if objects cache info is stored on region db --- OpenSim/Framework/RegionInfo.cs | 5 +++++ OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 75ed999..98ef5d5 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -180,6 +180,7 @@ namespace OpenSim.Framework private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>(); + public UUID CacheID { get; set;} // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. // MT: Yes. Estates can't span trust boundaries. Therefore, it can be @@ -196,6 +197,7 @@ namespace OpenSim.Framework public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName) { // m_configSource = configSource; + CacheID = UUID.Random(); if (filename.ToLower().EndsWith(".ini")) { @@ -255,6 +257,7 @@ namespace OpenSim.Framework ReadNiniConfig(source, name); m_serverURI = string.Empty; + CacheID = UUID.Random(); } public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri) @@ -266,11 +269,13 @@ namespace OpenSim.Framework m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; m_serverURI = string.Empty; + CacheID = UUID.Random(); } public RegionInfo() { m_serverURI = string.Empty; + CacheID = UUID.Random(); } public EstateSettings EstateSettings diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5ffea62..8d5980a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -929,7 +929,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //BillableFactor zc.AddFloat(es.BillableFactor); //CacheID - zc.AddUUID(regionInfo.RegionID); // needs review when we actuall support cache + zc.AddUUID(regionInfo.CacheID); // needs review when we actuall support cache //TerrainBase0 //TerrainBase1 //TerrainBase2 -- cgit v1.1 From a56f40470efd0b3ca6000cb4561efc59c6b3c25e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 18:55:40 +0100 Subject: control visible regions by avatar position and view range, first dirty code --- .../EntityTransfer/EntityTransferModule.cs | 358 ++++++++++++++++----- .../Framework/Interfaces/IEntityTransferModule.cs | 2 + OpenSim/Region/Framework/Scenes/Scene.cs | 6 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 150 +++++---- 4 files changed, 372 insertions(+), 144 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6b3e8c4..b4ac968 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1932,12 +1932,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (seeds.ContainsKey(regionhandler)) seeds.Remove(regionhandler); -/* - List<ulong> oldregions = new List<ulong>(seeds.Keys); - if (oldregions.Contains(currentRegionHandler)) - oldregions.Remove(currentRegionHandler); -*/ if (!seeds.ContainsKey(currentRegionHandler)) seeds.Add(currentRegionHandler, sp.ControllingClient.RequestClientInfo().CapsPath); @@ -1975,24 +1970,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.Mac = currentAgentCircuit.Mac; agent.Id0 = currentAgentCircuit.Id0; } -/* - AgentPosition agentpos = null; - if (oldregions.Count > 0) - { - agentpos = new AgentPosition(); - agentpos.AgentID = new UUID(sp.UUID.Guid); - agentpos.SessionID = sp.ControllingClient.SessionId; - agentpos.Size = sp.Appearance.AvatarSize; - agentpos.Center = sp.CameraPosition; - agentpos.Far = sp.DrawDistance; - agentpos.Position = sp.AbsolutePosition; - agentpos.Velocity = sp.Velocity; - agentpos.RegionHandle = currentRegionHandler; - agentpos.Throttles = sp.ControllingClient.GetThrottlesPacked(1); - agentpos.ChildrenCapSeeds = seeds; - } -*/ IPEndPoint external = region.ExternalEndPoint; if (external != null) { @@ -2001,20 +1979,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer InformClientOfNeighbourCompleted, d); } -/* - if(oldregions.Count >0) - { - uint neighbourx; - uint neighboury; - UUID scope = sp.Scene.RegionInfo.ScopeID; - foreach (ulong handler in oldregions) - { - Utils.LongToUInts(handler, out neighbourx, out neighboury); - GridRegion neighbour = sp.Scene.GridService.GetRegionByPosition(scope, (int)neighbourx, (int)neighboury); - sp.Scene.SimulationService.UpdateAgent(neighbour, agentpos); - } - } - */ } #endregion @@ -2024,6 +1988,44 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer private delegate void InformClientOfNeighbourDelegate( ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent); + List<GridRegion> RegionsInView(Vector3 pos, RegionInfo curregion, List<GridRegion> fullneighbours, float viewrange) + { + List<GridRegion> ret = new List<GridRegion>(); + if(fullneighbours.Count == 0) + return ret; + + int curX = (int)Util.RegionToWorldLoc(curregion.RegionLocX) + (int)pos.X; + int minX = curX - (int)viewrange; + int maxX = curX + (int)viewrange; + int curY = (int)Util.RegionToWorldLoc(curregion.RegionLocY) + (int)pos.Y; + int minY = curY - (int)viewrange; + int maxY = curY + (int)viewrange; + int rtmp; + + foreach (GridRegion r in fullneighbours) + { + OpenSim.Framework.RegionFlags? regionFlags = r.RegionFlags; + if (regionFlags != null) + { + if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0) + continue; + } + + rtmp = r.RegionLocX; + if (maxX < rtmp) + continue; + if (minX > rtmp + r.RegionSizeX) + continue; + rtmp = r.RegionLocY; + if (maxY < rtmp) + continue; + if (minY > rtmp + r.RegionSizeY) + continue; + ret.Add(r); + } + return ret; + } + /// <summary> /// This informs all neighbouring regions about agent "avatar". /// and as important informs the avatar about then @@ -2033,20 +2035,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { // assumes that out of view range regions are disconnected by the previus region - List<GridRegion> neighbours = new List<GridRegion>(); Scene spScene = sp.Scene; - RegionInfo m_regionInfo = spScene.RegionInfo; + RegionInfo regionInfo = spScene.RegionInfo; - if (m_regionInfo != null) - { - neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); - } - else - { - m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); - } + if (regionInfo == null) + return; + + ulong currentRegionHandler = regionInfo.RegionHandle; - ulong currentRegionHandler = m_regionInfo.RegionHandle; + List<GridRegion> fullneighbours = GetNeighbors(sp); + List<GridRegion> neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); LinkedList<ulong> previousRegionNeighbourHandles; Dictionary<ulong, string> seeds; @@ -2082,13 +2080,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer List<AgentCircuitData> cagents = new List<AgentCircuitData>(); List<ulong> newneighbours = new List<ulong>(); - bool notHG = (sp.TeleportFlags & Constants.TeleportFlags.ViaHGLogin) == 0; - foreach (GridRegion neighbour in neighbours) { ulong handler = neighbour.RegionHandle; - if (notHG && previousRegionNeighbourHandles.Contains(handler)) + if (previousRegionNeighbourHandles.Contains(handler)) { // agent already knows this region previousRegionNeighbourHandles.Remove(handler); @@ -2135,13 +2131,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer foreach (ulong handler in previousRegionNeighbourHandles) seeds.Remove(handler); - if(notHG) // does not work on HG - { - toclose = new List<ulong>(previousRegionNeighbourHandles); -// sp.CloseChildAgents(toclose); - } - else - toclose = new List<ulong>(); + toclose = new List<ulong>(previousRegionNeighbourHandles); } else toclose = new List<ulong>(); @@ -2173,7 +2163,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Util.FireAndForget(delegate { - Thread.Sleep(500); // the original delay that was at InformClientOfNeighbourAsync start int count = 0; IPEndPoint ipe; @@ -2196,10 +2185,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } count++; } - else if (notHG && !previousRegionNeighbourHandles.Contains(handler)) + else if (!previousRegionNeighbourHandles.Contains(handler)) { spScene.SimulationService.UpdateAgent(neighbour, agentpos); } + if (sp.IsDeleted) + return; } catch (Exception e) { @@ -2216,6 +2207,202 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } + public void CheckChildAgents(ScenePresence sp) + { + // assumes that out of view range regions are disconnected by the previus region + + Scene spScene = sp.Scene; + RegionInfo regionInfo = spScene.RegionInfo; + + if (regionInfo == null) + return; + + ulong currentRegionHandler = regionInfo.RegionHandle; + + List<GridRegion> fullneighbours = GetNeighbors(sp); + List<GridRegion> neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + + LinkedList<ulong> previousRegionNeighbourHandles = new LinkedList<ulong>(sp.KnownRegions.Keys); + + IClientAPI spClient = sp.ControllingClient; + + AgentCircuitData currentAgentCircuit = + spScene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); + + List<AgentCircuitData> cagents = new List<AgentCircuitData>(); + List<GridRegion> newneighbours = new List<GridRegion>(); + + foreach (GridRegion neighbour in neighbours) + { + ulong handler = neighbour.RegionHandle; + + if (previousRegionNeighbourHandles.Contains(handler)) + { + // agent already knows this region + previousRegionNeighbourHandles.Remove(handler); + continue; + } + + if (handler == currentRegionHandler) + continue; + + // a new region to add + AgentCircuitData agent = spClient.RequestClientInfo(); + agent.BaseFolder = UUID.Zero; + agent.InventoryFolder = UUID.Zero; + agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); + agent.child = true; + agent.Appearance = new AvatarAppearance(); + agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; + agent.startfar = sp.DrawDistance; + if (currentAgentCircuit != null) + { + agent.ServiceURLs = currentAgentCircuit.ServiceURLs; + agent.IPAddress = currentAgentCircuit.IPAddress; + agent.Viewer = currentAgentCircuit.Viewer; + agent.Channel = currentAgentCircuit.Channel; + agent.Mac = currentAgentCircuit.Mac; + agent.Id0 = currentAgentCircuit.Id0; + } + + newneighbours.Add(neighbour); + agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); + sp.AddNeighbourRegion(neighbour, agent.CapsPath); + + agent.ChildrenCapSeeds = null; + cagents.Add(agent); + } + + List<ulong> toclose; + // previousRegionNeighbourHandles now contains regions to forget + if (previousRegionNeighbourHandles.Count > 0) + { + if (previousRegionNeighbourHandles.Contains(currentRegionHandler)) + previousRegionNeighbourHandles.Remove(currentRegionHandler); + + foreach (ulong handler in previousRegionNeighbourHandles) + sp.KnownRegions.Remove(handler); + + toclose = new List<ulong>(previousRegionNeighbourHandles); + } + else + toclose = new List<ulong>(); + + ICapabilitiesModule capsModule = spScene.CapsModule; + if (capsModule != null) + capsModule.SetChildrenSeed(sp.UUID, sp.KnownRegions); + + if (toclose.Count > 0) + sp.CloseChildAgents(toclose); + + if (newneighbours.Count > 0) + { + int count = 0; + IPEndPoint ipe; + + foreach (GridRegion neighbour in newneighbours) + { + try + { + ipe = neighbour.ExternalEndPoint; + if (ipe != null) + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); + else + { + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: lost DNS resolution for neighbour {0}", neighbour.ExternalHostName); + } + count++; + if (sp.IsDeleted) + return; + } + catch (Exception e) + { + m_log.ErrorFormat( + "[ENTITY TRANSFER MODULE]: Error creating child agent at {0} ({1} ({2}, {3}). {4}", + neighbour.ExternalHostName, + neighbour.RegionHandle, + neighbour.RegionLocX, + neighbour.RegionLocY, + e); + } + } + } + } + + public void CloseOldChildAgents(ScenePresence sp) + { + Scene spScene = sp.Scene; + RegionInfo regionInfo = spScene.RegionInfo; + + if (regionInfo == null) + return; + + ulong currentRegionHandler = regionInfo.RegionHandle; + + List<GridRegion> fullneighbours = GetNeighbors(sp); + List<GridRegion> neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + + LinkedList<ulong> previousRegionNeighbourHandles; + Dictionary<ulong, string> seeds; + ICapabilitiesModule capsModule = spScene.CapsModule; + + if (capsModule != null) + { + seeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(sp.UUID)); + previousRegionNeighbourHandles = new LinkedList<ulong>(seeds.Keys); + } + else + { + seeds = new Dictionary<ulong, string>(); + previousRegionNeighbourHandles = new LinkedList<ulong>(); + } + + IClientAPI spClient = sp.ControllingClient; + + // This will fail if the user aborts login + try + { + if (!seeds.ContainsKey(currentRegionHandler)) + seeds.Add(currentRegionHandler, spClient.RequestClientInfo().CapsPath); + } + catch + { + return; + } + + foreach (GridRegion neighbour in neighbours) + { + ulong handler = neighbour.RegionHandle; + + if (previousRegionNeighbourHandles.Contains(handler)) + previousRegionNeighbourHandles.Remove(handler); + } + + List<ulong> toclose; + // previousRegionNeighbourHandles now contains regions to forget + if (previousRegionNeighbourHandles.Count == 0) + return; + + if (previousRegionNeighbourHandles.Contains(currentRegionHandler)) + previousRegionNeighbourHandles.Remove(currentRegionHandler); + + foreach (ulong handler in previousRegionNeighbourHandles) + seeds.Remove(handler); + + toclose = new List<ulong>(previousRegionNeighbourHandles); + + if (capsModule != null) + capsModule.SetChildrenSeed(sp.UUID, seeds); + + sp.KnownRegions = seeds; + sp.SetNeighbourRegionSizeInfo(neighbours); + + Util.FireAndForget(delegate + { + sp.CloseChildAgents(toclose); + }); + } + // Computes the difference between two region bases. // Returns a vector of world coordinates (meters) from base of first region to the second. // The first region is the home region of the passed scene presence. @@ -2416,6 +2603,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } + // all this code should be moved to scene replacing the now bad one there + // cache Neighbors + List<GridRegion> Neighbors = null; + DateTime LastNeighborsTime = DateTime.MinValue; + /// <summary> /// Return the list of online regions that are considered to be neighbours to the given scene. /// </summary> @@ -2423,39 +2615,41 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// <param name="pRegionLocX"></param> /// <param name="pRegionLocY"></param> /// <returns></returns> - protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) + protected List<GridRegion> GetNeighbors(ScenePresence avatar) { Scene pScene = avatar.Scene; - RegionInfo m_regionInfo = pScene.RegionInfo; - List<GridRegion> neighbours; - uint dd = (uint)avatar.RegionViewDistance; + uint dd = (uint)pScene.MaxRegionViewDistance; + if(dd <= 1) + return new List<GridRegion>(); + + if (Neighbors != null && (DateTime.UtcNow - LastNeighborsTime).TotalSeconds < 30) + { + return Neighbors; + } - // until avatar movement updates client connections, we need to send at least this current region immediate neighbors - uint ddX = Math.Max(dd, Constants.RegionSize); - uint ddY = Math.Max(dd, Constants.RegionSize); + RegionInfo regionInfo = pScene.RegionInfo; + List<GridRegion> neighbours; - ddX--; - ddY--; + dd--; - // reference to region edges. Should be avatar position - uint startX = Util.RegionToWorldLoc(pRegionLocX); - uint endX = startX + m_regionInfo.RegionSizeX; - uint startY = Util.RegionToWorldLoc(pRegionLocY); - uint endY = startY + m_regionInfo.RegionSizeY; + uint startX = Util.RegionToWorldLoc(regionInfo.RegionLocX); + uint endX = startX + regionInfo.RegionSizeX; + uint startY = Util.RegionToWorldLoc(regionInfo.RegionLocY); + uint endY = startY + regionInfo.RegionSizeY; - startX -= ddX; - startY -= ddY; - endX += ddX; - endY += ddY; + startX -= dd; + startY -= dd; + endX += dd; + endY += dd; - neighbours - = avatar.Scene.GridService.GetRegionRange( - m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); + neighbours = avatar.Scene.GridService.GetRegionRange( + regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). - neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); - + neighbours.RemoveAll( r => r.RegionID == regionInfo.RegionID ); + Neighbors = neighbours; + LastNeighborsTime = DateTime.UtcNow; return neighbours; } #endregion diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 1b690ba..9377564 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs @@ -90,6 +90,8 @@ namespace OpenSim.Region.Framework.Interfaces void AgentArrivedAtDestination(UUID agent); void EnableChildAgents(ScenePresence agent); + void CheckChildAgents(ScenePresence agent); + void CloseOldChildAgents(ScenePresence agent); void EnableChildAgent(ScenePresence agent, GridRegion region); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7d312e9..e130bd7 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1286,7 +1286,6 @@ namespace OpenSim.Region.Framework.Scenes { if (RegionInfo.RegionHandle != otherRegion.RegionHandle) { - if (isNeighborRegion(otherRegion)) { // Let the grid service module know, so this can be cached @@ -1296,9 +1295,6 @@ namespace OpenSim.Region.Framework.Scenes { ForEachRootScenePresence(delegate(ScenePresence agent) { - //agent.ControllingClient.new - //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); - List<ulong> old = new List<ulong>(); old.Add(otherRegion.RegionHandle); agent.DropOldNeighbours(old); @@ -1324,7 +1320,7 @@ namespace OpenSim.Region.Framework.Scenes public bool isNeighborRegion(GridRegion otherRegion) { - int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; ; + int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX) return false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index be593ad..fbf9b4a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -165,6 +165,7 @@ namespace OpenSim.Region.Framework.Scenes public static readonly float MOVEMENT = .25f; public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; + public static readonly float CHILDAGENTSCHECK_MOVEMENT = 1024f; // 32m public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms) private UUID m_previusParcelUUID = UUID.Zero; @@ -342,7 +343,8 @@ namespace OpenSim.Region.Framework.Scenes private int m_lastChildAgentUpdateGodLevel; private float m_lastChildAgentUpdateDrawDistance; private Vector3 m_lastChildAgentUpdatePosition; -// private Vector3 m_lastChildAgentUpdateCamPosition; + private Vector3 m_lastChildAgentCheckPosition; + // private Vector3 m_lastChildAgentUpdateCamPosition; private Vector3 m_lastCameraRayCastCam; private Vector3 m_lastCameraRayCastPos; @@ -627,7 +629,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance); + return Util.Clamp(m_drawDistance + 64f, 64f, m_scene.MaxRegionViewDistance); } } @@ -2321,6 +2323,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; m_lastChildAgentUpdateDrawDistance = DrawDistance; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; @@ -4049,20 +4052,11 @@ namespace OpenSim.Region.Framework.Scenes //NeedInitialData = 4; //return; } - - // Create child agents in neighbouring regions IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); if (m_agentTransfer != null) { - m_agentTransfer.EnableChildAgents(this); + m_agentTransfer.CloseOldChildAgents(this); } - - m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; - m_lastChildAgentUpdatePosition = AbsolutePosition; - m_lastChildAgentUpdateDrawDistance = DrawDistance; - - m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; - m_childUpdatesBusy = false; // allow them } m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); @@ -4126,6 +4120,24 @@ namespace OpenSim.Region.Framework.Scenes m_reprioritizationBusy = false; } + + if (!IsChildAgent) + { + // Create child agents in neighbouring regions + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); + if (m_agentTransfer != null) + { + m_agentTransfer.EnableChildAgents(this); + } + + m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; + m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_childUpdatesBusy = false; // allow them + } }); } @@ -4399,56 +4411,80 @@ namespace OpenSim.Region.Framework.Scenes if(m_childUpdatesBusy) return; - //possible KnownRegionHandles always contains current region and this check is not needed - int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0; - if(KnownRegionHandles.Count > minhandles) - { - int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); - if(tdiff < CHILDUPDATES_TIME) - return; + int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); + if (tdiff < CHILDUPDATES_TIME) + return; - bool doUpdate = false; - if(m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) - doUpdate = true; - - if(!doUpdate && Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) - doUpdate = true; + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); + float dx = pos.X - m_lastChildAgentCheckPosition.Y; + float dy = pos.Y - m_lastChildAgentCheckPosition.Y; + if ((m_agentTransfer != null) && ((dx * dx + dy *dy) > CHILDAGENTSCHECK_MOVEMENT)) + { + m_childUpdatesBusy = true; + m_lastChildAgentCheckPosition = pos; + m_lastChildAgentUpdatePosition = pos; + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + // m_lastChildAgentUpdateCamPosition = CameraPosition; - if(!doUpdate) + Util.FireAndForget( + o => + { + m_agentTransfer.EnableChildAgents(this); + m_lastChildUpdatesTime = Util.EnvironmentTickCount(); + m_childUpdatesBusy = false; + }, null, "ScenePresence.CheckChildAgents"); + } + else + { + //possible KnownRegionHandles always contains current region and this check is not needed + int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0; + if(KnownRegionHandles.Count > minhandles) { - diff = pos - m_lastChildAgentUpdatePosition; - if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) + bool doUpdate = false; + if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) doUpdate = true; - } - if(doUpdate) - { - m_childUpdatesBusy = true; - m_lastChildAgentUpdatePosition = pos; - m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; - m_lastChildAgentUpdateDrawDistance = DrawDistance; -// m_lastChildAgentUpdateCamPosition = CameraPosition; - - AgentPosition agentpos = new AgentPosition(); - agentpos.AgentID = new UUID(UUID.Guid); - agentpos.SessionID = ControllingClient.SessionId; - agentpos.Size = Appearance.AvatarSize; - agentpos.Center = CameraPosition; - agentpos.Far = DrawDistance; - agentpos.Position = AbsolutePosition; - agentpos.Velocity = Velocity; - agentpos.RegionHandle = RegionHandle; - agentpos.GodData = GodController.State(); - agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); - - // Let's get this out of the update loop - Util.FireAndForget( - o => - { - m_scene.SendOutChildAgentUpdates(agentpos, this); - m_lastChildUpdatesTime = Util.EnvironmentTickCount(); - m_childUpdatesBusy = false; - }, null, "ScenePresence.SendOutChildAgentUpdates"); + bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; + if (!viewchanged) + doUpdate = true; + + if(!doUpdate) + { + diff = pos - m_lastChildAgentUpdatePosition; + if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) + doUpdate = true; + } + + if (doUpdate) + { + m_childUpdatesBusy = true; + m_lastChildAgentUpdatePosition = pos; + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + // m_lastChildAgentUpdateCamPosition = CameraPosition; + + AgentPosition agentpos = new AgentPosition(); + agentpos.AgentID = new UUID(UUID.Guid); + agentpos.SessionID = ControllingClient.SessionId; + agentpos.Size = Appearance.AvatarSize; + agentpos.Center = CameraPosition; + agentpos.Far = DrawDistance; + agentpos.Position = AbsolutePosition; + agentpos.Velocity = Velocity; + agentpos.RegionHandle = RegionHandle; + agentpos.GodData = GodController.State(); + agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); + + // Let's get this out of the update loop + Util.FireAndForget( + o => + { + m_scene.SendOutChildAgentUpdates(agentpos, this); + m_lastChildUpdatesTime = Util.EnvironmentTickCount(); + m_childUpdatesBusy = false; + }, null, "ScenePresence.SendOutChildAgentUpdates"); + } } } } -- cgit v1.1 From 50c810549c5faf87017c189326732ba8899a58d0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 20:16:23 +0100 Subject: change visible regions also by view range change; fix check on crossings --- .../Framework/EntityTransfer/EntityTransferModule.cs | 11 +++++++---- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b4ac968..8668558 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1785,11 +1785,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.Position = pos; cAgent.ChildrenCapSeeds = agent.KnownRegions; - childRegionsToClose = agent.GetChildAgentsToClose(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); - if(cAgent.ChildrenCapSeeds != null) + if(ctx.OutboundVersion < 0.7f) { - foreach(ulong regh in childRegionsToClose) - cAgent.ChildrenCapSeeds.Remove(regh); + childRegionsToClose = agent.GetChildAgentsToClose(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); + if(cAgent.ChildrenCapSeeds != null) + { + foreach(ulong regh in childRegionsToClose) + cAgent.ChildrenCapSeeds.Remove(regh); + } } if (isFlying) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fbf9b4a..438ae4c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4415,10 +4415,12 @@ namespace OpenSim.Region.Framework.Scenes if (tdiff < CHILDUPDATES_TIME) return; + bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); - float dx = pos.X - m_lastChildAgentCheckPosition.Y; + float dx = pos.X - m_lastChildAgentCheckPosition.X; float dy = pos.Y - m_lastChildAgentCheckPosition.Y; - if ((m_agentTransfer != null) && ((dx * dx + dy *dy) > CHILDAGENTSCHECK_MOVEMENT)) + if ((m_agentTransfer != null) && (viewchanged || ((dx * dx + dy * dy) > CHILDAGENTSCHECK_MOVEMENT))) { m_childUpdatesBusy = true; m_lastChildAgentCheckPosition = pos; @@ -4445,7 +4447,6 @@ namespace OpenSim.Region.Framework.Scenes if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) doUpdate = true; - bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; if (!viewchanged) doUpdate = true; -- cgit v1.1 From 8d272fb1d08275e4416c08fc82c054825d427467 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 03:25:02 +0100 Subject: mantis 8512: fix runprebuild --- runprebuild.bat | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/runprebuild.bat b/runprebuild.bat index 3ee1648..e5d7cb8 100755 --- a/runprebuild.bat +++ b/runprebuild.bat @@ -5,23 +5,23 @@ bin\Prebuild.exe /target vs2015 setlocal ENABLEEXTENSIONS set VALUE_NAME=MSBuildToolsPath +if "%PROCESSOR_ARCHITECTURE%"=="x86" set PROGRAMS=%ProgramFiles% +if defined ProgramFiles(x86) set PROGRAMS=%ProgramFiles(x86)% + rem Try to find VS2019 for %%e in (Enterprise Professional Community) do ( if exist "%PROGRAMS%\Microsoft Visual Studio\2019\%%e\MSBuild\Current\Bin\MSBuild.exe" ( - set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2019\%%e\MSBuild\Current\Bin\" + set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2019\%%e\MSBuild\Current\Bin\MSBuild" goto :found ) ) rem try find vs2017 -if "%PROCESSOR_ARCHITECTURE%"=="x86" set PROGRAMS=%ProgramFiles% -if defined ProgramFiles(x86) set PROGRAMS=%ProgramFiles(x86)% - for %%e in (Enterprise Professional Community) do ( if exist "%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\MSBuild.exe" ( - set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\" + set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\MSBuild" goto :found ) ) @@ -40,7 +40,7 @@ if defined FOUNDGREP ( rem try vs2015 FOR /F "usebackq tokens=1-3" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v %VALUE_NAME% 2^>nul ^| %FINDCMD% "%VALUE_NAME%"`) DO ( - set ValueValue=%%C + set ValueValue=%%C\msbuild goto :found ) @@ -54,6 +54,6 @@ goto :done :found @echo Found msbuild at %ValueValue% @echo Creating compile.bat - @echo %ValueValue%\msbuild opensim.sln > compile.bat + @echo %ValueValue% opensim.sln > compile.bat :done \ No newline at end of file -- cgit v1.1 From 0652f01d4cbae9585f4288b68d1feff1711d6be4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 03:45:27 +0100 Subject: duhhh npcs don't have child agents; plus minor typos --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- .../ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 17 ++++++++++++----- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 2 +- OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 2 +- runprebuild.bat | 4 +++- 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index deeacf5..ea68581 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -505,7 +505,7 @@ namespace OpenSim.Region.ClientStack.Linden case FileAgentInventoryState.processRequest: case FileAgentInventoryState.processUpload: LLSDAssetUploadError resperror = new LLSDAssetUploadError(); - resperror.message = "Uploader busy processing previus request"; + resperror.message = "Uploader busy processing previous request"; resperror.identifier = UUID.Zero; LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index cf5f0ef..9b8f11a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -724,7 +724,7 @@ namespace OpenSim.Region.ClientStack.Linden int m = curCost.medLODSize - 384; int h = curCost.highLODSize - 384; - // use previus higher LOD size on missing ones + // use previous higher LOD size on missing ones if (m <= 0) m = h; if (l <= 0) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8d5980a..a1d2e11 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -929,7 +929,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //BillableFactor zc.AddFloat(es.BillableFactor); //CacheID - zc.AddUUID(regionInfo.CacheID); // needs review when we actuall support cache + zc.AddUUID(regionInfo.CacheID); //TerrainBase0 //TerrainBase1 //TerrainBase2 diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 438ae4c..f9d1f54 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3072,10 +3072,14 @@ namespace OpenSim.Region.Framework.Scenes Vector2 regionSize; regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); - if (pos.X < 0 || pos.X >= regionSize.X - || pos.Y < 0 || pos.Y >= regionSize.Y - || pos.Z < 0) - return; + if (pos.X < 0.5f) + pos.X = 0.5f; + else if (pos.X > regionSize.X - 0.5f) + pos.X = regionSize.X - 0.5f; + if (pos.Y < 0.5f) + pos.Y = 0.5f; + else if (pos.Y > regionSize.Y - 0.5f) + pos.Y = regionSize.Y - 0.5f; float terrainHeight; Scene targetScene = m_scene; @@ -4405,6 +4409,9 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerSignificantClientMovement(this); } + if(IsNPC) + return; + // updates priority recalc checkRePrioritization(); @@ -6720,7 +6727,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; - // only those on previus parcel need receive kills + // only those on previous parcel need receive kills if (previusParcelID == p.currentParcelUUID) { if(!p.IsViewerUIGod) diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index bc440fc..50b0cb5 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -556,7 +556,7 @@ namespace OpenSim.Region.Framework.Scenes sb[27].StatID = (uint)Stats.PhysicsLodTasks; sb[27].StatValue = 0; - sb[28].StatID = (uint)Stats.ScriptEps; // we actuall have this, but not messing array order AGAIN + sb[28].StatID = (uint)Stats.ScriptEps; // we actually have this, but not messing array order AGAIN sb[28].StatValue = (float)Math.Round(m_scriptEventsPerSecond * updateTimeFactor); sb[29].StatID = (uint)Stats.SimAIStepTimeMS; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 7ad5e3d..267fc5b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -1603,7 +1603,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - Vector3 a = _velocity; // previus velocity + Vector3 a = _velocity; // previous velocity SetSmooth(ref _velocity,ref vel,2); a = (_velocity - a) * invtimeStep; SetSmooth(ref _acceleration,ref a,2); diff --git a/runprebuild.bat b/runprebuild.bat index e5d7cb8..0bee6f5 100755 --- a/runprebuild.bat +++ b/runprebuild.bat @@ -54,6 +54,8 @@ goto :done :found @echo Found msbuild at %ValueValue% @echo Creating compile.bat +rem To compile in debug mode @echo %ValueValue% opensim.sln > compile.bat - +rem To compile in release mode comment line (add rem to start) above and uncomment next (remove rem) +rem @echo %ValueValue% /P:Config=Release opensim.sln > compile.bat :done \ No newline at end of file -- cgit v1.1 From 63321f9ccc1e35db8034da64c510f334e7d5e7d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 04:08:14 +0100 Subject: add option RegionViewDistance --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- bin/OpenSimDefaults.ini | 11 +++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e130bd7..351592d 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -275,6 +275,12 @@ namespace OpenSim.Region.Framework.Scenes get { return m_maxRegionViewDistance; } } + protected float m_minRegionViewDistance = 96f; + public float MinRegionViewDistance + { + get { return m_minRegionViewDistance; } + } + private List<string> m_AllowedViewers = new List<string>(); private List<string> m_BannedViewers = new List<string>(); @@ -920,6 +926,7 @@ namespace OpenSim.Region.Framework.Scenes m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); + m_minRegionViewDistance = startupConfig.GetFloat("MinRegionsViewDistance", m_maxRegionViewDistance); // old versions compatibility LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); @@ -930,6 +937,11 @@ namespace OpenSim.Region.Framework.Scenes if (m_maxRegionViewDistance > m_maxDrawDistance) m_maxRegionViewDistance = m_maxDrawDistance; + if(m_minRegionViewDistance < 96f) + m_minRegionViewDistance = 96f; + if(m_minRegionViewDistance > m_maxRegionViewDistance) + m_minRegionViewDistance = m_maxRegionViewDistance; + UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); if (!UseBackup) m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f9d1f54..60a9c3a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -629,7 +629,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - return Util.Clamp(m_drawDistance + 64f, 64f, m_scene.MaxRegionViewDistance); + return Util.Clamp(m_drawDistance + 64f, m_scene.MinRegionViewDistance, m_scene.MaxRegionViewDistance); } } diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 0b56163..9518aaf 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -164,15 +164,10 @@ ; limit the maximum view range ( no effect still (does limit MaxRegionsViewDistance) ) ;MaxDrawDistance = 512 - ; the maximum distance to tell a viewer to connect to a neighbour region, so it can be seen - ; (it is limited by MaxDrawDistance above) - ; less than 256 shows immediate neighbours; 256 to 511 also second imediate neighbours etc - ; more than 511m can cause viewers problems specially in case of dense regions. - ; curretly this distance is from current region borders. - ; Warning: if relevant regions have different setting you may notice strange - ; effects due to that asymmetry - ; ***** + ; Other regions visibilty depends on avatar position and view range + ; the view range considered is limited the maximum and minimum distances: ;MaxRegionsViewDistance = 255 + ;MinRegionsViewDistance = 96 ; If you have only one region in an instance, or to avoid the many bugs ; that you can trigger in modules by restarting a region, set this to -- cgit v1.1 From 6485377ecd8ece0e1a998e03d5f38db9bf6890a8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 04:21:40 +0100 Subject: fix MinRegionViewDistance option (added in last commit); change regions view control --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 351592d..2fa92b3 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -926,7 +926,7 @@ namespace OpenSim.Region.Framework.Scenes m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); - m_minRegionViewDistance = startupConfig.GetFloat("MinRegionsViewDistance", m_maxRegionViewDistance); + m_minRegionViewDistance = startupConfig.GetFloat("MinRegionsViewDistance", m_minRegionViewDistance); // old versions compatibility LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 60a9c3a..200036c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -342,6 +342,7 @@ namespace OpenSim.Region.Framework.Scenes private int m_lastChildUpdatesTime; private int m_lastChildAgentUpdateGodLevel; private float m_lastChildAgentUpdateDrawDistance; + private float m_lastRegionsDrawDistance; private Vector3 m_lastChildAgentUpdatePosition; private Vector3 m_lastChildAgentCheckPosition; // private Vector3 m_lastChildAgentUpdateCamPosition; @@ -2325,6 +2326,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdatePosition = AbsolutePosition; m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; m_lastChildAgentUpdateDrawDistance = DrawDistance; + m_lastRegionsDrawDistance = RegionViewDistance; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them @@ -4138,6 +4140,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdatePosition = AbsolutePosition; m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; m_lastChildAgentUpdateDrawDistance = DrawDistance; + m_lastRegionsDrawDistance = RegionViewDistance; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them @@ -4422,7 +4425,7 @@ namespace OpenSim.Region.Framework.Scenes if (tdiff < CHILDUPDATES_TIME) return; - bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; + bool viewchanged = Math.Abs(RegionViewDistance - m_lastRegionsDrawDistance) > 32.0f; IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); float dx = pos.X - m_lastChildAgentCheckPosition.X; @@ -4434,6 +4437,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdatePosition = pos; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_lastChildAgentUpdateDrawDistance = DrawDistance; + m_lastRegionsDrawDistance = RegionViewDistance; // m_lastChildAgentUpdateCamPosition = CameraPosition; Util.FireAndForget( @@ -4454,7 +4458,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) doUpdate = true; - if (!viewchanged) + if (Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) doUpdate = true; if(!doUpdate) -- cgit v1.1 From 7ce45235e61b1ee48a2b5208e5fdfb39a76ad96c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 11:19:38 +0100 Subject: make sure viewer knows where to place a sitting avatar, this will need deep revision with culling --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 +++++++++++++ bin/OpenSimDefaults.ini | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 200036c..a52fa76 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4210,8 +4210,17 @@ namespace OpenSim.Region.Framework.Scenes { m_lastSize = Appearance.AvatarSize; int count = 0; + SceneObjectPart sitroot = null; + if (ParentID != 0 && ParentPart != null) // we need to send the sitting root prim + { + sitroot = ParentPart.ParentGroup.RootPart; + } foreach (ScenePresence p in presences) { + if (sitroot != null) // we need to send the sitting root prim + { + p.ControllingClient.SendEntityFullUpdateImmediate(ParentPart.ParentGroup.RootPart); + } p.ControllingClient.SendEntityFullUpdateImmediate(this); if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) // either just kill the object @@ -4225,6 +4234,10 @@ namespace OpenSim.Region.Framework.Scenes public void SendInitialAvatarDataToAgent(ScenePresence p) { + if(ParentID != 0 && ParentPart != null) // we need to send the sitting root prim + { + p.ControllingClient.SendEntityFullUpdateImmediate(ParentPart.ParentGroup.RootPart); + } p.ControllingClient.SendEntityFullUpdateImmediate(this); if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) // either just kill the object diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 9518aaf..8696fe8 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -164,7 +164,7 @@ ; limit the maximum view range ( no effect still (does limit MaxRegionsViewDistance) ) ;MaxDrawDistance = 512 - ; Other regions visibilty depends on avatar position and view range + ; Other regions visibility depends on avatar position and view range ; the view range considered is limited the maximum and minimum distances: ;MaxRegionsViewDistance = 255 ;MinRegionsViewDistance = 96 -- cgit v1.1 From 28c97257302a6f6596dca0b79f4c57f0e7f28225 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 12:31:43 +0100 Subject: kill avatar on agents that do not see its new region --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a52fa76..c728d9b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1655,6 +1655,14 @@ namespace OpenSim.Region.Framework.Scenes CollisionPlane = Vector4.UnitW; + // we need to kill this on agents that do not see the new region + m_scene.ForEachRootScenePresence(delegate(ScenePresence p) + { + if (!p.knowsNeighbourRegion(newRegionHandle)) + { + SendKillTo(p); + } + }); m_scene.EventManager.TriggerOnMakeChildAgent(this); } -- cgit v1.1 From 3bc0690a7a49fe38644ca3ae3cfae6bb5f34c91a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 12:32:36 +0100 Subject: temp workaround on sits culling --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 32 ++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a1d2e11..112b66d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5588,27 +5588,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (e != null && e is SceneObjectGroup) { SceneObjectGroup grp = (SceneObjectGroup)e; - if(grp.IsDeleted || grp.IsAttachment) + if(grp.IsDeleted || grp.IsAttachment ) continue; bool inviewgroups; lock (GroupsInView) inviewgroups = GroupsInView.Contains(grp); - Vector3 grppos = grp.getCenterOffset(); - float dpos = (grppos - mypos).LengthSquared(); - - float maxview = grp.GetBoundsRadius() + cullingrange; - if (dpos > maxview * maxview) + //temp handling of sits + if(grp.GetSittingAvatarsCount() > 0) { - if(inviewgroups) - kills.Add(grp); + if (!inviewgroups) + GroupsNeedFullUpdate.Add(grp); + NewGroupsInView.Add(grp); } else { - if(!inviewgroups) - GroupsNeedFullUpdate.Add(grp); - NewGroupsInView.Add(grp); + Vector3 grppos = grp.getCenterOffset(); + float dpos = (grppos - mypos).LengthSquared(); + + float maxview = grp.GetBoundsRadius() + cullingrange; + if (dpos > maxview * maxview) + { + if(inviewgroups) + kills.Add(grp); + } + else + { + if (!inviewgroups) + GroupsNeedFullUpdate.Add(grp); + NewGroupsInView.Add(grp); + } } } } -- cgit v1.1 From 5ed2b5c990a9d0037a15347cb8bb4db1a105c5e8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 14:43:48 +0100 Subject: try handle the special case MaxRegionsViewDistance = 0 (agents only see void around region, even if there are regions around --- .../EntityTransfer/EntityTransferModule.cs | 50 +++++++++++++++++----- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +-- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 8668558..75d7bc5 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1057,6 +1057,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } } + else + { + if(!sp.IsInLocalTransit || sp.RegionViewDistance == 0) + { + // this will be closed by callback + if (agentCircuit.ChildrenCapSeeds != null) + agentCircuit.ChildrenCapSeeds.Remove(sp.RegionHandle); + } + } string capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);; @@ -1129,7 +1138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.SenderWantsToWaitForRoot = true; - if(!sp.IsInLocalTransit) + if(!sp.IsInLocalTransit || sp.RegionViewDistance == 0) SetNewCallbackURL(agent, sp.Scene.RegionInfo); // Reset the do not close flag. This must be done before the destination opens child connections (here @@ -1565,6 +1574,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public ScenePresence CrossAsync(ScenePresence agent, bool isFlying) { + if(agent.RegionViewDistance == 0) + return agent; + Vector3 newpos; EntityTransferContext ctx = new EntityTransferContext(); string failureReason; @@ -1994,7 +2006,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer List<GridRegion> RegionsInView(Vector3 pos, RegionInfo curregion, List<GridRegion> fullneighbours, float viewrange) { List<GridRegion> ret = new List<GridRegion>(); - if(fullneighbours.Count == 0) + if(fullneighbours.Count == 0 || viewrange == 0) return ret; int curX = (int)Util.RegionToWorldLoc(curregion.RegionLocX) + (int)pos.X; @@ -2036,7 +2048,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// <param name="sp"></param> public void EnableChildAgents(ScenePresence sp) { - // assumes that out of view range regions are disconnected by the previus region + // assumes that out of view range regions are disconnected by the previous region Scene spScene = sp.Scene; RegionInfo regionInfo = spScene.RegionInfo; @@ -2046,8 +2058,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer ulong currentRegionHandler = regionInfo.RegionHandle; - List<GridRegion> fullneighbours = GetNeighbors(sp); - List<GridRegion> neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + List<GridRegion> neighbours; + if (sp.RegionViewDistance > 0) + { + List<GridRegion> fullneighbours = GetNeighbors(sp); + neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + } + else + neighbours = new List<GridRegion>(); LinkedList<ulong> previousRegionNeighbourHandles; Dictionary<ulong, string> seeds; @@ -2212,7 +2230,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public void CheckChildAgents(ScenePresence sp) { - // assumes that out of view range regions are disconnected by the previus region + // assumes that out of view range regions are disconnected by the previous region Scene spScene = sp.Scene; RegionInfo regionInfo = spScene.RegionInfo; @@ -2222,8 +2240,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer ulong currentRegionHandler = regionInfo.RegionHandle; - List<GridRegion> fullneighbours = GetNeighbors(sp); - List<GridRegion> neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + List<GridRegion> neighbours; + if (sp.RegionViewDistance > 0) + { + List<GridRegion> fullneighbours = GetNeighbors(sp); + neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + } + else + neighbours = new List<GridRegion>(); LinkedList<ulong> previousRegionNeighbourHandles = new LinkedList<ulong>(sp.KnownRegions.Keys); @@ -2342,8 +2366,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer ulong currentRegionHandler = regionInfo.RegionHandle; - List<GridRegion> fullneighbours = GetNeighbors(sp); - List<GridRegion> neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + List<GridRegion> neighbours; + if (sp.RegionViewDistance > 0) + { + List<GridRegion> fullneighbours = GetNeighbors(sp); + neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + } + else + neighbours = new List<GridRegion>(); LinkedList<ulong> previousRegionNeighbourHandles; Dictionary<ulong, string> seeds; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c728d9b..aea3a8d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1651,8 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes m_previusParcelUUID = UUID.Zero; m_currentParcelHide = false; m_currentParcelUUID = UUID.Zero; - // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into - + CollisionPlane = Vector4.UnitW; // we need to kill this on agents that do not see the new region @@ -4439,7 +4438,7 @@ namespace OpenSim.Region.Framework.Scenes // updates priority recalc checkRePrioritization(); - if(m_childUpdatesBusy) + if(m_childUpdatesBusy || RegionViewDistance == 0) return; int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); -- cgit v1.1 From 0ebb1f3f4b7dc2ede7ab12cd086f8189926251ad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 12:25:54 +0100 Subject: presence detector: don't even try to logout agents that didn't made to root --- .../ServiceConnectorsOut/Presence/PresenceDetector.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index a7e62eb..3f418f6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs @@ -50,7 +50,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence public void AddRegion(Scene scene) { scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; - scene.EventManager.OnNewClient += OnNewClient; m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); @@ -61,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence public void RemoveRegion(Scene scene) { scene.EventManager.OnMakeRootAgent -= OnMakeRootAgent; - scene.EventManager.OnNewClient -= OnNewClient; m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); } @@ -71,7 +69,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence if (sp.IsNPC) return; - if(sp.gotCrossUpdate) + sp.ControllingClient.OnConnectionClosed += OnConnectionClose; + + if (sp.gotCrossUpdate) { Util.FireAndForget(delegate { @@ -89,11 +89,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); } - public void OnNewClient(IClientAPI client) - { - client.OnConnectionClosed += OnConnectionClose; - } - public void OnConnectionClose(IClientAPI client) { if (client != null && client.SceneAgent != null && !client.SceneAgent.IsChildAgent) -- cgit v1.1 From b7c1d6e7f5b4005d5a416e991de32ab67d8e6693 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 16:09:42 +0100 Subject: UserAgentService: change handling of its external IP --- .../Simulation/SimulationServiceConnector.cs | 9 ---- .../Services/HypergridService/UserAgentService.cs | 50 ++++++++++++---------- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 4fd1fe5..e15ac8c 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -100,14 +100,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string reason) { - string tmp = String.Empty; - return CreateAgent(source, destination, aCircuit, flags, ctx, out tmp, out reason); - } - - public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string myipaddress, out string reason) - { reason = String.Empty; - myipaddress = String.Empty; if (destination == null) { @@ -134,7 +127,6 @@ namespace OpenSim.Services.Connectors.Simulation reason = data["reason"].AsString(); success = data["success"].AsBoolean(); - myipaddress = data["your_ip"].AsString(); return success; } @@ -149,7 +141,6 @@ namespace OpenSim.Services.Connectors.Simulation reason = data["reason"].AsString(); success = data["success"].AsBoolean(); - myipaddress = data["your_ip"].AsString(); m_log.WarnFormat( "[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName); return success; diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 6f2cdd5..bfa97a1 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -73,6 +73,7 @@ namespace OpenSim.Services.HypergridService protected static FriendsSimConnector m_FriendsSimConnector; // grid protected static string m_GridName; + protected static string m_MyExternalIP = ""; protected static int m_LevelOutsideContacts; protected static bool m_ShowDetails; @@ -147,9 +148,20 @@ namespace OpenSim.Services.HypergridService } } - if (!m_GridName.EndsWith("/")) - m_GridName = m_GridName + "/"; - + if (!string.IsNullOrEmpty(m_GridName)) + { + m_GridName = m_GridName.ToLowerInvariant(); + if (!m_GridName.EndsWith("/")) + m_GridName = m_GridName + "/"; + Uri gateURI; + if(!Uri.TryCreate(m_GridName, UriKind.Absolute, out gateURI)) + throw new Exception(String.Format("[UserAgentService] could not parse gatekeeper uri")); + string host = gateURI.DnsSafeHost; + IPAddress ip = Util.GetHostFromDNS(host); + if(ip == null) + throw new Exception(String.Format("[UserAgentService] failed to resolve gatekeeper host")); + m_MyExternalIP = ip.ToString(); + } // Finally some cleanup m_Database.DeleteOld(); @@ -189,7 +201,6 @@ namespace OpenSim.Services.HypergridService } } - public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) { position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; @@ -222,7 +233,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI); - string gridName = gatekeeper.ServerURI; + string gridName = gatekeeper.ServerURI.ToLowerInvariant(); UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID); if (account == null) @@ -269,8 +280,13 @@ namespace OpenSim.Services.HypergridService TravelingAgentInfo old = null; TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old); + if(!fromLogin && old != null && !string.IsNullOrEmpty(old.ClientIPAddress)) + { + m_log.DebugFormat("[USER AGENT SERVICE]: stored IP = {0}. Old circuit IP: {1}", old.ClientIPAddress, agentCircuit.IPAddress); + agentCircuit.IPAddress = old.ClientIPAddress; + } + bool success = false; - string myExternalIP = string.Empty; m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}, desired region: {2}", m_GridName, gridName, region.RegionID); @@ -282,7 +298,7 @@ namespace OpenSim.Services.HypergridService { //TODO: Should there not be a call to QueryAccess here? EntityTransferContext ctx = new EntityTransferContext(); - success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, ctx, out myExternalIP, out reason); + success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, ctx, out reason); } if (!success) @@ -300,14 +316,6 @@ namespace OpenSim.Services.HypergridService // Everything is ok - if (!fromLogin) - { - // Update the perceived IP Address of our grid - m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); - } - - travel.MyIpAddress = myExternalIP; - StoreTravelInfo(travel); return true; @@ -384,10 +392,12 @@ namespace OpenSim.Services.HypergridService TravelingAgentInfo travel = new TravelingAgentInfo(hgt); - bool result = travel.ClientIPAddress == reportedIP || travel.MyIpAddress == reportedIP; // NATed + bool result = travel.ClientIPAddress == reportedIP; + if(!result && !string.IsNullOrEmpty(m_MyExternalIP)) + result = reportedIP == m_MyExternalIP; // NATed - m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}", - reportedIP, travel.ClientIPAddress, travel.MyIpAddress, result); + m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {2}; result is {3}", + reportedIP, travel.ClientIPAddress, m_MyExternalIP, result); return result; } @@ -704,7 +714,6 @@ namespace OpenSim.Services.HypergridService hgt.Data["GridExternalName"] = travel.GridExternalName; hgt.Data["ServiceToken"] = travel.ServiceToken; hgt.Data["ClientIPAddress"] = travel.ClientIPAddress; - hgt.Data["MyIPAddress"] = travel.MyIpAddress; m_Database.Store(hgt); } @@ -719,7 +728,6 @@ namespace OpenSim.Services.HypergridService public string GridExternalName = string.Empty; public string ServiceToken = string.Empty; public string ClientIPAddress = string.Empty; // as seen from this user agent service - public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper public TravelingAgentInfo(HGTravelingData t) { @@ -730,7 +738,6 @@ namespace OpenSim.Services.HypergridService GridExternalName = t.Data["GridExternalName"]; ServiceToken = t.Data["ServiceToken"]; ClientIPAddress = t.Data["ClientIPAddress"]; - MyIpAddress = t.Data["MyIPAddress"]; } } @@ -743,7 +750,6 @@ namespace OpenSim.Services.HypergridService GridExternalName = old.GridExternalName; ServiceToken = old.ServiceToken; ClientIPAddress = old.ClientIPAddress; - MyIpAddress = old.MyIpAddress; } } } -- cgit v1.1 From a25e18587c4f6757361f15b7e2ad844eade5b40f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 16:30:19 +0100 Subject: set SupportViewerObjectsCache true by default --- bin/OpenSimDefaults.ini | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 8696fe8..8582b94 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -685,23 +685,6 @@ [ClientStack.LindenUDP] - ; The client socket receive buffer size determines how many - ; incoming requests we can process; the default on .NET is 8192 - ; which is about 2 4k-sized UDP datagrams. On mono this is - ; whatever the underlying operating system has as default; for - ; example, ubuntu 8.04 or SLES11 have about 111k, which is about - ; 27 4k-sized UDP datagrams (on linux platforms you can [as root] - ; do "sysctl net.core.rmem_default" to find out what your system - ; uses a default socket receive buffer size. - ; - ; client_socket_rcvbuf_size allows you to specify the receive - ; buffer size LLUDPServer should use. NOTE: this will be limited - ; by the system's settings for the maximum client receive buffer - ; size (on linux systems you can set that with "sysctl -w - ; net.core.rmem_max=X") - ; - ;client_socket_rcvbuf_size = 8388608 - ; Maximum outbound bytes per second for a single scene. This can be used to ; throttle total outbound UDP traffic for a simulator. The default value is ; 0, meaning no throttling at the scene level. The example given here is @@ -726,8 +709,8 @@ ; Adaptive throttling attempts to limit network overload when multiple ; clients login by starting each connection more slowly. Disabled by ; default - ; - enable_adaptive_throttles = false + ; currently disabled + ;enable_adaptive_throttles = false ; Per-client bytes per second rates for the various throttle categories. ; These are default values that will be overridden by clients. These @@ -743,7 +726,7 @@ ;asset_default = 10500 ; TextureSendLimit determines how many packets will be put on - ; the outgoing queue each cycle. Like the settings above, this + ; the lludp outgoing queue each cycle. Like the settings above, this ; is a balance between responsiveness to priority updates and ; total throughput. Higher numbers will give a better ; throughput at the cost of reduced responsiveness to client @@ -771,8 +754,10 @@ ; ;PausedAckTimeout = 300 - ; experimental feature, things may still go very wrong - ; SupportViewerObjectsCache = false + ; Support viewers object cache, default true + ; users may need to reduce viewer bandwitdh if some prims or terrain parts fail to rez. + ; + ; SupportViewerObjectsCache = true [ClientStack.LindenCaps] ;; Long list of capabilities taken from -- cgit v1.1 From ec6a52c029792e78d31100a742d575ae71b402e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 21:26:12 +0100 Subject: change interpretation of a viewer flag --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 +++----------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 112b66d..62f0b32 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4814,7 +4814,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EntityUpdate update; - bool viewerCache = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0;// && mysp.IsChildAgent; // only on child agents + bool viewerCache = m_supportViewerCache;// && mysp.IsChildAgent; // only on child agents bool doCulling = m_scene.ObjectsCullingByDistance; float cullingrange = 64.0f; Vector3 mypos = Vector3.Zero; @@ -5650,7 +5650,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(GroupsNeedFullUpdate.Count > 0) { - bool sendProbes = m_supportViewerCache && (m_viewerHandShakeFlags & 1) != 0 && (m_viewerHandShakeFlags & 2) == 0; + bool sendProbes = m_supportViewerCache && (m_viewerHandShakeFlags & 2) == 0; if(sendProbes) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 6746573..19535dc 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -369,7 +369,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// </summary> public int IncomingOrphanedPacketCount { get; protected set; } - public bool SupportViewerObjectsCache = false; + public bool SupportViewerObjectsCache = true; /// <summary> /// Run queue empty processing within a single persistent thread. /// </summary> diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index aea3a8d..c536184 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4045,11 +4045,9 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); m_callbackURI = null; - //NeedInitialData = 4; - //return; } // v0.7 close HG sender region - if (!string.IsNullOrEmpty(m_newCallbackURI)) + else if (!string.IsNullOrEmpty(m_newCallbackURI)) { m_log.DebugFormat( "[SCENE PRESENCE({0})]: Releasing {1} {2} with callback to {3}", @@ -4062,8 +4060,6 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); m_newCallbackURI = null; - //NeedInitialData = 4; - //return; } IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); if (m_agentTransfer != null) @@ -4096,12 +4092,8 @@ namespace OpenSim.Region.Framework.Scenes } else { - bool cacheCulling = (flags & 1) != 0; - bool cacheEmpty; - if (cacheCulling) - cacheEmpty = (flags & 2) != 0; - else - cacheEmpty = true; + //bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty = (flags & 2) != 0;; EntityBase[] entities = Scene.Entities.GetEntities(); if(cacheEmpty) -- cgit v1.1 From 442ef1cc9e5c7d2c9dce17ee525f6adb41cdc5ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 21:27:54 +0100 Subject: change a comment --- bin/OpenSimDefaults.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 8582b94..456dcd6 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -756,6 +756,7 @@ ; Support viewers object cache, default true ; users may need to reduce viewer bandwitdh if some prims or terrain parts fail to rez. + ; change to false if you need to use old viewers that do not support this feature ; ; SupportViewerObjectsCache = true -- cgit v1.1 From 539a3a9273a2777f6a42d739e496da2b74b2efa7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 Apr 2019 16:29:31 +0100 Subject: make robust ban by MAC options visible, thx Bill Blight --- bin/Robust.HG.ini.example | 4 ++++ bin/Robust.ini.example | 2 ++ 2 files changed, 6 insertions(+) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 0f9bb4b..726e468 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -568,6 +568,8 @@ ;; ;; To turn off basic dos protection, set the DOSMaxRequestsInTimeFrame to 0. + ;; Allow banning via hashed MAC must be set in both [GatekeeperService] and [LoginService] + ;DeniedMacs = "YOURLONGMACTRSING ANOTHERMAC" [MapImageService] LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" @@ -663,6 +665,8 @@ ;; Leave blank or commented for no exceptions. ; DisallowExcept = "http://myfriendgrid.com:8002, http://myboss.com:8002" + ;; Allow banning via hashed MAC must be set in both [GatekeeperService] and [LoginService] + ;DeniedMacs = "YOURLONGMACTRSING ANOTHERMAC" [UserAgentService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService" diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 3222a94..50986de 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -495,6 +495,8 @@ ;; ;; To turn off basic dos protection, set the DOSMaxRequestsInTimeFrame to 0. + ;; Allow banning via hashed MAC + ;DeniedMacs = "YOURLONGMACTRSING ANOTHERMAC" [MapImageService] LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" -- cgit v1.1 From b104934a258c34a77c0470b8495d9d286c82f4f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Apr 2019 13:50:51 +0100 Subject: add osGetPSTWallclock() returns wall clock in PST or PDT, for those that for some odd reason think need it. OpenSim girds shoudl use UTC (gtm) but whatever --- .../Shared/Api/Implementation/OSSL_Api.cs | 23 ++++++++++- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 6 +++ bin/ScriptSyntax.xml | 47 ++++++++++++---------- 4 files changed, 55 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7348499..4a74c15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -145,6 +145,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; protected ISoundModule m_SoundModule = null; internal IConfig m_osslconfig; + internal TimeZoneInfo PSTTimeZone = null; public void Initialize( IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item) @@ -201,7 +202,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api default: break; } - } + + try + { + PSTTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); + } + catch + { + PSTTimeZone = null; + } + } public override Object InitializeLifetimeService() { @@ -5441,5 +5451,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; return detectedParams.Key.ToString(); } + + // returns PST or PDT wall clock + public LSL_Float osGetPSTWallclock() + { + m_host.AddScriptLPS(1); + if(PSTTimeZone == null) + return DateTime.Now.TimeOfDay.TotalSeconds; + + DateTime time = TimeZoneInfo.ConvertTime(DateTime.UtcNow, PSTTimeZone); + return time.TimeOfDay.TotalSeconds; + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 49b3f74..26bac00 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -549,5 +549,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String osGetInventoryName(LSL_Key itemId); LSL_String osGetInventoryDesc(LSL_String itemNameOrId); LSL_Key osGetLastChangedEventKey(); + LSL_Float osGetPSTWallclock(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index fb491e4..7a4a5fb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -1381,5 +1381,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetLastChangedEventKey(); } + + public LSL_Float osGetPSTWallclock() + { + return m_OSSL_Functions.osGetPSTWallclock(); + } + } } diff --git a/bin/ScriptSyntax.xml b/bin/ScriptSyntax.xml index 8f2f6002..989984a 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -20392e48-fad2-094e-bc5b-cda003a1e940 +e796a21f-5a66-e4ec-833f-c4896b8e87e4 <llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer> <key>controls</key> <map> @@ -6116,14 +6116,15 @@ <key>arguments</key><array> <map><key>a</key><map><key>type</key><string>float</string></map></map> <map><key>b</key><map><key>type</key><string>float</string></map></map> + <map><key>margin</key><map><key>type</key><string>float</string></map></map> </array> </map> <key>osApproxEquals</key> <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>a</key><map><key>type</key><string>float</string></map></map> - <map><key>b</key><map><key>type</key><string>float</string></map></map> + <map><key>ra</key><map><key>type</key><string>rotation</string></map></map> + <map><key>rb</key><map><key>type</key><string>rotation</string></map></map> <map><key>margin</key><map><key>type</key><string>float</string></map></map> </array> </map> @@ -6148,17 +6149,16 @@ <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>ra</key><map><key>type</key><string>rotation</string></map></map> - <map><key>rb</key><map><key>type</key><string>rotation</string></map></map> - <map><key>margin</key><map><key>type</key><string>float</string></map></map> + <map><key>va</key><map><key>type</key><string>vector</string></map></map> + <map><key>vb</key><map><key>type</key><string>vector</string></map></map> </array> </map> <key>osApproxEquals</key> <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>va</key><map><key>type</key><string>vector</string></map></map> - <map><key>vb</key><map><key>type</key><string>vector</string></map></map> + <map><key>a</key><map><key>type</key><string>float</string></map></map> + <map><key>b</key><map><key>type</key><string>float</string></map></map> </array> </map> <key>osAvatarName2Key</key> @@ -6284,6 +6284,8 @@ <key>return</key><string>string</string> <key>arguments</key><array> <map><key>drawList</key><map><key>type</key><string>string</string></map></map> + <map><key>startX</key><map><key>type</key><string>integer</string></map></map> + <map><key>startY</key><map><key>type</key><string>integer</string></map></map> <map><key>endX</key><map><key>type</key><string>integer</string></map></map> <map><key>endY</key><map><key>type</key><string>integer</string></map></map> </array> @@ -6293,8 +6295,6 @@ <key>return</key><string>string</string> <key>arguments</key><array> <map><key>drawList</key><map><key>type</key><string>string</string></map></map> - <map><key>startX</key><map><key>type</key><string>integer</string></map></map> - <map><key>startY</key><map><key>type</key><string>integer</string></map></map> <map><key>endX</key><map><key>type</key><string>integer</string></map></map> <map><key>endY</key><map><key>type</key><string>integer</string></map></map> </array> @@ -6433,13 +6433,13 @@ <map> <key>arguments</key><array> <map><key>avatar</key><map><key>type</key><string>string</string></map></map> - <map><key>target</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osForceOtherSit</key> <map> <key>arguments</key><array> <map><key>avatar</key><map><key>type</key><string>string</string></map></map> + <map><key>target</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osFormatString</key> @@ -6653,6 +6653,11 @@ <map><key>rules</key><map><key>type</key><string>list</string></map></map> </array> </map> + <key>osGetPSTWallclock</key> + <map> + <key>return</key><string>float</string> + <key>arguments</key><undef/> + </map> <key>osGetRegionMapTexture</key> <map> <key>return</key><string>key</string> @@ -6865,6 +6870,7 @@ <map><key>name</key><map><key>type</key><string>string</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>notecard</key><map><key>type</key><string>string</string></map></map> + <map><key>options</key><map><key>type</key><string>integer</string></map></map> </array> </map> <key>osNpcCreate</key> @@ -6875,7 +6881,6 @@ <map><key>name</key><map><key>type</key><string>string</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>notecard</key><map><key>type</key><string>string</string></map></map> - <map><key>options</key><map><key>type</key><string>integer</string></map></map> </array> </map> <key>osNpcGetOwner</key> @@ -7100,13 +7105,13 @@ <key>osRegionNotice</key> <map> <key>arguments</key><array> - <map><key>agentID</key><map><key>type</key><string>key</string></map></map> <map><key>msg</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osRegionNotice</key> <map> <key>arguments</key><array> + <map><key>agentID</key><map><key>type</key><string>key</string></map></map> <map><key>msg</key><map><key>type</key><string>string</string></map></map> </array> </map> @@ -7478,6 +7483,8 @@ <key>arguments</key><array> <map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>value</key><map><key>type</key><string>string</string></map></map> + <map><key>start</key><map><key>type</key><string>integer</string></map></map> + <map><key>count</key><map><key>type</key><string>integer</string></map></map> <map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map> </array> </map> @@ -7487,8 +7494,6 @@ <key>arguments</key><array> <map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>value</key><map><key>type</key><string>string</string></map></map> - <map><key>start</key><map><key>type</key><string>integer</string></map></map> - <map><key>count</key><map><key>type</key><string>integer</string></map></map> <map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map> </array> </map> @@ -7554,8 +7559,7 @@ <map> <key>arguments</key><array> <map><key>agent</key><map><key>type</key><string>string</string></map></map> - <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> - <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> + <map><key>regionName</key><map><key>type</key><string>string</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7564,6 +7568,8 @@ <map> <key>arguments</key><array> <map><key>agent</key><map><key>type</key><string>string</string></map></map> + <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> + <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7572,7 +7578,6 @@ <map> <key>arguments</key><array> <map><key>agent</key><map><key>type</key><string>string</string></map></map> - <map><key>regionName</key><map><key>type</key><string>string</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7590,6 +7595,7 @@ <key>osTeleportOwner</key> <map> <key>arguments</key><array> + <map><key>regionName</key><map><key>type</key><string>string</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7597,7 +7603,8 @@ <key>osTeleportOwner</key> <map> <key>arguments</key><array> - <map><key>regionName</key><map><key>type</key><string>string</string></map></map> + <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> + <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7605,8 +7612,6 @@ <key>osTeleportOwner</key> <map> <key>arguments</key><array> - <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> - <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> -- cgit v1.1 From cadcf412ec55b38ff10596958cd09dd6ef4dfd3a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Apr 2019 14:04:02 +0100 Subject: linux likes other tz names --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4a74c15..de7da0e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -211,6 +211,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { PSTTimeZone = null; } + if(PSTTimeZone == null) + { + try + { + PSTTimeZone = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); + } + catch + { + PSTTimeZone = null; + } + } } public override Object InitializeLifetimeService() -- cgit v1.1 From 2c8e03b589585c1d4b19368f30ccf2806f09cafb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 00:25:38 +0100 Subject: testing ... --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++---- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 16 +--------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 62f0b32..9e0c783 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5149,7 +5149,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.DataLength = lastpos; m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, - delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + //delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + null, false, false); buf = newbuf; zc.Data = buf.Data; @@ -5173,7 +5174,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.Data[countposition] = (byte)count; buf.DataLength = zc.Finish(); m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, - delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + //delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + null, false, false); } } @@ -5296,7 +5298,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.DataLength = lastpos; m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, - delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + //delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + null, false, false); buf = newbuf; zc.Data = buf.Data; @@ -5319,7 +5322,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.Data[countposition] = (byte)count; buf.DataLength = zc.Finish(); m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, - delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + //delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); + null, false, false); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 19535dc..3817830 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -229,11 +229,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP StatVerbosity.Debug)); } - public virtual bool HandlesRegion(Location x) - { - return m_udpServer.HandlesRegion(x); - } - public virtual void Start() { m_udpServer.Start(); @@ -256,7 +251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary> public const int MTU = 1400; - public const int MAXPAYLOAD = 1250; + public const int MAXPAYLOAD = 1200; /// <summary>Number of forced client logouts due to no receipt of packets before timeout.</summary> public int ClientLogoutsDueToNoReceives { get; protected set; } @@ -298,9 +293,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// <summary>Reference to the scene this UDP server is attached to</summary> public Scene Scene { get; protected set; } - /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> - protected Location m_location; - /// <summary>The size of the receive buffer for the UDP socket. This value /// is passed up to the operating system and used in the system networking /// stack. Use zero to leave this value as the default</summary> @@ -545,7 +537,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } Scene = (Scene)scene; - m_location = new Location(Scene.RegionInfo.RegionHandle); OqrEngine = new JobEngine( string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name), @@ -673,11 +664,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP commands.Register(); } - public bool HandlesRegion(Location x) - { - return x == m_location; - } - public int GetTotalQueuedOutgoingPackets() { int total = 0; -- cgit v1.1 From f29fdb6bdae51e50f749e2144a3e92fb3171f436 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 10:22:55 +0100 Subject: old tp timing issues on grid presence notification did came back, so put back old hack --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 75d7bc5..a2c2aa7 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1147,11 +1147,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // in no close. sp.DoNotCloseAfterTeleport = false; + // we still need to flag this as child here + // a close from receiving region seems possible to happen before we reach sp.MakeChildAgent below + // causing the agent to be loggout out from grid incorrectly + sp.IsChildAgent = true; // Send the Update. If this returns true, we know the client has contacted the destination // via CompleteMovementIntoRegion, so we can let go. // If it returns false, something went wrong, and we need to abort. if (!UpdateAgent(reg, finalDestination, agent, sp, ctx)) { + sp.IsChildAgent = false; if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) { m_interRegionTeleportAborts.Value++; -- cgit v1.1 From b8a061816ff15bd6d021e4936ee4332877d557b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 12:46:21 +0100 Subject: degradate udp network efficiency a bit --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9e0c783..670d61f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5059,7 +5059,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (istree) maxUpdatesBytes -= 64; else - maxUpdatesBytes -= 100; // crude estimation + maxUpdatesBytes -= 120; // crude estimation if (compressedUpdates == null) { @@ -5277,9 +5277,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP lastzc = zc.ZeroCount; CreateCompressedUpdateBlockZC(sop, mysp, zc); - if (zc.Position < LLUDPServer.MAXPAYLOAD) + if (zc.Position < LLUDPServer.MAXPAYLOAD - 200) { - tau.Add(eu); + //tau.Add(eu); ++count; } else @@ -5312,7 +5312,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // im lazy now, just do last again CreateCompressedUpdateBlockZC(sop, mysp, zc); tau = new List<EntityUpdate>(30); - tau.Add(eu); + //tau.Add(eu); count = 1; } } -- cgit v1.1 From 49fb9d6b4bdb31d7a67bc0d97f565122a273bc96 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 13:05:18 +0100 Subject: degradate udp network efficiency a bit more --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 670d61f..2fb67e0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5127,7 +5127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP CreateAvatarUpdateBlock((ScenePresence)eu.Entity, zc); else CreatePrimUpdateBlock((SceneObjectPart)eu.Entity, mysp, zc); - if (zc.Position < LLUDPServer.MAXPAYLOAD) + if (zc.Position < LLUDPServer.MAXPAYLOAD - 200) { tau.Add(eu); ++count; -- cgit v1.1 From c09b312b058a9fb7d5da15abeb8708d69fd97cf5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 18:50:08 +0100 Subject: testing ... --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 6 ++++++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2fb67e0..b7e9117 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5429,7 +5429,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.DataLength = lastpos; // zero encode is not as spec m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, - delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, true); + //delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, true); + null, false, true); tau = new List<EntityUpdate>(30); tau.Add(eu); @@ -5444,7 +5445,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP buf.Data[17] = (byte)count; buf.DataLength = pos; m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, - delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, true); + //delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, true); + null, false, true); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 303f505..fc1e846 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -728,6 +728,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// acknowledgement</param> public void UpdateRoundTrip(float r) { + return; + /* const float ALPHA = 0.125f; const float BETA = 0.25f; const float K = 4.0f; @@ -755,6 +757,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //if (RTO != rto) // m_log.Debug("[LLUDPCLIENT]: Setting RTO to " + RTO + "ms from " + rto + "ms with an RTTVAR of " + //RTTVAR + " based on new RTT of " + r + "ms"); + */ } /// <summary> @@ -763,13 +766,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// </summary> public void BackoffRTO() { + return; // Reset SRTT and RTTVAR, we assume they are bogus since things // didn't work out and we're backing off the timeout + /* SRTT = 0.0f; RTTVAR = 0.0f; // Double the retransmission timeout RTO = Math.Min(RTO * 2, m_maxRTO); + */ } const double MIN_CALLBACK_MS = 20.0; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3817830..285751d 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1214,7 +1214,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Stats tracking Interlocked.Increment(ref udpClient.PacketsSent); PacketsSentCount++; - SyncSend(buffer); // Keep track of when this packet was sent out (right now) -- cgit v1.1 From b051b3a81dbb3bb0e7358e257b1cf82f5daee4ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 21:30:06 +0100 Subject: change to ping based RTO --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 68 ++++------------------ .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 14 ++--- .../Linden/UDP/UnackedPacketCollection.cs | 8 --- 3 files changed, 18 insertions(+), 72 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index fc1e846..f812ce1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// milliseconds or longer will be resent</summary> /// <remarks>Calculated from <seealso cref="SRTT"/> and <seealso cref="RTTVAR"/> using the /// guidelines in RFC 2988</remarks> - public int RTO; + public int m_RTO; /// <summary>Number of bytes received since the last acknowledgement was sent out. This is used /// to loosely follow the TCP delayed ACK algorithm in RFC 1122 (4.2.3.2)</summary> public int BytesSinceLastACK; @@ -190,7 +190,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private byte[] m_packedThrottles; private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC - private int m_maxRTO = 60000; + private int m_maxRTO = 10000; public bool m_deliverPackets = true; private float m_burstTime; @@ -264,7 +264,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // Default the retransmission timeout to one second - RTO = m_defaultRTO; + m_RTO = m_defaultRTO; // Initialize this to a sane value to prevent early disconnects TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; @@ -719,63 +719,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// <summary> - /// Called when an ACK packet is received and a round-trip time for a - /// packet is calculated. This is used to calculate the smoothed - /// round-trip time, round trip time variance, and finally the - /// retransmission timeout + /// Called when we get a ping update /// </summary> - /// <param name="r">Round-trip time of a single packet and its + /// <param name="r"> ping time in ms /// acknowledgement</param> - public void UpdateRoundTrip(float r) + public void UpdateRoundTrip(int p) { - return; - /* - const float ALPHA = 0.125f; - const float BETA = 0.25f; - const float K = 4.0f; + p *= 5; + if( p> m_maxRTO) + p = m_maxRTO; + else if(p < m_defaultRTO) + p = m_defaultRTO; - if (RTTVAR == 0.0f) - { - // First RTT measurement - SRTT = r; - RTTVAR = r * 0.5f; - } - else - { - // Subsequence RTT measurement - RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r); - SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r; - } - - int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); - - // Clamp the retransmission timeout to manageable values - rto = Utils.Clamp(rto, m_defaultRTO, m_maxRTO); - - RTO = rto; - - //if (RTO != rto) - // m_log.Debug("[LLUDPCLIENT]: Setting RTO to " + RTO + "ms from " + rto + "ms with an RTTVAR of " + - //RTTVAR + " based on new RTT of " + r + "ms"); - */ - } - - /// <summary> - /// Exponential backoff of the retransmission timeout, per section 5.5 - /// of RFC 2988 - /// </summary> - public void BackoffRTO() - { - return; - // Reset SRTT and RTTVAR, we assume they are bogus since things - // didn't work out and we're backing off the timeout - /* - SRTT = 0.0f; - RTTVAR = 0.0f; - - // Double the retransmission timeout - RTO = Math.Min(RTO * 2, m_maxRTO); - */ + m_RTO = p; } const double MIN_CALLBACK_MS = 20.0; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 285751d..e313934 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1120,13 +1120,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // Get a list of all of the packets that have been sitting unacked longer than udpClient.RTO - List<OutgoingPacket> expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO); + List<OutgoingPacket> expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.m_RTO); if (expiredPackets != null) { - //m_log.Debug("[LLUDPSERVER]: Handling " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); - // Exponential backoff of the retransmission timeout - udpClient.BackoffRTO(); for (int i = 0; i < expiredPackets.Count; ++i) expiredPackets[i].UnackedMethod(expiredPackets[i]); } @@ -1515,10 +1512,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP else if (packet.Type == PacketType.CompletePingCheck) { double t = Util.GetTimeStampMS() - udpClient.m_lastStartpingTimeMS; - double c = udpClient.m_pingMS; - c = 800 * c + 200 * t; - c /= 1000; - udpClient.m_pingMS = (int)c; + double c = 0.8 * udpClient.m_pingMS; + c += 0.2 * t; + int p = (int)c; + udpClient.m_pingMS = p; + udpClient.UpdateRoundTrip(p); return; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index 1f978e1..32a6c40 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs @@ -215,14 +215,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // As with other network applications, assume that an acknowledged packet is an // indication that the network can handle a little more load, speed up the transmission ackedPacket.Client.FlowThrottle.AcknowledgePackets(1); - - if (!pendingAcknowledgement.FromResend) - { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingAcknowledgement.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); - } } else { -- cgit v1.1 From b459b2c65f4aa393a07147ea56b21a433bc33fc9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 00:25:49 +0100 Subject: dont send animation before object --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 36 +++++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b7e9117..7dfcc7a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4967,15 +4967,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP continue; } - if (m_SupportObjectAnimations && updateFlags.HasFlag(PrimUpdateFlags.Animations)) + if (updateFlags == PrimUpdateFlags.Animations) { - if (part.Animations != null) + if (m_SupportObjectAnimations && part.Animations != null) { if (ObjectAnimationUpdates == null) ObjectAnimationUpdates = new List<SceneObjectPart>(); ObjectAnimationUpdates.Add(part); maxUpdatesBytes -= 20 * part.Animations.Count + 24; } + continue; } if(viewerCache) @@ -5126,7 +5127,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (eu.Entity is ScenePresence) CreateAvatarUpdateBlock((ScenePresence)eu.Entity, zc); else - CreatePrimUpdateBlock((SceneObjectPart)eu.Entity, mysp, zc); + { + SceneObjectPart part = (SceneObjectPart)eu.Entity; + if (eu.Flags.HasFlag(PrimUpdateFlags.Animations)) + { + if (m_SupportObjectAnimations && part.Animations != null) + { + if (ObjectAnimationUpdates == null) + ObjectAnimationUpdates = new List<SceneObjectPart>(); + ObjectAnimationUpdates.Add(part); + } + eu.Flags &= ~PrimUpdateFlags.Animations; + } + CreatePrimUpdateBlock(part, mysp, zc); + } if (zc.Position < LLUDPServer.MAXPAYLOAD - 200) { tau.Add(eu); @@ -5273,6 +5287,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP SceneObjectPart sop = (SceneObjectPart)eu.Entity; if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) continue; + + if (eu.Flags.HasFlag(PrimUpdateFlags.Animations)) + { + if (m_SupportObjectAnimations && sop.Animations != null) + { + if (ObjectAnimationUpdates == null) + ObjectAnimationUpdates = new List<SceneObjectPart>(); + ObjectAnimationUpdates.Add(sop); + } + eu.Flags &= ~PrimUpdateFlags.Animations; + } + lastpos = zc.Position; lastzc = zc.ZeroCount; @@ -6996,7 +7022,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddUInt(part.LocalId); zc.AddByte(state); // state zc.AddUUID(part.UUID); - zc.AddZeros(4); // crc unused + zc.AddUInt((uint)part.ParentGroup.PseudoCRC); zc.AddByte((byte)pcode); // material 1 // clickaction 1 @@ -7108,7 +7134,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddUInt(part.LocalId); zc.AddByte(state); // state zc.AddUUID(part.UUID); - zc.AddZeros(4); // crc unused + zc.AddUInt((uint)part.ParentGroup.PseudoCRC); zc.AddByte((byte)pcode); zc.AddByte(part.Material); zc.AddByte(part.ClickAction); // clickaction -- cgit v1.1 From ee989dd5522df30666b91bac5bb95643cc4a4523 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 00:27:17 +0100 Subject: missing file --- OpenSim/Framework/IClientAPI.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index b395f39..8d0cb5a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -596,6 +596,7 @@ namespace OpenSim.Framework public PrimUpdateFlags Flags { get { return m_flags; } + set { m_flags = value; } } public virtual void Update() -- cgit v1.1 From 4475b3db2774073d1ab430bc8aa33b310f5fff2e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 14:01:10 +0100 Subject: degradate udp network efficiency a even more --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7dfcc7a..988f547 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1672,7 +1672,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { s = 2 * i; OpenSimTerrainCompressor.CreatePatchFromTerrainData(bitpack, terrData, map[s], map[s + 1]); - if (bitpack.BytePos > 950 && i != numberPatchs - 1) + if (bitpack.BytePos > 900 && i != numberPatchs - 1) { //finish this packet bitpack.PackBitsFromByte(END_OF_PATCHES); @@ -5100,7 +5100,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(objectUpdates != null) { - int blocks = objectUpdates.Count; List<EntityUpdate> tau = new List<EntityUpdate>(30); UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); @@ -5141,13 +5140,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } CreatePrimUpdateBlock(part, mysp, zc); } - if (zc.Position < LLUDPServer.MAXPAYLOAD - 200) + if (zc.Position < LLUDPServer.MAXPAYLOAD - 300) { tau.Add(eu); ++count; - --blocks; } - else if (blocks > 0) + else { // we need more packets UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); @@ -5179,7 +5177,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP tau = new List<EntityUpdate>(30); tau.Add(eu); count = 1; - --blocks; } } -- cgit v1.1 From d9776131624703df55079e82bb4250cb1e5d3ec0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 21:28:41 +0100 Subject: do disable probes when voc is disabled --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 988f547..01a9fb6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -15413,7 +15413,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(m_supportViewerCache) ret = m_viewerHandShakeFlags; else - ret = m_viewerHandShakeFlags & 4; + ret = (m_viewerHandShakeFlags & 4) | 2; // disable probes if (m_scene.CapsModule != null) { -- cgit v1.1 From 2b604fa8894811a6ec4aaf70542c24d974026048 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 11 Apr 2019 23:44:18 +0100 Subject: update warp3d.dll --- bin/Warp3D.dll | Bin 75776 -> 76288 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/Warp3D.dll b/bin/Warp3D.dll index 523d67f..4eb3f77 100755 Binary files a/bin/Warp3D.dll and b/bin/Warp3D.dll differ -- cgit v1.1 From a824258c8888f207a425ed0f62adacbafe32d7c5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 11 Apr 2019 23:47:01 +0100 Subject: warp3d: reduce work prims textures to at most 256x256 --- OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 99cf121..f927573 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -790,7 +790,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap try { using (Bitmap img = (Bitmap)m_imgDecoder.DecodeToImage(asset)) - ret = new warp_Texture(img); + ret = new warp_Texture(img, 8); // reduce textures size to 256x256 } catch (Exception e) { -- cgit v1.1 From cfd39238684b64b66f2f469e803cef409d0dde6f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 Apr 2019 00:19:42 +0100 Subject: update warp3d.dll --- bin/Warp3D.dll | Bin 76288 -> 76288 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/Warp3D.dll b/bin/Warp3D.dll index 4eb3f77..055b8bc 100755 Binary files a/bin/Warp3D.dll and b/bin/Warp3D.dll differ -- cgit v1.1 From a83b7a292bc3c18c9c6a1aa17cfc2622b99804c4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 15 Apr 2019 23:32:22 +0100 Subject: mantis 8518: Yengine; we can't wait for GC (worse finalizers) to count released memory of some local variables, so add a pseudo free; fix memory account on timeslice rentry; change the folder for the debug IL files; fix memory usage on reset. This changes will only take effect on new compiles --- .../ScriptEngine/YEngine/MMRScriptCodeGen.cs | 48 ++++++--- .../ScriptEngine/YEngine/MMRScriptCollector.cs | 12 +-- .../ScriptEngine/YEngine/MMRScriptCompValu.cs | 4 +- .../ScriptEngine/YEngine/MMRScriptCompile.cs | 2 +- OpenSim/Region/ScriptEngine/YEngine/XMRArray.cs | 9 +- .../Region/ScriptEngine/YEngine/XMRHeapTracker.cs | 112 ++++++++++++++++----- .../Region/ScriptEngine/YEngine/XMRInstAbstract.cs | 59 +++++------ OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs | 7 ++ OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs | 5 +- 9 files changed, 178 insertions(+), 80 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs index 5f00f86..e6a4224 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs @@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine public CallLabel openCallLabel = null; // only one call label can be open at a time // - the call label is open from the time of CallPre() until corresponding CallPost() // - so no non-trivial pushes/pops etc allowed between a CallPre() and a CallPost() - + public List<ScriptMyLocal> HeapLocals = new List<ScriptMyLocal>(); private ScriptMyILGen _ilGen; public ScriptMyILGen ilGen { @@ -1258,6 +1258,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // resume at the correct spot. actCallLabels.Clear(); allCallLabels.Clear(); + HeapLocals.Clear(); openCallLabel = null; // Alloc stack space for local vars. @@ -1398,19 +1399,17 @@ namespace OpenSim.Region.ScriptEngine.Yengine _ilGen = collector.WriteOutAll(); collector = null; - // Output code to restore stack frame from stream. - // It jumps back to the call labels within the function body. List<ScriptMyLocal> activeTemps = null; - if(!isTrivial) + if (!isTrivial) { - // Build list of locals and temps active at all the call labels. + // Build list of locals and temps active at all the call labels. activeTemps = new List<ScriptMyLocal>(); - foreach(CallLabel cl in allCallLabels) - { - foreach(ScriptMyLocal lcl in cl.callLabel.whereAmI.localsReadBeforeWritten) + foreach (CallLabel cl in allCallLabels) { - if(!activeTemps.Contains(lcl)) + foreach(ScriptMyLocal lcl in cl.callLabel.whereAmI.localsReadBeforeWritten) { + if(!activeTemps.Contains(lcl)) + { activeTemps.Add(lcl); } } @@ -1452,11 +1451,34 @@ namespace OpenSim.Region.ScriptEngine.Yengine } // Output the 'real' return opcode. + // push return value ilGen.MarkLabel(retLabel); - if(!(curDeclFunc.retType is TokenTypeVoid)) + if (!(curDeclFunc.retType is TokenTypeVoid)) { ilGen.Emit(curDeclFunc, OpCodes.Ldloc, retValue); } + + // pseudo free memory usage + foreach (ScriptMyLocal sml in HeapLocals) + { + Type t = sml.type; + if (t == typeof(HeapTrackerList)) + { + ilGen.Emit(curDeclFunc, OpCodes.Ldloc, sml); + HeapTrackerList.GenFree(curDeclFunc, ilGen); + } + else if (t == typeof(HeapTrackerString)) + { + ilGen.Emit(curDeclFunc, OpCodes.Ldloc, sml); + HeapTrackerString.GenFree(curDeclFunc, ilGen); + } + else if (t == typeof(HeapTrackerObject)) + { + ilGen.Emit(curDeclFunc, OpCodes.Ldloc, sml); + HeapTrackerObject.GenFree(curDeclFunc, ilGen); + } + } + ilGen.Emit(curDeclFunc, OpCodes.Ret); retLabel = null; retValue = null; @@ -1675,11 +1697,11 @@ namespace OpenSim.Region.ScriptEngine.Yengine if(u != t) { if(t == typeof(HeapTrackerList)) - HeapTrackerList.GenPop(curDeclFunc, ilGen); + HeapTrackerList.GenRestore(curDeclFunc, ilGen); if(t == typeof(HeapTrackerObject)) - HeapTrackerObject.GenPop(curDeclFunc, ilGen); + HeapTrackerObject.GenRestore(curDeclFunc, ilGen); if(t == typeof(HeapTrackerString)) - HeapTrackerString.GenPop(curDeclFunc, ilGen); + HeapTrackerString.GenRestore(curDeclFunc, ilGen); } else { diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCollector.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCollector.cs index 75eae53..e92f429 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCollector.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCollector.cs @@ -2611,10 +2611,10 @@ namespace OpenSim.Region.ScriptEngine.Yengine // everything required by any blocks it can branch to. do { - this.resolvedSomething = false; - this.resolveSequence++; - this.ResolveBlock((GraphNodeBlock)firstLin); - } while(this.resolvedSomething); + resolvedSomething = false; + resolveSequence++; + ResolveBlock((GraphNodeBlock)firstLin); + } while(resolvedSomething); // Repeat the cutting loops as long as we keep finding stuff. bool didSomething; @@ -2939,7 +2939,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine return; // So we don't recurse forever on a backward branch. - currentBlock.hasBeenResolved = this.resolveSequence; + currentBlock.hasBeenResolved = resolveSequence; // Assume we haven't written any locals yet. List<ScriptMyLocal> localsWrittenSoFar = new List<ScriptMyLocal>(); @@ -2975,7 +2975,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine !currentBlock.localsReadBeforeWritten.Contains(readByNextBlock)) { currentBlock.localsReadBeforeWritten.Add(readByNextBlock); - this.resolvedSomething = true; + resolvedSomething = true; } } } diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompValu.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompValu.cs index 675ab9a..486d822 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompValu.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompValu.cs @@ -1483,7 +1483,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine { if(type.ToHeapTrackerType() != null) { - this.localBuilder = scg.ilGen.DeclareLocal(type.ToHeapTrackerType(), name); + localBuilder = scg.ilGen.DeclareLocal(type.ToHeapTrackerType(), name); + scg.HeapLocals.Add(localBuilder); scg.PushXMRInst(); scg.ilGen.Emit(type, OpCodes.Newobj, type.GetHeapTrackerCtor()); scg.ilGen.Emit(type, OpCodes.Stloc, localBuilder); @@ -1547,6 +1548,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine scg.ilGen.Emit(errorAt, OpCodes.Ldloc, localBuilder); scg.ilGen.Emit(errorAt, OpCodes.Ldloc, htpop); type.CallHeapTrackerPopMeth(errorAt, scg.ilGen); + scg.HeapLocals.Add(htpop); } else { diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompile.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompile.cs index f37efd4..8e15402 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompile.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCompile.cs @@ -130,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // Since we just wrote the .xmrobj file, maybe save disassembly. if (m_Engine.m_ScriptDebugSaveIL) { - string asmFileName = GetScriptFileName (m_ScriptObjCodeKey + ".yasm"); + string asmFileName = GetScriptILFileName(m_ScriptObjCodeKey + ".yasm"); // m_log.Debug ("[YEngine]: MMRScriptCompileSaveILGen: saving to " + asmFileName); asmFileWriter = File.CreateText (asmFileName); } diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRArray.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRArray.cs index 3d0525b..930a8d6 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRArray.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRArray.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // Save new value in array, replacing one of same key if there. // null means remove the value, ie, script did array[key] = undef. - if(value != null) + if (value != null) { dnary[key] = value; } @@ -285,10 +285,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine public void RecvArrayObj(RecvArrayObjDelegate recvObj) { heapUse = inst.UpdateHeapUse(heapUse, EMPTYHEAP); - - // Cause any enumeration to refill the array from the sorted dictionary. - // Since it is a sorted dictionary, any enumerations will be in the same - // order as on the sending side. + // Cause any enumeration to refill the array from the sorted dictionary. + // Since it is a sorted dictionary, any enumerations will be in the same + // order as on the sending side. arrayValid = 0; enumrValid = false; diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRHeapTracker.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRHeapTracker.cs index 33eb8bf..8b67349 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRHeapTracker.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRHeapTracker.cs @@ -58,11 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine if(inst == null) throw new ArgumentNullException("inst"); instance = inst; - } - - ~HeapTrackerBase() - { - usage = instance.UpdateHeapUse(usage, 0); + usage = 0; } } @@ -73,24 +69,33 @@ namespace OpenSim.Region.ScriptEngine.Yengine { private static FieldInfo listValueField = typeof(HeapTrackerList).GetField("value"); private static MethodInfo listSaveMethod = typeof(HeapTrackerList).GetMethod("Save"); + private static MethodInfo listRestoreMethod = typeof(HeapTrackerList).GetMethod("Restore"); + private static MethodInfo listFreeMethod = typeof(HeapTrackerList).GetMethod("Free"); public LSL_List value; - public HeapTrackerList(XMRInstAbstract inst) : base(inst) { } + public HeapTrackerList(XMRInstAbstract inst) : base(inst) {} - // generate CIL code to pop the value from the CIL stack + // generate CIL code to pop the value ie store in value // input: // 'this' pointer already pushed on CIL stack - // new value pushed on CIL stack + // new value // output: - // 'this' pointer popped from stack - // new value popped from CIL stack - // heap usage updated public static void GenPop(Token errorAt, ScriptMyILGen ilGen) { ilGen.Emit(errorAt, OpCodes.Call, listSaveMethod); } + public static void GenRestore(Token errorAt, ScriptMyILGen ilGen) + { + ilGen.Emit(errorAt, OpCodes.Call, listRestoreMethod); + } + + public static void GenFree(Token errorAt, ScriptMyILGen ilGen) + { + ilGen.Emit(errorAt, OpCodes.Call, listFreeMethod); + } + // generate CIL code to push the value on the CIL stack // input: // 'this' pointer already pushed on CIL stack @@ -106,23 +111,32 @@ namespace OpenSim.Region.ScriptEngine.Yengine public void Save(LSL_List lis) { - int newuse = Size(lis); - usage = instance.UpdateHeapUse(usage, newuse); + if (lis == null) + usage = instance.UpdateHeapUse(usage, 0); + else + usage = instance.UpdateHeapUse(usage, Size(lis)); value = lis; } - //private static int counter = 5; - public static int Size(LSL_List lis) + public void Restore(LSL_List lis) { - // VS2017 in debug mode seems to have a problem running this statement quickly: - //SLOW: return (!typeof(LSL_List).IsValueType && (lis == null)) ? 0 : lis.Size; - - //FAST: return 33; - //SLOW: return (lis == null) ? 0 : 99; - //FAST: return ++ counter; + value = lis; + if (lis != null) + usage = Size(lis); + else + usage = 0; + } - // VS2017 in debug mode seems content to run this quickly though: + public void Free() + { + usage = instance.UpdateHeapUse(usage, 0); + value = null; + instance = null; + } + //private static int counter = 5; + public static int Size(LSL_List lis) + { try { return lis.Size; @@ -141,6 +155,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine { private static FieldInfo objectValueField = typeof(HeapTrackerObject).GetField("value"); private static MethodInfo objectSaveMethod = typeof(HeapTrackerObject).GetMethod("Save"); + private static MethodInfo objectRestoreMethod = typeof(HeapTrackerObject).GetMethod("Restore"); + private static MethodInfo objectFreeMethod = typeof(HeapTrackerObject).GetMethod("Free"); public const int HT_CHAR = 2; public const int HT_DELE = 8; @@ -168,6 +184,16 @@ namespace OpenSim.Region.ScriptEngine.Yengine ilGen.Emit(errorAt, OpCodes.Call, objectSaveMethod); } + public static void GenRestore(Token errorAt, ScriptMyILGen ilGen) + { + ilGen.Emit(errorAt, OpCodes.Call, objectRestoreMethod); + } + + public static void GenFree(Token errorAt, ScriptMyILGen ilGen) + { + ilGen.Emit(errorAt, OpCodes.Call, objectFreeMethod); + } + // generate CIL code to push the value on the CIL stack // input: // 'this' pointer already pushed on CIL stack @@ -188,6 +214,19 @@ namespace OpenSim.Region.ScriptEngine.Yengine value = obj; } + public void Restore(object obj) + { + value = obj; + usage = Size(obj); + } + + public void Free() + { + usage = instance.UpdateHeapUse(usage, 0); + value = null; + instance = null; + } + // public so it can be used by XMRArray public static int Size(object obj) { @@ -204,8 +243,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine return HT_SING; if(obj is int) return HT_INT; - if(obj is LSL_Float) - return HT_SFLT; + if(obj is LSL_Float) // lsl floats are stupid doubles + return HT_DOUB; if(obj is LSL_Integer) return HT_INT; if(obj is LSL_List) @@ -252,7 +291,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine public class HeapTrackerString: HeapTrackerBase { private static FieldInfo stringValueField = typeof(HeapTrackerString).GetField("value"); + private static MethodInfo stringRestoreMethod = typeof(HeapTrackerString).GetMethod("Restore"); private static MethodInfo stringSaveMethod = typeof(HeapTrackerString).GetMethod("Save"); + private static MethodInfo stringFreeMethod = typeof(HeapTrackerString).GetMethod("Free"); public string value; @@ -271,6 +312,16 @@ namespace OpenSim.Region.ScriptEngine.Yengine ilGen.Emit(errorAt, OpCodes.Call, stringSaveMethod); } + public static void GenRestore(Token errorAt, ScriptMyILGen ilGen) + { + ilGen.Emit(errorAt, OpCodes.Call, stringRestoreMethod); + } + + public static void GenFree(Token errorAt, ScriptMyILGen ilGen) + { + ilGen.Emit(errorAt, OpCodes.Call, stringFreeMethod); + } + // generate CIL code to push the value on the CIL stack // input: // 'this' pointer already pushed on CIL stack @@ -291,6 +342,19 @@ namespace OpenSim.Region.ScriptEngine.Yengine value = str; } + public void Restore(string str) + { + value = str; + usage = Size(str); + } + + public void Free() + { + usage = instance.UpdateHeapUse(usage, 0); + value = null; + instance = null; + } + public static int Size(string str) { return (str == null) ? 0 : str.Length * HeapTrackerObject.HT_CHAR; diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs index a440cf3..f21116e 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs @@ -84,17 +84,36 @@ namespace OpenSim.Region.ScriptEngine.Yengine heapUse = instance.UpdateHeapUse(heapUse, 0); } + public void Clear() + { + heapUse = 0; + if(iarArrays != null) + { + foreach(XMR_Array xa in iarArrays) + xa.__pub_clear(); + } + if(iarChars != null) + iarChars = new char[iarChars.Length]; + if (iarLists != null) + iarLists = new LSL_List[iarLists.Length]; + if (iarObjects != null) + iarObjects = new object[iarObjects.Length]; + if(iarStrings != null) + iarStrings = new string[iarStrings.Length]; + } + public void AllocVarArrays(XMRInstArSizes ars) { ClearOldArrays(); + int newuse = heapUse + + ars.iasChars* HeapTrackerObject.HT_CHAR + + ars.iasFloats * HeapTrackerObject.HT_SFLT + + ars.iasIntegers * HeapTrackerObject.HT_INT + + ars.iasRotations * HeapTrackerObject.HT_ROT + + ars.iasVectors * HeapTrackerObject.HT_VEC + + ars.iasSDTIntfObjs * HeapTrackerObject.HT_DELE; - heapUse = instance.UpdateHeapUse(heapUse, - ars.iasChars * HeapTrackerObject.HT_CHAR + - ars.iasFloats * HeapTrackerObject.HT_SFLT + - ars.iasIntegers * HeapTrackerObject.HT_INT + - ars.iasRotations * HeapTrackerObject.HT_ROT + - ars.iasVectors * HeapTrackerObject.HT_VEC + - ars.iasSDTIntfObjs * HeapTrackerObject.HT_DELE); + heapUse = instance.UpdateHeapUse(heapUse, newuse); iarArrays = (ars.iasArrays > 0) ? new XMR_Array[ars.iasArrays] : noArrays; iarChars = (ars.iasChars > 0) ? new char[ars.iasChars] : noChars; @@ -424,31 +443,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine \**************************************************/ protected int heapLimit; - private int heapUsed; + protected int heapUsed; public virtual int UpdateHeapUse(int olduse, int newuse) { - if(newuse <= olduse) - Interlocked.Add(ref heapUsed, newuse - olduse); - else - { - int newtotal, oldtotal; - do - { - oldtotal = Interlocked.Add(ref heapUsed, 0); - newtotal = oldtotal + newuse - olduse; - if(newtotal > heapLimit) - { - // System.GC.Collect (); - // System.GC.WaitForPendingFinalizers (); - oldtotal = Interlocked.Add(ref heapUsed, 0); - newtotal = oldtotal + newuse - olduse; - if(newtotal > heapLimit) - throw new OutOfHeapException(oldtotal, newtotal, heapLimit); - } - } while(Interlocked.CompareExchange(ref heapUsed, newtotal, oldtotal) != oldtotal); - } - + int newtotal = Interlocked.Add(ref heapUsed, newuse - olduse); + if(newtotal > heapLimit) + throw new OutOfHeapException(newtotal + olduse - newuse, newtotal, heapLimit); return newuse; } diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs index ff8dae5..e97c71e 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstMisc.cs @@ -236,6 +236,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine return GetScriptFileName(m_ScriptBasePath, filename); } + public string GetScriptILFileName(string filename) + { + string path = Path.Combine(m_ScriptBasePath, "DebugIL"); + Directory.CreateDirectory(path); + return Path.Combine(path, filename); + } + public static string GetScriptFileName(string scriptBasePath, string filename) { // Get old path, ie, all files lumped in a single huge directory. diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index 4f94c23..987e22c 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -841,6 +841,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine m_SleepUntil = DateTime.MinValue; // not doing llSleep() m_ResetCount++; // has been reset once more + heapUsed = 0; + glblVars.Clear(); + // Tell next call to 'default state_entry()' to reset all global // vars to their initial values. doGblInit = true; @@ -848,7 +851,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // Throw away all its stack frames. // If the script is resetting itself, there shouldn't be any stack frames. // If the script is being reset by something else, we throw them away cuz we want to start from the beginning of an event handler. - stackFrames = null; + stackFrames = null; // Set script to 'default' state and queue call to its // 'state_entry()' event handler. -- cgit v1.1 From 2fa5d10c00d09f48dadc1a43a9ff191389e8d4d1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 00:07:13 +0100 Subject: Ynegine: add some missing memory usage on script reset --- OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs index f21116e..65bdf51 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs @@ -86,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine public void Clear() { - heapUse = 0; + int newheapUse = 0; if(iarArrays != null) { foreach(XMR_Array xa in iarArrays) @@ -100,9 +100,19 @@ namespace OpenSim.Region.ScriptEngine.Yengine iarObjects = new object[iarObjects.Length]; if(iarStrings != null) iarStrings = new string[iarStrings.Length]; + if (iarFloats != null) + newheapUse += iarFloats.Length * HeapTrackerObject.HT_DOUB; + if (iarIntegers != null) + newheapUse += iarIntegers.Length * HeapTrackerObject.HT_INT; + if (iarRotations != null) + newheapUse += iarRotations.Length * HeapTrackerObject.HT_ROT; + if (iarVectors != null) + newheapUse += iarVectors.Length * HeapTrackerObject.HT_VEC; + + heapUse = instance.UpdateHeapUse(0, newheapUse); } - public void AllocVarArrays(XMRInstArSizes ars) + public void AllocVarArrays(XMRInstArSizes ars) { ClearOldArrays(); int newuse = heapUse + @@ -204,7 +214,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // value types simply are the size of the value * number of values newheapuse += chrs.Length * HeapTrackerObject.HT_CHAR; - newheapuse += flts.Length * HeapTrackerObject.HT_SFLT; + newheapuse += flts.Length * HeapTrackerObject.HT_DOUB; newheapuse += ints.Length * HeapTrackerObject.HT_INT; newheapuse += rots.Length * HeapTrackerObject.HT_ROT; newheapuse += vecs.Length * HeapTrackerObject.HT_VEC; -- cgit v1.1 From 6bbd5eb6a20aeef37aab1832c464c09d8d62f27b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 11:39:28 +0100 Subject: Yengine: change binary code version, so scripts are automaticly recompiled with new changes --- OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs index e6a4224..27fde5b 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine public static readonly string OBJECT_CODE_MAGIC = "YObjectCode"; // reserve positive version values for original xmr - public static int COMPILED_VERSION_VALUE = -1; // decremented when compiler or object file changes + public static int COMPILED_VERSION_VALUE = -2; // decremented when compiler or object file changes public static readonly int CALL_FRAME_MEMUSE = 64; public static readonly int STRING_LEN_TO_MEMUSE = 2; -- cgit v1.1 From 09d92565dc3dd0b663d796e51a0a4e927f0e3337 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 15:31:31 +0100 Subject: typo on a debug message format --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index f56b212..4e451b5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -233,7 +233,7 @@ namespace OpenSim.Region.ClientStack.Linden else { m_log.WarnFormat( - "[EVENTQUEUE]: (Enqueue) No queue found for agent {0} in region {2}", + "[EVENTQUEUE]: (Enqueue) No queue found for agent {0} in region {1}", avatarID, m_scene.Name); } } -- cgit v1.1 From 37fb937e0d3b6a7e19c46c2fb6e06894c6bf7918 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 17:28:09 +0100 Subject: Yengine: rename a field, do some updates using interlocked --- .../Region/ScriptEngine/YEngine/XMRInstAbstract.cs | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs index 65bdf51..dec775f 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine public Delegate[][] iarSDTIntfObjs; private XMRInstAbstract instance; - private int heapUse; + private int arraysHeapUse; private static readonly XMR_Array[] noArrays = new XMR_Array[0]; private static readonly char[] noChars = new char[0]; @@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine ~XMRInstArrays() { - heapUse = instance.UpdateHeapUse(heapUse, 0); + arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, 0); } public void Clear() @@ -109,13 +109,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine if (iarVectors != null) newheapUse += iarVectors.Length * HeapTrackerObject.HT_VEC; - heapUse = instance.UpdateHeapUse(0, newheapUse); + arraysHeapUse = instance.UpdateHeapUse(0, newheapUse); } public void AllocVarArrays(XMRInstArSizes ars) { ClearOldArrays(); - int newuse = heapUse + + int newuse = arraysHeapUse + ars.iasChars* HeapTrackerObject.HT_CHAR + ars.iasFloats * HeapTrackerObject.HT_SFLT + ars.iasIntegers * HeapTrackerObject.HT_INT + @@ -123,7 +123,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine ars.iasVectors * HeapTrackerObject.HT_VEC + ars.iasSDTIntfObjs * HeapTrackerObject.HT_DELE; - heapUse = instance.UpdateHeapUse(heapUse, newuse); + arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, newuse); iarArrays = (ars.iasArrays > 0) ? new XMR_Array[ars.iasArrays] : noArrays; iarChars = (ars.iasChars > 0) ? new char[ars.iasChars] : noChars; @@ -143,9 +143,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine */ public void PopList(int index, LSL_List lis) { - LSL_List old = iarLists[index]; - int newheapuse = heapUse + HeapTrackerList.Size(lis) - HeapTrackerList.Size(old); - heapUse = instance.UpdateHeapUse(heapUse, newheapuse); + int delta = HeapTrackerObject.Size(lis) - HeapTrackerObject.Size(iarLists[index]); + instance.UpdateHeapUse(0, delta); + Interlocked.Add(ref arraysHeapUse, delta); iarLists[index] = lis; } @@ -154,9 +154,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine */ public void PopObject(int index, object obj) { - object old = iarObjects[index]; - int newheapuse = heapUse + HeapTrackerObject.Size(obj) - HeapTrackerObject.Size(old); - heapUse = instance.UpdateHeapUse(heapUse, newheapuse); + int delta = HeapTrackerObject.Size(obj) - HeapTrackerObject.Size(iarObjects[index]); + instance.UpdateHeapUse(0, delta); + Interlocked.Add(ref arraysHeapUse, delta); iarObjects[index] = obj; } @@ -165,9 +165,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine */ public void PopString(int index, string str) { - string old = iarStrings[index]; - int newheapuse = heapUse + HeapTrackerString.Size(str) - HeapTrackerString.Size(old); - heapUse = instance.UpdateHeapUse(heapUse, newheapuse); + int delta = HeapTrackerString.Size(str) - HeapTrackerString.Size(iarStrings[index]); + instance.UpdateHeapUse(0, delta); + Interlocked.Add(ref arraysHeapUse, delta); iarStrings[index] = str; } @@ -210,7 +210,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine iarSDTClObjs = (XMRSDTypeClObj[])recver(); Delegate[][] dels = (Delegate[][])recver(); - int newheapuse = heapUse; + int newheapuse = arraysHeapUse; // value types simply are the size of the value * number of values newheapuse += chrs.Length * HeapTrackerObject.HT_CHAR; @@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // others (XMR_Array, XMRSDTypeClObj) keep track of their own heap usage // update script heap usage, throwing an exception before finalizing changes - heapUse = instance.UpdateHeapUse(heapUse, newheapuse); + arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, newheapuse); iarChars = chrs; iarFloats = flts; @@ -248,7 +248,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine private void ClearOldArrays() { - int newheapuse = heapUse; + int newheapuse = arraysHeapUse; iarArrays = null; if(iarChars != null) @@ -301,7 +301,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine iarSDTIntfObjs = null; } - heapUse = instance.UpdateHeapUse(heapUse, newheapuse); + arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, newheapuse); } } -- cgit v1.1 From 11cad57c9cac5c17a9d658da7ec2e8c4b5cc75d1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 19:07:26 +0100 Subject: lludp: change burst, make it per category (overall reduction) --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 37 ++++++++++++++++++++-- .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 32 ++++++++----------- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f812ce1..7c8e226 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -260,7 +260,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize the packet outboxes, where packets sit while they are waiting for tokens m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); // Initialize the token buckets that control the throttling for each category - m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); + //m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); + float rate = rates.GetRate(type); + float burst = rate * rates.BrustTime; + m_throttleCategories[i] = new TokenBucket(m_throttleClient, rate , burst); } // Default the retransmission timeout to one second @@ -443,7 +446,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int total = resend + land + wind + cloud + task + texture + asset; - float m_burst = total * m_burstTime; + //float m_burst = total * m_burstTime; if (ThrottleDebugLevel > 0) { @@ -453,7 +456,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } TokenBucket bucket; - + /* bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; bucket.RequestedDripRate = resend; bucket.RequestedBurst = m_burst; @@ -481,6 +484,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; bucket.RequestedBurst = m_burst; + */ + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; + bucket.RequestedDripRate = resend; + bucket.RequestedBurst = resend * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land]; + bucket.RequestedDripRate = land; + bucket.RequestedBurst = land * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind]; + bucket.RequestedDripRate = wind; + bucket.RequestedBurst = wind * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud]; + bucket.RequestedDripRate = cloud; + bucket.RequestedBurst = cloud * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset]; + bucket.RequestedDripRate = asset; + bucket.RequestedBurst = asset * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; + bucket.RequestedDripRate = task; + bucket.RequestedBurst = task * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; + bucket.RequestedDripRate = texture; + bucket.RequestedBurst = texture * m_burstTime; // Reset the packed throttles cached data m_packedThrottles = null; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 1daf091..1bf05a3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -45,22 +45,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP private static Int32 m_counter = 0; -// private Int32 m_identifier; - protected const float m_timeScale = 1e-3f; /// <summary> - /// This is the number of m_minimumDripRate bytes - /// allowed in a burst - /// roughtly, with this settings, the maximum time system will take - /// to recheck a bucket in ms - /// + /// minimum recovery rate, ie bandwith /// </summary> - protected const float m_quantumsPerBurst = 5; + protected const float MINDRIPRATE = 500; - /// <summary> - /// </summary> - protected const float m_minimumDripRate = 1500; + // minimum and maximim burst size, ie max number of bytes token can have + protected const float MINBURST = 1500; // can't be less than one MTU or it will block + protected const float MAXBURST = 7500; /// <summary>Time of the last drip</summary> protected double m_lastDrip; @@ -109,10 +103,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_burst; } set { float rate = (value < 0 ? 0 : value); - if (rate < 1.5f * m_minimumDripRate) - rate = 1.5f * m_minimumDripRate; - else if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; + if (rate < MINBURST) + rate = MINBURST; + else if (rate > MAXBURST) + rate = MAXBURST; m_burst = rate; } @@ -122,8 +116,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { get { float rate = RequestedBurst * BurstModifier(); - if (rate < m_minimumDripRate) - rate = m_minimumDripRate; + if (rate < MINBURST) + rate = MINBURST; return (float)rate; } } @@ -159,8 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP return rate; rate *= m_parent.DripRateModifier(); - if (rate < m_minimumDripRate) - rate = m_minimumDripRate; + if (rate < MINDRIPRATE) + rate = MINDRIPRATE; return (float)rate; } -- cgit v1.1 From 2b4e5fcded071cde180149ddc6eee454e8ce4e2b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Apr 2019 13:17:40 +0100 Subject: mantis 8517: let texture argument of PRIM_TEXTURE only change the other parameters. On PRIM_NORMAL and PRIM_SPECULAR will be as NULL_KEY removing the material. This may be changed for coerence in future --- .../Shared/Api/Implementation/LSL_Api.cs | 125 ++++++++++++--------- 1 file changed, 72 insertions(+), 53 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 45efa77..cbd2b3c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2410,12 +2410,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID textureID = new UUID(); - - textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); - if (textureID == UUID.Zero) + bool dotexture = true; + if(String.IsNullOrEmpty(texture)) + dotexture = false; + else { - if (!UUID.TryParse(texture, out textureID)) - return; + textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); + if (textureID == UUID.Zero) + { + if (!UUID.TryParse(texture, out textureID)) + return; + } } Primitive.TextureEntry tex = part.Shape.Textures; @@ -2424,7 +2429,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (face >= 0 && face < nsides) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); - texface.TextureID = textureID; + if (dotexture) + texface.TextureID = textureID; texface.RepeatU = (float)scaleU; texface.RepeatV = (float)ScaleV; texface.OffsetU = (float)offsetU; @@ -2440,7 +2446,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (tex.FaceTextures[i] != null) { - tex.FaceTextures[i].TextureID = textureID; + if (dotexture) + tex.FaceTextures[i].TextureID = textureID; tex.FaceTextures[i].RepeatU = (float)scaleU; tex.FaceTextures[i].RepeatV = (float)ScaleV; tex.FaceTextures[i].OffsetU = (float)offsetU; @@ -2448,7 +2455,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api tex.FaceTextures[i].Rotation = (float)rotation; } } - tex.DefaultTexture.TextureID = textureID; + if (dotexture) + tex.DefaultTexture.TextureID = textureID; tex.DefaultTexture.RepeatU = (float)scaleU; tex.DefaultTexture.RepeatV = (float)ScaleV; tex.DefaultTexture.OffsetU = (float)offsetU; @@ -10422,17 +10430,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } string mapname = rules.Data[idx++].ToString(); - - UUID mapID = ScriptUtils.GetAssetIdFromItemName(m_host, mapname, (int)AssetType.Texture); - if (mapID == UUID.Zero) + UUID mapID = UUID.Zero; + if (!string.IsNullOrEmpty(mapname)) { - if (!UUID.TryParse(mapname, out mapID)) + mapID = ScriptUtils.GetAssetIdFromItemName(m_host, mapname, (int)AssetType.Texture); + if (mapID == UUID.Zero) { - Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NORMAL: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1)); - return new LSL_List(); + if (!UUID.TryParse(mapname, out mapID)) + { + Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NORMAL: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1)); + return new LSL_List(); + } } } - LSL_Vector mnrepeat; try { @@ -10489,17 +10499,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } string smapname = rules.Data[idx++].ToString(); - - UUID smapID = ScriptUtils.GetAssetIdFromItemName(m_host, smapname, (int)AssetType.Texture); - if (smapID == UUID.Zero) + UUID smapID = UUID.Zero; + if(!string.IsNullOrEmpty(smapname)) { - if (!UUID.TryParse(smapname, out smapID)) + smapID = ScriptUtils.GetAssetIdFromItemName(m_host, smapname, (int)AssetType.Texture); + if (smapID == UUID.Zero) { - Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SPECULAR: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1)); - return new LSL_List(); + if (!UUID.TryParse(smapname, out smapID)) + { + Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SPECULAR: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1)); + return new LSL_List(); + } } } - LSL_Vector msrepeat; try { @@ -10715,24 +10727,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api FaceMaterial mat = null; UUID oldid = texface.MaterialID; - if(oldid != UUID.Zero) - mat = m_materialsModule.GetMaterialCopy(oldid); + if(mapID != UUID.Zero) + { + if(oldid != UUID.Zero) + mat = m_materialsModule.GetMaterialCopy(oldid); - if(mat == null) - mat = new FaceMaterial(); + if(mat == null) + mat = new FaceMaterial(); - mat.NormalMapID = mapID; - mat.NormalOffsetX = offsetX; - mat.NormalOffsetY = offsetY; - mat.NormalRepeatX = repeatX; - mat.NormalRepeatY = repeatY; - mat.NormalRotation = rot; + mat.NormalMapID = mapID; + mat.NormalOffsetX = offsetX; + mat.NormalOffsetY = offsetY; + mat.NormalRepeatX = repeatX; + mat.NormalRepeatY = repeatY; + mat.NormalRotation = rot; - UUID id = m_materialsModule.AddNewMaterial(mat); - if(oldid == id) + mapID = m_materialsModule.AddNewMaterial(mat); + } + if(oldid == mapID) return false; - texface.MaterialID = id; + texface.MaterialID = mapID; part.Shape.TextureEntry = tex.GetBytes(9); m_materialsModule.RemoveMaterial(oldid); return true; @@ -10777,29 +10792,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api FaceMaterial mat = null; UUID oldid = texface.MaterialID; - if(oldid != UUID.Zero) - mat = m_materialsModule.GetMaterialCopy(oldid); + if (mapID != UUID.Zero) + { + if (oldid != UUID.Zero) + mat = m_materialsModule.GetMaterialCopy(oldid); - if(mat == null) - mat = new FaceMaterial(); + if (mat == null) + mat = new FaceMaterial(); - mat.SpecularMapID = mapID; - mat.SpecularOffsetX = offsetX; - mat.SpecularOffsetY = offsetY; - mat.SpecularRepeatX = repeatX; - mat.SpecularRepeatY = repeatY; - mat.SpecularRotation = rot; - mat.SpecularLightColorR = colorR; - mat.SpecularLightColorG = colorG; - mat.SpecularLightColorB = colorB; - mat.SpecularLightExponent = gloss; - mat.EnvironmentIntensity = env; + mat.SpecularMapID = mapID; + mat.SpecularOffsetX = offsetX; + mat.SpecularOffsetY = offsetY; + mat.SpecularRepeatX = repeatX; + mat.SpecularRepeatY = repeatY; + mat.SpecularRotation = rot; + mat.SpecularLightColorR = colorR; + mat.SpecularLightColorG = colorG; + mat.SpecularLightColorB = colorB; + mat.SpecularLightExponent = gloss; + mat.EnvironmentIntensity = env; - UUID id = m_materialsModule.AddNewMaterial(mat); - if(oldid == id) + mapID = m_materialsModule.AddNewMaterial(mat); + } + + if(oldid == mapID) return false; - texface.MaterialID = id; + texface.MaterialID = mapID; part.Shape.TextureEntry = tex.GetBytes(9); m_materialsModule.RemoveMaterial(oldid); return true; -- cgit v1.1 From bd442208d84e3412385ecb3421344e871206e0a4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Apr 2019 14:01:54 +0100 Subject: mantis 8517: actually let NULL_KEY do the same as on PRIM_TEXTURE --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cbd2b3c..5c6b7b2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2411,7 +2411,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID textureID = new UUID(); bool dotexture = true; - if(String.IsNullOrEmpty(texture)) + if(String.IsNullOrEmpty(texture) || texture == ScriptBaseClass.NULL_KEY) dotexture = false; else { -- cgit v1.1 From 5314f375c50f3a81f0bad0507800745a555b7e59 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Apr 2019 15:26:27 +0100 Subject: change osSetProjectionParams a bit and add a variant that atkes a linknumber argument. For now can only change one prim per call --- .../Shared/Api/Implementation/OSSL_Api.cs | 36 ++++++++++++++++++++-- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 5 +-- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 9 ++++-- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index de7da0e..c1c1eaf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3818,15 +3818,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// <summary> /// Set parameters for light projection in host prim /// </summary> - public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) + public void osSetProjectionParams(LSL_Integer projection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb) { - osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); + SetProjectionParams(m_host, projection, texture, fov, focus, amb); + } + + /// <summary> + /// Set parameters for light projection of a linkset prim + /// </summary> + public void osSetProjectionParams(LSL_Integer linknum, LSL_Integer projection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb) + { + if (linknum == ScriptBaseClass.LINK_THIS || linknum == m_host.LinkNum) + { + SetProjectionParams(m_host, projection, texture, fov, focus, amb); + return; + } + + if (linknum < 0 || linknum > m_host.ParentGroup.PrimCount) + return; + + if(linknum < 2 && m_host.LinkNum < 2) + { + SetProjectionParams(m_host, projection, texture, fov, focus, amb); + return; + } + + SceneObjectPart obj = m_host.ParentGroup.GetLinkNumPart(linknum); + if(obj != null) + SetProjectionParams(obj, projection, texture, fov, focus, amb); } /// <summary> /// Set parameters for light projection with uuid of target prim /// </summary> - public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) + public void osSetProjectionParams(LSL_Key prim, LSL_Integer llprojection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb) { CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); @@ -3841,7 +3866,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj == null) return; } + SetProjectionParams(obj, llprojection, texture, fov, focus, amb); + } + private void SetProjectionParams(SceneObjectPart obj, LSL_Integer llprojection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb) + { + bool projection = llprojection != 0; obj.Shape.ProjectionEntry = projection; obj.Shape.ProjectionTextureUUID = new UUID(texture); obj.Shape.ProjectionFOV = (float)fov; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 26bac00..ce6aaf8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -393,8 +393,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osForceOtherSit(string avatar, string target); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); - void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb); - void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); + void osSetProjectionParams(LSL_Integer projection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb); + void osSetProjectionParams(LSL_Key prim, LSL_Integer projection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb); + void osSetProjectionParams(LSL_Integer linknumber, LSL_Integer projection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb); LSL_List osGetAvatarList(); LSL_List osGetNPCList(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 7a4a5fb..fd5142f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -1035,16 +1035,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osSetPrimitiveParams(prim, rules); } - public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) + public void osSetProjectionParams(LSL_Integer projection, LSL_Key texture, double fov, double focus, double amb) { m_OSSL_Functions.osSetProjectionParams(projection, texture, fov, focus, amb); } - public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) + public void osSetProjectionParams(LSL_Key prim, LSL_Integer projection, LSL_Key texture, double fov, double focus, double amb) { m_OSSL_Functions.osSetProjectionParams(prim, projection, texture, fov, focus, amb); } + public void osSetProjectionParams(LSL_Integer linknumber, LSL_Integer projection, LSL_Key texture, LSL_Float fov, LSL_Float focus, LSL_Float amb) + { + m_OSSL_Functions.osSetProjectionParams(linknumber, projection, texture, fov, focus, amb); + } + public LSL_List osGetAvatarList() { return m_OSSL_Functions.osGetAvatarList(); -- cgit v1.1 From 8994045d5fdfe2c9f61d3a6a92c8dbc97462db7a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 Apr 2019 14:52:15 +0100 Subject: old typo --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 6 ++--- .../Region/ClientStack/Linden/UDP/ThrottleRates.cs | 6 ++--- bin/ScriptSyntax.xml | 27 +++++++++++++++------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 7c8e226..4e9cf1c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -242,7 +242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (maxRTO != 0) m_maxRTO = maxRTO; - m_burstTime = rates.BrustTime; + m_burstTime = rates.BurstTime; float m_burst = rates.ClientMaxRate * m_burstTime; // Create a token bucket throttle for this client that has the scene token bucket as a parent @@ -251,7 +251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; - m_burst = rates.Total * rates.BrustTime; + m_burst = rates.Total * rates.BurstTime; for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { @@ -262,7 +262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize the token buckets that control the throttling for each category //m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); float rate = rates.GetRate(type); - float burst = rate * rates.BrustTime; + float burst = rate * rates.BurstTime; m_throttleCategories[i] = new TokenBucket(m_throttleClient, rate , burst); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index 3277638..707acdd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Int64 MinimumAdaptiveThrottleRate; public int ClientMaxRate; - public float BrustTime; + public float BurstTime; /// <summary> /// Default constructor @@ -94,8 +94,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (ClientMaxRate > 1000000) ClientMaxRate = 1000000; // no more than 8Mbps - BrustTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10); - BrustTime *= 1e-3f; + BurstTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10); + BurstTime *= 1e-3f; // Adaptive is broken // AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); diff --git a/bin/ScriptSyntax.xml b/bin/ScriptSyntax.xml index 989984a..d01414b 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -e796a21f-5a66-e4ec-833f-c4896b8e87e4 +5b85f255-466f-238d-90ed-5726eaa2e67b <llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer> <key>controls</key> <map> @@ -6754,15 +6754,15 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 <key>osKickAvatar</key> <map> <key>arguments</key><array> - <map><key>FirstName</key><map><key>type</key><string>string</string></map></map> - <map><key>SurName</key><map><key>type</key><string>string</string></map></map> + <map><key>agentId</key><map><key>type</key><string>key</string></map></map> <map><key>alert</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osKickAvatar</key> <map> <key>arguments</key><array> - <map><key>agentId</key><map><key>type</key><string>key</string></map></map> + <map><key>FirstName</key><map><key>type</key><string>string</string></map></map> + <map><key>SurName</key><map><key>type</key><string>string</string></map></map> <map><key>alert</key><map><key>type</key><string>string</string></map></map> </array> </map> @@ -7351,6 +7351,7 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 <key>osSetProjectionParams</key> <map> <key>arguments</key><array> + <map><key>prim</key><map><key>type</key><string>key</string></map></map> <map><key>projection</key><map><key>type</key><string>integer</string></map></map> <map><key>texture</key><map><key>type</key><string>key</string></map></map> <map><key>fov</key><map><key>type</key><string>float</string></map></map> @@ -7361,7 +7362,17 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 <key>osSetProjectionParams</key> <map> <key>arguments</key><array> - <map><key>prim</key><map><key>type</key><string>key</string></map></map> + <map><key>projection</key><map><key>type</key><string>integer</string></map></map> + <map><key>texture</key><map><key>type</key><string>key</string></map></map> + <map><key>fov</key><map><key>type</key><string>float</string></map></map> + <map><key>focus</key><map><key>type</key><string>float</string></map></map> + <map><key>amb</key><map><key>type</key><string>float</string></map></map> + </array> + </map> + <key>osSetProjectionParams</key> + <map> + <key>arguments</key><array> + <map><key>linknumber</key><map><key>type</key><string>integer</string></map></map> <map><key>projection</key><map><key>type</key><string>integer</string></map></map> <map><key>texture</key><map><key>type</key><string>key</string></map></map> <map><key>fov</key><map><key>type</key><string>float</string></map></map> @@ -7595,7 +7606,8 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 <key>osTeleportOwner</key> <map> <key>arguments</key><array> - <map><key>regionName</key><map><key>type</key><string>string</string></map></map> + <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> + <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7603,8 +7615,7 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 <key>osTeleportOwner</key> <map> <key>arguments</key><array> - <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> - <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> + <map><key>regionName</key><map><key>type</key><string>string</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> -- cgit v1.1 From 15dd03349024d74d4db22f5c6dab77570eb9c340 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 22:52:58 +0100 Subject: primbasicshape: convert eventual MeshEP to SculpEP --- OpenSim/Framework/PrimitiveBaseShape.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index a5f3ba6..a49f53c 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1039,6 +1039,7 @@ namespace OpenSim.Framework const byte LightEP = 0x20; const byte SculptEP = 0x30; const byte ProjectionEP = 0x40; + //const byte MeshEP = 0x60; const byte MeshFlagsEP = 0x70; int TotalBytesLength = 1; // ExtraParamsNum @@ -1121,7 +1122,10 @@ namespace OpenSim.Framework if (_sculptEntry) { - returnBytes[i] = SculptEP; + //if(_sculptType == 5) + // returnBytes[i] = MeshEP; + //else + returnBytes[i] = SculptEP; i += 2; returnBytes[i] = 17; i += 4; @@ -1164,6 +1168,7 @@ namespace OpenSim.Framework const ushort LightEP = 0x20; const ushort SculptEP = 0x30; const ushort ProjectionEP = 0x40; + const ushort MeshEP = 0x60; const ushort MeshFlagsEP = 0x70; switch (type) @@ -1186,6 +1191,7 @@ namespace OpenSim.Framework ReadLightData(data, 0); break; + case MeshEP: case SculptEP: if (!inUse) { @@ -1231,6 +1237,7 @@ namespace OpenSim.Framework const byte LightEP = 0x20; const byte SculptEP = 0x30; const byte ProjectionEP = 0x40; + const byte MeshEP = 0x60; const byte MeshFlagsEP = 0x70; byte extraParamCount = data[0]; @@ -1252,6 +1259,7 @@ namespace OpenSim.Framework i += 16; break; + case MeshEP: case SculptEP: ReadSculptData(data, i); i += 17; -- cgit v1.1 From e9587c88354964f7b1e5ca38e1b1f8b6da7ef9d4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 22:56:31 +0100 Subject: sop: rename a few fields --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 14 +++--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 50 +++++++++++----------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0b38179..c0bafc5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -770,9 +770,9 @@ namespace OpenSim.Region.Framework.Scenes } if(av.IsNPC) - av.crossingFlags = 0; + av.m_crossingFlags = 0; else - av.crossingFlags = cflags; + av.m_crossingFlags = cflags; av.PrevSitOffset = av.OffsetPosition; av.ParentID = 0; @@ -821,7 +821,7 @@ namespace OpenSim.Region.Framework.Scenes if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx)) crossedfar = true; else - av.crossingFlags = 0; + av.m_crossingFlags = 0; } if(crossedfar) @@ -834,7 +834,7 @@ namespace OpenSim.Region.Framework.Scenes av.IsInTransit = true; m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); - if(av.crossingFlags > 0) + if(av.m_crossingFlags > 0) entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); if (av.IsChildAgent) @@ -849,7 +849,7 @@ namespace OpenSim.Region.Framework.Scenes av.ParentPart = null; // In any case av.IsInTransit = false; - av.crossingFlags = 0; + av.m_crossingFlags = 0; m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); } else @@ -865,7 +865,7 @@ namespace OpenSim.Region.Framework.Scenes oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); av.AbsolutePosition = oldp; - av.crossingFlags = 0; + av.m_crossingFlags = 0; av.sitAnimation = "SIT"; av.IsInTransit = false; if(av.Animator!= null) @@ -926,7 +926,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avinfo.av; av.ParentUUID = UUID.Zero; av.ParentID = avinfo.ParentID; - av.crossingFlags = 0; + av.m_crossingFlags = 0; } } avsToCross.Clear(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c536184..b341d48 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -601,9 +601,9 @@ namespace OpenSim.Region.Framework.Scenes public string Firstname { get; private set; } public string Lastname { get; private set; } - public bool haveGroupInformation; - public bool gotCrossUpdate; - public byte crossingFlags; + public bool m_haveGroupInformation; + public bool m_gotCrossUpdate; + public byte m_crossingFlags; public string Grouptitle { @@ -1322,7 +1322,7 @@ namespace OpenSim.Region.Framework.Scenes { part.AddSittingAvatar(this); // if not actually on the target invalidate it - if(gotCrossUpdate && (crossingFlags & 0x04) == 0) + if(m_gotCrossUpdate && (m_crossingFlags & 0x04) == 0) part.SitTargetAvatar = UUID.Zero; ParentID = part.LocalId; @@ -1604,9 +1604,9 @@ namespace OpenSim.Region.Framework.Scenes public void MakeChildAgent(ulong newRegionHandle) { m_updateAgentReceivedAfterTransferEvent.Reset(); - haveGroupInformation = false; - gotCrossUpdate = false; - crossingFlags = 0; + m_haveGroupInformation = false; + m_gotCrossUpdate = false; + m_crossingFlags = 0; m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; RegionHandle = newRegionHandle; @@ -2152,7 +2152,7 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { - if (!haveGroupInformation) + if (!m_haveGroupInformation) { IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); if (gm != null) @@ -2171,9 +2171,9 @@ namespace OpenSim.Region.Framework.Scenes } if (m_teleportFlags > 0) - gotCrossUpdate = false; // sanity check + m_gotCrossUpdate = false; // sanity check - if (!gotCrossUpdate) + if (!m_gotCrossUpdate) RotateToLookAt(look); m_previusParcelHide = false; @@ -2185,7 +2185,7 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; // Tell the client that we're ready to send rest - if (!gotCrossUpdate) + if (!m_gotCrossUpdate) { m_gotRegionHandShake = false; // allow it if not a crossing ControllingClient.SendRegionHandshake(); @@ -2197,7 +2197,7 @@ namespace OpenSim.Region.Framework.Scenes if(!IsNPC) { - if( ParentPart != null && (crossingFlags & 0x08) != 0) + if( ParentPart != null && (m_crossingFlags & 0x08) != 0) { ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); } @@ -2221,13 +2221,13 @@ namespace OpenSim.Region.Framework.Scenes GodController.SyncViewerState(); // start sending terrain patchs - if (!gotCrossUpdate) + if (!m_gotCrossUpdate) Scene.SendLayerData(ControllingClient); // send initial land overlay and parcel ILandChannel landch = m_scene.LandChannel; if (landch != null) - landch.sendClientInitialLandInfo(client, !gotCrossUpdate); + landch.sendClientInitialLandInfo(client, !m_gotCrossUpdate); } List<ScenePresence> allpresences = m_scene.GetScenePresences(); @@ -2318,7 +2318,7 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { - if(gotCrossUpdate) + if(m_gotCrossUpdate) { SendOtherAgentsAvatarFullToMe(); @@ -2356,7 +2356,7 @@ namespace OpenSim.Region.Framework.Scenes IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); if (friendsModule != null) { - if(gotCrossUpdate) + if(m_gotCrossUpdate) friendsModule.IsNowRoot(this); else friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); @@ -2367,9 +2367,9 @@ namespace OpenSim.Region.Framework.Scenes } finally { - haveGroupInformation = false; - gotCrossUpdate = false; - crossingFlags = 0; + m_haveGroupInformation = false; + m_gotCrossUpdate = false; + m_crossingFlags = 0; m_inTransit = false; } @@ -4910,7 +4910,7 @@ namespace OpenSim.Region.Framework.Scenes if(isCrossUpdate) { - cAgent.CrossingFlags = crossingFlags; + cAgent.CrossingFlags = m_crossingFlags; cAgent.CrossingFlags |= 1; cAgent.CrossExtraFlags = 0; if((LastCommands & ScriptControlled.CONTROL_LBUTTON) != 0) @@ -5047,9 +5047,9 @@ namespace OpenSim.Region.Framework.Scenes if (cAgent.MotionState != 0) Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; - crossingFlags = cAgent.CrossingFlags; - gotCrossUpdate = (crossingFlags != 0); - if(gotCrossUpdate) + m_crossingFlags = cAgent.CrossingFlags; + m_gotCrossUpdate = (m_crossingFlags != 0); + if(m_gotCrossUpdate) { LastCommands &= ~(ScriptControlled.CONTROL_LBUTTON | ScriptControlled.CONTROL_ML_LBUTTON); if((cAgent.CrossExtraFlags & 1) != 0) @@ -5059,11 +5059,11 @@ namespace OpenSim.Region.Framework.Scenes MouseDown = (cAgent.CrossExtraFlags & 3) != 0; } - haveGroupInformation = false; + m_haveGroupInformation = false; // using this as protocol detection don't want to mess with the numbers for now if(cAgent.ActiveGroupTitle != null) { - haveGroupInformation = true; + m_haveGroupInformation = true; COF = cAgent.agentCOF; if(ControllingClient.IsGroupMember(cAgent.ActiveGroupID)) { -- cgit v1.1 From 3491af440f7d4852415f574b06356bec3006c0c8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 23:01:37 +0100 Subject: missing files... --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 6 +++--- .../CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs | 2 +- .../CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs | 2 +- OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 772485c..39bf46c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private void OnMakeRootAgent(ScenePresence sp) { - if(sp.gotCrossUpdate) + if(sp.m_gotCrossUpdate) return; RecacheFriends(sp.ControllingClient); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a2c2aa7..187df31 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1874,7 +1874,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); Vector3 vel2 = Vector3.Zero; - if((agent.crossingFlags & 2) != 0) + if((agent.m_crossingFlags & 2) != 0) vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); if (m_eqModule != null) @@ -1900,10 +1900,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if(childRegionsToClose != null) agent.CloseChildAgents(childRegionsToClose); - if((agent.crossingFlags & 8) == 0) + if((agent.m_crossingFlags & 8) == 0) agent.ClearControls(); // don't let attachments delete (called in HasMovedAway) disturb taken controls on viewers - agent.HasMovedAway((agent.crossingFlags & 8) == 0); + agent.HasMovedAway((agent.m_crossingFlags & 8) == 0); agent.MakeChildAgent(neighbourRegion.RegionHandle); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs index 1529fc2..615ae78 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser if (sp.IsNPC) return; - if(sp.gotCrossUpdate) + if(sp.m_gotCrossUpdate) { Util.FireAndForget(delegate { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index 3f418f6..6f4eace 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence sp.ControllingClient.OnConnectionClosed += OnConnectionClose; - if (sp.gotCrossUpdate) + if (sp.m_gotCrossUpdate) { Util.FireAndForget(delegate { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 65d50bb..4b81838 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // There might be some problem with the thread we're generating this on but not // doing the update at this time causes problems (Mantis #7920 and #7915) // TODO: move sending this update to a later time in the rootification of the client. - if(!sp.haveGroupInformation) + if(!sp.m_haveGroupInformation) SendAgentGroupDataUpdate(sp.ControllingClient, false); } -- cgit v1.1 From 9225b783092d3265714520fdfdab8100902b27c2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 23:04:04 +0100 Subject: missing files... --- OpenSim/Addons/Groups/GroupsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 5b76e0a..e98bc0f 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -249,7 +249,7 @@ namespace OpenSim.Groups // There might be some problem with the thread we're generating this on but not // doing the update at this time causes problems (Mantis #7920 and #7915) // TODO: move sending this update to a later time in the rootification of the client. - if(!sp.haveGroupInformation) + if(!sp.m_haveGroupInformation) SendAgentGroupDataUpdate(sp.ControllingClient, false); } -- cgit v1.1 From 11c945a5651d8e55c6948df9a026ff3d85566b51 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 1 May 2019 01:35:45 +0100 Subject: add osLocalTeleportAgent(key agent, vector position, vector velocity, vector lookat, LSL_Integer flags). Velocity only works with ubOde but still not good. flags = bit field: 1 use velocity, 2 use lookat, 4 rotate avatar look in current velocity direction (ignored if 2 ie flag = 7 is same as 3). This bypasses most the unnecessary logic of osTeleportAgent, having usage same permissions. It may do region crossings(?). Experimental stage, feedbakc expected ;) --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 +++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 ++++++++++------------ .../Region/PhysicsModules/ubOde/ODECharacter.cs | 4 +- .../Shared/Api/Implementation/OSSL_Api.cs | 17 ++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ 6 files changed, 62 insertions(+), 28 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2fa92b3..073d11f 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4795,6 +4795,20 @@ Label_GroupsDone: return true; } + + /// <summary> + /// Tries to teleport agent within region. + /// </summary> + /// <param name="remoteClient"></param> + /// <param name="position"></param> + /// <param name="lookAt"></param> + /// <param name="teleportFlags"></param> + public void RequestLocalTeleport(ScenePresence sp, Vector3 position, Vector3 vel, + Vector3 lookat, int flags) + { + sp.LocalTeleport(position, vel, lookat, flags); + } + /// <summary> /// Tries to teleport agent to another region. /// </summary> diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b341d48..56e822a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1688,10 +1688,6 @@ namespace OpenSim.Region.Framework.Scenes // } } - /// <summary> - /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. - /// </summary> - /// <param name="pos"></param> public void Teleport(Vector3 pos) { TeleportWithMomentum(pos, Vector3.Zero); @@ -1736,36 +1732,37 @@ namespace OpenSim.Region.Framework.Scenes SendTerseUpdateToAllClients(); } - public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) + public void LocalTeleport(Vector3 newpos, Vector3 newvel, Vector3 newlookat, int flags) { if(!CheckLocalTPLandingPoint(ref newpos)) return; AbsolutePosition = newpos; - if (newvel.HasValue) + if ((flags & 1) != 0) { - if ((Vector3)newvel == Vector3.Zero) - { - if (PhysicsActor != null) - PhysicsActor.SetMomentum(Vector3.Zero); - m_velocity = Vector3.Zero; - } - else - { - if (PhysicsActor != null) - PhysicsActor.SetMomentum((Vector3)newvel); - m_velocity = (Vector3)newvel; + if (PhysicsActor != null) + PhysicsActor.SetMomentum(newvel); + m_velocity = newvel; + } - if (rotateToVelXY) - { - Vector3 lookAt = (Vector3)newvel; - lookAt.Z = 0; - lookAt.Normalize(); - ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation); - return; - } - } + if ((flags & 2) != 0) + { + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); + } + else if((flags & 4) != 0) + { + if((flags & 1) != 0) + newlookat = newvel; + else + newlookat = m_velocity; + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); } SendTerseUpdateToAllClients(); } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 267fc5b..cec8b74 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -1976,8 +1976,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeTargetVelocity(Vector3 newVel) { - m_pidControllerActive = true; - m_freemove = false; + //m_pidControllerActive = true; + //m_freemove = false; _target_velocity = newVel; if (Body != IntPtr.Zero) SafeNativeMethods.BodyEnable(Body); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c1c1eaf..a0f784e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -924,6 +924,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Teleport functions + public void osLocalTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Vector3 lookat, LSL_Integer flags) + { + UUID agentId; + if (!UUID.TryParse(agent, out agentId)) + return; + + ScenePresence presence = World.GetScenePresence(agentId); + if (presence == null || presence.IsDeleted || presence.IsInTransit) + return; + + Vector3 pos = presence.AbsolutePosition; + if (!checkAllowAgentTPbyLandOwner(agentId, pos)) + return; + + World.RequestLocalTeleport(presence, position, velocity, lookat, flags); + } + public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index ce6aaf8..194df36 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -150,6 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osGetAgentIP(string agent); // Teleport commands + void osLocalTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Vector3 lookat, LSL_Integer flags); void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index fd5142f..88ea9d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -247,6 +247,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase // Teleport Functions + public void osLocalTeleportAgent(LSL_Key agent, vector position, vector velocity, vector lookat, LSL_Integer flags) + { + m_OSSL_Functions.osLocalTeleportAgent(agent, position, velocity, lookat, flags); + } + public void osTeleportAgent(string agent, string regionName, vector position, vector lookat) { m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat); -- cgit v1.1 From ea32a73103b3df4b6c5d904ae92e088e0b5bbdc2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 1 May 2019 03:49:24 +0100 Subject: osLocalTeleportAgent: no region crossings :( ; check avatar access to target position; flag 8 == force fly; 16 force nofly (both == fly) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 77 +++++++++++++++++++--- .../Region/PhysicsModules/ubOde/ODECharacter.cs | 1 + 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 56e822a..cd2b9b4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1734,24 +1734,72 @@ namespace OpenSim.Region.Framework.Scenes public void LocalTeleport(Vector3 newpos, Vector3 newvel, Vector3 newlookat, int flags) { - if(!CheckLocalTPLandingPoint(ref newpos)) - return; + if (newpos.X <= 0) + { + newpos.X = 0.1f; + if (newvel.X < 0) + newvel.X = 0; + } + else if (newpos.X >= Scene.RegionInfo.RegionSizeX) + { + newpos.X = Scene.RegionInfo.RegionSizeX - 0.1f; + if (newvel.X > 0) + newvel.X = 0; + } - AbsolutePosition = newpos; + if (newpos.Y <= 0) + { + newpos.Y = 0.1f; + if (newvel.Y < 0) + newvel.Y = 0; + } + else if (newpos.Y >= Scene.RegionInfo.RegionSizeY) + { + newpos.Y = Scene.RegionInfo.RegionSizeY - 0.1f; + if (newvel.Y > 0) + newvel.Y = 0; + } - if ((flags & 1) != 0) + string reason; + if (!m_scene.TestLandRestrictions(UUID, out reason, ref newpos.X, ref newpos.Y)) + return ; + + if (IsSatOnObject) + StandUp(); + + float localHalfAVHeight = 0.8f; + if (Appearance != null) + localHalfAVHeight = Appearance.AvatarHeight / 2; + + float posZLimit = 22; + + // TODO: Check other Scene HeightField + posZLimit = (float)Scene.Heightmap[(int)newpos.X, (int)newpos.Y]; + + posZLimit += localHalfAVHeight + 0.1f; + + if ((newpos.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { - if (PhysicsActor != null) - PhysicsActor.SetMomentum(newvel); - m_velocity = newvel; + newpos.Z = posZLimit; } + if ((flags & 8) != 0) + Flying = true; + else if ((flags & 16) != 0) + Flying = false; + + uint tpflags = (uint)TeleportFlags.ViaLocation; + if(Flying) + tpflags |= (uint)TeleportFlags.IsFlying; + + Vector3 lookat = Lookat; + if ((flags & 2) != 0) { newlookat.Z = 0; newlookat.Normalize(); if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); + lookat = newlookat; } else if((flags & 4) != 0) { @@ -1762,8 +1810,19 @@ namespace OpenSim.Region.Framework.Scenes newlookat.Z = 0; newlookat.Normalize(); if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); + lookat = newlookat; + } + + AbsolutePosition = newpos; + ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); + + if ((flags & 1) != 0) + { + if (PhysicsActor != null) + PhysicsActor.SetMomentum(newvel); + m_velocity = newvel; } + SendTerseUpdateToAllClients(); } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index cec8b74..b86be0f 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -1921,6 +1921,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde _position = newPos; m_freemove = false; + _zeroFlag = false; m_pidControllerActive = true; } -- cgit v1.1 From 3a055c578d9fb2e1f6c0c9ba47a7b8c9c5d8af48 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 2 May 2019 03:11:16 +0100 Subject: soem cleanup --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 +-- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- .../Shared/Api/Runtime/LSL_Constants.cs | 15 ++- bin/ScriptSyntax.xml | 104 ++++++++++++++------- 4 files changed, 90 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd2b9b4..b12bb45 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1769,19 +1769,12 @@ namespace OpenSim.Region.Framework.Scenes float localHalfAVHeight = 0.8f; if (Appearance != null) - localHalfAVHeight = Appearance.AvatarHeight / 2; - - float posZLimit = 22; - - // TODO: Check other Scene HeightField - posZLimit = (float)Scene.Heightmap[(int)newpos.X, (int)newpos.Y]; + localHalfAVHeight = Appearance.AvatarHeight * 0.5f; + float posZLimit = (float)Scene.Heightmap[(int)newpos.X, (int)newpos.Y]; posZLimit += localHalfAVHeight + 0.1f; - - if ((newpos.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) - { + if (newpos.Z < posZLimit) newpos.Z = posZLimit; - } if ((flags & 8) != 0) Flying = true; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a0f784e..7d3c832 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -936,7 +936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 pos = presence.AbsolutePosition; if (!checkAllowAgentTPbyLandOwner(agentId, pos)) - return; + return; World.RequestLocalTeleport(presence, position, velocity, lookat, flags); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 8b70128..86c6d7c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public partial class ScriptBaseClass { // SCRIPTS CONSTANTS - public static readonly LSLInteger OS_APIVERSION = 3; + public static readonly LSLInteger OS_APIVERSION = 4; public static readonly LSLInteger TRUE = 1; public static readonly LSLInteger FALSE = 0; @@ -898,6 +898,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase //ApiDesc osTeleportObject flag: the rotation is the final rotation, otherwise is a added rotation public const int OSTPOBJ_SETROT = 0x4; + //ApiDesc osLocalTeleportAgent no flags + public const int OS_LTPAG_NONE = 0x0; + //ApiDesc osLocalTeleportAgent use velocity + public const int OS_LTPAG_USEVEL = 0x1; + //ApiDesc osLocalTeleportAgent use lookat + public const int OS_LTPAG_USELOOKAT = 0x2; + //ApiDesc osLocalTeleportAgent align lookat to velocity + public const int OS_LTPAG_ALGNLV = 0x4; + //ApiDesc osLocalTeleportAgent force fly + public const int OS_LTPAG_FORCEFLY = 0x8; + //ApiDesc osLocalTeleportAgent force no fly + public const int OS_LTPAG_FORCENOFLY = 0x16; + // Constants for Windlight public const int WL_WATER_COLOR = 0; public const int WL_WATER_FOG_DENSITY_EXPONENT = 1; diff --git a/bin/ScriptSyntax.xml b/bin/ScriptSyntax.xml index d01414b..2282ada 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -5b85f255-466f-238d-90ed-5726eaa2e67b +24121ec8-c0a3-099d-8d83-64feaa32418c <llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer> <key>controls</key> <map> @@ -1513,7 +1513,7 @@ </map> <key>OS_APIVERSION</key><map> <key>type</key><string>integer</string> - <key>value</key><string>3</string> + <key>value</key><string>4</string> </map> <key>OS_ATTACH_MSG_ALL</key><map> <key>type</key><string>integer</string> @@ -1539,6 +1539,36 @@ <key>type</key><string>integer</string> <key>value</key><string>0x1</string> </map> + <key>OS_LTPAG_ALGNLV</key><map> + <key>type</key><string>integer</string> + <key>value</key><string>0x4</string> + <key>tooltip</key><string>osLocalTeleportAgent align lookat to velocity</string> + </map> + <key>OS_LTPAG_FORCEFLY</key><map> + <key>type</key><string>integer</string> + <key>value</key><string>0x8</string> + <key>tooltip</key><string>osLocalTeleportAgent force fly</string> + </map> + <key>OS_LTPAG_FORCENOFLY</key><map> + <key>type</key><string>integer</string> + <key>value</key><string>0x16</string> + <key>tooltip</key><string>osLocalTeleportAgent force no fly</string> + </map> + <key>OS_LTPAG_NONE</key><map> + <key>type</key><string>integer</string> + <key>value</key><string>0x0</string> + <key>tooltip</key><string>osLocalTeleportAgent no flags</string> + </map> + <key>OS_LTPAG_USELOOKAT</key><map> + <key>type</key><string>integer</string> + <key>value</key><string>0x2</string> + <key>tooltip</key><string>osLocalTeleportAgent use lookat</string> + </map> + <key>OS_LTPAG_USEVEL</key><map> + <key>type</key><string>integer</string> + <key>value</key><string>0x1</string> + <key>tooltip</key><string>osLocalTeleportAgent use velocity</string> + </map> <key>OS_NPC_CREATOR_OWNED</key><map> <key>type</key><string>integer</string> <key>value</key><string>0x1</string> @@ -6116,49 +6146,49 @@ <key>arguments</key><array> <map><key>a</key><map><key>type</key><string>float</string></map></map> <map><key>b</key><map><key>type</key><string>float</string></map></map> - <map><key>margin</key><map><key>type</key><string>float</string></map></map> </array> </map> <key>osApproxEquals</key> <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>ra</key><map><key>type</key><string>rotation</string></map></map> - <map><key>rb</key><map><key>type</key><string>rotation</string></map></map> - <map><key>margin</key><map><key>type</key><string>float</string></map></map> + <map><key>va</key><map><key>type</key><string>vector</string></map></map> + <map><key>vb</key><map><key>type</key><string>vector</string></map></map> </array> </map> <key>osApproxEquals</key> <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>ra</key><map><key>type</key><string>rotation</string></map></map> - <map><key>rb</key><map><key>type</key><string>rotation</string></map></map> + <map><key>a</key><map><key>type</key><string>float</string></map></map> + <map><key>b</key><map><key>type</key><string>float</string></map></map> + <map><key>margin</key><map><key>type</key><string>float</string></map></map> </array> </map> <key>osApproxEquals</key> <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>va</key><map><key>type</key><string>vector</string></map></map> - <map><key>vb</key><map><key>type</key><string>vector</string></map></map> - <map><key>margin</key><map><key>type</key><string>float</string></map></map> + <map><key>ra</key><map><key>type</key><string>rotation</string></map></map> + <map><key>rb</key><map><key>type</key><string>rotation</string></map></map> </array> </map> <key>osApproxEquals</key> <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>va</key><map><key>type</key><string>vector</string></map></map> - <map><key>vb</key><map><key>type</key><string>vector</string></map></map> + <map><key>ra</key><map><key>type</key><string>rotation</string></map></map> + <map><key>rb</key><map><key>type</key><string>rotation</string></map></map> + <map><key>margin</key><map><key>type</key><string>float</string></map></map> </array> </map> <key>osApproxEquals</key> <map> <key>return</key><string>integer</string> <key>arguments</key><array> - <map><key>a</key><map><key>type</key><string>float</string></map></map> - <map><key>b</key><map><key>type</key><string>float</string></map></map> + <map><key>va</key><map><key>type</key><string>vector</string></map></map> + <map><key>vb</key><map><key>type</key><string>vector</string></map></map> + <map><key>margin</key><map><key>type</key><string>float</string></map></map> </array> </map> <key>osAvatarName2Key</key> @@ -6284,8 +6314,6 @@ <key>return</key><string>string</string> <key>arguments</key><array> <map><key>drawList</key><map><key>type</key><string>string</string></map></map> - <map><key>startX</key><map><key>type</key><string>integer</string></map></map> - <map><key>startY</key><map><key>type</key><string>integer</string></map></map> <map><key>endX</key><map><key>type</key><string>integer</string></map></map> <map><key>endY</key><map><key>type</key><string>integer</string></map></map> </array> @@ -6295,6 +6323,8 @@ <key>return</key><string>string</string> <key>arguments</key><array> <map><key>drawList</key><map><key>type</key><string>string</string></map></map> + <map><key>startX</key><map><key>type</key><string>integer</string></map></map> + <map><key>startY</key><map><key>type</key><string>integer</string></map></map> <map><key>endX</key><map><key>type</key><string>integer</string></map></map> <map><key>endY</key><map><key>type</key><string>integer</string></map></map> </array> @@ -6433,13 +6463,13 @@ <map> <key>arguments</key><array> <map><key>avatar</key><map><key>type</key><string>string</string></map></map> + <map><key>target</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osForceOtherSit</key> <map> <key>arguments</key><array> <map><key>avatar</key><map><key>type</key><string>string</string></map></map> - <map><key>target</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osFormatString</key> @@ -6754,15 +6784,15 @@ <key>osKickAvatar</key> <map> <key>arguments</key><array> - <map><key>agentId</key><map><key>type</key><string>key</string></map></map> + <map><key>FirstName</key><map><key>type</key><string>string</string></map></map> + <map><key>SurName</key><map><key>type</key><string>string</string></map></map> <map><key>alert</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osKickAvatar</key> <map> <key>arguments</key><array> - <map><key>FirstName</key><map><key>type</key><string>string</string></map></map> - <map><key>SurName</key><map><key>type</key><string>string</string></map></map> + <map><key>agentId</key><map><key>type</key><string>key</string></map></map> <map><key>alert</key><map><key>type</key><string>string</string></map></map> </array> </map> @@ -6781,6 +6811,16 @@ <key>return</key><string>string</string> <key>arguments</key><undef/> </map> + <key>osLocalTeleportAgent</key> + <map> + <key>arguments</key><array> + <map><key>agent</key><map><key>type</key><string>key</string></map></map> + <map><key>position</key><map><key>type</key><string>vector</string></map></map> + <map><key>velocity</key><map><key>type</key><string>vector</string></map></map> + <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> + <map><key>flags</key><map><key>type</key><string>integer</string></map></map> + </array> + </map> <key>osLoopSound</key> <map> <key>arguments</key><array> @@ -7105,13 +7145,13 @@ <key>osRegionNotice</key> <map> <key>arguments</key><array> + <map><key>agentID</key><map><key>type</key><string>key</string></map></map> <map><key>msg</key><map><key>type</key><string>string</string></map></map> </array> </map> <key>osRegionNotice</key> <map> <key>arguments</key><array> - <map><key>agentID</key><map><key>type</key><string>key</string></map></map> <map><key>msg</key><map><key>type</key><string>string</string></map></map> </array> </map> @@ -7351,7 +7391,6 @@ <key>osSetProjectionParams</key> <map> <key>arguments</key><array> - <map><key>prim</key><map><key>type</key><string>key</string></map></map> <map><key>projection</key><map><key>type</key><string>integer</string></map></map> <map><key>texture</key><map><key>type</key><string>key</string></map></map> <map><key>fov</key><map><key>type</key><string>float</string></map></map> @@ -7362,6 +7401,7 @@ <key>osSetProjectionParams</key> <map> <key>arguments</key><array> + <map><key>linknumber</key><map><key>type</key><string>integer</string></map></map> <map><key>projection</key><map><key>type</key><string>integer</string></map></map> <map><key>texture</key><map><key>type</key><string>key</string></map></map> <map><key>fov</key><map><key>type</key><string>float</string></map></map> @@ -7372,7 +7412,7 @@ <key>osSetProjectionParams</key> <map> <key>arguments</key><array> - <map><key>linknumber</key><map><key>type</key><string>integer</string></map></map> + <map><key>prim</key><map><key>type</key><string>key</string></map></map> <map><key>projection</key><map><key>type</key><string>integer</string></map></map> <map><key>texture</key><map><key>type</key><string>key</string></map></map> <map><key>fov</key><map><key>type</key><string>float</string></map></map> @@ -7494,8 +7534,6 @@ <key>arguments</key><array> <map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>value</key><map><key>type</key><string>string</string></map></map> - <map><key>start</key><map><key>type</key><string>integer</string></map></map> - <map><key>count</key><map><key>type</key><string>integer</string></map></map> <map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map> </array> </map> @@ -7505,6 +7543,8 @@ <key>arguments</key><array> <map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>value</key><map><key>type</key><string>string</string></map></map> + <map><key>start</key><map><key>type</key><string>integer</string></map></map> + <map><key>count</key><map><key>type</key><string>integer</string></map></map> <map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map> </array> </map> @@ -7541,6 +7581,7 @@ <key>arguments</key><array> <map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>start</key><map><key>type</key><string>integer</string></map></map> + <map><key>length</key><map><key>type</key><string>integer</string></map></map> </array> </map> <key>osStringSubString</key> @@ -7549,7 +7590,6 @@ <key>arguments</key><array> <map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>start</key><map><key>type</key><string>integer</string></map></map> - <map><key>length</key><map><key>type</key><string>integer</string></map></map> </array> </map> <key>osSunGetParam</key> @@ -7579,8 +7619,6 @@ <map> <key>arguments</key><array> <map><key>agent</key><map><key>type</key><string>string</string></map></map> - <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> - <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7589,6 +7627,8 @@ <map> <key>arguments</key><array> <map><key>agent</key><map><key>type</key><string>string</string></map></map> + <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> + <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7606,8 +7646,6 @@ <key>osTeleportOwner</key> <map> <key>arguments</key><array> - <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> - <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7615,7 +7653,8 @@ <key>osTeleportOwner</key> <map> <key>arguments</key><array> - <map><key>regionName</key><map><key>type</key><string>string</string></map></map> + <map><key>regionX</key><map><key>type</key><string>integer</string></map></map> + <map><key>regionY</key><map><key>type</key><string>integer</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> @@ -7623,6 +7662,7 @@ <key>osTeleportOwner</key> <map> <key>arguments</key><array> + <map><key>regionName</key><map><key>type</key><string>string</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map> </array> -- cgit v1.1 From 3ae4115e4390eab1391b74ba82792dc5df9dac1e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 3 May 2019 00:39:55 +0100 Subject: osLocalTeleportAgent: if lookat or fly options, just move the avatar, not telling viewer about any teleport --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 61 +++++++++++++----------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b12bb45..f569d21 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1776,38 +1776,43 @@ namespace OpenSim.Region.Framework.Scenes if (newpos.Z < posZLimit) newpos.Z = posZLimit; - if ((flags & 8) != 0) - Flying = true; - else if ((flags & 16) != 0) - Flying = false; + if((flags & 0x1e) != 0) + { + if ((flags & 8) != 0) + Flying = true; + else if ((flags & 16) != 0) + Flying = false; - uint tpflags = (uint)TeleportFlags.ViaLocation; - if(Flying) - tpflags |= (uint)TeleportFlags.IsFlying; + uint tpflags = (uint)TeleportFlags.ViaLocation; + if(Flying) + tpflags |= (uint)TeleportFlags.IsFlying; - Vector3 lookat = Lookat; + Vector3 lookat = Lookat; - if ((flags & 2) != 0) - { - newlookat.Z = 0; - newlookat.Normalize(); - if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - lookat = newlookat; - } - else if((flags & 4) != 0) - { - if((flags & 1) != 0) - newlookat = newvel; - else - newlookat = m_velocity; - newlookat.Z = 0; - newlookat.Normalize(); - if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - lookat = newlookat; - } + if ((flags & 2) != 0) + { + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + lookat = newlookat; + } + else if((flags & 4) != 0) + { + if((flags & 1) != 0) + newlookat = newvel; + else + newlookat = m_velocity; + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + lookat = newlookat; + } - AbsolutePosition = newpos; - ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); + AbsolutePosition = newpos; + ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); + } + else + AbsolutePosition = newpos; if ((flags & 1) != 0) { -- cgit v1.1 From 0e2adbe0fb030eae48bb778b21495d5d50ba8f2a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 14 May 2019 02:48:03 +0100 Subject: mantis 8527 and 8517: let llSetLinkPrimitiveParam*() PRIM_TEXTURE ignore texture id/name if invalid, processing the other parameters, for compatibily with old scripts. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5c6b7b2..5c04659 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2419,7 +2419,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (textureID == UUID.Zero) { if (!UUID.TryParse(texture, out textureID)) - return; + dotexture = false; } } -- cgit v1.1 From 9c44dc3384cdc13bc11d6cff8e700e338c564d99 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 19 May 2019 14:20:01 +0100 Subject: change yengine comments on ini file --- bin/OpenSim.ini.example | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 8b77ee9..7db7506 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -927,14 +927,10 @@ [YEngine] ;; experimental engine - ;; ONLY SUPORTS ONE REGION PER INSTANCE at this point ;; implements non preemptive microthreading, so fixing problems like llSleep or long events handlers ;; but those will suffer from timeslicing, so will be slower. - ;; compiles LSL directly to IL, so only suports LSL scripting (no C# etc) - ;; shares the Xengine APIs like LSL, OSSL, etc. - ;; DANGER, do not use with HG, don't leave regions running alone with it. - ;; TPs or crossings to/from Xengine will full recompile scripts losing state. - ;; attachment scripts may misbehave, cars will stop on crossings, etc. + ;; warning: scripts state is lost on TP or cross to Xengine regions (cars stop, etc) + ;; ignore its extensions (subset of original XMRengine), those are still undefined. Enabled = false ScriptStackSize = 256 ScriptHeapSize = 256 -- cgit v1.1 From 8410a01fb4c9621d5eeb911d61f8fd544b4396b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 22 May 2019 23:16:20 +0100 Subject: missing old flag VEHICLE_FLAG_NO_FLY_UP --- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 86c6d7c..fa0e25c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -189,6 +189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int VEHICLE_RANGE_BLOCK = 45; public const int VEHICLE_ROLL_FRAME = 46; public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1; + public const int VEHICLE_FLAG_NO_FLY_UP = 1; //legacy public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2; public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4; public const int VEHICLE_FLAG_HOVER_TERRAIN_ONLY = 8; -- cgit v1.1 From 38e937f91b08a2e52c47d2353c57556f542a00c1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 28 May 2019 21:37:59 +0100 Subject: add sim feature AvatarHoverHeightEnabled; mantis 8535: make option MeshModelAllowTextureToInventory visible --- .../ClientStack/Linden/Caps/AgentPreferencesModule.cs | 3 +++ bin/OpenSimDefaults.ini | 15 +++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs index 8f65a69..b0ba5a3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs @@ -77,6 +77,9 @@ namespace OpenSim.Region.ClientStack.LindenCaps { RegisterCaps(agentID, caps); }; + ISimulatorFeaturesModule simFeatures = scene.RequestModuleInterface<ISimulatorFeaturesModule>(); + if(simFeatures != null) + simFeatures.AddFeature("AvatarHoverHeightEnabled",OSD.FromBoolean(true)); } public void PostInitialise() {} diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 456dcd6..1332ce8 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1712,17 +1712,12 @@ [Economy] ; the economy module in use ; default is the provided BetaGridLikeMoneyModule - ; - This module is for demonstration only - ; The default economy module only implements just enough to allow free actions (transfer of objects, etc). ; There is no intention to implement anything further in core OpenSimulator. ; This functionality has to be provided by third party modules. - ; To use other modules you need to override this setting on OpenSim.ini Economy (or startup) section ; economymodule = BetaGridLikeMoneyModule - ; These economy values get used in the BetaGridLikeMoneyModule. - This module is for demonstration only - - ; The default economy module only implements just enough to allow free actions (transfer of objects, etc). - ; There is no intention to implement anything further in core OpenSimulator. - ; This functionality has to be provided by third party modules. + ; Economy values get used in the BetaGridLikeMoneyModule. ;; Enables selling things for $0. Default is true. ; SellEnabled = true @@ -1750,6 +1745,14 @@ ;PriceObjectRent = 0 ;PriceObjectScaleFactor = 10 ;PriceParcelRent = 0 + + ; Mesh upload settings, independent of economymodule + + ; Create inventory entries for textures uploaded with a model + ; default is false, ie, do not create + ; MeshModelAllowTextureToInventory = true + + [XEngine] ; Enable this engine in this OpenSim instance -- cgit v1.1 From 41e2379f976dbc21613b24eb74a946481b0b811f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Jun 2019 19:02:50 +0100 Subject: mantis 8460: reduce odds of watchdog timeout warning --- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index da54c54..15294c3 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -406,16 +406,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap WorkManager.StartThread( process, - string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), - ThreadPriority.BelowNormal, - true, - false); + string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName)); WorkManager.StartThread( MapBlockSendThread, - string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName), - ThreadPriority.BelowNormal, - true, - false); + string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName)); } /// <summary> @@ -482,7 +476,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // viewers only ask for green dots to each region now // except at login with regionhandle 0 // possible on some other rare ocasions - // use previus hack of sending all items with the green dots + // use previous hack of sending all items with the green dots bool adultRegion; if (regionhandle == 0) @@ -1189,6 +1183,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return; GetAndSendBlocksInternal(req.client, req.minX, req.minY, req.maxX, req.maxY, req.flags); + Watchdog.UpdateThread(); } thisRunData.Clear(); -- cgit v1.1 From 9ff7601214c8cbc022308dc62ed8aa321598a1df Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Jun 2019 20:15:36 +0100 Subject: reduce some useless array copies --- OpenSim/Framework/IClientAPI.cs | 3 ++- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 19 +++++++++++++--- .../Region/CoreModules/Agent/Xfer/XferModule.cs | 26 +++++----------------- .../Server/IRCClientView.cs | 3 ++- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 4 +++- OpenSim/Tests/Common/Mock/TestClient.cs | 3 ++- 6 files changed, 31 insertions(+), 27 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8d0cb5a..68ca52e 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1235,7 +1235,8 @@ namespace OpenSim.Framework /// <param name="node"></param> void SendBulkUpdateInventory(InventoryNodeBase node); - void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory); + void SendXferPacket(ulong xferID, uint packet, + byte[] XferData, int XferDataOffset, int XferDatapktLen, bool isTaskInventory); void SendAbortXferPacket(ulong xferID); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 01a9fb6..5d4d5cd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2886,7 +2886,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP 18 // ID (high frequency bigendian) }; - public void SendXferPacket(ulong xferID, uint packet, byte[] payload, bool isTaskInventory) + public void SendXferPacket(ulong xferID, uint packet, + byte[] XferData, int XferDataOffset, int XferDatapktLen, bool isTaskInventory) { UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); byte[] data = buf.Data; @@ -2896,7 +2897,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.UInt64ToBytesSafepos(xferID, data, 7); // 15 Utils.UIntToBytesSafepos(packet, data, 15); // 19 - int len = payload.Length; + + int len = XferDatapktLen; + if (XferDataOffset == 0) // first packet needs to send the total xfer data len + len += 4; + if (len > LLUDPServer.MAXPAYLOAD) // should never happen len = LLUDPServer.MAXPAYLOAD; if (len == 0) @@ -2908,7 +2913,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { data[19] = (byte)len; data[20] = (byte)(len >> 8); - Buffer.BlockCopy(payload, 0, data, 21, len); + if(XferDataOffset == 0) + { + // need to send total xfer data len + Utils.IntToBytesSafepos(XferData.Length, data, 21); + if (XferDatapktLen > 0) + Buffer.BlockCopy(XferData, XferDataOffset, data, 25, XferDatapktLen); + } + else + Buffer.BlockCopy(XferData, XferDataOffset, data, 21, XferDatapktLen); } buf.DataLength = 21 + len; diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 1b6401a..94e8064 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -272,9 +272,9 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer if (!Transfers.ContainsKey(xferID)) { byte[] fileData = NewFiles[fileName].Data; - int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Asset) >> 11; - if(Transfers.Count > 1) - burstSize /= Transfers.Count; + int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10; + burstSize = burstSize * (remoteClient.PingTimeMS + 50); + burstSize >>= 9; // ping is ms, 2 round trips XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize); @@ -332,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private int lastBytes; private int lastSentPacket; private int lastAckPacket; - private int burstSize; + private int burstSize; // additional packets, so can be zero private int retries = 0; public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz) @@ -352,7 +352,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { if(!isDeleted) { - Data = new byte[0]; + Data = null; isDeleted = true; } } @@ -381,7 +381,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer lastBytes = 1024; LastPacket--; } - } lastAckPacket = -1; @@ -422,20 +421,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer pktid = (uint)pkt; } - byte[] transferData; - if(pkt == 0) - { - transferData = new byte[pktsize + 4]; - Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4); - Array.Copy(Data, 0, transferData, 4, pktsize); - } - else - { - transferData = new byte[pktsize]; - Array.Copy(Data, pkt << 10, transferData, 0, pktsize); - } - - Client.SendXferPacket(XferID, pktid, transferData, false); + Client.SendXferPacket(XferID, pktid, Data, pkt << 10, pktsize, true); lastSentPacket = pkt; lastsendTimeMS = now; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 16be1c8..e27bbc3 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1157,7 +1157,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) + public void SendXferPacket(ulong xferID, uint packet, + byte[] XferData, int XferDataOffset, int XferDatapktLen, bool isTaskInventory) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index b2a9716..d3eb25f 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -868,9 +868,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) + public virtual void SendXferPacket(ulong xferID, uint packet, + byte[] XferData, int XferDataOffset, int XferDatapktLen, bool isTaskInventory) { } + public virtual void SendAbortXferPacket(ulong xferID) { diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 3cd5253..fd14291 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -819,7 +819,8 @@ namespace OpenSim.Tests.Common { } - public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) + public virtual void SendXferPacket(ulong xferID, uint packet, + byte[] XferData, int XferDataOffset, int XferDatapktLen, bool isTaskInventory) { } -- cgit v1.1 From 2cba0d676ec28d7b061bcb3a83069e6e50d95a5e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Jun 2019 23:40:50 +0100 Subject: test... --- OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 94e8064..705d7ea 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -274,7 +274,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer byte[] fileData = NewFiles[fileName].Data; int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10; burstSize = burstSize * (remoteClient.PingTimeMS + 50); - burstSize >>= 9; // ping is ms, 2 round trips + burstSize /= 1000; // ping is ms XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize); @@ -333,7 +333,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private int lastSentPacket; private int lastAckPacket; private int burstSize; // additional packets, so can be zero - private int retries = 0; public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz) { @@ -461,11 +460,11 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer if(!isDeleted) { double timeMS = now - lastsendTimeMS; - if(timeMS > 60000.0) + if(timeMS > 90000.0) done(); - else if(timeMS > 3500.0 && retries++ < 3) + else if(timeMS > 3500.0) { - burstSize >>= 1; + burstSize = 0; // cancel burst mode SendBurst(now); } } -- cgit v1.1 From 017253fae93da198688ccfbe1628f92a98a7024d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Jun 2019 19:17:32 +0100 Subject: a few more changes to lludp Xfer download --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../Region/CoreModules/Agent/Xfer/XferModule.cs | 42 ++++++++++++++-------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5d4d5cd..ac30868 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2880,7 +2880,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP static private readonly byte[] SendXferPacketHeader = new byte[] { - Helpers.MSG_RELIABLE, + 0, //Helpers.MSG_RELIABLE, Xfer control must provide reliabialty 0, 0, 0, 0, // sequence number 0, // extra 18 // ID (high frequency bigendian) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 705d7ea..c5ef25a 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -273,8 +273,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { byte[] fileData = NewFiles[fileName].Data; int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10; - burstSize = burstSize * (remoteClient.PingTimeMS + 50); - burstSize /= 1000; // ping is ms + burstSize *= remoteClient.PingTimeMS; + burstSize >>= 9; // ping is ms, 2 round trips XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize); @@ -327,12 +327,14 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public bool isDeleted = false; private object myLock = new object(); - private double lastsendTimeMS; + private double lastACKTimeMS; private int LastPacket; private int lastBytes; private int lastSentPacket; private int lastAckPacket; private int burstSize; // additional packets, so can be zero + private int retries; + private bool inBurst; public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz) { @@ -394,12 +396,15 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private void SendBurst(double now) { + inBurst = true; + lastACKTimeMS = now; // reset timeout int start = lastAckPacket + 1; int end = start + burstSize; if (end > LastPacket) end = LastPacket; - while(start <= end) + while (start <= end) SendPacket(start++ , now); + inBurst = false; } private void SendPacket(int pkt, double now) @@ -422,8 +427,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer Client.SendXferPacket(XferID, pktid, Data, pkt << 10, pktsize, true); + retries = 0; lastSentPacket = pkt; - lastsendTimeMS = now; } /// <summary> @@ -447,30 +452,37 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer done(); return true; } + double now = Util.GetTimeStampMS(); - SendPacket(lastSentPacket + 1, now); + lastACKTimeMS = now; + retries = 0; + if (!inBurst) + SendPacket(lastSentPacket + 1, now); return false; } } public bool checkTime(double now) { - if(Monitor.TryEnter(myLock)) + if (Monitor.TryEnter(myLock)) { - if(!isDeleted) + if (!isDeleted && !inBurst) { - double timeMS = now - lastsendTimeMS; - if(timeMS > 90000.0) + if (++retries >= 4) done(); - else if(timeMS > 3500.0) + else { - burstSize = 0; // cancel burst mode - SendBurst(now); + double timeMS = now - lastACKTimeMS; + if(timeMS > 3000.0) + { + burstSize >>= 2; + SendBurst(now); + } } } - + bool isdel = isDeleted; Monitor.Exit(myLock); - return isDeleted; + return isdel; } return false; } -- cgit v1.1 From 238efad6907e9848765cf5a102e15631d9ca6981 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 11 Jun 2019 01:19:57 +0100 Subject: a few more changes to lludp Xfer download --- .../Region/CoreModules/Agent/Xfer/XferModule.cs | 37 +++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index c5ef25a..dd37263 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer if(!inTimeTick) { double now = Util.GetTimeStampMS(); - if(now - lastTimeTick > 1750.0) + if(now - lastTimeTick > 500.0) { if(Transfers.Count == 0 && NewFiles.Count == 0) @@ -233,6 +233,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public void transfersTimeTick(double now) { XferDownLoad[] xfrs; + int inow = (int)now; lock(Transfers) { if(Transfers.Count == 0) @@ -243,7 +244,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } foreach(XferDownLoad xfr in xfrs) { - if(xfr.checkTime(now)) + if(xfr.checkTime(inow)) { ulong xfrID = xfr.XferID; lock(Transfers) @@ -274,7 +275,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer byte[] fileData = NewFiles[fileName].Data; int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10; burstSize *= remoteClient.PingTimeMS; - burstSize >>= 9; // ping is ms, 2 round trips + burstSize >>= 10; // ping is ms, 1 round trips XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize); @@ -320,14 +321,14 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public class XferDownLoad { - public IClientAPI Client; + public IClientAPI remoteClient; public byte[] Data = new byte[0]; public string FileName = String.Empty; public ulong XferID = 0; public bool isDeleted = false; private object myLock = new object(); - private double lastACKTimeMS; + private int lastACKTimeMS; private int LastPacket; private int lastBytes; private int lastSentPacket; @@ -341,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer FileName = fileName; Data = data; XferID = xferID; - Client = client; + remoteClient = client; burstSize = burstsz; } @@ -397,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private void SendBurst(double now) { inBurst = true; - lastACKTimeMS = now; // reset timeout + lastACKTimeMS = (int)now; // reset timeout int start = lastAckPacket + 1; int end = start + burstSize; if (end > LastPacket) @@ -425,7 +426,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer pktid = (uint)pkt; } - Client.SendXferPacket(XferID, pktid, Data, pkt << 10, pktsize, true); + remoteClient.SendXferPacket(XferID, pktid, Data, pkt << 10, pktsize, true); retries = 0; lastSentPacket = pkt; @@ -454,7 +455,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } double now = Util.GetTimeStampMS(); - lastACKTimeMS = now; + lastACKTimeMS = (int)now; retries = 0; if (!inBurst) SendPacket(lastSentPacket + 1, now); @@ -462,18 +463,24 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } } - public bool checkTime(double now) + public bool checkTime(int now) { if (Monitor.TryEnter(myLock)) { if (!isDeleted && !inBurst) { - if (++retries >= 4) - done(); - else + int timeMS = now - lastACKTimeMS; + + int tout = 5 * remoteClient.PingTimeMS; + if(tout > 10000) + tout = 10000; + else if (tout < 500) + tout = 500; + if (timeMS > tout) { - double timeMS = now - lastACKTimeMS; - if(timeMS > 3000.0) + if (++retries >= 4) + done(); + else { burstSize >>= 2; SendBurst(now); -- cgit v1.1 From da90da220e72ae08a2819111ce3f4c7746609719 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jun 2019 01:43:32 +0100 Subject: still a few more changes to lludp Xfer download for lost udp case --- OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index dd37263..056e786 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -233,7 +233,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public void transfersTimeTick(double now) { XferDownLoad[] xfrs; - int inow = (int)now; lock(Transfers) { if(Transfers.Count == 0) @@ -244,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } foreach(XferDownLoad xfr in xfrs) { - if(xfr.checkTime(inow)) + if(xfr.checkTime(now)) { ulong xfrID = xfr.XferID; lock(Transfers) @@ -328,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public bool isDeleted = false; private object myLock = new object(); - private int lastACKTimeMS; + private double lastACKTimeMS; private int LastPacket; private int lastBytes; private int lastSentPacket; @@ -389,6 +388,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer lastSentPacket = -1; double now = Util.GetTimeStampMS(); + retries = 0; SendBurst(now); return; @@ -428,7 +428,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer remoteClient.SendXferPacket(XferID, pktid, Data, pkt << 10, pktsize, true); - retries = 0; lastSentPacket = pkt; } @@ -445,8 +444,10 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer return true; packet &= 0x7fffffff; - if(lastAckPacket < packet) - lastAckPacket = (int)packet; + if(lastAckPacket >= packet) + return false; + + lastAckPacket = (int)packet; if(lastAckPacket == LastPacket) { @@ -463,15 +464,15 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } } - public bool checkTime(int now) + public bool checkTime(double now) { if (Monitor.TryEnter(myLock)) { if (!isDeleted && !inBurst) { - int timeMS = now - lastACKTimeMS; + double timeMS = now - lastACKTimeMS; - int tout = 5 * remoteClient.PingTimeMS; + double tout = 5 * remoteClient.PingTimeMS; if(tout > 10000) tout = 10000; else if (tout < 500) -- cgit v1.1 From 878d0defc7d32d180b8e0b7eb9994ac953cd2ee3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jun 2019 02:41:20 +0100 Subject: add a lock --- .../Region/CoreModules/Agent/Xfer/XferModule.cs | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 056e786..b897d04 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer if(!inTimeTick) { double now = Util.GetTimeStampMS(); - if(now - lastTimeTick > 500.0) + if(now - lastTimeTick > 750.0) { if(Transfers.Count == 0 && NewFiles.Count == 0) @@ -334,7 +334,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private int lastAckPacket; private int burstSize; // additional packets, so can be zero private int retries; - private bool inBurst; public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client, int burstsz) { @@ -397,15 +396,16 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private void SendBurst(double now) { - inBurst = true; - lastACKTimeMS = (int)now; // reset timeout - int start = lastAckPacket + 1; - int end = start + burstSize; - if (end > LastPacket) - end = LastPacket; - while (start <= end) - SendPacket(start++ , now); - inBurst = false; + lock(myLock) + { + lastACKTimeMS = (int)now; // reset timeout + int start = lastAckPacket + 1; + int end = start + burstSize; + if (end > LastPacket) + end = LastPacket; + while (start <= end) + SendPacket(start++ , now); + } } private void SendPacket(int pkt, double now) @@ -458,8 +458,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer double now = Util.GetTimeStampMS(); lastACKTimeMS = (int)now; retries = 0; - if (!inBurst) - SendPacket(lastSentPacket + 1, now); + SendPacket(lastSentPacket + 1, now); return false; } } @@ -468,15 +467,15 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { if (Monitor.TryEnter(myLock)) { - if (!isDeleted && !inBurst) + if (!isDeleted) { double timeMS = now - lastACKTimeMS; double tout = 5 * remoteClient.PingTimeMS; if(tout > 10000) tout = 10000; - else if (tout < 500) - tout = 500; + else if (tout < 1000) + tout = 1000; if (timeMS > tout) { if (++retries >= 4) -- cgit v1.1 From 4b8c5ee6e87259d169d73cab42704f17a83b62bf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jun 2019 03:12:51 +0100 Subject: test... --- OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index b897d04..8b7a82d 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -444,10 +444,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer return true; packet &= 0x7fffffff; - if(lastAckPacket >= packet) - return false; - - lastAckPacket = (int)packet; + if(lastAckPacket < packet) + lastAckPacket = (int)packet; if(lastAckPacket == LastPacket) { -- cgit v1.1 From 086248c13b750e7e6ba2ffb7365611b72a2bc4be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jun 2019 00:08:51 +0100 Subject: minor cleanup --- .../Region/CoreModules/Agent/Xfer/XferModule.cs | 84 ++++++++++------------ 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 8b7a82d..32b3523 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -50,8 +50,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private object timeTickLock = new object(); - private double lastTimeTick = 0.0; - private double lastFilesExpire = 0.0; + private int lastTimeTick = 0; + private int lastFilesExpire = 0; private bool inTimeTick = false; public struct XferRequest @@ -66,15 +66,15 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { public byte[] Data; public int refsCount; - public double timeStampMS; + public int timeStampMS; } #region INonSharedRegionModule Members public void Initialise(IConfigSource config) { - lastTimeTick = Util.GetTimeStampMS() + 30000.0; - lastFilesExpire = lastTimeTick + 180000.0; + lastTimeTick = (int)Util.GetTimeStampMS() + 30000; + lastFilesExpire = lastTimeTick + 180000; } public void AddRegion(Scene scene) @@ -121,10 +121,9 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { if(!inTimeTick) { - double now = Util.GetTimeStampMS(); - if(now - lastTimeTick > 750.0) + int now = (int)Util.GetTimeStampMS(); + if(now - lastTimeTick > 750) { - if(Transfers.Count == 0 && NewFiles.Count == 0) lastTimeTick = now; else @@ -163,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { lock (NewFiles) { - double now = Util.GetTimeStampMS(); + int now = (int)Util.GetTimeStampMS(); if (NewFiles.ContainsKey(fileName)) { NewFiles[fileName].refsCount++; @@ -183,18 +182,18 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } #endregion - public void expireFiles(double now) + public void expireFiles(int now) { lock (NewFiles) { // hopefully we will not have many files so nasty code will do it - if(now - lastFilesExpire > 120000.0) + if(now - lastFilesExpire > 120000) { lastFilesExpire = now; List<string> expires = new List<string>(); foreach(string fname in NewFiles.Keys) { - if(NewFiles[fname].refsCount == 0 && now - NewFiles[fname].timeStampMS > 120000.0) + if(NewFiles[fname].refsCount == 0 && now - NewFiles[fname].timeStampMS > 120000) expires.Add(fname); } foreach(string fname in expires) @@ -230,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer } } - public void transfersTimeTick(double now) + public void transfersTimeTick(int now) { XferDownLoad[] xfrs; lock(Transfers) @@ -241,6 +240,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer xfrs = new XferDownLoad[Transfers.Count]; Transfers.Values.CopyTo(xfrs,0); } + foreach(XferDownLoad xfr in xfrs) { if(xfr.checkTime(now)) @@ -274,12 +274,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer byte[] fileData = NewFiles[fileName].Data; int burstSize = remoteClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Task) >> 10; burstSize *= remoteClient.PingTimeMS; - burstSize >>= 10; // ping is ms, 1 round trips + burstSize >>= 10; // ping is ms, 1 round trip + if(burstSize > 32) + burstSize = 32; XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient, burstSize); Transfers.Add(xferID, transaction); - transaction.StartSend(); // The transaction for this file is on its way @@ -327,7 +328,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public bool isDeleted = false; private object myLock = new object(); - private double lastACKTimeMS; + private int lastACKTimeMS; private int LastPacket; private int lastBytes; private int lastSentPacket; @@ -385,30 +386,25 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer lastAckPacket = -1; lastSentPacket = -1; - - double now = Util.GetTimeStampMS(); retries = 0; - SendBurst(now); + SendBurst(); return; } } - private void SendBurst(double now) + private void SendBurst() { - lock(myLock) - { - lastACKTimeMS = (int)now; // reset timeout - int start = lastAckPacket + 1; - int end = start + burstSize; - if (end > LastPacket) - end = LastPacket; - while (start <= end) - SendPacket(start++ , now); - } + int start = lastAckPacket + 1; + int end = start + burstSize; + if (end > LastPacket) + end = LastPacket; + while (start <= end) + SendPacket(start++); + lastACKTimeMS = (int)Util.GetTimeStampMS(); // reset timeout } - private void SendPacket(int pkt, double now) + private void SendPacket(int pkt) { if(pkt > LastPacket) return; @@ -443,45 +439,43 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer if(isDeleted) return true; - packet &= 0x7fffffff; - if(lastAckPacket < packet) + packet &= 0x7fffffff; + if (lastAckPacket < packet) lastAckPacket = (int)packet; - - if(lastAckPacket == LastPacket) + else if (lastAckPacket == LastPacket) { done(); return true; } - double now = Util.GetTimeStampMS(); - lastACKTimeMS = (int)now; + lastACKTimeMS = (int)Util.GetTimeStampMS(); retries = 0; - SendPacket(lastSentPacket + 1, now); + SendPacket(lastSentPacket + 1); return false; } } - public bool checkTime(double now) + public bool checkTime(int now) { if (Monitor.TryEnter(myLock)) { if (!isDeleted) { - double timeMS = now - lastACKTimeMS; - - double tout = 5 * remoteClient.PingTimeMS; + int timeMS = now - lastACKTimeMS; + int tout = 5 * remoteClient.PingTimeMS; if(tout > 10000) tout = 10000; else if (tout < 1000) tout = 1000; + if (timeMS > tout) { - if (++retries >= 4) + if (++retries > 4) done(); else { - burstSize >>= 2; - SendBurst(now); + burstSize = lastSentPacket - lastAckPacket - 1; + SendBurst(); } } } -- cgit v1.1 From b09ea5bdc7ce657e8f785caf7abd8778a8afb3da Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jun 2019 01:12:47 +0100 Subject: delay timeout a bit --- OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 32b3523..6157f38 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -401,7 +401,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer end = LastPacket; while (start <= end) SendPacket(start++); - lastACKTimeMS = (int)Util.GetTimeStampMS(); // reset timeout + lastACKTimeMS = (int)Util.GetTimeStampMS() + 1000; // reset timeout with some slack for queues delays } private void SendPacket(int pkt) @@ -474,7 +474,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer done(); else { - burstSize = lastSentPacket - lastAckPacket - 1; + burstSize = lastSentPacket - lastAckPacket; SendBurst(); } } -- cgit v1.1 From 79442c8c56afc543ea731fff92ac4c4e9a442ee3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jun 2019 01:33:25 +0100 Subject: handle confirmXfer sync --- OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 6157f38..56123a5 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -463,10 +463,10 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer { int timeMS = now - lastACKTimeMS; int tout = 5 * remoteClient.PingTimeMS; - if(tout > 10000) - tout = 10000; - else if (tout < 1000) + if (tout < 1000) tout = 1000; + else if(tout > 10000) + tout = 10000; if (timeMS > tout) { -- cgit v1.1 From 05f508229ce2938f3f88510080f5b65ed5a9b324 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Jun 2019 20:12:33 +0100 Subject: make materials save to grid less async on manual backup or shutdown --- .../OptionalModules/Materials/MaterialsModule.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 822439f..2aea7f9 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -133,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Materials if(m_changed.Count == 0) return; - if(forcedBackup) + if (forcedBackup) { toStore = new List<FaceMaterial>(m_changed.Keys); m_changed.Clear(); @@ -154,16 +154,29 @@ namespace OpenSim.Region.OptionalModules.Materials m_changed.Remove(fm); } } + } if(toStore.Count > 0) - Util.FireAndForget(delegate + { + if (forcedBackup) { - foreach(FaceMaterial fm in toStore) + foreach (FaceMaterial fm in toStore) { AssetBase a = MakeAsset(fm, false); m_scene.AssetService.Store(a); } - }); + } + else + { + Util.FireAndForget(delegate + { + foreach (FaceMaterial fm in toStore) + { + AssetBase a = MakeAsset(fm, false); + m_scene.AssetService.Store(a); + } + }); + } } } -- cgit v1.1 From 03abb970f4e93e9f89f4b848703ccb2eddddfe9a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Jun 2019 20:13:57 +0100 Subject: reduce httptimout on first try to save a asset to grid --- OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index b636a7b..b12ea62 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -510,7 +510,7 @@ namespace OpenSim.Services.Connectors try { newID = SynchronousRestObjectRequester. - MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth); + MakeRequest<AssetBase, string>("POST", uri, asset, 10000, m_Auth); } catch { -- cgit v1.1 From d372309e3cb3407e54b49e4da6fd3296f150b84d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Jul 2019 20:49:00 +0100 Subject: mantis 8558: send sane values for Agents and objects capability (max hard limit) --- OpenSim/Framework/RegionInfoForEstateMenuArgs.cs | 4 ++- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 35 ++++++---------------- .../World/Estate/EstateManagementModule.cs | 4 ++- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/OpenSim/Framework/RegionInfoForEstateMenuArgs.cs b/OpenSim/Framework/RegionInfoForEstateMenuArgs.cs index f274da2..1b828ca 100644 --- a/OpenSim/Framework/RegionInfoForEstateMenuArgs.cs +++ b/OpenSim/Framework/RegionInfoForEstateMenuArgs.cs @@ -33,7 +33,7 @@ namespace OpenSim.Framework { public float billableFactor; public uint estateID; - public byte maxAgents; + public int maxAgents; public float objectBonusFactor; public uint parentEstateID; public int pricePerMeter; @@ -48,5 +48,7 @@ namespace OpenSim.Framework public float waterHeight; public string simName; public string regionType; + public int AgentCapacity; + public int ObjectsCapacity; } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ac30868..aeb728e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6347,7 +6347,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP rinfopack.AgentData.SessionID = SessionId; rinfoblk.BillableFactor = args.billableFactor; rinfoblk.EstateID = args.estateID; - rinfoblk.MaxAgents = args.maxAgents; + rinfoblk.MaxAgents = (byte)args.maxAgents; rinfoblk.ObjectBonusFactor = args.objectBonusFactor; rinfoblk.ParentEstateID = args.parentEstateID; rinfoblk.PricePerMeter = args.pricePerMeter; @@ -6363,9 +6363,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP rinfoblk.SimName = Utils.StringToBytes(args.simName); rinfopack.RegionInfo2 = new RegionInfoPacket.RegionInfo2Block(); - rinfopack.RegionInfo2.HardMaxAgents = uint.MaxValue; - rinfopack.RegionInfo2.HardMaxObjects = uint.MaxValue; - rinfopack.RegionInfo2.MaxAgents32 = uint.MaxValue; + rinfopack.RegionInfo2.HardMaxAgents = (uint)args.AgentCapacity; + rinfopack.RegionInfo2.HardMaxObjects = (uint)args.ObjectsCapacity; + rinfopack.RegionInfo2.MaxAgents32 = (uint)args.maxAgents; rinfopack.RegionInfo2.ProductName = Util.StringToBytes256(args.regionType); rinfopack.RegionInfo2.ProductSKU = Utils.EmptyBytes; @@ -8013,7 +8013,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.AssetUploadRequest, HandleAssetUploadRequest); AddLocalPacketHandler(PacketType.RequestXfer, HandleRequestXfer); AddLocalPacketHandler(PacketType.SendXferPacket, HandleSendXferPacket); - AddLocalPacketHandler(PacketType.ConfirmXferPacket, HandleConfirmXferPacket); + AddLocalPacketHandler(PacketType.ConfirmXferPacket, HandleConfirmXferPacket, false); AddLocalPacketHandler(PacketType.AbortXfer, HandleAbortXfer); AddLocalPacketHandler(PacketType.CreateInventoryFolder, HandleCreateInventoryFolder); AddLocalPacketHandler(PacketType.UpdateInventoryFolder, HandleUpdateInventoryFolder); @@ -10636,12 +10636,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { RequestXferPacket xferReq = (RequestXferPacket)Pack; - RequestXfer handlerRequestXfer = OnRequestXfer; - - if (handlerRequestXfer != null) - { - handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); - } + OnRequestXfer?.Invoke(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); return true; } @@ -10649,11 +10644,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; - XferReceive handlerXferReceive = OnXferReceive; - if (handlerXferReceive != null) - { - handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); - } + OnXferReceive?.Invoke(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); return true; } @@ -10661,23 +10652,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; - ConfirmXfer handlerConfirmXfer = OnConfirmXfer; - if (handlerConfirmXfer != null) - { - handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); - } + OnConfirmXfer?.Invoke(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); return true; } private bool HandleAbortXfer(IClientAPI sender, Packet Pack) { AbortXferPacket abortXfer = (AbortXferPacket)Pack; - AbortXfer handlerAbortXfer = OnAbortXfer; - if (handlerAbortXfer != null) - { - handlerAbortXfer(this, abortXfer.XferID.ID); - } + OnAbortXfer?.Invoke(this, abortXfer.XferID.ID); return true; } diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 936f956..986a44f 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1404,7 +1404,7 @@ namespace OpenSim.Region.CoreModules.World.Estate RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor; args.estateID = Scene.RegionInfo.EstateSettings.EstateID; - args.maxAgents = (byte)Scene.RegionInfo.RegionSettings.AgentLimit; + args.maxAgents = Scene.RegionInfo.RegionSettings.AgentLimit; args.objectBonusFactor = (float)Scene.RegionInfo.RegionSettings.ObjectBonus; args.parentEstateID = Scene.RegionInfo.EstateSettings.ParentEstateID; args.pricePerMeter = Scene.RegionInfo.EstateSettings.PricePerMeter; @@ -1419,6 +1419,8 @@ namespace OpenSim.Region.CoreModules.World.Estate args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight; args.simName = Scene.RegionInfo.RegionName; args.regionType = Scene.RegionInfo.RegionType; + args.AgentCapacity = Scene.RegionInfo.AgentCapacity; + args.ObjectsCapacity = Scene.RegionInfo.ObjectCapacity; remote_client.SendRegionInfoToEstateMenu(args); } -- cgit v1.1 From aedaa32ddc683e925e9a618ee731501fad0d4204 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 13 Jul 2019 13:30:15 +0100 Subject: When using FSAssets, the HGAssetService would still use AssetService. This introduces a new HGAssetService config option named BackingService, which defaults to the old behaviour, loading AssetService. It can, however, be used to load FSAssets for HG assets, which eliminates numerous problems. --- .../Services/HypergridService/HGAssetService.cs | 83 ++++++++++++++++++---- 1 file changed, 70 insertions(+), 13 deletions(-) diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index a66478e..8fef57a 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs @@ -39,6 +39,7 @@ using OpenSim.Framework.Serialization.External; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Services.AssetService; +using OpenSim.Services.Base; namespace OpenSim.Services.HypergridService { @@ -47,7 +48,7 @@ namespace OpenSim.Services.HypergridService /// but implements it in ways that are appropriate for inter-grid /// asset exchanges. /// </summary> - public class HGAssetService : OpenSim.Services.AssetService.AssetService, IAssetService + public class HGAssetService : ServiceBase, IAssetService { private static readonly ILog m_log = LogManager.GetLogger( @@ -60,7 +61,9 @@ namespace OpenSim.Services.HypergridService private AssetPermissions m_AssetPerms; - public HGAssetService(IConfigSource config, string configName) : base(config, configName) + IAssetService m_assetService = null; + + public HGAssetService(IConfigSource config, string configName) : base(config) { m_log.Debug("[HGAsset Service]: Starting"); IConfig assetConfig = config.Configs[configName]; @@ -86,12 +89,30 @@ namespace OpenSim.Services.HypergridService // Permissions m_AssetPerms = new AssetPermissions(assetConfig); + string str = assetConfig.GetString("BackingService", "OpenSim.Services.AssetService.dll:AssetService"); + + if (str != string.Empty) + { + args = new object[] { config }; + m_assetService = LoadPlugin<IAssetService>(str, args); + if (m_assetService != null) + { + m_log.InfoFormat("[HGASSETS]: Backing service loaded: {0}", str); + } + else + { + m_log.ErrorFormat("[HGASSETS]: Failed to load backing service {0}", str); + } + } + + + } - #region IAssetService overrides - public override AssetBase Get(string id) + #region IAssetService + public AssetBase Get(string id) { - AssetBase asset = base.Get(id); + AssetBase asset = m_assetService.Get(id); if (asset == null) return null; @@ -107,9 +128,9 @@ namespace OpenSim.Services.HypergridService return asset; } - public override AssetMetadata GetMetadata(string id) + public AssetMetadata GetMetadata(string id) { - AssetMetadata meta = base.GetMetadata(id); + AssetMetadata meta = m_assetService.GetMetadata(id); if (meta == null) return null; @@ -119,7 +140,7 @@ namespace OpenSim.Services.HypergridService return meta; } - public override byte[] GetData(string id) + public byte[] GetData(string id) { AssetBase asset = Get(id); @@ -142,7 +163,7 @@ namespace OpenSim.Services.HypergridService //public virtual bool Get(string id, Object sender, AssetRetrieved handler) - public override string Store(AssetBase asset) + public string Store(AssetBase asset) { if (!m_AssetPerms.AllowedImport(asset.Type)) return string.Empty; @@ -155,15 +176,53 @@ namespace OpenSim.Services.HypergridService asset.Data = Utils.StringToBytes(xml); } - return base.Store(asset); + return m_assetService.Store(asset); } - public override bool Delete(string id) + public bool Delete(string id) { // NOGO return false; } + public AssetBase GetCached(string id) + { + AssetBase asset = m_assetService.GetCached(id); + + if (asset == null) + return null; + + if (!m_AssetPerms.AllowedExport(asset.Type)) + return null; + + if (asset.Metadata.Type == (sbyte)AssetType.Object) + asset.Data = AdjustIdentifiers(asset.Data); + + AdjustIdentifiers(asset.Metadata); + + return asset; + } + + public bool Get(string id, object sender, AssetRetrieved handler) + { + AssetBase asset = Get(id); + + handler?.Invoke(id, sender, asset); + + return true; + } + + public bool[] AssetsExist(string[] ids) + { + return m_assetService.AssetsExist(ids); + } + + public bool UpdateContent(string id, byte[] data) + { + // NO WAY + return false; + } + #endregion protected void AdjustIdentifiers(AssetMetadata meta) @@ -187,7 +246,5 @@ namespace OpenSim.Services.HypergridService return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero)); } - } - } -- cgit v1.1 From 78359c108dfbecc9d8b7a26712eed061c1c0d648 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 15 Jul 2019 22:10:47 +0100 Subject: mantis 8563: do not modify collection inside a loop on it a foreach on it --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5c04659..5d72858 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -14192,15 +14192,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; - if (land.OwnerID == m_host.OwnerID) + if (land.OwnerID == m_host.OwnerID && land.ParcelAccessList.Count > 0) { + var todelete = new List<LandAccessEntry>(); foreach (LandAccessEntry entry in land.ParcelAccessList) { if (entry.Flags == AccessList.Ban) - { - land.ParcelAccessList.Remove(entry); - } + todelete.Add(entry); } + foreach (LandAccessEntry entry in todelete) + land.ParcelAccessList.Remove(entry); } ScriptSleep(m_sleepMsOnResetLandBanList); } @@ -14209,15 +14210,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; - if (land.OwnerID == m_host.OwnerID) + if (land.OwnerID == m_host.OwnerID && land.ParcelAccessList.Count > 0) { + var todelete = new List<LandAccessEntry>(); foreach (LandAccessEntry entry in land.ParcelAccessList) { if (entry.Flags == AccessList.Access) - { - land.ParcelAccessList.Remove(entry); - } + todelete.Add(entry); } + foreach (LandAccessEntry entry in todelete) + land.ParcelAccessList.Remove(entry); } ScriptSleep(m_sleepMsOnResetLandPassList); } -- cgit v1.1