From 1b8999b1300b7b9cb17d610c677496114b650d5a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Mar 2019 11:14:59 +0000 Subject: [PATCH 001/150] try to work around robust shutdown/quit blocking on mono --- .../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 14e21a2167..790aa99974 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) { From b82337de09b5e1e18f1df17cfe0c2123f062347f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Mar 2019 11:48:17 +0000 Subject: [PATCH 002/150] 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 900327a792..422a8bce18 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(); From f143dbc23fc5984728d32602f9602a4fcda35577 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Mar 2019 17:11:23 +0000 Subject: [PATCH 003/150] lludp direct encode object Properties update packets --- .../ClientStack/Linden/UDP/LLClientView.cs | 345 +++++++++++------- 1 file changed, 208 insertions(+), 137 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ac041f500b..181c4e2f1e 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 objectFamilyBlocks = null; - List objectPropertiesBlocks = null; + List objectPropertiesUpdates = null; + List objectPropertiesFamilyUpdates = null; List 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(); - objectFamilyBlocks.Add(objPropDB); - maxUpdateBytes -= objPropDB.Length; + if(objectPropertiesFamilyUpdates == null) + objectPropertiesFamilyUpdates = new List(); + objectPropertiesFamilyUpdates.Add(update); + maxUpdateBytes -= 100; } } @@ -5169,58 +5182,107 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(needPhysics == null) needPhysics = new List(); needPhysics.Add(sop); - ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); - if(objectPropertiesBlocks == null) - objectPropertiesBlocks = new List(); - objectPropertiesBlocks.Add(objPropDB); - maxUpdateBytes -= objPropDB.Length; + if(objectPropertiesUpdates == null) + objectPropertiesUpdates = new List(); + 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 tau = new List(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); - if (objectFamilyBlocks != null) - { - // one packet per object block... uggh... - for (int i = 0; i < objectFamilyBlocks.Count; i++) + 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) { - ObjectPropertiesFamilyPacket packet = - (ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); + 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 - packet.ObjectData = objectFamilyBlocks[i]; + 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; - // 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 updates = new List(); -// 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); + //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(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(needPhysics != null) + if (objectPropertiesFamilyUpdates != null) + { + foreach (EntityUpdate eu in objectPropertiesFamilyUpdates) + { + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(ObjectFamilyUpdateHeader, 0, buf.Data, 0, 8); + + LLUDPZeroEncoder zc = new LLUDPZeroEncoder(buf.Data); + zc.Position = 8; + + CreateObjectPropertiesFamilyBlock((SceneObjectPart)eu.Entity, eu.Flags, zc); + buf.DataLength = zc.Finish(); + //List tau = new List(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) { IEventQueue eq = Scene.RequestModuleInterface(); 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(); - - block.RequestFlags = (uint)requestFlags; - block.ObjectID = sop.UUID; - if (sop.OwnerID == sop.GroupID) - block.OwnerID = UUID.Zero; - 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); - - return block; - } - - 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 - - ObjectPropertiesPacket.ObjectDataBlock block = - new ObjectPropertiesPacket.ObjectDataBlock(); - - block.ObjectID = sop.UUID; - block.Name = Util.StringToBytes256(sop.Name); - block.Description = Util.StringToBytes256(sop.Description); - - 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; - - block.ItemID = sop.FromUserInventoryItemID; - block.FolderID = UUID.Zero; // sog.FromFolderID ?? - block.FromTaskID = UUID.Zero; // ??? - block.InventorySerial = (short)sop.InventorySerial; - SceneObjectPart root = sop.ParentGroup.RootPart; - block.TouchName = Util.StringToBytes256(root.TouchName); + zc.AddUInt((uint)requestFlags); + zc.AddUUID(sop.UUID); + if (sop.OwnerID == sop.GroupID) + zc.AddZeros(16); + else + zc.AddUUID(sop.OwnerID); + zc.AddUUID(sop.GroupID); - // 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(); -// } -// } + zc.AddUInt(root.BaseMask); + zc.AddUInt(root.OwnerMask); + zc.AddUInt(root.GroupMask); + zc.AddUInt(root.EveryoneMask); + zc.AddUInt(root.NextOwnerMask); - 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; + zc.AddZeros(4); // int ownership cost - return block; + //sale info block + zc.AddByte(root.ObjectSaleType); + zc.AddInt(root.SalePrice); + + zc.AddUInt(sop.Category); //Category + + 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); + } + + private void CreateObjectPropertiesBlock(SceneObjectPart sop, LLUDPZeroEncoder zc) + { + SceneObjectPart root = sop.ParentGroup.RootPart; + + 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 From 46dc9ebd4e9fa6deb218b9ebc0d95b63a2f08826 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Mar 2019 18:08:05 +0000 Subject: [PATCH 004/150] lludp: change zero encode of strings; limit them to what current viewers expect --- .../ClientStack/Linden/UDP/LLClientView.cs | 180 +----------------- .../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 181c4e2f1e..cb2d9e2ac8 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 8ed2cf12cd..0b008a9f85 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); + } + } } From e1c20a32ca414ce95e1f41e92956eab5ca17f342 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Mar 2019 18:17:50 +0000 Subject: [PATCH 005/150] LSL: limit sittext and touchtext to length current viewers cand display --- .../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 ab3562f35b..5dc626076c 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) From 492ba8f644abf64704bcf35a4f3d3c7990833f00 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Mar 2019 19:21:44 +0000 Subject: [PATCH 006/150] minor cleanup --- .../ClientStack/Linden/UDP/LLClientView.cs | 9 +------ .../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 cb2d9e2ac8..547c8a65d3 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 2300800f57..780e8f889c 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 public readonly int TextureSendLimit; - /// Handlers for incoming packets - //PacketEventDictionary packetEvents = new PacketEventDictionary(); - /// Incoming packets that are awaiting handling - //protected OpenMetaverse.BlockingQueue packetInbox = new OpenMetaverse.BlockingQueue(); - protected BlockingCollection packetInbox = new BlockingCollection(); /// Bandwidth throttle for this UDP server @@ -374,12 +369,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public int IncomingOrphanedPacketCount { get; protected set; } - /// - /// Queue some low priority but potentially high volume async requests so that they don't overwhelm available - /// threadpool threads. - /// -// public JobEngine IpahEngine { get; protected set; } - /// /// Run queue empty processing within a single persistent thread. /// @@ -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 From 4a80802bec6574c54f534f83379a1b979dd9e20d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 00:38:49 +0000 Subject: [PATCH 007/150] lludp direct encode mapblockreply. Not bc its a high volume packet, but bc it needed work anyways --- .../ClientStack/Linden/UDP/LLClientView.cs | 153 +++++++++++++----- 1 file changed, 116 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 547c8a65d3..f2ebe2a7ab 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 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 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(); - - 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++) + // check if we will need sizes block and get them aside + int count = 0; + ushort ut; + foreach (MapBlockData md in mapBlocks) { - 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; + ut = md.SizeX; + sizes[count++] = ut; + if (ut > 256) + needSizes = true; - 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 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 sendingBlocks = new List(); + 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(); + ++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); } } From d8f9a007f4aa8e445baefc4210b3e454f006caca Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 14:30:53 +0000 Subject: [PATCH 008/150] bug fix on mapblockreply; direct encode mapitemreply just because.. --- .../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 f2ebe2a7ab..83128d2994 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 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 From 5428b4799df0851d3091cf12f80bed6672bb09b3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 15:40:01 +0000 Subject: [PATCH 009/150] lludp: direct encode rest of send terseupdates --- .../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 83128d2994..2b7a7ed3c2 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 withobjects = new List(animations.Length); - List noobjects = new List(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 users, List 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); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); - // 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; - - 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, From 2ff5b322bec0242af40cf956e9de1622894e17f6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Mar 2019 17:44:34 +0000 Subject: [PATCH 010/150] lludp: direct encode CoarseLocationUpdate --- .../ClientStack/Linden/UDP/LLClientView.cs | 71 +++++++++++-------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2b7a7ed3c2..9d5a7ba14c 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 users, List CoarseLocations) { // We don't need to update inactive clients. if (!IsActive) return; - CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); - loc.Header.Reliable = false; - - // 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); - - CoarseLocationUpdatePacket.IndexBlock ib = new CoarseLocationUpdatePacket.IndexBlock(); - - loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; - loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; + int totalLocations = Math.Min(CoarseLocations.Count, 60); + int totalAgents = Math.Min(users.Count, 60); + if(totalAgents > totalLocations) + totalAgents = totalLocations; int selfindex = -1; - for (int i = 0; i < total; i++) + int preyindex = -1; + + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + Buffer.BlockCopy(CoarseLocationUpdateHeader, 0, buf.Data, 0, 8); + byte[] data = buf.Data; + + data[8] = (byte)totalLocations; + int pos = 9; + + for (int i = 0; i < totalLocations; ++i) { - CoarseLocationUpdatePacket.LocationBlock lb = - new CoarseLocationUpdatePacket.LocationBlock(); - - lb.X = (byte)CoarseLocations[i].X; - lb.Y = (byte)CoarseLocations[i].Y; - - 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)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; + } } - ib.You = (short)selfindex; - ib.Prey = -1; - loc.Index = ib; + Utils.Int16ToBytes((short)selfindex, data, pos); pos += 2; + Utils.Int16ToBytes((short)preyindex, data, pos); pos += 2; - OutPacket(loc, ThrottleOutPacketType.Task); + data[pos++] = (byte)totalAgents; + for (int i = 0; i < totalAgents; ++i) + { + users[i].ToBytes(data, pos); + pos += 16; + } + + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); } #endregion Avatar Packet/Data Sending Methods From ee8ad3e69d01678006155bac8fc3efd254d1b438 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 02:02:40 +0000 Subject: [PATCH 011/150] lludp: direct encode AvatarAppearance --- .../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 9d5a7ba14c..4f4bb61112 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) { - avblock = new AvatarAppearancePacket.VisualParamBlock(); - avblock.ParamValue = visualParams[i]; - avp.VisualParam[i] = avblock; + data[pos++] = 0; + data[pos++] = 0; + } + else + { + 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[] { From 8bb0c05825b2c974c07d4660003a1812223870a4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 18:16:38 +0000 Subject: [PATCH 012/150] lludp: direct encode PacketAck, StartPingCheck and CompletePingCheck --- .../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 780e8f889c..79f5fe614e 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) { + 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; + uint ack; - - if (udpClient.PendingAcks.Dequeue(out ack)) + int count = 0; + while (udpClient.PendingAcks.Dequeue(out ack)) { - List blocks = new List(); - 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; - pc.PingID.PingID = (byte)udpClient.CurrentPingSequence++; - // We *could* get OldestUnacked, but it would hurt performance and not provide any benefit - pc.PingID.OldestUnacked = 0; + 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; + + 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 From 9ccca71c1b13ed4e12c739774ca703cfafed5480 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 19:00:02 +0000 Subject: [PATCH 013/150] remove redundant code --- OpenSim/Framework/IClientAPI.cs | 2 -- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 15 +-------------- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 +- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 8 ++++---- .../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 d63136e332..63e3782606 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 cachedTextures); - void SendStartPingCheck(byte seq); - /// /// Tell the client that an object has been deleted /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4f4bb61112..1004b075bb 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 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 2981337b2d..303f5054fd 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 79f5fe614e..25e4de5343 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 0fc724b379..fb195e7119 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 localID) { diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index de9ab98779..022ebdfe0b 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 Data) { } From b9987b41837e00f21873e14df0cbf7e60377308a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Mar 2019 21:37:21 +0000 Subject: [PATCH 014/150] stop sending some useless small packets --- .../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 1004b075bb..39e2d39f31 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) From 84187975bdfc4a877fb1f6a2c193d8227d3c258a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 18:03:22 +0000 Subject: [PATCH 015/150] lludp AgentMovementComplete enconding --- .../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 39e2d39f31..ab5790c0dc 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(); m_GroupsModule = scene.RequestModuleInterface(); ImageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface()); - 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 /// 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) From 6fd7b931b1a7dade8604fb0356fc6e0058fd5135 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 18:58:07 +0000 Subject: [PATCH 016/150] lludp ChatFromSimulator enconding; some simplification --- .../ClientStack/Linden/UDP/LLClientView.cs | 91 +++++++++++++------ .../ClientStack/Linden/UDP/LLUDPServer.cs | 30 +++++- 2 files changed, 88 insertions(+), 33 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ab5790c0dc..97b2c5c3b0 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) - { - 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; + 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) + }; - OutPacket(reply, ThrottleOutPacketType.Unknown); + public void SendChatMessage(string message, byte chattype, Vector3 fromPos, string fromName, + UUID sourceID, UUID ownerID, byte sourcetype, byte audible) + { + 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; + } + + buf.DataLength = pos; + m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); } /// @@ -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 25e4de5343..465a4d0718 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) From 606d09670958c59b1b2daf75064ca36a17df248c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 21:04:42 +0000 Subject: [PATCH 017/150] lludp ImprovedInstantMessage enconding --- .../ClientStack/Linden/UDP/LLClientView.cs | 119 ++++++++++++++---- 1 file changed, 95 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 97b2c5c3b0..a44185af92 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 /// // + + 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) { - ImprovedInstantMessagePacket msg - = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); - - 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); - 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++] = 0; + data[pos++] = 0; } + else + { + data[pos++] = (byte)len; + data[pos++] = (byte)(len >> 8); + Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; + } + + 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 + { + 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 message) From 37619443a7e184722577cf6d914c5f505fd1dfbd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 22:19:23 +0000 Subject: [PATCH 018/150] lludp GenericMessage enconding --- .../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 a44185af92..a9a56302b9 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 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 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) From f17dba9925d299f59c6707953832d3ebd3e739f4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 22:26:02 +0000 Subject: [PATCH 019/150] 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 a9a56302b9..96ad930f1d 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 From ee0eef5ee080aaee1f85c206c6f781c816f84c94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 22:29:15 +0000 Subject: [PATCH 020/150] also fix the ThrottleOutPacketType --- .../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 96ad930f1d..e3d04b5211 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); } } From 199d4a1bd02c5e782db65a320b6965388ded1fb6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Mar 2019 23:36:49 +0000 Subject: [PATCH 021/150] lludp ReplyTaskInventory, SendXferPacket and AbortXfer enconding --- .../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 e3d04b5211..0d78654cbc 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, From c2086e6257bbf63c4b4edf56729bdf78e4ce3195 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 00:47:45 +0000 Subject: [PATCH 022/150] 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 465a4d0718..2f73454223 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 1c5d23d9b4..e66305598c 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) From 6dde1aaa1482a111b80fd87d836c0537e7edd509 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:00:36 +0000 Subject: [PATCH 023/150] try save a few ns on parcel overlays --- .../World/Land/LandManagementModule.cs | 232 +++++++++++------- 1 file changed, 145 insertions(+), 87 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 8c327d8c72..c57e7bb8f7 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 /// - /// 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. /// /// The object representing the client - /// X position in the region to send surrounding parcel layer info - /// y position in the region to send surrounding parcel layer info - /// Distance from x,y position to send parcel layer info 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) + // hide avatars + if (!currentParcel.LandData.SeeAVs) + curByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS; + + // 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 (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) { - westParcel = GetLandObject((x - 1), y); + 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]; + } } - if (y > 0) + } + else + { + while (++x < sx && GetLandObjectIDinLandUnits(x, y) == curID) { - southParcel = GetLandObject(x, (y - 1)); - } + // 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; - 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; - } - - if (y == 0) - { - tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; - } - else if (southParcel != null && southParcel != currentParcelBlock) - { - 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; - - - 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]; + } } } } From 1c6be0fae39e3de9e449f7da67381a63746f1702 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:10:08 +0000 Subject: [PATCH 024/150] 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 c57e7bb8f7..d693d21f42 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; From 182977a872f837a29f936964d8df55942187261a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:38:43 +0000 Subject: [PATCH 025/150] do not send parceloverlay on crossings (may be bad, or not) --- OpenSim/Framework/ILandChannel.cs | 2 +- OpenSim/Region/CoreModules/World/Land/LandChannel.cs | 4 ++-- .../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 e5ea596327..0efd9085ec 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 993b7825c0..eaa5292ced 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 d693d21f42..c7b45ef291 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 e66305598c..a67d701c1e 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 cb16f55edd..87cbede58b 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 From b10a3ba0232031a1daac2a972478b7c34b7ec7ff Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:52:57 +0000 Subject: [PATCH 026/150] 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 0efd9085ec..6f4a07a293 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 eaa5292ced..9e687eb0aa 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 c7b45ef291..b67cad7e95 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 a67d701c1e..f010035c36 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 87cbede58b..b5227aa5df 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 From 132d8be9cc9d27175ad771dbb93d5822cbd5b513 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 07:22:24 +0000 Subject: [PATCH 027/150] 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 0d78654cbc..0cba49504c 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; From 71361f61f41d0a37efcf4f9637b1270a13d7a47c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 08:52:14 +0000 Subject: [PATCH 028/150] lludp SimStats encoding --- .../ClientStack/Linden/UDP/LLClientView.cs | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0cba49504c..41f40da427 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; + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; - pack.Header.Reliable = false; - pack.RegionInfo = new SimStatsPacket.RegionInfoBlock[0]; - OutPacket(pack, ThrottleOutPacketType.Task); + //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 From a7927e9d7b6ad4357b3b6701b79ad9f48496888a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 09:44:13 +0000 Subject: [PATCH 029/150] lludp ObjectAnimation encoding --- .../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 41f40da427..dd67e67b75 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; - for(int i = 0; i< count; i++) + //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; + + 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); } } From 7884278097d49730606afca20cad60510a70269d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 10:29:48 +0000 Subject: [PATCH 030/150] try to avoid some useless full object updates --- .../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 312ce26e4a..edcdbd3512 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 /// 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 /// 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) From c521ff394eb59bb5dfc767b3f8ebf7176b91685f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 10:59:01 +0000 Subject: [PATCH 031/150] 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 dd67e67b75..5302fff0fe 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; From af35882eda75c1a406ec7a2890370380810bf19f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 13:00:11 +0000 Subject: [PATCH 032/150] 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 edcdbd3512..1a5e9d6cf2 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; } From fe6317f009cbdbe9b075c32584e1188cb59ddf94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 21:37:58 +0000 Subject: [PATCH 033/150] LSL update texture entry is heavy, set all parameters on same update --- .../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 1a5e9d6cf2..cf9dfee913 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 5dc626076c..ba35b55e4f 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 cede84d25b..20dbd2ec5a 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 From 81ff118378863be6297016bef5a522ba0c76d1ca Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Mar 2019 14:41:19 +0000 Subject: [PATCH 034/150] lludp direct encode RegionHandshake --- .../ClientStack/Linden/UDP/LLClientView.cs | 268 +++++++++++------- 1 file changed, 161 insertions(+), 107 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5302fff0fe..aae4b87c83 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) + // temporary here ( from estatemanagermodule) + private uint GetRegionFlags() { - 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; + RegionFlags flags = RegionFlags.None; - 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; + 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; - handshake.RegionInfo3 = new RegionHandshakePacket.RegionInfo3Block(); - handshake.RegionInfo3.CPUClassID = 9; - handshake.RegionInfo3.CPURatio = 1; + return (uint)flags; + } - handshake.RegionInfo3.ColoName = Utils.EmptyBytes; - handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); - handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; + // 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 + }; - 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 + public void SendRegionHandshake(RegionInfo _regionInfo, RegionHandshakeArgs args) + { + RegionInfo regionInfo = m_scene.RegionInfo; + RegionSettings regionSettings = regionInfo.RegionSettings; + EstateSettings es = regionInfo.EstateSettings; - OutPacket(handshake, ThrottleOutPacketType.Unknown); + 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; From d6b3413c6337f8409b78266ac987aac63a5f77e5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Mar 2019 15:09:53 +0000 Subject: [PATCH 035/150] 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 1b5ebfaafb..1c0b97af98 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 63e3782606..0c5224b8be 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(); /// /// Send chat to the viewer. diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index aae4b87c83..50bb9ba0db 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 2f73454223..c899428f08 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 fb195e7119..59ce05a6a9 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 9c130618fc..09f2a58873 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 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 022ebdfe0b..bc6cb60ccd 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) { From 7211afb3b9193e23ee19225bd2f7ebfe8249bdd2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Mar 2019 15:12:56 +0000 Subject: [PATCH 036/150] missing file --- .../World/Estate/EstateManagementModule.cs | 98 +++++++------------ 1 file changed, 33 insertions(+), 65 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index ac28ceeac0..fd087213af 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.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.AllowDirectTeleport) - flags |= RegionFlags.AllowDirectTeleport; - if (Scene.RegionInfo.EstateSettings.DenyAnonymous) - flags |= RegionFlags.DenyAnonymous; - if (Scene.RegionInfo.EstateSettings.DenyIdentified) - flags |= RegionFlags.DenyIdentified; - if (Scene.RegionInfo.EstateSettings.DenyTransacted) - 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.ResetHomeOnTeleport) + flags |= RegionFlags.ResetHomeOnTeleport; + if (Scene.RegionInfo.EstateSettings.FixedSun) + flags |= RegionFlags.SunFixed; + 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) // unused? + flags |= RegionFlags.DenyIdentified; + if (Scene.RegionInfo.EstateSettings.DenyTransacted) // unused? + flags |= RegionFlags.DenyTransacted; + if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) + flags |= RegionFlags.AllowParcelChanges; + 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; } From b1cf06796f498be162ae8e3dedca2ae9d8af9bda Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 06:21:57 +0000 Subject: [PATCH 037/150] 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 cf9dfee913..6fb0eed03e 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 From cfbd34f618b8e1debd701aab3d51163942f08310 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 06:52:18 +0000 Subject: [PATCH 038/150] add some code for compressed updates, but disabled, since more changes are needed elsewhere --- .../ClientStack/Linden/UDP/LLClientView.cs | 411 +++++++++++++++--- .../ClientStack/Linden/UDP/LLUDPServer.cs | 10 +- 2 files changed, 365 insertions(+), 56 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 50bb9ba0db..662e5ade56 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 compressedUpdateBlocks = null; List objectUpdates = null; - // List compressedUpdates = null; + //List compressedUpdates = null; List terseUpdates = null; List 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) { - objectUpdates = new List(); - maxUpdatesBytes -= 18; + maxUpdatesBytes -= 150; // crude estimation + + if (objectUpdates == null) + { + objectUpdates = new List(); + maxUpdatesBytes -= 18; + } + objectUpdates.Add(update); + } + 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) + { + maxUpdatesBytes -= 150; // crude estimation + + if (objectUpdates == null) + { + objectUpdates = new List(); + maxUpdatesBytes -= 18; + } + objectUpdates.Add(update); + } + //compress still disabled + /* + else + { + maxUpdatesBytes -= 150; // crude estimation + + if (compressedUpdates == null) + { + compressedUpdates = new List(); + 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 tau = new List(30); - OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates, oPacket); }); + UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); + byte[] data = buf.Data; + + Buffer.BlockCopy(CompressedObjectHeader, 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 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(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 { - // TODO: Implement this - return null; + None = 0x00, + /// Unknown + ScratchPad = 0x01, + /// Whether the object has a TreeSpecies + Tree = 0x02, + /// Whether the object has floating text ala llSetText + HasText = 0x04, + /// Whether the object has an active particle system + HasParticles = 0x08, + /// Whether the object has sound attached to it + HasSound = 0x10, + /// Whether the object is attached to a root object or not + HasParent = 0x20, + /// Whether the object has texture animation settings + TextureAnimation = 0x40, + /// Whether the object has an angular velocity + HasAngularVelocity = 0x80, + /// Whether the object has a name value pairs string + HasNameValues = 0x100, + /// Whether the object has a Media URL set + MediaURL = 0x200 + } + + ///**** temp hack + private static Random rnd = new Random(); + + protected void CreateCompressedUpdateBlock(SceneObjectPart part, ScenePresence sp, byte[] dest, ref int pos) + { + // 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 c899428f08..a0b3d21e9f 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(); From db191cd4e26c759a2a66946329f07cc52fe1cab3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 07:13:39 +0000 Subject: [PATCH 039/150] 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 6fb0eed03e..5c38bf3d6e 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; } From d0052c817486a1691fc4e2e7027ac41240b966aa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 02:18:32 +0000 Subject: [PATCH 040/150] 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 +- .../ClientStack/Linden/UDP/LLClientView.cs | 249 +++++++--- .../ClientStack/Linden/UDP/LLUDPServer.cs | 9 +- .../World/Estate/EstateManagementModule.cs | 2 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 19 +- OpenSim/Region/Framework/Scenes/Scene.cs | 35 +- .../Framework/Scenes/SceneObjectGroup.cs | 66 ++- .../Framework/Scenes/SceneObjectPart.cs | 16 +- .../Region/Framework/Scenes/ScenePresence.cs | 449 +++++++++++------- .../Server/IRCClientView.cs | 4 +- .../OptionalModules/World/NPC/NPCAvatar.cs | 4 +- OpenSim/Tests/Common/Mock/TestClient.cs | 4 +- 12 files changed, 529 insertions(+), 345 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0c5224b8be..5a5e5d0413 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 OnRegionHandShakeReply; + event Action OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; event Action OnCompleteMovementToRegion; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 662e5ade56..526783e66e 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 OnRegionHandShakeReply; + public event Action 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 objectUpdates = null; - //List compressedUpdates = null; + List objectUpdateProbes = null; + List compressedUpdates = null; List terseUpdates = null; List 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 GroupsNeedFullUpdate = new HashSet(); - + 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(); + 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(); + 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(); - 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,23 +5047,7 @@ 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) - { - maxUpdatesBytes -= 150; // crude estimation - - if (objectUpdates == null) - { - objectUpdates = new List(); - maxUpdatesBytes -= 18; - } - objectUpdates.Add(update); - } - //compress still disabled - /* - else + if (useCompressUpdate) { maxUpdatesBytes -= 150; // crude estimation @@ -5052,7 +5058,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP } compressedUpdates.Add(update); } - */ + else + { + maxUpdatesBytes -= 150; // crude estimation + + if (objectUpdates == null) + { + objectUpdates = new List(); + maxUpdatesBytes -= 18; + } + objectUpdates.Add(update); + } } } @@ -5147,7 +5163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); } } - /* + if(compressedUpdates != null) { List tau = new List(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 handlerRegionHandShakeReply = OnRegionHandShakeReply; - if (handlerRegionHandShakeReply != null) - { - handlerRegionHandShakeReply(this); - } + Action 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 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; - if (handlerCompleteMovementToRegion != null) - { - handlerCompleteMovementToRegion(sender, true); - } - else - m_log.Debug("HandleCompleteAgentMovement NULL handler"); + if (handlerCompleteMovementToRegion == null) + return false; - handlerCompleteMovementToRegion = null; + CompleteAgentMovementPacket cmp = (CompleteAgentMovementPacket)Pack; + if(cmp.AgentData.AgentID != m_agentId || cmp.AgentData.SessionID != m_sessionId || cmp.AgentData.CircuitCode != m_circuitCode) + return false; + + 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 a0b3d21e9f..6032681290 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 /// public int IncomingOrphanedPacketCount { get; protected set; } + public bool SupportViewerObjectsCache = false; /// /// Run queue empty processing within a single persistent thread. /// @@ -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 fd087213af..936f956c7a 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 0c080d22df..299509100f 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 /// 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); + } + } - if (sog != null) - sog.SendFullAnimUpdateToClient(remoteClient); + //SceneObjectGroup sog = GetGroupByPrim(primLocalID); + + //if (sog != null) + //sog.SendFullAnimUpdateToClient(remoteClient); } /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7668a87511..7d312e90f0 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 7d5bbbf0a0..0b3817996e 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 + ); + } + } + /// /// 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; /// /// 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); } /// @@ -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 /// @@ -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 5c38bf3d6e..4f3f83a656 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; } - } - /// /// 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 /// @@ -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 f010035c36..e635841c46 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(); - if (gm != null) - Grouptitle = gm.GetGroupTitle(m_uuid); + if (!haveGroupInformation && !IsNPC) + { + IGroupsModule gm = m_scene.RequestModuleInterface(); + 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); + + 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)); + } } - - 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)); - } -// 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,33 +2189,30 @@ 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); - } - - // 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); - - // 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)); + ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); } + // 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); + + // 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)); + if(m_teleportFlags > 0) { gotCrossUpdate = false; // sanity check @@ -2251,104 +2250,103 @@ namespace OpenSim.Region.Framework.Scenes landch.sendClientInitialLandInfo(client, !gotCrossUpdate); } - if (!IsChildAgent) + List allpresences = m_scene.GetScenePresences(); + + // 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); + + // send this animations + + UUID[] animIDs = null; + int[] animseqs = null; + UUID[] animsobjs = null; + + if (Animator != null) + Animator.GetArrays(out animIDs, out animseqs, out animsobjs); + + bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); + + if (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 + //if (cachedbaked) { - List allpresences = m_scene.GetScenePresences(); - - // 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); - - // send this animations - - UUID[] animIDs = null; - int[] animseqs = null; - UUID[] animsobjs = null; - - if (Animator != null) - Animator.GetArrays(out animIDs, out animseqs, out animsobjs); - - bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); - - if (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 - //if (cachedbaked) + foreach (ScenePresence p in allpresences) { + if (p == this) + continue; + + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) + continue; + + SendAppearanceToAgentNF(p); + if (haveAnims) + SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); + } + } // 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); + }); + + // }); + } + 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()); + sog.ResumeScripts(); + } + foreach (ScenePresence p in allpresences) { if (p == this) + { + SendAttachmentsToAgentNF(this); continue; + } if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) continue; - SendAppearanceToAgentNF(p); - if (haveAnims) - SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); - } - } // 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); - }); - - // }); - } - 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()); - sog.ResumeScripts(); - } - - foreach (ScenePresence p in allpresences) - { - if (p == this) - { - SendAttachmentsToAgentNF(this); - 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(); - if (friendsModule != null) + if (openChildAgents) { - if(gotCrossUpdate) - friendsModule.IsNowRoot(this); - else - friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + IFriendsModule friendsModule = m_scene.RequestModuleInterface(); + 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 59ce05a6a9..80baf82dbc 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 OnRegionHandShakeReply; + public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action 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 09f2a58873..a7ed7d14d5 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 OnRegionHandShakeReply; + public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action 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 bc6cb60ccd..4fe2684c9a 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 OnRegionHandShakeReply; + public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; @@ -880,7 +880,7 @@ namespace OpenSim.Tests.Common { if (OnRegionHandShakeReply != null) { - OnRegionHandShakeReply(this); + OnRegionHandShakeReply(this, 0); } } From a9aba562b11d2b45eee0ad9edbae97167cf1ae8d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 02:24:32 +0000 Subject: [PATCH 041/150] 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 4f3f83a656..ebb8eda3b5 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; From 010d64dcd2d55850750b3c67ae901d7b183fd741 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 03:58:22 +0000 Subject: [PATCH 042/150] a bit more suicidal... --- .../ClientStack/Linden/UDP/LLClientView.cs | 6 ++-- .../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 526783e66e..9d606a682e 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 e635841c46..e35481f1b8 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; From b6626739e2b74dc0f66888ab9f383bd39a574945 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 04:28:22 +0000 Subject: [PATCH 043/150] 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 20dbd2ec5a..0b5616351b 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 From 9c322c93ccb3d4560bc3c1082c15ff9e01d6dda3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 08:04:23 +0000 Subject: [PATCH 044/150] fix particles encoding on compressedupdate --- .../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 9d606a682e..2b288df70b 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 /// Whether the object has floating text ala llSetText HasText = 0x04, /// Whether the object has an active particle system - HasParticles = 0x08, + HasParticlesLegacy = 0x08, /// Whether the object has sound attached to it HasSound = 0x10, /// Whether the object is attached to a root object or not @@ -7157,7 +7157,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Whether the object has a name value pairs string HasNameValues = 0x100, /// Whether the object has a Media URL set - 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); From 33986aea5e2ced1be33ef3b8d5c361742b17c427 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 23:32:39 +0000 Subject: [PATCH 045/150] 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 eb1ab4504a..e2934630f5 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++; } } From 027750e98ff40b87d774dc6ad4700969b3714087 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 00:35:30 +0000 Subject: [PATCH 046/150] compact the trivial te case, a more complete one may be needed even beening heavy --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 10 +++++++++- .../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 92f5a2cc24..16178e6c6f 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 ebb8eda3b5..5e2204e5fc 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); From 481d7156d16adc59da0ab82f0ae5d7b3c584e104 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 01:51:29 +0000 Subject: [PATCH 047/150] 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 16178e6c6f..deeacf5b58 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; } /// @@ -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 e2934630f5..8844a0fc06 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); From b32b104996289b3e28c179b992cb5f44b6d1327a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 16:15:24 +0000 Subject: [PATCH 048/150] some more changes on objects sending --- OpenSim/Framework/ISceneAgent.cs | 8 -- .../ClientStack/Linden/UDP/LLClientView.cs | 27 +++++-- .../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 5d70b83357..43e1b085b8 100644 --- a/OpenSim/Framework/ISceneAgent.cs +++ b/OpenSim/Framework/ISceneAgent.cs @@ -70,14 +70,6 @@ namespace OpenSim.Framework AvatarAppearance Appearance { get; set; } /// - /// Send initial scene data to the client controlling this agent - /// - /// - /// This includes scene object data and the appearance data of other avatars. - /// - void SendInitialDataToMe(); - - /// /// Direction in which the scene presence is looking. /// /// Will be Vector3.Zero for a child agent. diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2b288df70b..601de61de2 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 e35481f1b8..9a879f7ca7 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; - - }); - } - /// /// Send avatar full data appearance and animations for all other root agents to this agent, this agent /// can be either a child or root From 5035de053a533bb0407fb8ad11c44351026f6cf8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Mar 2019 17:51:38 +0000 Subject: [PATCH 049/150] we should be able to zeroencode compressedupdates --- .../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 601de61de2..187b6fa7c4 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 tau = new List(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(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 tau = new List(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(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) { From 83fd05f13165477b82615c74a12f08b0a2bdfb05 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 02:04:11 +0000 Subject: [PATCH 050/150] 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 187b6fa7c4..67c5e38830 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 9a879f7ca7..63eb29fbcf 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 allpresences = m_scene.GetScenePresences(); foreach (ScenePresence p in allpresences) { From dad533fe1c5574f9c8813955030f1b0f9a1f078e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 06:43:22 +0000 Subject: [PATCH 051/150] 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 67c5e38830..6b70922797 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; } From 5663e2c0c82756268c5a6aa767e6ca765c00e71d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 07:32:06 +0000 Subject: [PATCH 052/150] 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 6b70922797..d21452febd 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 6032681290..b105d52c5a 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 63eb29fbcf..2145fcdbac 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)); From 1847a42a861d6a0f575c56f566b947dfb21c1f03 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Mar 2019 00:02:24 +0000 Subject: [PATCH 053/150] changes on teleports v7 --- OpenSim/Framework/ChildAgentDataUpdate.cs | 16 ++-- .../EntityTransfer/EntityTransferModule.cs | 92 +++++++------------ .../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 ee5007abf8..2d00296460 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 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 9471c908cb..09b0dd6027 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -54,14 +54,8 @@ 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; - /// - /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. - /// - public int MaxTransferDistance { get; set; } - /// /// 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. @@ -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); @@ -639,29 +628,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return true; } - /// - /// Determines whether this instance is within the max transfer distance. - /// - /// - /// - /// - /// true if this instance is within max transfer distance; otherwise, false. - /// - 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; - } - /// /// Wraps DoTeleportInternal() and manages the transfer state. /// @@ -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; } /// @@ -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 2145fcdbac..a95036c198 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 /// - /// 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. /// - private string m_callbackURI; + private string m_callbackURI; // to remove with v1 support + private string m_newCallbackURI; /// /// 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(); @@ -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); From 3644879677a53d1d18319b826050949a6950a2a9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Mar 2019 02:32:36 +0000 Subject: [PATCH 054/150] mantis 8508: ignore llAttachToAvatar if already attached --- .../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 ba35b55e4f..45efa77836 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); } From f6db9e044d56ed86d95d468980bef2c8acc4f1c8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Mar 2019 13:46:39 +0000 Subject: [PATCH 055/150] 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 1b735e33de..3743b7e5eb 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)) { From 6cf85a3db111c2f8e56dde8a05ff3cf13f5ecd14 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Mar 2019 12:07:49 +0000 Subject: [PATCH 056/150] a few more changes on initial objects send --- OpenSim/Framework/IClientAPI.cs | 4 +- .../ClientStack/Linden/UDP/LLClientView.cs | 27 +++- .../ClientStack/Linden/UDP/LLUDPServer.cs | 124 ++--------------- .../CoreModules/World/Land/LandObject.cs | 2 +- .../Region/Framework/Scenes/ScenePresence.cs | 128 ++++++++++-------- .../Server/IRCClientView.cs | 11 +- .../OptionalModules/World/NPC/NPCAvatar.cs | 9 +- OpenSim/Tests/Common/Mock/TestClient.cs | 9 +- 8 files changed, 120 insertions(+), 194 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5a5e5d0413..8b1a98286b 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 OnRegionHandShakeReply; + event Action OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; event Action 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 d21452febd..6859b8357c 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 OnRegionHandShakeReply; + public event Action 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 handlerRegionHandShakeReply = OnRegionHandShakeReply; + Action 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(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 b105d52c5a..6746573860 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 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); - } - } -*/ /// /// 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 26500ab3e7..094b0f523b 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 a95036c198..123b605dc7 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; } /// /// 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; + + if (NeedInitialData) + { + SendInitialData(); + return; + } + + if (IsChildAgent || IsInTransit) return; CheckForBorderCrossing(); - if (IsInTransit || IsLoggingIn) - return; - - if(m_movingToTarget) + 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 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 80baf82dbc..9f85185dc0 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 OnRegionHandShakeReply; + public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action 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 a7ed7d14d5..954d336e04 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 OnRegionHandShakeReply; + public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action 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 4fe2684c9a..0af49f23b4 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 OnRegionHandShakeReply; + public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; public event Action 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; + } } } From fa4716955eeab003cf7096b1736661c2fa676b94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Mar 2019 12:51:10 +0000 Subject: [PATCH 057/150] make 2 tests happy again --- .../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 5457dc3831..0e7be7de3d 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( From 98be9969912921b67e1fd831fb567d18ad84823b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Mar 2019 12:56:23 +0000 Subject: [PATCH 058/150] 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 0af49f23b4..0031127763 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; } } From 4626f0850a6a8d65105d63dcf90a87b1d696f004 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 02:12:30 +0100 Subject: [PATCH 059/150] fix osSet/GetPrimitiveParams threat level --- .../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 dabd399b0a..7348499461 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"); From 89ac80189c16da5320518467b725405b8ecbd16f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 05:34:35 +0100 Subject: [PATCH 060/150] do clear MOAP on remove --- .../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 f5aa40a856..66a7df162f 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; From 3a6d87da9519e0c3be3e6711d02301f72196bba7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 19:28:06 +0100 Subject: [PATCH 061/150] a few more changes on initial data sending --- .../Region/Framework/Scenes/ScenePresence.cs | 144 ++++++------------ 1 file changed, 43 insertions(+), 101 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 123b605dc7..2f26320758 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(); if (gm != null) @@ -2150,54 +2151,46 @@ 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 + + if (!gotCrossUpdate) + RotateToLookAt(look); + + m_previusParcelHide = false; + m_previusParcelUUID = UUID.Zero; + m_currentParcelHide = false; + m_currentParcelUUID = UUID.Zero; + ParcelDwellTickMS = Util.GetTimeStampMS(); + + m_inTransit = false; + + // Tell the client that we're ready to send rest + ControllingClient.SendRegionHandshake(); + + ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; - int delayctnr = Util.EnvironmentTickCount(); - - if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) + if(!IsNPC) { - ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); - } - - // 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); - - // not sure we need this - if (!cachedbaked) + if( ParentPart != null && (crossingFlags & 0x08) != 0) { - if (m_scene.AvatarFactory != null) + ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); + } + + // verify baked textures and cache + if (m_scene.AvatarFactory != null && !isHGTP) + { + 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); - // 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(); @@ -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; From 9650cb87083ed40a55f5fc54c129e9ec18c93f46 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 20:31:35 +0100 Subject: [PATCH 062/150] 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 2f26320758..0687da49e8 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; From 939aff5c3ba6b667c22f371ec8250cd8ac9f8271 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 20:43:32 +0100 Subject: [PATCH 063/150] 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 0687da49e8..cd630b838b 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; } } From 190e2da672704068a0b9c1b4ea48e2b92ba9fdca Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 22:50:14 +0100 Subject: [PATCH 064/150] 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 3743b7e5eb..d237d2c3f2 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)) From 7110e988155943168c5cf55281f4c57961d1be9a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 23:31:18 +0100 Subject: [PATCH 065/150] 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 cd630b838b..5faa7641dc 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 { From 772aa5234a144486d1b2dd1a70fd403cacb9b767 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 01:48:23 +0100 Subject: [PATCH 066/150] 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 7fc97e9c1a..7ef1b9f08e 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(); From 3327bed34b8edd37e293493da39d4f515850d92d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 12:46:03 +0100 Subject: [PATCH 067/150] fix tp set callback log message --- .../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 09b0dd6027..831c359beb 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); } /// From 5dc7623e388827184e90220eceecdfd076d546a1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 13:18:40 +0100 Subject: [PATCH 068/150] change avatar arrival at hg destination handling --- .../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 831c359beb..01b4f106e7 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); } From 3b63699b9d9f26248af8e27b3ea183903bdeaa67 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 13:55:54 +0100 Subject: [PATCH 069/150] still issues on fast hg tps --- .../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 01b4f106e7..fb2fd07490 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); } From 7f55db72d2c2be3d0e3396dc8a4ba8ca1f504fd3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 13:58:41 +0100 Subject: [PATCH 070/150] Yengine: try fix changing scripts running state if the have long events --- .../Region/ScriptEngine/YEngine/XMREngine.cs | 27 ++++++++- .../ScriptEngine/YEngine/XMRInstMisc.cs | 27 ++++++++- .../Region/ScriptEngine/YEngine/XMRInstRun.cs | 57 +++++++++++++------ .../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 6acc293869..e1f8c4c329 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 12feb7b428..ff8dae5abc 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 d237d2c3f2..4f94c23c5a 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 llns = new LinkedListNode(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 08c7e80c92..f68fd51cd1 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; From 2739b2f5cc633cb9d292b037a03c160be749777e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 Apr 2019 18:12:17 +0100 Subject: [PATCH 071/150] 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 8844a0fc06..adc8298867 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(); From ba66d2d3c125136171dc9fec34bb9d424a6a731d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 10:13:26 +0100 Subject: [PATCH 072/150] minor cleanup on mesh decompress code --- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 28 ++++++------------- .../Meshing/Meshmerizer/Meshmerizer.cs | 16 ++++------- .../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 adc8298867..cf5f0ef15b 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 0d4b6b96f2..de39d0ed07 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 6950f2dc2a..84495963ab 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) From 1984cbdbe5beaa26b46cb9e03ddf6cbcaf56815b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 13:49:25 +0100 Subject: [PATCH 073/150] add extra delay before sending initial data --- .../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 5faa7641dc..8c462116ed 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; } From 8152e47a4a3a460590825e9475599075c9e31e9d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 15:10:42 +0100 Subject: [PATCH 074/150] change the point where child regions are closed/opened --- .../Region/Framework/Scenes/ScenePresence.cs | 166 +++++++++--------- 1 file changed, 86 insertions(+), 80 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8c462116ed..12887fbced 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(); - 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(); + 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) - { - if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) - ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); - } } else { - 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) + 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)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; } - - m_reprioritizationLastPosition = AbsolutePosition; - m_reprioritizationLastDrawDistance = DrawDistance; - m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it - - m_reprioritizationBusy = false; - }); } From 433e529512b20aed91412e0f8c0f02f38d422035 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 15:58:36 +0100 Subject: [PATCH 075/150] make tests happy again; try to speedup crossings --- .../Avatar/Chat/Tests/ChatModuleTests.cs | 16 +++++++--- .../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 0e7be7de3d..e63629e680 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 12887fbced..c71d20d2c8 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(); + 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 From e7f0131509c33e0af55d361f476f2c270aedb152 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 17:05:47 +0100 Subject: [PATCH 076/150] another test.... --- .../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 abf8c488c5..7c3eab1e56 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); From b458c5a9b4ffeff738d4e854bdf81e70427845fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 17:26:06 +0100 Subject: [PATCH 077/150] another test.... --- .../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 94e6b99c3b..676d7eb981 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 destinationTestClients = new List(); 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)); } /// @@ -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)); From 8e094887cd72fb878a5ac33bcb2fd95fcf771462 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 20:27:56 +0100 Subject: [PATCH 078/150] change avatars sending point --- .../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 c71d20d2c8..2c20da6f37 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(); 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; From 15b6d8c1477e6a294819bf5c0c510d909997fb8f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 00:50:54 +0100 Subject: [PATCH 079/150] 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 +++ .../Framework/EntityTransfer/EntityTransferModule.cs | 3 ++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++++++- .../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 5a9eeb57f9..330a41e93d 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 /// public Vector3 startpos; + public float startfar = -1.0f; public Dictionary 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 b6e48b4372..2cd11ffe83 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 8b1a98286b..b395f392e6 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 54a6654685..b8a24ea7a6 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 6859b8357c..5ffea6297b 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 fb2fd07490..6b3e8c48c3 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 2c20da6f37..be593ad5a2 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 9f85185dc0..16be1c80f8 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(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 954d336e04..b2a9716a93 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 0031127763..3cd525369a 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; } From 42414bfa551d8039bd5fb4ae9c7054c4bb67d599 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 15:07:15 +0100 Subject: [PATCH 080/150] 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 e2b68326b5..3ee1648c63 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 From 07796d5ccfc8b5a8df0a50d6f4678a9c13847318 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 18:52:28 +0100 Subject: [PATCH 081/150] 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 75ed999601..98ef5d58e3 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -180,6 +180,7 @@ namespace OpenSim.Framework private Dictionary m_extraSettings = new Dictionary(); + 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 5ffea6297b..8d5980a22e 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 From a56f40470efd0b3ca6000cb4561efc59c6b3c25e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 18:55:40 +0100 Subject: [PATCH 082/150] control visible regions by avatar position and view range, first dirty code --- .../EntityTransfer/EntityTransferModule.cs | 360 ++++++++++++++---- .../Interfaces/IEntityTransferModule.cs | 2 + OpenSim/Region/Framework/Scenes/Scene.cs | 6 +- .../Region/Framework/Scenes/ScenePresence.cs | 146 ++++--- 4 files changed, 371 insertions(+), 143 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6b3e8c48c3..b4ac968008 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 oldregions = new List(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 RegionsInView(Vector3 pos, RegionInfo curregion, List fullneighbours, float viewrange) + { + List ret = new List(); + 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; + } + /// /// 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 neighbours = new List(); 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 = m_regionInfo.RegionHandle; + ulong currentRegionHandler = regionInfo.RegionHandle; + + List fullneighbours = GetNeighbors(sp); + List neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); LinkedList previousRegionNeighbourHandles; Dictionary seeds; @@ -2082,13 +2080,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer List cagents = new List(); List newneighbours = new List(); - 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(previousRegionNeighbourHandles); -// sp.CloseChildAgents(toclose); - } - else - toclose = new List(); + toclose = new List(previousRegionNeighbourHandles); } else toclose = new List(); @@ -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 fullneighbours = GetNeighbors(sp); + List neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + + LinkedList previousRegionNeighbourHandles = new LinkedList(sp.KnownRegions.Keys); + + IClientAPI spClient = sp.ControllingClient; + + AgentCircuitData currentAgentCircuit = + spScene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); + + List cagents = new List(); + List newneighbours = new List(); + + 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 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(previousRegionNeighbourHandles); + } + else + toclose = new List(); + + 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 fullneighbours = GetNeighbors(sp); + List neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + + LinkedList previousRegionNeighbourHandles; + Dictionary seeds; + ICapabilitiesModule capsModule = spScene.CapsModule; + + if (capsModule != null) + { + seeds = new Dictionary(capsModule.GetChildrenSeeds(sp.UUID)); + previousRegionNeighbourHandles = new LinkedList(seeds.Keys); + } + else + { + seeds = new Dictionary(); + previousRegionNeighbourHandles = new LinkedList(); + } + + 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 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(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 Neighbors = null; + DateTime LastNeighborsTime = DateTime.MinValue; + /// /// Return the list of online regions that are considered to be neighbours to the given scene. /// @@ -2423,39 +2615,41 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// /// - protected List GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) + protected List GetNeighbors(ScenePresence avatar) { Scene pScene = avatar.Scene; - RegionInfo m_regionInfo = pScene.RegionInfo; + + uint dd = (uint)pScene.MaxRegionViewDistance; + if(dd <= 1) + return new List(); + + if (Neighbors != null && (DateTime.UtcNow - LastNeighborsTime).TotalSeconds < 30) + { + return Neighbors; + } + + RegionInfo regionInfo = pScene.RegionInfo; List neighbours; - uint dd = (uint)avatar.RegionViewDistance; + dd--; - // 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); + uint startX = Util.RegionToWorldLoc(regionInfo.RegionLocX); + uint endX = startX + regionInfo.RegionSizeX; + uint startY = Util.RegionToWorldLoc(regionInfo.RegionLocY); + uint endY = startY + regionInfo.RegionSizeY; - ddX--; - ddY--; + startX -= dd; + startY -= dd; + endX += dd; + endY += 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; - - startX -= ddX; - startY -= ddY; - endX += ddX; - endY += ddY; - - 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 1b690bad3f..937756448b 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 7d312e90f0..e130bd7bc2 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 old = new List(); 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 be593ad5a2..fbf9b4a783 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(); 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(); + 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; + + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); + float dx = pos.X - m_lastChildAgentCheckPosition.Y; + float dy = pos.Y - m_lastChildAgentCheckPosition.Y; + if ((m_agentTransfer != null) && ((dx * dx + dy *dy) > CHILDAGENTSCHECK_MOVEMENT)) { - int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); - if(tdiff < CHILDUPDATES_TIME) - return; + m_childUpdatesBusy = true; + m_lastChildAgentCheckPosition = pos; + m_lastChildAgentUpdatePosition = pos; + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + // m_lastChildAgentUpdateCamPosition = CameraPosition; - bool doUpdate = false; - if(m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) - doUpdate = true; - - if(!doUpdate && Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) - doUpdate = true; - - 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; + bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; + if (!viewchanged) + doUpdate = true; - 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); + if(!doUpdate) + { + diff = pos - m_lastChildAgentUpdatePosition; + if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) + doUpdate = true; + } - // 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"); + 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"); + } } } } From 50c810549c5faf87017c189326732ba8899a58d0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 20:16:23 +0100 Subject: [PATCH 083/150] 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 b4ac968008..86685587a9 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 fbf9b4a783..438ae4cb5f 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(); - 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; From 8d272fb1d08275e4416c08fc82c054825d427467 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 03:25:02 +0100 Subject: [PATCH 084/150] mantis 8512: fix runprebuild --- runprebuild.bat | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/runprebuild.bat b/runprebuild.bat index 3ee1648c63..e5d7cb882c 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 From 0652f01d4cbae9585f4288b68d1feff1711d6be4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 03:45:27 +0100 Subject: [PATCH 085/150] duhhh npcs don't have child agents; plus minor typos --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 2 +- .../ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../Region/Framework/Scenes/ScenePresence.cs | 17 ++++++++++++----- .../Region/Framework/Scenes/SimStatsReporter.cs | 2 +- .../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 deeacf5b58..ea68581f33 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 cf5f0ef15b..9b8f11a52b 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 8d5980a22e..a1d2e11551 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 438ae4cb5f..f9d1f54b46 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 bc440fc144..50b0cb5571 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 7ad5e3ddb1..267fc5b458 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 e5d7cb882c..0bee6f5781 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 From 63321f9ccc1e35db8034da64c510f334e7d5e7d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 04:08:14 +0100 Subject: [PATCH 086/150] 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 e130bd7bc2..351592da17 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 m_AllowedViewers = new List(); private List m_BannedViewers = new List(); @@ -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 f9d1f54b46..60a9c3a398 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 0b5616351b..9518aaf0a4 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 From 6485377ecd8ece0e1a998e03d5f38db9bf6890a8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 04:21:40 +0100 Subject: [PATCH 087/150] 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 351592da17..2fa92b3394 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 60a9c3a398..200036c527 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(); 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) From 7ce45235e61b1ee48a2b5208e5fdfb39a76ad96c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 11:19:38 +0100 Subject: [PATCH 088/150] 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 200036c527..a52fa76e14 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 9518aaf0a4..8696fe883a 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 From 28c97257302a6f6596dca0b79f4c57f0e7f28225 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 12:31:43 +0100 Subject: [PATCH 089/150] 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 a52fa76e14..c728d9b235 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); } From 3bc0690a7a49fe38644ca3ae3cfae6bb5f34c91a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 12:32:36 +0100 Subject: [PATCH 090/150] temp workaround on sits culling --- .../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 a1d2e11551..112b66d7a9 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); + } } } } From 5ed2b5c990a9d0037a15347cb8bb4db1a105c5e8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 14:43:48 +0100 Subject: [PATCH 091/150] try handle the special case MaxRegionsViewDistance = 0 (agents only see void around region, even if there are regions around --- .../EntityTransfer/EntityTransferModule.cs | 50 +++++++++++++++---- .../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 86685587a9..75d7bc555f 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 RegionsInView(Vector3 pos, RegionInfo curregion, List fullneighbours, float viewrange) { List ret = new List(); - 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 /// 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 fullneighbours = GetNeighbors(sp); - List neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + List neighbours; + if (sp.RegionViewDistance > 0) + { + List fullneighbours = GetNeighbors(sp); + neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + } + else + neighbours = new List(); LinkedList previousRegionNeighbourHandles; Dictionary 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 fullneighbours = GetNeighbors(sp); - List neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + List neighbours; + if (sp.RegionViewDistance > 0) + { + List fullneighbours = GetNeighbors(sp); + neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + } + else + neighbours = new List(); LinkedList previousRegionNeighbourHandles = new LinkedList(sp.KnownRegions.Keys); @@ -2342,8 +2366,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer ulong currentRegionHandler = regionInfo.RegionHandle; - List fullneighbours = GetNeighbors(sp); - List neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + List neighbours; + if (sp.RegionViewDistance > 0) + { + List fullneighbours = GetNeighbors(sp); + neighbours = RegionsInView(sp.AbsolutePosition, regionInfo, fullneighbours, sp.RegionViewDistance); + } + else + neighbours = new List(); LinkedList previousRegionNeighbourHandles; Dictionary seeds; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c728d9b235..aea3a8db47 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); From 0ebb1f3f4b7dc2ede7ab12cd086f8189926251ad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 12:25:54 +0100 Subject: [PATCH 092/150] 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 a7e62eb755..3f418f6de3 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) From b7c1d6e7f5b4005d5a416e991de32ab67d8e6693 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 16:09:42 +0100 Subject: [PATCH 093/150] UserAgentService: change handling of its external IP --- .../Simulation/SimulationServiceConnector.cs | 9 ---- .../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 4fd1fe54e3..e15ac8c47b 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -99,15 +99,8 @@ 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 6f2cdd5e99..bfa97a157c 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; } } } From a25e18587c4f6757361f15b7e2ad844eade5b40f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 16:30:19 +0100 Subject: [PATCH 094/150] 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 8696fe883a..8582b94a2e 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 From ec6a52c029792e78d31100a742d575ae71b402e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 21:26:12 +0100 Subject: [PATCH 095/150] change interpretation of a viewer flag --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- .../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 112b66d7a9..62f0b32126 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 6746573860..19535dcfc2 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 /// public int IncomingOrphanedPacketCount { get; protected set; } - public bool SupportViewerObjectsCache = false; + public bool SupportViewerObjectsCache = true; /// /// Run queue empty processing within a single persistent thread. /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index aea3a8db47..c536184f8c 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(); 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) From 442ef1cc9e5c7d2c9dce17ee525f6adb41cdc5ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 21:27:54 +0100 Subject: [PATCH 096/150] change a comment --- bin/OpenSimDefaults.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 8582b94a2e..456dcd6e8a 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 From 539a3a9273a2777f6a42d739e496da2b74b2efa7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 Apr 2019 16:29:31 +0100 Subject: [PATCH 097/150] 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 0f9bb4b27b..726e468304 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 3222a94ad1..50986de847 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" From b104934a258c34a77c0470b8495d9d286c82f4f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Apr 2019 13:50:51 +0100 Subject: [PATCH 098/150] 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 +++- .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 6 + bin/ScriptSyntax.xml | 123 +++++++++--------- 4 files changed, 93 insertions(+), 60 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7348499461..4a74c1530b 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 49b3f74e8c..26bac00da4 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 fb491e4923..7a4a5fb1d3 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 8f2f6002f9..989984a31b 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -20392e48-fad2-094e-bc5b-cda003a1e940 +e796a21f-5a66-e4ec-833f-c4896b8e87e4 llsd-lsl-syntax-version2 controls @@ -6116,6 +6116,41 @@ arguments atypefloat btypefloat + margintypefloat + + + osApproxEquals + + returninteger + arguments + ratyperotation + rbtyperotation + margintypefloat + + + osApproxEquals + + returninteger + arguments + ratyperotation + rbtyperotation + + + osApproxEquals + + returninteger + arguments + vatypevector + vbtypevector + margintypefloat + + + osApproxEquals + + returninteger + arguments + vatypevector + vbtypevector osApproxEquals @@ -6124,41 +6159,6 @@ arguments atypefloat btypefloat - margintypefloat - - - osApproxEquals - - returninteger - arguments - ratyperotation - rbtyperotation - - - osApproxEquals - - returninteger - arguments - vatypevector - vbtypevector - margintypefloat - - - osApproxEquals - - returninteger - arguments - ratyperotation - rbtyperotation - margintypefloat - - - osApproxEquals - - returninteger - arguments - vatypevector - vbtypevector osAvatarName2Key @@ -6284,6 +6284,8 @@ returnstring arguments drawListtypestring + startXtypeinteger + startYtypeinteger endXtypeinteger endYtypeinteger @@ -6293,8 +6295,6 @@ returnstring arguments drawListtypestring - startXtypeinteger - startYtypeinteger endXtypeinteger endYtypeinteger @@ -6433,13 +6433,13 @@ arguments avatartypestring - targettypestring osForceOtherSit arguments avatartypestring + targettypestring osFormatString @@ -6653,6 +6653,11 @@ rulestypelist + osGetPSTWallclock + + returnfloat + arguments + osGetRegionMapTexture returnkey @@ -6865,6 +6870,7 @@ nametypestring positiontypevector notecardtypestring + optionstypeinteger osNpcCreate @@ -6875,7 +6881,6 @@ nametypestring positiontypevector notecardtypestring - optionstypeinteger osNpcGetOwner @@ -7100,13 +7105,13 @@ osRegionNotice arguments - agentIDtypekey msgtypestring osRegionNotice arguments + agentIDtypekey msgtypestring @@ -7478,6 +7483,8 @@ arguments srctypestring valuetypestring + starttypeinteger + counttypeinteger ignorecasetypeinteger @@ -7487,8 +7494,6 @@ arguments srctypestring valuetypestring - starttypeinteger - counttypeinteger ignorecasetypeinteger @@ -7551,6 +7556,15 @@ osTeleportAgent + + arguments + agenttypestring + regionNametypestring + positiontypevector + lookattypevector + + + osTeleportAgent arguments agenttypestring @@ -7568,15 +7582,6 @@ lookattypevector - osTeleportAgent - - arguments - agenttypestring - regionNametypestring - positiontypevector - lookattypevector - - osTeleportObject returninteger @@ -7588,13 +7593,6 @@ osTeleportOwner - - arguments - positiontypevector - lookattypevector - - - osTeleportOwner arguments regionNametypestring @@ -7611,6 +7609,13 @@ lookattypevector + osTeleportOwner + + arguments + positiontypevector + lookattypevector + + osTerrainFlush arguments From cadcf412ec55b38ff10596958cd09dd6ef4dfd3a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Apr 2019 14:04:02 +0100 Subject: [PATCH 099/150] linux likes other tz names --- .../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 4a74c1530b..de7da0ed00 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() From 2c8e03b589585c1d4b19368f30ccf2806f09cafb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 00:25:38 +0100 Subject: [PATCH 100/150] testing ... --- .../ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++---- .../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 62f0b32126..9e0c783707 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 19535dcfc2..381783013c 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 /// Maximum transmission unit, or UDP packet size, for the LLUDP protocol public const int MTU = 1400; - public const int MAXPAYLOAD = 1250; + public const int MAXPAYLOAD = 1200; /// Number of forced client logouts due to no receipt of packets before timeout. public int ClientLogoutsDueToNoReceives { get; protected set; } @@ -298,9 +293,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Reference to the scene this UDP server is attached to public Scene Scene { get; protected set; } - /// The X/Y coordinates of the scene this UDP server is attached to - protected Location m_location; - /// 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 @@ -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; From f29fdb6bdae51e50f749e2144a3e92fb3171f436 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 10:22:55 +0100 Subject: [PATCH 101/150] old tp timing issues on grid presence notification did came back, so put back old hack --- .../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 75d7bc555f..a2c2aa754a 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++; From b8a061816ff15bd6d021e4936ee4332877d557b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 12:46:21 +0100 Subject: [PATCH 102/150] 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 9e0c783707..670d61feb2 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(30); - tau.Add(eu); + //tau.Add(eu); count = 1; } } From 49fb9d6b4bdb31d7a67bc0d97f565122a273bc96 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 13:05:18 +0100 Subject: [PATCH 103/150] 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 670d61feb2..2fb67e0403 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; From c09b312b058a9fb7d5da15abeb8708d69fd97cf5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 18:50:08 +0100 Subject: [PATCH 104/150] 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 2fb67e0403..b7e9117dfe 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(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 303f5054fd..fc1e8462d6 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 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"); + */ } /// @@ -763,13 +766,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// 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 381783013c..285751da1e 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) From b051b3a81dbb3bb0e7358e257b1cf82f5daee4ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Apr 2019 21:30:06 +0100 Subject: [PATCH 105/150] change to ping based RTO --- .../ClientStack/Linden/UDP/LLUDPClient.cs | 68 ++++--------------- .../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 fc1e8462d6..f812ce13a2 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 /// Calculated from and using the /// guidelines in RFC 2988 - public int RTO; + public int m_RTO; /// 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) 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 } /// - /// 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 /// - /// Round-trip time of a single packet and its + /// ping time in ms /// acknowledgement - 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"); - */ - } - - /// - /// Exponential backoff of the retransmission timeout, per section 5.5 - /// of RFC 2988 - /// - 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 285751da1e..e3139345fd 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 expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO); + List 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 1f978e13c3..32a6c404d6 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 { From b459b2c65f4aa393a07147ea56b21a433bc33fc9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 00:25:49 +0100 Subject: [PATCH 106/150] dont send animation before object --- .../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 b7e9117dfe..7dfcc7a918 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(); 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(); + 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(); + 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 From ee989dd5522df30666b91bac5bb95643cc4a4523 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 00:27:17 +0100 Subject: [PATCH 107/150] 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 b395f392e6..8d0cb5afbd 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() From 4475b3db2774073d1ab430bc8aa33b310f5fff2e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 14:01:10 +0100 Subject: [PATCH 108/150] 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 7dfcc7a918..988f5478d6 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 tau = new List(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(30); tau.Add(eu); count = 1; - --blocks; } } From d9776131624703df55079e82bb4250cb1e5d3ec0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Apr 2019 21:28:41 +0100 Subject: [PATCH 109/150] 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 988f5478d6..01a9fb6eb8 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) { From 2b604fa8894811a6ec4aaf70542c24d974026048 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 11 Apr 2019 23:44:18 +0100 Subject: [PATCH 110/150] 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 523d67f95c1506ec4b9ec9f7c34f39f99fd25726..4eb3f77c7ac731e42727336d03a71ca52503fa2c 100755 GIT binary patch delta 14641 zcmbuG2Yggz*8k7*%*?%a?j(~bnaNBhfk1+Z)SxU<6lp3dReBL=QeKcI2o}7FB7&lT z!%`Fwc0mDg7eomns7MJ2q9}^4;8HAr$byREYvDcTJWqxovj5%BKguu9_nh<8`;>d< zPDSEY|njivHs~_yx+9OYVB*c%&S7(fIOL>1*a`eo&XHr~% zJ2_%zZpTU4m~zMK=gIrY=B{r_H+$v%>|v%a= z?@wU5MmSX42!@^z1Q3I}WXf}!Y)dN>3K(Qr7~V^&W4%xE~$Xa$xV4M!V2iob(_ z8d*KUft$j1&`scKGEG#smSZ!{dQb$hDp|E~UuN;27&p*3oHXxt6snYah1P_myD@XKm7%Y?jw2WRm`ZYQupL#V;|-A~w7m`y|~4ubVVrcJSLUKT7Fw5sI0XOS#(kw+0+P z3{NbH`(c2+ByPaN1~uZ!FjX)O-3E*SQg1HluUzq2w$uqx5hF~}+Ft5$n+&S>JFaYz z@d@_3ZG^h9%@{6hcrKT8HK%8?zE4^OR%Unb-wkF2uL%C&yu}~E{{`UFWV?+Cr+VgO z(GH@JkJbRxixU+=Q>OYRQB7#i*TX$b9W#j9z`ab9Z}by(hgpnwEv9>N$@dr>VA{wPPKV=6 z-z4j7y0Y;^wuMB#psq~E2DXDNQJZN1=PnX0m>NdNS4VVYdM7z!QzD}#+ggY_*cM5? zx+&otGX(65lZLIYQSXeOLY*G?7PTOD)-Ygq&QGYXv2I5daN6@NTHeh16?JutG!_x2 z0YAk^5BiUxrB62LC!FqqX%{SWe~bFIUzjdvlP%0BG!w@hBMQah80u53^(Cc`ae5GI zoGk{cWWA5|K`b;1<5_Rx$TqBfShv~aZIVk`JA;~{x}iEy;&z(?of!rN+t!J ziIKj@>8lM3dy~)O(KbpW=vH;7>ray@YiqYoi>p z+=wMO0%ANfC-BsJnlp3;%Ju^5SFAp^_vZ9k)_<|~WnIVmEo+n`PjaKPaoDlBtZ8hi zg$okzKG{Mu59dG4a{<4FNb7RXrm)6w3E`-)x;S$kwm-sJkL~Tb%I8>*uo_%_H%|YJ z^#rS*?E%h}$NB-6>2%^2?PIu&(;4ip%8Ca84%AB4FIjC|iUN9Z`X$y=tRc3?Z1NVd zew9P%NEOm!3DPXK7qWiI-bGF>Id0)1o@V`wRdR8bDu^?ioTjZtz_YY>1q|Tr zOWDX-hmmYI71hgofwFg zO|BuRPJB2jZBV!rd4E*f)Gn^zGgLQ({Inpq#A)yAX3{Fib<^2V#QKYi((kigs6{~3 z9PMCeeV+L%&GDGN;5J}0H>er+uWNwT?lRud`tX|W>!K=uP9r^!(5#16`~QEglB|+wP8#<5aR7Z?Q|z`Qs8!kQ^vq$ zL)wWC)|PHcs|wVys|s3&GlLEu(#QDVp`s0-ov^_%)k>q zfDc!IH%`}t=b9d9s;Mk{AvU9*rap;Rvw9a$_P`w5_VOh>= zI1h?7O=fD&R0=b(zd=}1s3JEe)?wt^nqGFlX@+oJQp=nuGIWD%VQnbg6 zLrYD`Sh<<)K+hEJF>_&=|sHT%!BMJRTU@Vd(3=jpy_qH+$?}@DcWNe z!f2*Butx4Pi(tB@=a`mjdV#5MtH%C}hctZ{h>0R-Mo;N52R;mZlKiT?P>f1u>`1r{ zW*Pp!3$p<}&S8L<1CP67q7jVK)H^w5MYBCk_&gl8<%E& zW8MH;@EMw{rI}xtZ2;)G59vwtwS`cMzA!sLfu{4xf9*&(H1E2?Y_h?uSbpStvnzC} zPc#L-3!Fn5u8D@M8{D6wJ!VgMTGL>2o!JYPr>NZQ4eK>cPG4vCh3zRSH}8OtG`;TF zd&~hToS(kO90;c?oOm4uf&VJinAh#!%pp*mqI2eOxJA?a^m20q3{8<~je>_#bj}oG_^IawjB6c({`NU4*@<<;m;K4AM4?s3^7e3B2BER(1mF`+=>spPr&MHD6$mV zds|sgKtFthC))0KZ?R^;IgOv%U9BXHXsnzcC;D1{hDS8*Ngra(hsBznard>JfkT>x z#rj&$LcgXe-#xw@T1BH>Bdw({NK*&bIBOZq)6~-Cj6{U%RA@tVJ_l_y?XvGh z`iY4yNeyc`h2hV35A|th z#?P6rK-%>c#niCY!E~ll7=)iVltHXH`(P7O?UoghIQlPDVBec;(yZI(~K+}Bh)7I;dcOw@Hr@d9JH{n`M z--N1Ko1v?wxtRhVj{7RIeoPxLw!mZBcP3ZB76%q-d_5L{t?<02R#pVI!D>w{yaKkv ztD3&>F0smCv!b#u!?FoQGaPWebIUwTBc|XQg=r5$@bx@IX=(@x!NLc?ApxxdOTT{++c(eYVrpdV5`$V6PDkB{)_$;F7W%Ol;|LLTB zbS{L%eJMI;M#RG@GOehXt%;7hEb)D3%;#YBhY@3oPU#FaqHz97+bi#~zb3_+S)pDwMbH!*TX9~Pw z7I>?O>Du`Q?($W|3Qe^zw7OWYX%|N3i*ij*Agan)by*z zfI_jOpK4mQoN}{Je5}ZUYB|N;n&P~6zF{`@))RsLDs-)lA1H`En*JeMd9M;LYf1~I zTMfmk0V*<+Y3V>kWAQ`IhN5_oqPM~nIbG9kj@+loX@^^BLvih$Dzq!^>kY+XP5Iti zy$wa%!OC|6KPYG@3WgHRfi0pV`aaO~lIZSjBo1o&Uf%9)EY789khh8G^FJ!zyJCd* zI&$;sZEM9xS>S0Hr|%QcmWS>EoV z^5)fBEF4XdYKiv#oo_SyXu&!QyuHPj3L)RS)O&}p#;7WG=d3_lI+lo5^J;HDv0Kw? zfmgi!#W_V-%xm6(B5^lI!VgG;M0ZWs2MxGWs1NCQAg_??=X>>M8fJ%S^K=h#l$&8G;9aGBgHXA za5v7NF`{5D`=D3&3-1^){%N98=!+9^teCH9MU-f{rVVLdd&fE=@Qezr9X;b6D|Rz| zDN1nWj~96hxKLi(pM~rLnz9o_!6HTB7*TUgwD2Z~CeJG0-SJ<%6GS^r z`!l3HQ8@iH?s8f7z2a_7>2be(pID@+Z9D)Ehz*)1WJK&qVyCA083Ay_eoaYNj$I_QS$ntQwP^9e_u~6^_P29H=ScW=*~DHgt;Uqse8~w5N!Xnr_Bh ziYekDO?1cmsF!DI1-W5#6C^AQ6g&z;Lj9jf$t}#iF1E(6y~~$?P+4# z^F(UNOc#rp=xPrY(}jDvip&oScv6Hkl_#3mGg4GwG_hxkI@(9go-eLtDuwbyYov!) zs8VkCG_eKC*#9YzV=l4E#OK<1E{CY#MV0Xs(`Ze% zrVqBu#73r4Smy0vuNQBwQIT(Bp&LZzS|nVe(sh@;L7dZcO5SB}60KiWzH>-#3im5W z4la_q*tRWVKOtspZQf&V6UT_KY591sw?pKtBboyrg(lfM#11BPnRe@)P2Gg=7W;JM zZ}M?_wHW>s9C(k+eS*8#OhRi|oUq_*L@F zf^5%9`bE~4QZv4#YJb=P7xQ%=`hJmwoSXNDu^P3%! z#TsYC&)PAWOwn(4wp_01ku0w-S02{XA>s8^m1)~mp|^X^+SOzeO^>_J+WB&*ros4) zff~9K_(4lB?kkj!vX3Trx?>f|#R_?sFOpEsy+A5Ai)5D+6?<#R^(oq87R$696_Hha z_2q~Z75W;;1B&pOvc9j8ob)zF!V%fj*Hq5bL^Hv;PBz%3oK|Lm_j=h;(|5R7v#r*0s3wus!q-~9k)oS?H^_e~;_lw$$X^v& z4_NJeH%ZSsT#Plvs$tzE{feNC?CfhJi!`ltm7BN7=9=#J_VTrpC7Om>{e2zf%bMC6 z{e8E|)0+0@4Dof5#d}mkgMmWmA)S62KX4a9PdQUl&-f5uFS%9I+^iwKzVe)=q259m zAnUxVig^Z~8wbi8G`*2M$~RE<)wInT=NlyNPthdbP&p?>lYPVG-yMxJtx3KS@@-A) zknoL_rt7gWV`a{Js=_DJhxqQ19aHp}?>;#>MYDVl$n~1C;{AOO%9EOwXUy}J$Od~= zDW#!#zK7)Oy^g}4Ks|&n=cP&YM437w?O`)X$_9rLfPg+75Q*RAuN)MKjiao3N*CV_@0#qwDTX{dA=p` z+K*J|a18yc9Gaps-%>d{Me}^m$pf19=9c-E%h-P1nDBV9QZCT6(%R%(DNkxD!zZUz z5|0~jYFPA@kY#=Xm0l5`^riamy_d#sNl-aT`-G^Ld$AT56l9bAN0aok5jo_zBbOXi ztB@%(%#O?01>37;P)r)9YjNHj&by7Pyqx_&a>i%*W?GDDbds-r*3LYTN$H$q`aiQA zO1q%cMJ3;8kew_7Utv&sG&lVT_a9l@Q1XZNOY>Gls*;s94su_d%XH=zY|0;X_21hs z=RL`tKZ$j@@cjya8{e-``Hh1&{c$yvf!w5&O>#Du&Zfp2v!Z=2s(_c1!w%&-Z)Q>2 zNxv|PM{)clzMZ3rRlh5HRXPW2aY0uPHA}_ZjMq~_H7p0ebAe;*hGBS3JTQRA`@EOD zGr6t{^TGx59h_}$cpQ~pSW}R?td)bv?$-88n{pRcpc?9i30#?q8HdAhaT8TTRr$TK zp#mB~a`NGT)0nF#mH0xO94bv2T==aDs=fvGwZcv@E_`WDcJg{Eygc>?ahcM)Zqk=| zma8Ru>9W(70$jxs@+)On&)HNFIXJ2DBgN!3NAjz_h!se%@Zt(+imOt>1Ki`beCgjx z-g~5;LzhMZMY?q4e`0waJ0o?YFHN6GqZ*aHa>-+O@vV-NcN9(-31J5dazQg*3a@Ze zj$US^tNE(*(tY4^%i_|=i!FFc;9Ks?tVF6z^5XdYnxb467xeGSxinHQyBOG5P%oZO zy^{4l&lRnb?LN_ z=5@m}xYt&!>nRS;Em{}KBw#Er_=&t+A7nc%cnQ6D)pX+dbg6~B5|o!FHO|E-l}QJI z#BZfigSz0@yWx3mZW1Se0aY{bqL`e`f~~v<(5WCf$ORPS=4|*aA8fk;8?iwb$E(U{ ze|K>SZkWqmx^$eV1l&saV9ek&s)LoOIh>6fkpQK;IH-sZD5V9QCYA6yF8+&$TJ0aS zyd^gjk3o(f&gH0F_3)^6!J~X&U$`jv-Is=ZJ$|neRK*wUQt#lEE$SLqwhZGcmE}cl zsG3{5I8Ad4&rQC#hjDcAyDt~oQn59uE%`7G5pKiSI5*D;573;TZwgTnm-ALWA}G?$ zksdAwKR4pbSGgSL|G%Kh9k`Ho!F9X={%ovnz#0aS~m8 zE&mhCh3YS!AL=qid0(axa`7SRhEHR>DP73s!f$raApf_P9KKAH*8{C_;TbR(E4#Ry zKa9cae^F(Z24&)uF?Dg37u9#z4>#P2Yg$!#@vVjA0k0fCfVaNN7K#}t;3*zzm7#LK z+u)YshB`QJJurc1Z{-E4(p_+pR=!MbK36@w?HIh-n=m1{=6G)H3ndHqiDo{$!fRmz zstevgt++#K989)9k)6yu(aoXlM(P{G5}r<%X8OJ5;thE<7fdR7qju?yT3LR@dFNug zTib2E)u0BtV3))9v9!NS?XKL56MThx@CaPbv!-%dod={6dh?;DwmJ0x@Engo<%^+i zA(gjctLMq7OzMQVG)+ZZd}30JdJ3s{7Ww0tKRRtyUbR~AM5fL8(#)5(`aeA@|Jw%P z=B#?GDo|;4TcXkv_%ysUrt*{6?>pe(yV=y_tW?79BSmdp{Uwe+vL}PzWI0r^3qG!N zpQ)Nsxj{6CDmr$-USUy3nd;I7FCOiDvstmdhhaQK@Shh#5rN-IqAw4`0Y3<{;Yx%6 zeq)`qF>4Ffn^`-t_GImk8o@8;Qsfxcds(NUX5%N7ROlycS;Fc0tVjM_2+qJ>Bum%8mYkY#D+t zJ$BsmKjKC(_W3cSEdc@KWFx{K`FP8a7DEOx85W zPPZ^kng);IyU0w|G`KzyL5rCiM=zx_Ii1EMk;zIOD0Vq#xPmcaq@UV&I(-S8!J@mm z&T!Bf&U^+=We#@z1a%U_QD01q7faZ_1YU_g=vpGky98rqxP~~#W5sDmO{R-{hPKuN3iY(p|CJ+^?d& z2YMUC`nju#AdGVF6i;Q}jp>O-M0&+_v3oi1H}3ivX+UG~lko$l-!jg-8;if>8lJ{t zm647*-N;1UVC~j1HZ&4Y8Vz|%9^M#Sr0WwHbBjjjZq6^Gt?6HPG;{^_D*N-O!n?HT4Bsyhkt#6 zS_ltAJ)}gy9fs0?wo6gOyenYC$3D)zBWbDReiW zJ*_?MJ>5Kadmivi@yzhd@jT-x^KA5N_U!b0Fv?K$W9&12&@2>eqwiL2QKxp?vd zezA3n58#bJIqN&9yR7$tm$tvGQYx#|bC?990-}IAZ zbihsNVw>OCy7rE5TcvyM>OZmNu(b=$9}mo(91v3j1OKrz7sTP>i86nl$aaUX!LJWCz<+g7ui|vWvfveB UyYLp{(<5eY-HiBOVpg&Fe-qFF!vFvP delta 14497 zcmb803xG^z|HpsNGc)I$IkT6Uot@d4on4l7&Bj*R$R#Av4Y@}}Hda)K(CzF-;ti>( zb!iioT+$mh7E#!U&0BO;ZwaZS5~ZRy`Tu^u=h?BM_usqayU*wM`#qQQT+hroTl~Je zc&B^jl)6)W6Ue>&qo2_D${5x~eo05Pk5ZE;C?H<@2AItxQG z00QZ@>rSlFuAgzywW9+VS3b8vA6b5^(UQV0m&!&#bV*mEO9U9_#quT8#Uk5cHsx`J z@45j4Y-w=B9^1$>j60j6>C^MDIzLsP0^W@BL(@MLVpn|Aqoe$})H3{OC*{2v0^IRI z_l9%p2mSX)5d!`Zjp|_bVL^AzxQLFkDK3-a;+tkZ;{@crF{JvzV4e{O&KP#S5#Ae2 zYvKz8!;dz@1|Wok>GEFePsrzS!scEDkD9f^?0;S2BtCs z8LGz1Mw~izDi8>Su!cYwJ>ft&-uv-7S4G0XXp;%yU}lpWs|)`-4X9CnqS8%|NAohV z=*&Q-s`SD+SYw20jG{Rjh{}7ZKQFrn+map(#*O$o0p+j9C)5`0H&Fu0C3ts?v=f|bj07Sk(%8y!joR~Xv@SNQyC1{`GF&N?!QEUj64u?}GS1-@li z!p}D8Oty^keV=T==Ygv;40y>$>hk?F+kipQwSEI8nL`~k&G+|_2DA#2wn!sKrGKs8 zhNiKODFzg>*TdB`fuG$5j5jIf@z_wz`%yaSQB)gtrBVC>b6LoSHzIE*+u(JR`pu3h zHp~c9dRT~J9>}I#ZBo|yofH@tD~+bWEp}vPe&I#Xqy9 zZW$|haT>6xtWlGcJ}GCQW+1;3}` zh~Q5{9t{EXpC5L{C#;Xhz7tSre7kHL^_Os%}m3y$@dTV zlxYRmHx0gF+8^(?p>fOG*_I}91zpHAFU4nwJf=RJyOC(m)Fec{^F=qN&GA<^#GKk} zYcFnQo6RlhB<^CGBq+Wgs(_0;2Mht*qohIWYt$Q}hfquWhf$-EqlN*SvVKNg&iX2< zfFqv6XjzqU0(D`8G&yt<^>Bpr-IN0k{_3820QKz@(rYp8f`#tGsIRA-L~WCK(g;Ia zaR4=+^>Nk7K2r?-ottqmKlcISg+^E&a4AaoiJ>%$=xiQv`#8DLS2Wt zf?_wA0;Z!HP{j>hnocoaMM$6J^hJgny%Fw@_F?KFZ!-1DSg(b7hsTo9`WYn87vr+3}^@1BDuzL>} z-HUU?Nz^E+0lTkgyS&Pygvf5+JS7s;58=}Z&I7|lYNOi78)0^0V2K`9v6s_-@Pz%=pw7?0iPpXNJJvf{fps@3_1O)$!FTsiU;ZMghfEjulj|hS|L@Qw zpa_?WfN{KFva=~oqbT4>RvJseqbQ(0Hb~%DlG6MTdVc(j&BDcrO%!ktD;AK$`on)| zqSL*Y+9===Tnqv(2Ab`~tlL@7&mv1FEJ8qpC*}yAdUH9x2ax?m)~{K8Z12zMa@HSM zZ(?1|`Xg(YA|2S5MMb36A`P($w&d^?2iQVWPt9`yKc!K+DK~mDYZO1He1Ua8tHBL*dNcf!^$=?cJN%q2hjkk_s1rA6JEyPYbSismvtEzWQ@~Qz zuUKtdinvR1dL`>&)-<+9Z1Og8_}8ad1a>Xb&tjw*Y;VZ=Z}!Hs$$k|VF_(1@tK{M= zRSxGhIZa!QfG2q8*o{+FKp)<|lwEB{o70@GIM2`LsrO^B2WEIXsSj#0Z%33l3~vX% z#yMPI)6(*J`(r#6XXxTmV>hE^gKIGAnCMVc+Mo=`1qUo%@J5=1D^Ry%~6;>?KNOEH|Qe1zN`GSbm#Jh)}5F1 zO)jePKS`v!Gf2P4xEo`Zq(n^zH;qina41GNS2Wrz5kdodKXUr}<-vo5XIEu{`sNHht zCTnuU#QQY?g^Iv!O~R-(nx^|7aZDHZ@go#K3FHOirUzPST9!Endtsoa?y)(h31c+n zr#@p^(7dk7m!I;2X+xo=k0Q%VA8gaqFg0!_K^A{HD}jlzxS0$^n#LmGUFoM9$A#l& zD&*IrLRGu{uq;67fB#A|AO;aM3W+wDYP?ebt!!-3vE)uoi2~D3zE6p6p zY^8*_CEJ=$)V{vmtaJ$yf?2!3%XxGG#L*1k0A}$MBUgM?oCjY*$?Jw8e*YuK_*T=aIO`t-{N%;?dPn-X zCqYEhpiqG|1$r`Vg?9KMcseYxs5H-cHt|a9rcR?e10_MzmDU zf5mRFo`i=qRVEL%=D>VSPq}Zfo`SuaZi?JsJp%(YkJEbi*$mChNOi5@QMTB0a^&!sl5 zDsu_6OwfJSQW%(^iPkcBIziJMYdQQ|A>0=|X0C#y%c_g1W37g1OeN3{zlErPNIUky zN~XLH)sf^YPLM$QG(j(`{Qq7tTR-&gpB zWTgX7Yb=k1;0<^|)8$qOw!q7p+It0Tg*BSK^geC92^%%-P9xf;X<~Xvz6m=ueV9$O zTT@Ff(OylxA%dO9#H4$FK{lRtCUYMPrP1b(+ zIYG`g>i}3?ROsm7JJwfFplNFGBkLRJ#iX|EZ(%$Wt%=XAZ=v2*ly9=N$UoF`7>ui# zcugFEOPNaH`K)iOBhXjV)U2b{Pq6nIj)W0e#~te!;1?bEQwjqy^k>LU&?)OUG}1Hz zeJ8-WPGzJs;&*7SX^2^Ao`UZZw9=GfL01(?2d_)4NYHPlAvPxHnCaMJhsFuGyZc1n zZYm=kC-`wh(-QQhiXq*VkIsQKad(1_nIYjM$Yq7aOigsOWr!m^RK5?9BBEPwqEfgd z+vANoVp(71%=K27F;U!4(M+4D(M^h0;*mGYW+KTMq(aMW{8B;m)%1zH z%zL3&u1N&ER)JW2i;DCz%^$32D1OmdAo2aI+&K$Gi(6IXRk)28 zh_YK9g}L4mEs!oy`yQR=;3W4KGt+h_VczB#}YKqd#UJq zo67f&DDt)u8#RrRMc#Iz^Kj+cCq{ZN7w-=Ts=pMb%5mN+#1pqGXN4^GUMV7XC~APz zRXne$LQMDe5jF1?`inUuDN-%b{(tgqU>_~m+1~zQzaq%>&iCFd+@pZ%#~Zz@g^2S< zQ!%ufmw5+@ZJL(*S9k}BV~Vht3h!W%aTiCzw@8Jeho?6=|sGb~loPw;o-CIo=|%ri7d&@P%c-FwuDuf+&Gx{HA)C==PAJTbX)3 ztmqd(zUEUEz0JPk|4{V4@=aH?iG2qiRWzIF{l|%%66j`a_YM>OI3iYm*xKnGF2WR-EDytc=R=Mz*U#)`gAvkz#_juSca6j>3X)|zPHjS~gWC|^MrQiqAyHRT7WUI*afPO?4&HW77JW6k%m(&k zahs;LcndLEJfMm0a32=aG`)_`_NIt3O;3hGa;n&=DJ@LoUI6$r84Bo_QMuGxnh!johV+Ho3394rl*iVSY+DFZvBU&(( z!1`D_Bxi{#(SnW+0BhjR7H#5D=J#{Q?6lc1jV z3b8mrepo3EDuOO}h2>(>GF4$0yge@$Gc=vViMUFXY05I6wpNKxHGQA;wB@W4Sud%K zUm&g$MVi_r_qSJxSC~p*p|_{KT0F5rMZS)YgDS+ql}NZmrRx^ELhLA4bXeYEuM?41 z6dgy}Aa)bs8fl76+bCXKrFrQkhv-&8`AT6v(mP_YruK4*{jNw_qkKoj6nnRDW@>CD zU+9TDRbwA%hjT=S~(^$s2} ze-?|GN@1Z`Z~rX*P(J<${F}&g)>CLHg#26W-^2k;$J4gj{}Hn{DBl71R{Qre_VtsZ z-D~8dDZ9fyDP|_ujA6^GG<}_l-zduQuRF^5L8{mC$@$v( zt3QnN%0}g*L)9loZ&KuSePa9MY)$h#V}(z?rzzLF2YodUC!hRI`LLmQcO{cHt5OP* zy;h36aWkKPlVOTY_^@_Gz#uu^6G0x4A%zM<$1w*h`xuBj6qKz{ip zQz;xzJ!JdkPYL?TPLu8}l&=&fMGx5_ITQ)6pYSI;L*A#I_hkHGXUbKYI>!F6v*cb) zH+l})wPeaxRm>yqLw1gAt!ap9`0DD5D23ucim#sR&pw*mUaP(wqX_!~zxtH#6XE&C zT~l8+dXowz%JVjo(-Kr=o-g+%DBagow%b-6ndQ4cE?0!(+rW3R>|Vt_*e~;aEo7l4 znhBRm>n-IwiRW!=S&zxVuU~LAw~@`YlO{$Rxk6LtaK5jNd`Htjq|4+HO}XB%)n2yV zp$h#aT;OXj;|Xf*>mbV&@%46;yA)aXS(p1d%8wN})?}-W)lu%(89U3)zANPKnwGjM z%`0X4zf=|Xdb|3rl07vQS-pMN$|;(zF?##D$~QFa$Qt15F5Pdde1^Xv^pedrz2|NS zy=9>$=epLqPP}3G`m~W8m znxN6XTjgyDn&2yv6E)4WM*D`zd74%`h$G~Bjm@z!cgiE0CMFN?-6iYoRMk&Rc6{Sx z-vmweO_0+xB}IGt?v)!gJ)Jt;cfYiDseE^*P4_vnNYjyM+*cxJYnqen4Dd~ndGD&w zw*CRWX>y~cW=Jz-&-awCp1-&633)(M=g>S~sa*cP@-;~>^v#hwHLbv2n=7+EP`>f0 z4dE#{MpJ?Hg0D<2*Yt^Zy5pNC{U55(ffzbpwocG8-vU{bpy|HniObdE3Uc#+>G58#w z;{RlE13slchy72H4hB_+Qf2gnm9%Mq^sg@CDs0@jy#L*PE-!BL0`_r#?8Clv;ZqlC zP>B2TuNpz|)lH;al5@FqE;RyIa$nBkzFfj%@)^#v>e)tV7rv2z+dMr(CC8ZL>JAt9 z9F5X_aF)1qf7JA9oCO$)kA9E{u}55GRiW%fW(N(3aQBQf|s_ZtmGDOHFE}XM4}JcBq=O zBhR$(`ueNPRGGw=4XBBKXWji(IcHW$%~C5D%eN7_@_gzV?|&d$w1`hQkljTsQ8gRX z>Qkz-owcN?i8U9w8(zd-^uW6K=La&JnhRw&M!I1pZphUudNL0pEeK^1FqBvN?YvI! zVmqyL30--)bmGZ#wuQVBl$T~OPCVYUy)?uUd_2%SaiHB$#*LeT!)@?6VRAML*7D+~ zlS6Wh3n<17l*_~CiUBLIL1)IR%4mOgaS3ji#g|mwDSY_QhUw-aa1-Hk(~UiW?})|& zUu8HO*^&;f9a7JdnijRrr>{QZJzcIN3czVyd? z+Yh{$)E0W$D?oBTO=WKw=SR(fYl`oR{K<4KOLcMay$8ZhnD*EjpA6zVN%VzJ6if$Soo|fbhYMI+vbJaK!rGm+ zAL}605Deq=DAozAQ&BVVJ4!0_W40{d^c>a&kcMBWcM(6O;2TC_zMY49hkX&gN`9x` zX^GF8%}`rdf!Yc69vkljU`5h3m|bA(;ffXGLW? zr_(u|#8;foN)63-9p!RHiNPt&%Z<@kI za5-u#=z@AVOhUaHW}^0BdwgnSdwi`j+)({GuNlr_FHR>{;${7t^Ky&@A@l zGx0lq3^z$N9;AGnnSRqx#OR3o%bB)RV{Q4%KVF_(e)7~8{#pC{;$i=Yb*~jZHzd7X z*`3cVZ8+)hg%#riqOm)xu^CG%en Date: Thu, 11 Apr 2019 23:47:01 +0100 Subject: [PATCH 111/150] 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 99cf121368..f9275730c7 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) { From cfd39238684b64b66f2f469e803cef409d0dde6f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 Apr 2019 00:19:42 +0100 Subject: [PATCH 112/150] 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 4eb3f77c7ac731e42727336d03a71ca52503fa2c..055b8bcf0f9e36f78789dbbbd69cb1d37ad0d0d8 100755 GIT binary patch delta 7909 zcma)>d3;nww#QFZci%PXHR&bYfrJ1_NWg#y!LS4bL4{!npuwPF5tG4TQCUV{Izi0f zfMU292+Hyv-~i$ZNKim_Xc95VB91a5IKX2U8P-wWsl}f8@4f!OFZDg=RGqqYtIoaY zR2;Ea9I?MKn4X0%IAFqh5B=aZT4J|$&if?VbtW@U3lXr>X(^~}3k2EQj+KpK zpPSle@CXs&aTm{Ep@RJP^`L&vIh};X-ZoD*ihUmJ%45Y~9#63tiD&fR=TNb4$XfVD zEb67x!Z>IPUsA5(NqW7!wc%ko00@HLmrSQM!Jtk@an>H^_>lkxofbe# z%CKUe-|q|LuR)LB7tH@Ni}1DxJmK^9_8A_{V~l&kr^PL%NA;L!QGc^|d{n86c3PrwtfhR#oaH01ZCbt#!b4l_gS&FrJ z{dTLcRrI_<;7Ew6PrHQrOz0}=T=#X<=E0ka0u7P7sGo7&i%Q_C<2qWl2kxPM7-Sku zwy6r-4l+IAJdc)=6sF(s_7m8)!7BT8)B{eNYJ)y0Hq{SZ$@!?_hdgo~bw1a&l(ot;!_biJd2hee7Db0O~AH7Jginaz@}5@)R-_S|I(NLqHr$S zqo?uS`yt(BQ$3I$Xo}i^v-ZH!lfqXx>oZ)pa@DzJa4qM$ zgKHw!Os;?6x+ltiB-z_zg7*ngT6wW8yWb?8;h(1GrA!Cam2r z(i>yWsC`-AWES}#-X;aUb`3fi$jH{?92An1g45zyrW` zdj;1R*Zc^xJd7hm2?Y7hoWi%>V&0($Shsh%p5ou-^9(j>Z zIt7;p#`Q2CGdhsZ=m>{FyzS!drd$W%_9U>D>lv;F9z_Df zc>80nm$`bmJ!mj*7T2>8)=qB1^jw%}fZH>)*LjKAa{7;+<9A zW~GL}GFCd^G!|C^BYF7}c2SPL@D9Pv*qU#>Uwp+Fc`#u(YLJ&B*4Gc;crM`y@3174?S=nh;qk{u1$@4V4|-QtKM3?4&nZ- ztp4XzM7fRN%~Bx7wI?q%l&?oZkR@mtzKW9&Wh%|XCd3Y&!Vezy;_YExwn8)T89`vZ z58F}j@^T?6-9_9KSdMVZD0pm`4&)Ek9(L9i3B+Sp4D<=^4EEq*`WOD-VM8mxjvpI` zDLZ}&u+6CO&8Ps|>{Y53LzRj|lijZbrTI-^SH=&My7P#|ej$}&t@DybyAOjY4UNd>M|ss`teUW2Qae|zngEdu5&3$!Hlij%nZ$~4t?GpDB+c~KT8H+AQ|nYWG;6^+ zRKcpqR=l}+l4eD=TKc~5kUF#-$P^J9>^oI2*s}zUao4HI5SFwm5W}<5E>4YV2zp4e zf-yA(isRI1{c&G78dK9CC0mSjKGdjYKzm8sjF{RShQ_H;&4dY@YTzS!OwEG1lHTF8 zTGG3mc1s$;>7=Bi?jXs6uB}+U8aV3y*7EJ|MZUL+_h*x{*2~zwV#W4{bFQepU>Cj{ z1F3<^q_b)tfILC3CtXqdf;UcQEmy2#^oBYF2DW9RR>9BiJ4j(i6-Ip|`IU5}fr5hGWCf#+ab3fcBjQO|VVS zR>EjW{cV%;wN`??4|(^~N-$+nlP{0$5EOvU@kGYoJqC7SC)m zwY5+hr&qOguq00NwGZK2LGb6$9d#olbo;GerZumjS2SI#gPsrlW^==4ILWCJt5L1` zDcqK{-CwJI25CK6WF@d_v<3P|VijjAOqW!vzpZV9w1@eaa8*y&wnJx0m%QoP4j3Y7 zVG^;5z9@37(DuO&X*=y*VQu_kM9ylorT1oIu%q~ab^v)kZeP5j2JDj?*30AdQk{VJ$F8$pDdp z6(1)#CusxvT;%ryg^yJYFL^0WchqF^a-4L{PZmgGg|K6QTrUzGe?Sb9!9y9Y z50MX_5WWn3s~RS=iUqx4Y_;BM%pQ`YhsncF3)^`$MURldlF}n-dMcS9>2tNE-h|AJ z(*s&lvPM!4Mm8gLlIqo#R_IW6r(C@yxhQSFI26bv`%6Wh^hiw2B*){_PH#o-N%~wZ zu%;af_wJ>)BO6AD_ymtj>p<3x6qLki0^;|B{g_l)`>&e(SCXd z(szuAIFG*=bs){l7}dZoG6;Q#C4Eea^?Y(d(slZ@-ih3b(-{3hQu2Gz?@KaH??QG< znn=g#g{1FT;roG1)*m9rCA~^#w9^O|(kyO(Nq2wM6PqR!iDMEbD`>!sLck z|5bR%QvFGCW&(?=f(-o~{b{026ulZE?;@>yp8N0+e5{v}21%c}H|ZnDEkSr(w(6ru z_ysY_jpVIX!QpVuF8vv@Qrez!#q=>`^&}Co7wK6tc(R~jzLr+y;Tfr4>g6QKVzx@S ztR2(GlBqR30>}T}3LgpMW4+^%Y}Y0IdE$Oc#O3;bw#FYBk@KrQh4fp-qw!Z@yD^oN zN~*UR#vjQGk`hC1>+X?or+_ho#H6j(<%THvT9RdJVpNbbl9t%qFq2%DWKU^f^*`D% zHP@&jw3n-$@hW-suPlO>7VGBG?B1P?dBnR~^lGkjHWrZ9 zl5A?OQA;{=s)T*vhml@hBO-@8IvdN$a!!>n-0`sW?6K_BLB{)J$-6uPS7(^<5&1Aq zBdzz2b&RgiHjy9Ki7{?P7&U)S&}B{&Bt4c`W^5u`I90+beV9>4ntv=J4+IqWluTWZ zL@I&W#v7lKk`00`)A7buvRcwDr0t|^BkNZQZ4%3(WEUy;M1=NKry6@mUq*bBt9Ynz}S?T3wf^6J?$NWm|i8@Z3sHwMtO&sij+0$rm61VI~588PXnlGuww zB8~n{;x(57PO5F^9pR+Qr8#MyB=wUR8Qw`YMHw_+ zUJ00HD(xkyf7mpe(g~7=J8l~3bg85{_M1iqZICoZ^_eZ?Mby9?PuR?)7r2jAP?wfP z?fZb`7fX{xNAF_^8O78rS{J8wdJc{3|IOE^=FtgpN;lim#yDl0?P+0*N8*d&{boM> z;eeo1w2N6luS;S(p$lD94=jHbXh|*gZgc}8qo46K7t-C5*uE&F-5Z3j$lt{*q)$s4 zi`0WwNXpP7T2I;_i3A=pd(wrJ1R9sAHBW*<6N(pp|Vn}g{B zNgj75JVAGJidMm4dnOdq>(W^qDmRDGtS`kd3j^imQ?x`M2~ZL&Fy3akzTu5I$B78;3@0zu=ko_eIcTk6Sl8_oi3@!H;JsJa9sG-YM+~H>44+wx1Z?YjSjYNCioz<>!f{fq&=PBS6lWN znV&KV+f$Wfs*^6kY3TJPU$M7ERiG2Ot=z))PK7u+k^fHBP}eCg)VYcu^`Mf9nxHm! zG>0XjGE{GJ8EFpdLgO4s*j6A3dImI_1ecTk8g+ChZBobDx|6dBV{Hi#B+V53=7wY{ z8YIzN)F5q(8lfFf(`W%|b6SX6!M(G%cQ*IV<=!{AH>UK$m_uCuftm>~LtCW{nDC9+ z27GV|H4G%7s10O*k~hpQjyo)*TfSrhj&ttL*K zQ~zpz>w~K5(+6ICf74VC$+oAqQX}4qSE#4rHTMaZbp`o9t&?bBN?R0rqm4bEw%N4#D#ZTko)zv e&<4LPZ3i7Td9ug>qUVV}Rr$Jh(J3JUPG?hA`V#T3FkruoEo0*zr`B@WwyY$UadH_oS zD?q0t;ehTLd*{v_%WEZI2Ua3_60Jmg!<*^Rq<}w|^K8H$${8MO`~TPf-<=*x9x~|p zZ0yU5OZ7fdV3~DLjDmhv2)heeAu*6<^Klet@LECCApW9Lf^2}#;Q$l-KD*fdjKG@A zxg8ru&nN_HLQMVIIn+l(7g1mHUPjFfUQ-m<7rBnQf$L6G0+(Eu(Xu(|7V4@X(_kV| z6}TQ`dfamcEyI$Te#^^)uoBf64CZZ{!n9F58;W=g@c<=Gr%K>;)Tjc7`A9!a zU_pNbnSRL2%@qxwCWFsM_W+wA-OXlYk{*YZpAK8>S+zveGAo3-Bg|%^0+`Oj?iI-O zGcB-~c5<;676F^fc}5Dx=lWAr5``Ca3!8f^IUThzc2D?#2u|-ArFTghA!_fE5UK*l z_^@1cSabL5Oz-Gyh=2K*?hLX;8KE(K!*dSxEv_d6_0W5n>)FT<2QF3}rhUT=(H{L7 z*FFI0@kF(tby5oIJ{+|Li;^#+T1qYk5n$bixfXK$jH`=lD%VH3ZsMwQ&EWbN*DYM# zT(h}8&UHtW|4MK+!wx?3vr#v5-i77kj`pa#aMBdW!oZ3O2A{J=ynHi^`L94SPmptAR@OyX zVUwSPiPpR1JlAntf$KM@Y|e%_0?^yVCi73qW=M7LdE$B=Ed+{irx2LT_e=d0R%VMx zU@=!*$|wR`MFM#^B7$qllqCoe2?7vd73$!y2%N!=38ZoT{r?;yftk1$2;2oM+e^6a z=Gr>KEcamxQ364pnUi_yy~Qi^1y=0?uD^0MxqT=vui^ST*AZOTalOnnz$4G|K_}z1 z<8ZmgaZ3(vNW2)hg=HS*Kg)9hw|z`=`IF7y8p17vv%=NED>vr$7r8d!_8z>;_qm?r zs_^ay@bX7o&vNx}yO-BW<9dj<8STwSRKuYUFUNCtD%U=ko&;8KJ-9FMq=I zB3B=`2My+}&-K>`D<{@rdM3;?iQBWep61>~(G=!*fH(0L*B`i2-kc^H;+0iiW=9Qy zci7PZKjYy_;1Pa&3A;Fs_WSx`GB)O^cgsHzBdgR4dwF@7i1mO3tz-Rh+`_vVgq6uPvIL6Yw_|BADf|Rct_y<>&J2w zeEhf&C*65W3OtT5Wfa^tOndW-wX>6zMF-;A6%DP!%wQJ}(^vV$!5NLDmA^uDK|4v6$qTW|0!hQd3sn^+N@^GXo~l8Mx}sh?&kEIm zQIbvuSE(lKlGH4|LXCq+hKPJ4T+vT;Ly^RiaE0oDW0Ix^D%5z$%VeQ5g1$rrys$Dx z>r^k)&Eh^-8rgtLo+qg+vcZ15D%^h^+V*6Nh_%kmst=s?1&#KuQxhR9X=zdw?x1Ed zs#ZhLS&|*BQj=kDjH>P9RpF6UY8oUr5N(|eRjV1$LedvTm6{0yVpOeW!+1{Ru$tDW z_2D&1?{iuv=>tyNB^A;dd+4q(`PQDis|z`9Z`##>oU(t#@&&u`?r_cpwF_*+kH$dC zp)}!?+6^F2&>IOC)b8Mm(J6bv?pD#OYJce6RE+nEw-%{b(%DdzIsm4`s9GHiZ%G=h zu2YA=vKUpVLt(w7GWR-l1ni7amHIFok@SU8tv(W?`R?kdIub6$oK@;5@H7*H`NFuZ zj)A-w)vCqtfTa2EDs?Or#Yol0!Soo_s^j5pNo)b1gsm~ERwu$SNsE%)n!RjK{T!b* z30gN7-3|yRYm=d)B)7t-o1}n}YTwusj?dDbfr-L~xtC*S?QKP>?csYH4}G1`1sENOvrgth=qNO~+dLVE`a+KGCnjVHACpvB#S#yg(SmcS@UJslHU zYfE9C#Lnnk3eaAJwscI?-iL0I_8QM3UFXEMTbBL8z6M>Z)#cEp1B++25^V((#ONh$ zB`l25Y;6^MF9===)vBLD+&zES%d)TR>q1iPHv7Z`E~iMZF;wi})p zB!?kOlE;5RJ^BxNU;7SPNMF8MsU3%ojBpGu`@hgmz}qp}p`C>5G1{m70&(|?$Z7sV z+G%JjX|DhKhT3m1nB$yaM&ecV98BfJ7UpN|9Mpe+Rh*%H;vH>&{8c!5LAwOQ9u$qu zja<{Nz%Si-1Wbk{IT+psTdW;-;Ei{re8GY9wu7{|{PK%q+TGD8>O1%S@ zVzf@BWGR1pFaz)$jN-@VPh)snRmk=j)#9h0uO*e?J~zp*UZM+ju;7O~No&y;PyW?g z_}GcyBhSUCR!t-?#7NZwWUeH3$hAr$SNn>JKOqK5zX6QOp>v9^hsdfy!k3|MP{X8b zu%Ow-2K&y}4f^}^FuCtxVLPh^^$6)FDLqn0Pa)$aeW_;Zb;xTmYObY{<&ttRvMyOK zX|I}TPdm_{O+&pNIWKLuTnc29T?L|_^hlMOO}>dyp5Bn$k@Th7#{Tg@xa+-oGqSc& z#K&1~ttDCch@b>cOGXNM%A-I_k~d1wRzHh;P0~KgZFf4@fIMgy9}Gu(=`G2jA{JK; zpOAriYjRxDRXSX6Luz9*N^eVs{YylCMaJsw$#zLk(y@9+(!E&tej*d~d&xJFUZGR; zE@a;0!dFSl^sXfGgrIt~tfAhMER$GC=I8^-Om=z63x6nCIGzztc)Q7=aR0aUq2x5T z&43JjiT*Iro@5c__(EVg(vqhbu}!c_FChCQZSa1o7m`{*xLr2rBT0AykAy!HH`wnS z3g>LmA0BqDYqjUoM>7Bs}4X`ebYEoHy{7)h|1trRY5HF`05rkqD$ z`^W8QO&G821vL%g&*@JQ?*b9mDDa1UsHQOIraqZG^bU{4KX0k=3@MPb*P$8Dk_nRB zA&>p=;V?Wqv5=BB$|^9(0d3D#=Dp zrLa^VWUMEfSBuC!NeX;U64oG*QlO5J=%V-v|=D}1#`n~C#NR<9It-9=Hd zjT~i&74y}njUD6+ce2EJSKCD*>sV+x9Pv#vc9C72#L2o(CSfT)7`|yDH8S!xooVbN znU$j6Ml#d*icFQX80jFXk<^LWM)WXgyerMs1Wd+{m5$ zwzx$GaVm#2?*Zc$@or+ia&Y($7`MrGNxwJ`73l_<4nWF~KjWKGYYxKMz z$hC@yNe6t%Bl-33rqQP*UXEA5LzhT85%1PKbe|+@B_o~KEGn{t%0m}z5u`g#86LV_ z(jwO+;-PmWW$3@5@1JLdhX%LudN|N3)k9lH1wtpcTeIjZl3q3#t&#MX=aga5Gm@@& zFCxv}Cc3|fxO zoE5rlB-3S*UQE)>6#A2-o?+cgrExn&z2UBFMmlXPX{PgNO&mXN96Lwg}Ix`Mm8BQ21`@}eU> zE~#&zo!ODzkW`G+nMU@BdKr4MmQRZ$k)%#$KK(LAUCl1^M?w5?yV6^XqIeBV)q0p+ zscS!PMw_8!XT9p-nVL(J3*SW){)%7?qjD^kYF$n5|7S$I?C0xef_mdrGq{POj65) zapv3frli$4YYS<&!y@v9_-t527fWgx)mEGD&|?z6)90D*(z}m{&|(aIj~2zK(p*C4 z#%P}TK0PMsKuV>#j0TU&!T2YU74&UME3{4K3VL2rWk`XQ6t5e6!_B@6ThsQ3M!skt z=Vt`3N2g9&1Ph$$#Da0o-Q>;W30QtcNu)YyAAAT5~@YPAwZjZ^EoGGSq8G^#JLh-AXb&{$UjmK8{V{3MMgz{P~6QCBCD zn^NrPM1GAccEmxDq$&9Rg=8rjB+!PaLD~d0LR+Aw(Ke`=v;%4h_m*+*%iQ}K_s-_t z-O9ZfbAan9)NFVGnkczo!cj99{BQy_40p`FxsU-`TrT85HfnR|f!YrGq23F#P#=T^ zsC~J8DA$p&1}(*K9CZSmjoU_MLJM~WWvYP!-R#OgN?VmUXFHcW*En}Ok2!yGwsf^~ z<-2;g2Dm1;rn+XhX1U5;3tW}1jjk=O-L509v#v|7TGwrtVUN3<=-*}neCe&?x*v6~ zcF?Z4+@SaC&JnJUUCt7=h5#ku4oldo1C${;MUksVna=T_wj`yehdKXg^Q^J1Y^dWM z`Q2{IyLoHRMLYW??XNR5tMZsd8aTuC)ns4Ei_|K49sg;Xi9as<@s-RmE9(ZxZ7mnz z{HBkGu~spyaM1v2@O#*rIt2Rk&F_11@^237o->^`&ggOF!{wuwR(4M%8gU2Z7qYBc zvx>qr62?y~)6&QsQn4zPjH>X|B^}(S9n39$PFD=BOWq;(Ra~!2GDzLZlnnAcb=(K> o6*sa-b9Wx(LJMeyZ Date: Mon, 15 Apr 2019 23:32:22 +0100 Subject: [PATCH 113/150] 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 ++++++-- .../YEngine/MMRScriptCollector.cs | 12 +- .../ScriptEngine/YEngine/MMRScriptCompValu.cs | 4 +- .../ScriptEngine/YEngine/MMRScriptCompile.cs | 2 +- .../Region/ScriptEngine/YEngine/XMRArray.cs | 9 +- .../ScriptEngine/YEngine/XMRHeapTracker.cs | 112 ++++++++++++++---- .../ScriptEngine/YEngine/XMRInstAbstract.cs | 59 ++++----- .../ScriptEngine/YEngine/XMRInstMisc.cs | 7 ++ .../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 5f00f867c8..e6a4224f8b 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 HeapLocals = new List(); 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 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(); - 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 75eae53627..e92f429bdd 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 localsWrittenSoFar = new List(); @@ -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 675ab9ae25..486d822cb1 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 f37efd48d1..8e15402eeb 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 3d0525b7a4..930a8d6ca9 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 33eb8bf5e0..8b6734926d 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; } + public void Restore(LSL_List lis) + { + value = lis; + if (lis != null) + usage = Size(lis); + else + usage = 0; + } + + public void Free() + { + usage = instance.UpdateHeapUse(usage, 0); + value = null; + instance = null; + } + //private static int counter = 5; public static int Size(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; - - // VS2017 in debug mode seems content to run this quickly though: - 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 a440cf3a6e..f21116efa8 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 ff8dae5abc..e97c71e85f 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 4f94c23c5a..987e22caca 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. From 2fa5d10c00d09f48dadc1a43a9ff191389e8d4d1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 00:07:13 +0100 Subject: [PATCH 114/150] Ynegine: add some missing memory usage on script reset --- .../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 f21116efa8..65bdf51119 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; From 6bbd5eb6a20aeef37aab1832c464c09d8d62f27b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 11:39:28 +0100 Subject: [PATCH 115/150] 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 e6a4224f8b..27fde5b22c 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; From 09d92565dc3dd0b663d796e51a0a4e927f0e3337 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 15:31:31 +0100 Subject: [PATCH 116/150] typo on a debug message format --- .../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 f56b212a2d..4e451b5c7e 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); } } From 37fb937e0d3b6a7e19c46c2fb6e06894c6bf7918 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 17:28:09 +0100 Subject: [PATCH 117/150] Yengine: rename a field, do some updates using interlocked --- .../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 65bdf51119..dec775fab5 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); } } From 11cad57c9cac5c17a9d658da7ec2e8c4b5cc75d1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 16 Apr 2019 19:07:26 +0100 Subject: [PATCH 118/150] lludp: change burst, make it per category (overall reduction) --- .../ClientStack/Linden/UDP/LLUDPClient.cs | 37 +++++++++++++++++-- .../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 f812ce13a2..7c8e226672 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(); // 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 1daf091521..1bf05a3256 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; /// - /// 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 /// - protected const float m_quantumsPerBurst = 5; + protected const float MINDRIPRATE = 500; - /// - /// - 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; /// Time of the last drip 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; } From 2b4e5fcded071cde180149ddc6eee454e8ce4e2b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Apr 2019 13:17:40 +0100 Subject: [PATCH 119/150] 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 45efa77836..cbd2b3c35f 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; From bd442208d84e3412385ecb3421344e871206e0a4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Apr 2019 14:01:54 +0100 Subject: [PATCH 120/150] mantis 8517: actually let NULL_KEY do the same as on PRIM_TEXTURE --- .../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 cbd2b3c35f..5c6b7b2fae 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 { From 5314f375c50f3a81f0bad0507800745a555b7e59 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Apr 2019 15:26:27 +0100 Subject: [PATCH 121/150] 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 +++++++++++++++++-- .../Shared/Api/Interface/IOSSL_Api.cs | 5 +-- .../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 de7da0ed00..c1c1eafe2e 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 /// /// Set parameters for light projection in host prim /// - 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); + } + + /// + /// Set parameters for light projection of a linkset prim + /// + 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); } /// /// Set parameters for light projection with uuid of target prim /// - 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 26bac00da4..ce6aaf8852 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 7a4a5fb1d3..fd5142f71c 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(); From 8994045d5fdfe2c9f61d3a6a92c8dbc97462db7a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 Apr 2019 14:52:15 +0100 Subject: [PATCH 122/150] old typo --- .../ClientStack/Linden/UDP/LLUDPClient.cs | 6 ++--- .../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 7c8e226672..4e9cf1ce39 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 3277638697..707acdd7b4 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; /// /// 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 989984a31b..d01414b921 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -e796a21f-5a66-e4ec-833f-c4896b8e87e4 +5b85f255-466f-238d-90ed-5726eaa2e67b llsd-lsl-syntax-version2 controls @@ -6754,15 +6754,15 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 osKickAvatar arguments - FirstNametypestring - SurNametypestring + agentIdtypekey alerttypestring osKickAvatar arguments - agentIdtypekey + FirstNametypestring + SurNametypestring alerttypestring @@ -7351,6 +7351,7 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 osSetProjectionParams arguments + primtypekey projectiontypeinteger texturetypekey fovtypefloat @@ -7361,7 +7362,17 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 osSetProjectionParams arguments - primtypekey + projectiontypeinteger + texturetypekey + fovtypefloat + focustypefloat + ambtypefloat + + + osSetProjectionParams + + arguments + linknumbertypeinteger projectiontypeinteger texturetypekey fovtypefloat @@ -7595,7 +7606,8 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 osTeleportOwner arguments - regionNametypestring + regionXtypeinteger + regionYtypeinteger positiontypevector lookattypevector @@ -7603,8 +7615,7 @@ e796a21f-5a66-e4ec-833f-c4896b8e87e4 osTeleportOwner arguments - regionXtypeinteger - regionYtypeinteger + regionNametypestring positiontypevector lookattypevector From 15dd03349024d74d4db22f5c6dab77570eb9c340 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 22:52:58 +0100 Subject: [PATCH 123/150] 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 a5f3ba6e55..a49f53c8d1 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; From e9587c88354964f7b1e5ca38e1b1f8b6da7ef9d4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 22:56:31 +0100 Subject: [PATCH 124/150] sop: rename a few fields --- .../Framework/Scenes/SceneObjectGroup.cs | 14 +++--- .../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 0b3817996e..c0bafc55ff 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(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); oldp.Y = Util.Clamp(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 c536184f8c..b341d48bb4 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(); 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 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(); 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)) { From 3491af440f7d4852415f574b06356bec3006c0c8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 23:01:37 +0100 Subject: [PATCH 125/150] missing files... --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- .../Framework/EntityTransfer/EntityTransferModule.cs | 6 +++--- .../ServiceConnectorsOut/GridUser/ActivityDetector.cs | 2 +- .../ServiceConnectorsOut/Presence/PresenceDetector.cs | 2 +- .../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 772485cfeb..39bf46c619 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 a2c2aa754a..187df314e4 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 1529fc2764..615ae787ad 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 3f418f6de3..6f4eace92f 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 65d50bb9a0..4b81838094 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); } From 9225b783092d3265714520fdfdab8100902b27c2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 23:04:04 +0100 Subject: [PATCH 126/150] 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 5b76e0a5b8..e98bc0f151 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); } From 11c945a5651d8e55c6948df9a026ff3d85566b51 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 1 May 2019 01:35:45 +0100 Subject: [PATCH 127/150] 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 ++++++ .../Region/Framework/Scenes/ScenePresence.cs | 49 +++++++++---------- .../PhysicsModules/ubOde/ODECharacter.cs | 4 +- .../Shared/Api/Implementation/OSSL_Api.cs | 17 +++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../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 2fa92b3394..073d11f206 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4795,6 +4795,20 @@ Label_GroupsDone: return true; } + + /// + /// Tries to teleport agent within region. + /// + /// + /// + /// + /// + public void RequestLocalTeleport(ScenePresence sp, Vector3 position, Vector3 vel, + Vector3 lookat, int flags) + { + sp.LocalTeleport(position, vel, lookat, flags); + } + /// /// Tries to teleport agent to another region. /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b341d48bb4..56e822af4b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1688,10 +1688,6 @@ namespace OpenSim.Region.Framework.Scenes // } } - /// - /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. - /// - /// 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 267fc5b458..cec8b742a7 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 c1c1eafe2e..a0f784e667 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 ce6aaf8852..194df36fec 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 fd5142f71c..88ea9d5660 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); From ea32a73103b3df4b6c5d904ae92e088e0b5bbdc2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 1 May 2019 03:49:24 +0100 Subject: [PATCH 128/150] osLocalTeleportAgent: no region crossings :( ; check avatar access to target position; flag 8 == force fly; 16 force nofly (both == fly) --- .../Region/Framework/Scenes/ScenePresence.cs | 81 ++++++++++++++++--- .../PhysicsModules/ubOde/ODECharacter.cs | 1 + 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 56e822af4b..cd2b9b4222 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; - - AbsolutePosition = newpos; - - if ((flags & 1) != 0) + if (newpos.X <= 0) { - if (PhysicsActor != null) - PhysicsActor.SetMomentum(newvel); - m_velocity = newvel; + 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; + } + + 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; + } + + 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))) + { + 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 cec8b742a7..b86be0f7b8 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; } From 3a055c578d9fb2e1f6c0c9ba47a7b8c9c5d8af48 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 2 May 2019 03:11:16 +0100 Subject: [PATCH 129/150] soem cleanup --- .../Region/Framework/Scenes/ScenePresence.cs | 13 +- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- .../Shared/Api/Runtime/LSL_Constants.cs | 15 +- bin/ScriptSyntax.xml | 158 +++++++++++------- 4 files changed, 117 insertions(+), 71 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd2b9b4222..b12bb456ea 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 a0f784e667..7d3c832d1e 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 8b70128e71..86c6d7c2c8 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 d01414b921..2282adaea1 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -5b85f255-466f-238d-90ed-5726eaa2e67b +24121ec8-c0a3-099d-8d83-64feaa32418c llsd-lsl-syntax-version2 controls @@ -1513,7 +1513,7 @@ OS_APIVERSION typeinteger - value3 + value4 OS_ATTACH_MSG_ALL typeinteger @@ -1539,6 +1539,36 @@ typeinteger value0x1 + OS_LTPAG_ALGNLV + typeinteger + value0x4 + tooltiposLocalTeleportAgent align lookat to velocity + + OS_LTPAG_FORCEFLY + typeinteger + value0x8 + tooltiposLocalTeleportAgent force fly + + OS_LTPAG_FORCENOFLY + typeinteger + value0x16 + tooltiposLocalTeleportAgent force no fly + + OS_LTPAG_NONE + typeinteger + value0x0 + tooltiposLocalTeleportAgent no flags + + OS_LTPAG_USELOOKAT + typeinteger + value0x2 + tooltiposLocalTeleportAgent use lookat + + OS_LTPAG_USEVEL + typeinteger + value0x1 + tooltiposLocalTeleportAgent use velocity + OS_NPC_CREATOR_OWNED typeinteger value0x1 @@ -6116,33 +6146,6 @@ arguments atypefloat btypefloat - margintypefloat - - - osApproxEquals - - returninteger - arguments - ratyperotation - rbtyperotation - margintypefloat - - - osApproxEquals - - returninteger - arguments - ratyperotation - rbtyperotation - - - osApproxEquals - - returninteger - arguments - vatypevector - vbtypevector - margintypefloat osApproxEquals @@ -6159,6 +6162,33 @@ arguments atypefloat btypefloat + margintypefloat + + + osApproxEquals + + returninteger + arguments + ratyperotation + rbtyperotation + + + osApproxEquals + + returninteger + arguments + ratyperotation + rbtyperotation + margintypefloat + + + osApproxEquals + + returninteger + arguments + vatypevector + vbtypevector + margintypefloat osAvatarName2Key @@ -6284,8 +6314,6 @@ returnstring arguments drawListtypestring - startXtypeinteger - startYtypeinteger endXtypeinteger endYtypeinteger @@ -6295,6 +6323,8 @@ returnstring arguments drawListtypestring + startXtypeinteger + startYtypeinteger endXtypeinteger endYtypeinteger @@ -6433,13 +6463,13 @@ arguments avatartypestring + targettypestring osForceOtherSit arguments avatartypestring - targettypestring osFormatString @@ -6754,15 +6784,15 @@ osKickAvatar arguments - agentIdtypekey + FirstNametypestring + SurNametypestring alerttypestring osKickAvatar arguments - FirstNametypestring - SurNametypestring + agentIdtypekey alerttypestring @@ -6781,6 +6811,16 @@ returnstring arguments + osLocalTeleportAgent + + arguments + agenttypekey + positiontypevector + velocitytypevector + lookattypevector + flagstypeinteger + + osLoopSound arguments @@ -7105,13 +7145,13 @@ osRegionNotice arguments + agentIDtypekey msgtypestring osRegionNotice arguments - agentIDtypekey msgtypestring @@ -7349,17 +7389,6 @@ osSetProjectionParams - - arguments - primtypekey - projectiontypeinteger - texturetypekey - fovtypefloat - focustypefloat - ambtypefloat - - - osSetProjectionParams arguments projectiontypeinteger @@ -7380,6 +7409,17 @@ ambtypefloat + osSetProjectionParams + + arguments + primtypekey + projectiontypeinteger + texturetypekey + fovtypefloat + focustypefloat + ambtypefloat + + osSetRegionSunSettings arguments @@ -7494,8 +7534,6 @@ arguments srctypestring valuetypestring - starttypeinteger - counttypeinteger ignorecasetypeinteger @@ -7505,6 +7543,8 @@ arguments srctypestring valuetypestring + starttypeinteger + counttypeinteger ignorecasetypeinteger @@ -7541,6 +7581,7 @@ arguments srctypestring starttypeinteger + lengthtypeinteger osStringSubString @@ -7549,7 +7590,6 @@ arguments srctypestring starttypeinteger - lengthtypeinteger osSunGetParam @@ -7579,8 +7619,6 @@ arguments agenttypestring - regionXtypeinteger - regionYtypeinteger positiontypevector lookattypevector @@ -7589,6 +7627,8 @@ arguments agenttypestring + regionXtypeinteger + regionYtypeinteger positiontypevector lookattypevector @@ -7604,6 +7644,13 @@ osTeleportOwner + + arguments + positiontypevector + lookattypevector + + + osTeleportOwner arguments regionXtypeinteger @@ -7620,13 +7667,6 @@ lookattypevector - osTeleportOwner - - arguments - positiontypevector - lookattypevector - - osTerrainFlush arguments From 3ae4115e4390eab1391b74ba82792dc5df9dac1e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 3 May 2019 00:39:55 +0100 Subject: [PATCH 130/150] osLocalTeleportAgent: if lookat or fly options, just move the avatar, not telling viewer about any teleport --- .../Region/Framework/Scenes/ScenePresence.cs | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b12bb456ea..f569d21af5 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; - - uint tpflags = (uint)TeleportFlags.ViaLocation; - if(Flying) - tpflags |= (uint)TeleportFlags.IsFlying; - - Vector3 lookat = Lookat; - - if ((flags & 2) != 0) + if((flags & 0x1e) != 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 & 8) != 0) + Flying = true; + else if ((flags & 16) != 0) + Flying = false; - AbsolutePosition = newpos; - ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); + 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) + 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); + } + else + AbsolutePosition = newpos; if ((flags & 1) != 0) { From 0e2adbe0fb030eae48bb778b21495d5d50ba8f2a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 14 May 2019 02:48:03 +0100 Subject: [PATCH 131/150] mantis 8527 and 8517: let llSetLinkPrimitiveParam*() PRIM_TEXTURE ignore texture id/name if invalid, processing the other parameters, for compatibily with old scripts. --- .../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 5c6b7b2fae..5c0465946c 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; } } From 9c44dc3384cdc13bc11d6cff8e700e338c564d99 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 19 May 2019 14:20:01 +0100 Subject: [PATCH 132/150] 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 8b77ee9033..7db75063a8 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 From 8410a01fb4c9621d5eeb911d61f8fd544b4396b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 22 May 2019 23:16:20 +0100 Subject: [PATCH 133/150] 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 86c6d7c2c8..fa0e25c5f6 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; From 38e937f91b08a2e52c47d2353c57556f542a00c1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 28 May 2019 21:37:59 +0100 Subject: [PATCH 134/150] add sim feature AvatarHoverHeightEnabled; mantis 8535: make option MeshModelAllowTextureToInventory visible --- .../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 8f65a69121..b0ba5a3779 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(); + if(simFeatures != null) + simFeatures.AddFeature("AvatarHoverHeightEnabled",OSD.FromBoolean(true)); } public void PostInitialise() {} diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 456dcd6e8a..1332ce81b2 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 From 41e2379f976dbc21613b24eb74a946481b0b811f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Jun 2019 19:02:50 +0100 Subject: [PATCH 135/150] mantis 8460: reduce odds of watchdog timeout warning --- .../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 da54c543dd..15294c360e 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)); } /// @@ -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(); From 9ff7601214c8cbc022308dc62ed8aa321598a1df Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Jun 2019 20:15:36 +0100 Subject: [PATCH 136/150] reduce some useless array copies --- OpenSim/Framework/IClientAPI.cs | 3 ++- .../ClientStack/Linden/UDP/LLClientView.cs | 19 +++++++++++--- .../CoreModules/Agent/Xfer/XferModule.cs | 26 +++++-------------- .../Server/IRCClientView.cs | 3 ++- .../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 8d0cb5afbd..68ca52e2ee 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1235,7 +1235,8 @@ namespace OpenSim.Framework /// 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 01a9fb6eb8..5d4d5cd823 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 1b6401afd3..94e8064218 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 16be1c80f8..e27bbc3f74 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 b2a9716a93..d3eb25f671 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 3cd525369a..fd14291241 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) { } From 2cba0d676ec28d7b061bcb3a83069e6e50d95a5e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Jun 2019 23:40:50 +0100 Subject: [PATCH 137/150] 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 94e8064218..705d7eaa0d 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); } } From 017253fae93da198688ccfbe1628f92a98a7024d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Jun 2019 19:17:32 +0100 Subject: [PATCH 138/150] a few more changes to lludp Xfer download --- .../ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../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 5d4d5cd823..ac30868922 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 705d7eaa0d..c5ef25af2b 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; } /// @@ -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; } From 238efad6907e9848765cf5a102e15631d9ca6981 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 11 Jun 2019 01:19:57 +0100 Subject: [PATCH 139/150] a few more changes to lludp Xfer download --- .../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 c5ef25af2b..dd372636f6 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); From da90da220e72ae08a2819111ce3f4c7746609719 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jun 2019 01:43:32 +0100 Subject: [PATCH 140/150] still a few more changes to lludp Xfer download for lost udp case --- .../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 dd372636f6..056e78665f 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) From 878d0defc7d32d180b8e0b7eb9994ac953cd2ee3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jun 2019 02:41:20 +0100 Subject: [PATCH 141/150] add a lock --- .../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 056e78665f..b897d04e56 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) From 4b8c5ee6e87259d169d73cab42704f17a83b62bf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jun 2019 03:12:51 +0100 Subject: [PATCH 142/150] 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 b897d04e56..8b7a82d15a 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) { From 086248c13b750e7e6ba2ffb7365611b72a2bc4be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jun 2019 00:08:51 +0100 Subject: [PATCH 143/150] minor cleanup --- .../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 8b7a82d15a..32b3523a9f 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 expires = new List(); 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(); } } } From b09ea5bdc7ce657e8f785caf7abd8778a8afb3da Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jun 2019 01:12:47 +0100 Subject: [PATCH 144/150] 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 32b3523a9f..6157f38103 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(); } } From 79442c8c56afc543ea731fff92ac4c4e9a442ee3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jun 2019 01:33:25 +0100 Subject: [PATCH 145/150] 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 6157f38103..56123a53ef 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) { From 05f508229ce2938f3f88510080f5b65ed5a9b324 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Jun 2019 20:12:33 +0100 Subject: [PATCH 146/150] make materials save to grid less async on manual backup or shutdown --- .../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 822439fb5e..2aea7f9cb2 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(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); + } + }); + } } } From 03abb970f4e93e9f89f4b848703ccb2eddddfe9a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Jun 2019 20:13:57 +0100 Subject: [PATCH 147/150] 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 b636a7b269..b12ea62efc 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("POST", uri, asset, 100000, m_Auth); + MakeRequest("POST", uri, asset, 10000, m_Auth); } catch { From d372309e3cb3407e54b49e4da6fd3296f150b84d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Jul 2019 20:49:00 +0100 Subject: [PATCH 148/150] mantis 8558: send sane values for Agents and objects capability (max hard limit) --- .../Framework/RegionInfoForEstateMenuArgs.cs | 4 ++- .../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 f274da2e7a..1b828caad1 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 ac30868922..aeb728e8d1 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 936f956c7a..986a44f2dd 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); } From aedaa32ddc683e925e9a618ee731501fad0d4204 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 13 Jul 2019 13:30:15 +0100 Subject: [PATCH 149/150] 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. --- .../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 a66478ed01..8fef57a161 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. /// - 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(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)); } - } - } From 78359c108dfbecc9d8b7a26712eed061c1c0d648 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 15 Jul 2019 22:10:47 +0100 Subject: [PATCH 150/150] mantis 8563: do not modify collection inside a loop on it a foreach on it --- .../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 5c0465946c..5d72858fe2 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(); 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(); 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); }