From 28aa8010b2b47b73c6b867ff8f6284f98f12f37a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 15 Nov 2009 21:38:38 +0100 Subject: - Lower TIME_MS_TOLERANCE to 200ms - Allow m_updateFlag to be reset to 0 in the event of a terse update being rejected - Re-add a synchronous SendTo for certain types of packets --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 24 ++++++++++++++++++++-- .../Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | 18 ++++++++++++++++ .../Region/ClientStack/LindenUDP/OutgoingPacket.cs | 4 +++- 3 files changed, 43 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index c773c05..0b05ed9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -399,6 +399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Queue or Send OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category); + outgoingPacket.Type = type; if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket)) SendPacketFinal(outgoingPacket); @@ -510,6 +511,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte flags = buffer.Data[0]; bool isResend = (flags & Helpers.MSG_RESENT) != 0; bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; + bool sendSynchronous = false; LLUDPClient udpClient = outgoingPacket.Client; if (!udpClient.IsConnected) @@ -565,9 +567,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (isReliable) Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength); - // Put the UDP payload on the wire - AsyncBeginSend(buffer); + //Some packet types need to be sent synchonously. + //Sorry, i know it's not optimal, but until the LL client + //manages packets correctly and re-orders them as required, this is necessary. + + if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate + || outgoingPacket.Type == PacketType.ChatFromSimulator + || outgoingPacket.Type == PacketType.ObjectUpdate + || outgoingPacket.Type == PacketType.LayerData) + { + sendSynchronous = true; + } + // Put the UDP payload on the wire + if (sendSynchronous == true) + { + SyncBeginSend(buffer); + } + else + { + AsyncBeginSend(buffer); + } // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index d2779ba..63579ac 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs @@ -246,6 +246,24 @@ namespace OpenMetaverse } } + public void SyncBeginSend(UDPPacketBuffer buf) + { + if (!m_shutdownFlag) + { + try + { + m_udpSocket.SendTo( + buf.Data, + 0, + buf.DataLength, + SocketFlags.None, + buf.RemoteEndPoint); + } + catch (SocketException) { } + catch (ObjectDisposedException) { } + } + } + public void AsyncBeginSend(UDPPacketBuffer buf) { if (!m_shutdownFlag) diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs index 1a1a1cb..7dc42d3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs @@ -28,6 +28,7 @@ using System; using OpenSim.Framework; using OpenMetaverse; +using OpenMetaverse.Packets; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -52,7 +53,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int TickCount; /// Category this packet belongs to public ThrottleOutPacketType Category; - + /// The type of packet so its delivery method can be determined + public PacketType Type; /// /// Default constructor /// -- cgit v1.1 From b9546d12f230f4153b2c6e7e71520aa2d35c762b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Nov 2009 21:20:42 +0000 Subject: Change land packet sending back to what the careminster release used to use, remove the silly spiral stuff. Revert to double packets for improved user experience --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 83 +++++++++------------- 1 file changed, 34 insertions(+), 49 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7eb829e..49b9378 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -785,6 +785,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void SendLayerData(float[] map) { Util.FireAndForget(DoSendLayerData, map); + + // Send it sync, and async. It's not that much data + // and it improves user experience just so much! + DoSendLayerData(map); } /// @@ -797,16 +801,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { - //for (int y = 0; y < 16; y++) - //{ - // for (int x = 0; x < 16; x++) - // { - // SendLayerData(x, y, map); - // } - //} - - // Send LayerData in a spiral pattern. Fun! - SendLayerTopRight(map, 0, 0, 15, 15); + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x+=4) + { + SendLayerPacket(x, y, map); + } + } } catch (Exception e) { @@ -814,51 +815,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) - { - // Row - for (int i = x1; i <= x2; i++) - SendLayerData(i, y1, map); - - // Column - for (int j = y1 + 1; j <= y2; j++) - SendLayerData(x2, j, map); - - if (x2 - x1 > 0) - SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); - } - - void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) - { - // Row in reverse - for (int i = x2; i >= x1; i--) - SendLayerData(i, y2, map); - - // Column in reverse - for (int j = y2 - 1; j >= y1; j--) - SendLayerData(x1, j, map); - - if (x2 - x1 > 0) - SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); - } - /// /// Sends a set of four patches (x, x+1, ..., x+3) to the client /// /// heightmap /// X coordinate for patches 0..12 /// Y coordinate for patches 0..15 - // private void SendLayerPacket(float[] map, int y, int x) - // { - // int[] patches = new int[4]; - // patches[0] = x + 0 + y * 16; - // patches[1] = x + 1 + y * 16; - // patches[2] = x + 2 + y * 16; - // patches[3] = x + 3 + y * 16; - - // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); - // OutPacket(layerpack, ThrottleOutPacketType.Land); - // } + private void SendLayerPacket(int x, int y, float[] map) + { + int[] patches = new int[4]; + patches[0] = x + 0 + y * 16; + patches[1] = x + 1 + y * 16; + patches[2] = x + 2 + y * 16; + patches[3] = x + 3 + y * 16; + + float[] heightmap = (map.Length == 65536) ? + map : + LLHeightFieldMoronize(map); + + try + { + Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); + OutPacket(layerpack, ThrottleOutPacketType.Land); + } + catch + { + for (int px = x ; px < x + 4 ; px++) + SendLayerData(px, y, map); + } + } /// /// Sends a specified patch to a client -- cgit v1.1 From 0149265ee83581cf2fb150dcd5d8734c02926261 Mon Sep 17 00:00:00 2001 From: CasperW Date: Sat, 21 Nov 2009 15:36:38 +0100 Subject: Improved avatar responsiveness. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 4 +- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 24 +++--- .../Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | 89 +++++++++++++++++++--- 3 files changed, 91 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 49b9378..39eb968 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3121,7 +3121,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); - OutPacket(objupdate, ThrottleOutPacketType.Task); } @@ -3172,8 +3171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); } - // HACK: Using the task category until the tiered reprioritization code is in - OutPacket(terse, ThrottleOutPacketType.Task); + OutPacket(terse, ThrottleOutPacketType.State); } public void SendCoarseLocationUpdate(List users, List CoarseLocations) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 0b05ed9..4a7bdfe 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -571,23 +571,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Sorry, i know it's not optimal, but until the LL client //manages packets correctly and re-orders them as required, this is necessary. - if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate - || outgoingPacket.Type == PacketType.ChatFromSimulator - || outgoingPacket.Type == PacketType.ObjectUpdate - || outgoingPacket.Type == PacketType.LayerData) + + // Put the UDP payload on the wire + if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate) { - sendSynchronous = true; + SyncBeginPrioritySend(buffer, 2); // highest priority } - - // Put the UDP payload on the wire - if (sendSynchronous == true) + else if (outgoingPacket.Type == PacketType.ObjectUpdate + || outgoingPacket.Type == PacketType.ChatFromSimulator + || outgoingPacket.Type == PacketType.LayerData) { - SyncBeginSend(buffer); + SyncBeginPrioritySend(buffer, 1); // medium priority } else { - AsyncBeginSend(buffer); + SyncBeginPrioritySend(buffer, 0); // normal priority } + + //AsyncBeginSend(buffer); + // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; } @@ -862,7 +864,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length); - AsyncBeginSend(buffer); + SyncBeginPrioritySend(buffer, 1); //Setting this to a medium priority should help minimise resends } private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo) diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index 63579ac..45d9170 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs @@ -29,6 +29,7 @@ using System; using System.Net; using System.Net.Sockets; using System.Threading; +using System.Collections.Generic; using log4net; namespace OpenMetaverse @@ -52,12 +53,25 @@ namespace OpenMetaverse /// Local IP address to bind to in server mode protected IPAddress m_localBindAddress; + /// + /// Standard queue for our outgoing SyncBeginPrioritySend + /// + private List m_standardQueue = new List(); + + /// + /// Prioritised queue for our outgoing SyncBeginPrioritySend + /// + private List m_priorityQueue = new List(); + /// UDP socket, used in either client or server mode private Socket m_udpSocket; /// Flag to process packets asynchronously or synchronously private bool m_asyncPacketHandling; + /// Are we currently sending data asynchronously? + private volatile bool m_sendingData = false; + /// The all important shutdown flag private volatile bool m_shutdownFlag = true; @@ -246,25 +260,48 @@ namespace OpenMetaverse } } - public void SyncBeginSend(UDPPacketBuffer buf) + public void SyncBeginPrioritySend(UDPPacketBuffer buf, int Priority) { if (!m_shutdownFlag) { - try + if (!m_sendingData) { - m_udpSocket.SendTo( - buf.Data, - 0, - buf.DataLength, - SocketFlags.None, - buf.RemoteEndPoint); + m_sendingData = true; + try + { + AsyncBeginSend(buf); + } + catch (SocketException) { } + catch (ObjectDisposedException) { } + } + else + { + if (Priority == 2) + { + lock (m_priorityQueue) + { + m_priorityQueue.Add(buf); + } + } + else + { + lock (m_standardQueue) + { + if (Priority != 0) + { + m_standardQueue.Insert(0, buf); + } + else + { + m_standardQueue.Add(buf); + } + } + } } - catch (SocketException) { } - catch (ObjectDisposedException) { } } } - public void AsyncBeginSend(UDPPacketBuffer buf) + private void AsyncBeginSend(UDPPacketBuffer buf) { if (!m_shutdownFlag) { @@ -288,8 +325,36 @@ namespace OpenMetaverse { try { -// UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState; m_udpSocket.EndSendTo(result); + + if (m_sendingData) + { + lock (m_priorityQueue) + { + if (m_priorityQueue.Count > 0) + { + UDPPacketBuffer buf = m_priorityQueue[0]; + m_priorityQueue.RemoveAt(0); + AsyncBeginSend(buf); + } + else + { + lock (m_standardQueue) + { + if (m_standardQueue.Count > 0) + { + UDPPacketBuffer buf = m_standardQueue[0]; + m_standardQueue.RemoveAt(0); + AsyncBeginSend(buf); + } + else + { + m_sendingData = false; + } + } + } + } + } } catch (SocketException) { } catch (ObjectDisposedException) { } -- cgit v1.1 From 4a29a7f92cc5264dfcb4a4376a61506d29dd9d8d Mon Sep 17 00:00:00 2001 From: CasperW Date: Sat, 21 Nov 2009 18:50:52 +0100 Subject: Minor packet ordering fix --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 1 - .../Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | 40 ++++++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 4a7bdfe..98bb4f7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -578,7 +578,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP SyncBeginPrioritySend(buffer, 2); // highest priority } else if (outgoingPacket.Type == PacketType.ObjectUpdate - || outgoingPacket.Type == PacketType.ChatFromSimulator || outgoingPacket.Type == PacketType.LayerData) { SyncBeginPrioritySend(buffer, 1); // medium priority diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index 45d9170..de2cd24 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs @@ -57,7 +57,12 @@ namespace OpenMetaverse /// Standard queue for our outgoing SyncBeginPrioritySend /// private List m_standardQueue = new List(); - + + /// + /// Medium priority queue for our outgoing SyncBeginPrioritySend + /// + private List m_mediumPriorityQueue = new List(); + /// /// Prioritised queue for our outgoing SyncBeginPrioritySend /// @@ -285,13 +290,16 @@ namespace OpenMetaverse } else { - lock (m_standardQueue) + if (Priority != 0) { - if (Priority != 0) + lock (m_mediumPriorityQueue) { - m_standardQueue.Insert(0, buf); + m_mediumPriorityQueue.Add(buf); } - else + } + else + { + lock (m_standardQueue) { m_standardQueue.Add(buf); } @@ -339,17 +347,29 @@ namespace OpenMetaverse } else { - lock (m_standardQueue) + lock (m_mediumPriorityQueue) { - if (m_standardQueue.Count > 0) + if (m_mediumPriorityQueue.Count > 0) { - UDPPacketBuffer buf = m_standardQueue[0]; - m_standardQueue.RemoveAt(0); + UDPPacketBuffer buf = m_mediumPriorityQueue[0]; + m_mediumPriorityQueue.RemoveAt(0); AsyncBeginSend(buf); } else { - m_sendingData = false; + lock (m_standardQueue) + { + if (m_standardQueue.Count > 0) + { + UDPPacketBuffer buf = m_standardQueue[0]; + m_standardQueue.RemoveAt(0); + AsyncBeginSend(buf); + } + else + { + m_sendingData = false; + } + } } } } -- cgit v1.1 From 129de260329791529904c02c3515d40879d7d214 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 5 Dec 2009 23:25:30 +0000 Subject: Cause better packing of ObjectProperties --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 106 +++++++++++++++------ 1 file changed, 79 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e812945..71f9b90 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -352,6 +352,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private IHyperAssetService m_hyperAssets; private const bool m_checkPackets = true; + private Timer m_propertiesPacketTimer; + private List m_propertiesBlocks = new List(); + #endregion Class Members #region Properties @@ -433,6 +436,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpClient.OnQueueEmpty += HandleQueueEmpty; m_udpClient.OnPacketStats += PopulateStats; + m_propertiesPacketTimer = new Timer(100); + m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket; + RegisterLocalPacketHandlers(); } @@ -3562,42 +3568,88 @@ namespace OpenSim.Region.ClientStack.LindenUDP string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, uint BaseMask, byte saleType, int salePrice) { - ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); + //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); // TODO: don't create new blocks if recycling an old packet - proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; - proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); - proper.ObjectData[0].ItemID = ItemID; - proper.ObjectData[0].CreationDate = CreationDate; - proper.ObjectData[0].CreatorID = CreatorUUID; - proper.ObjectData[0].FolderID = FolderUUID; - proper.ObjectData[0].FromTaskID = FromTaskUUID; - proper.ObjectData[0].GroupID = GroupUUID; - proper.ObjectData[0].InventorySerial = InventorySerial; - - proper.ObjectData[0].LastOwnerID = LastOwnerUUID; + ObjectPropertiesPacket.ObjectDataBlock block = + new ObjectPropertiesPacket.ObjectDataBlock(); + + block.ItemID = ItemID; + block.CreationDate = CreationDate; + block.CreatorID = CreatorUUID; + block.FolderID = FolderUUID; + block.FromTaskID = FromTaskUUID; + block.GroupID = GroupUUID; + block.InventorySerial = InventorySerial; + + block.LastOwnerID = LastOwnerUUID; // proper.ObjectData[0].LastOwnerID = UUID.Zero; - proper.ObjectData[0].ObjectID = ObjectUUID; + block.ObjectID = ObjectUUID; if (OwnerUUID == GroupUUID) - proper.ObjectData[0].OwnerID = UUID.Zero; + block.OwnerID = UUID.Zero; else - proper.ObjectData[0].OwnerID = OwnerUUID; - proper.ObjectData[0].TouchName = Util.StringToBytes256(TouchTitle); - proper.ObjectData[0].TextureID = TextureID; - proper.ObjectData[0].SitName = Util.StringToBytes256(SitTitle); - proper.ObjectData[0].Name = Util.StringToBytes256(ItemName); - proper.ObjectData[0].Description = Util.StringToBytes256(ItemDescription); - proper.ObjectData[0].OwnerMask = OwnerMask; - proper.ObjectData[0].NextOwnerMask = NextOwnerMask; - proper.ObjectData[0].GroupMask = GroupMask; - proper.ObjectData[0].EveryoneMask = EveryoneMask; - proper.ObjectData[0].BaseMask = BaseMask; + block.OwnerID = OwnerUUID; + block.TouchName = Util.StringToBytes256(TouchTitle); + block.TextureID = TextureID; + block.SitName = Util.StringToBytes256(SitTitle); + block.Name = Util.StringToBytes256(ItemName); + block.Description = Util.StringToBytes256(ItemDescription); + block.OwnerMask = OwnerMask; + block.NextOwnerMask = NextOwnerMask; + block.GroupMask = GroupMask; + block.EveryoneMask = EveryoneMask; + block.BaseMask = BaseMask; // proper.ObjectData[0].AggregatePerms = 53; // proper.ObjectData[0].AggregatePermTextures = 0; // proper.ObjectData[0].AggregatePermTexturesOwner = 0; - proper.ObjectData[0].SaleType = saleType; - proper.ObjectData[0].SalePrice = salePrice; + block.SaleType = saleType; + block.SalePrice = salePrice; + + lock (m_propertiesPacketTimer) + { + m_propertiesBlocks.Add(block); + + int length = 0; + foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks) + { + length += b.Length; + } + if (length > 1100) // FIXME: use real MTU + { + ProcessObjectPropertiesPacket(null, null); + m_propertiesPacketTimer.Stop(); + return; + } + + m_propertiesPacketTimer.Stop(); + m_propertiesPacketTimer.Start(); + } + + //proper.Header.Zerocoded = true; + //OutPacket(proper, ThrottleOutPacketType.Task); + } + + private void ProcessObjectPropertiesPacket(Object sender, ElapsedEventArgs e) + { + ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); + + lock (m_propertiesPacketTimer) + { + m_propertiesPacketTimer.Stop(); + + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; + + int index = 0; + + foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks) + { + proper.ObjectData[index++] = b; + } + + m_propertiesBlocks.Clear(); + } + proper.Header.Zerocoded = true; OutPacket(proper, ThrottleOutPacketType.Task); } -- cgit v1.1 From 29a740ec8c78bfc3c1ab5b41b302ae2205c6e9aa Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Dec 2009 18:03:53 +0100 Subject: Initial windlight codebase commit --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b588a2e..6cbf1a6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -764,16 +764,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public void SendGenericMessage(string method, List message) + public void SendGenericMessage(string method, List message) { GenericMessagePacket gmp = new GenericMessagePacket(); gmp.MethodData.Method = Util.StringToBytes256(method); gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; int i = 0; - foreach (string val in message) + foreach (byte[] val in message) { gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); - gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); + gmp.ParamList[i++].Parameter = val; } OutPacket(gmp, ThrottleOutPacketType.Task); } -- cgit v1.1 From 31bf25d05e09395416c0427e783f8685a9e69889 Mon Sep 17 00:00:00 2001 From: CasperW Date: Sun, 20 Dec 2009 16:18:43 +0100 Subject: Reverted my changes to jhurliman's packet stack since it currently causes more problems than it resolves. The stack DOES need a rework particularly with regards to priorities, but this is not it. --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 27 +----- .../Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | 107 +-------------------- .../Region/ClientStack/LindenUDP/OutgoingPacket.cs | 4 +- 3 files changed, 6 insertions(+), 132 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 4d9f58f..3c4fa72 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -402,7 +402,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Queue or Send OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category); - outgoingPacket.Type = type; if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket)) SendPacketFinal(outgoingPacket); @@ -514,7 +513,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte flags = buffer.Data[0]; bool isResend = (flags & Helpers.MSG_RESENT) != 0; bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; - bool sendSynchronous = false; LLUDPClient udpClient = outgoingPacket.Client; if (!udpClient.IsConnected) @@ -570,28 +568,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (isReliable) Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength); - //Some packet types need to be sent synchonously. - //Sorry, i know it's not optimal, but until the LL client - //manages packets correctly and re-orders them as required, this is necessary. - - // Put the UDP payload on the wire - if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate) - { - SyncBeginPrioritySend(buffer, 2); // highest priority - } - else if (outgoingPacket.Type == PacketType.ObjectUpdate - || outgoingPacket.Type == PacketType.LayerData) - { - SyncBeginPrioritySend(buffer, 1); // medium priority - } - else - { - SyncBeginPrioritySend(buffer, 0); // normal priority - } - - //AsyncBeginSend(buffer); - + AsyncBeginSend(buffer); + // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; } @@ -872,7 +851,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length); - SyncBeginPrioritySend(buffer, 1); //Setting this to a medium priority should help minimise resends + AsyncBeginSend(buffer); } private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo) diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index de2cd24..d2779ba 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs @@ -29,7 +29,6 @@ using System; using System.Net; using System.Net.Sockets; using System.Threading; -using System.Collections.Generic; using log4net; namespace OpenMetaverse @@ -53,30 +52,12 @@ namespace OpenMetaverse /// Local IP address to bind to in server mode protected IPAddress m_localBindAddress; - /// - /// Standard queue for our outgoing SyncBeginPrioritySend - /// - private List m_standardQueue = new List(); - - /// - /// Medium priority queue for our outgoing SyncBeginPrioritySend - /// - private List m_mediumPriorityQueue = new List(); - - /// - /// Prioritised queue for our outgoing SyncBeginPrioritySend - /// - private List m_priorityQueue = new List(); - /// UDP socket, used in either client or server mode private Socket m_udpSocket; /// Flag to process packets asynchronously or synchronously private bool m_asyncPacketHandling; - /// Are we currently sending data asynchronously? - private volatile bool m_sendingData = false; - /// The all important shutdown flag private volatile bool m_shutdownFlag = true; @@ -265,51 +246,7 @@ namespace OpenMetaverse } } - public void SyncBeginPrioritySend(UDPPacketBuffer buf, int Priority) - { - if (!m_shutdownFlag) - { - if (!m_sendingData) - { - m_sendingData = true; - try - { - AsyncBeginSend(buf); - } - catch (SocketException) { } - catch (ObjectDisposedException) { } - } - else - { - if (Priority == 2) - { - lock (m_priorityQueue) - { - m_priorityQueue.Add(buf); - } - } - else - { - if (Priority != 0) - { - lock (m_mediumPriorityQueue) - { - m_mediumPriorityQueue.Add(buf); - } - } - else - { - lock (m_standardQueue) - { - m_standardQueue.Add(buf); - } - } - } - } - } - } - - private void AsyncBeginSend(UDPPacketBuffer buf) + public void AsyncBeginSend(UDPPacketBuffer buf) { if (!m_shutdownFlag) { @@ -333,48 +270,8 @@ namespace OpenMetaverse { try { +// UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState; m_udpSocket.EndSendTo(result); - - if (m_sendingData) - { - lock (m_priorityQueue) - { - if (m_priorityQueue.Count > 0) - { - UDPPacketBuffer buf = m_priorityQueue[0]; - m_priorityQueue.RemoveAt(0); - AsyncBeginSend(buf); - } - else - { - lock (m_mediumPriorityQueue) - { - if (m_mediumPriorityQueue.Count > 0) - { - UDPPacketBuffer buf = m_mediumPriorityQueue[0]; - m_mediumPriorityQueue.RemoveAt(0); - AsyncBeginSend(buf); - } - else - { - lock (m_standardQueue) - { - if (m_standardQueue.Count > 0) - { - UDPPacketBuffer buf = m_standardQueue[0]; - m_standardQueue.RemoveAt(0); - AsyncBeginSend(buf); - } - else - { - m_sendingData = false; - } - } - } - } - } - } - } } catch (SocketException) { } catch (ObjectDisposedException) { } diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs index 7dc42d3..1a1a1cb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs @@ -28,7 +28,6 @@ using System; using OpenSim.Framework; using OpenMetaverse; -using OpenMetaverse.Packets; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -53,8 +52,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int TickCount; /// Category this packet belongs to public ThrottleOutPacketType Category; - /// The type of packet so its delivery method can be determined - public PacketType Type; + /// /// Default constructor /// -- cgit v1.1 From d321d23afe62e0e00f774901be3e1d1d0eda8c15 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 16:01:36 +0000 Subject: Fix the spelling :/ --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index aeb97eb..8a5f209 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4840,9 +4840,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP UserProfile.FirstLifeImage = Properties.FLImageID; UserProfile.Image = Properties.ImageID; UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL); - Userprofile.Flags &= ~3; - Userprofile.Flags |= Properties.AllowPublish ? 1 : 0; - Userprofile.Flags |= Properties.MaturePublish ? 2 : 0; + UserProfile.Flags &= ~3; + UserProfile.Flags |= Properties.AllowPublish ? 1 : 0; + UserProfile.Flags |= Properties.MaturePublish ? 2 : 0; handlerUpdateAvatarProperties(this, UserProfile); } -- cgit v1.1 From 045a44b1afb8a72da922eaea7b4d0ca1833bc9dd Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 16:07:13 +0000 Subject: One should not copy/paste so much :) --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8a5f209..ba81d05 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4840,9 +4840,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP UserProfile.FirstLifeImage = Properties.FLImageID; UserProfile.Image = Properties.ImageID; UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL); - UserProfile.Flags &= ~3; - UserProfile.Flags |= Properties.AllowPublish ? 1 : 0; - UserProfile.Flags |= Properties.MaturePublish ? 2 : 0; + UserProfile.UserFlags &= ~3; + UserProfile.UserFlags |= Properties.AllowPublish ? 1 : 0; + UserProfile.UserFlags |= Properties.MaturePublish ? 2 : 0; handlerUpdateAvatarProperties(this, UserProfile); } -- cgit v1.1 From a2aadb78a919323d62a5b4a44c0899b63641788b Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Fri, 8 Jan 2010 23:12:11 -0500 Subject: Maintain control() event stream --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index afd5f86..0eed284 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4792,6 +4792,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP (x.CameraLeftAxis != lastarg.CameraLeftAxis) || (x.CameraUpAxis != lastarg.CameraUpAxis) || (x.ControlFlags != lastarg.ControlFlags) || + (x.ControlFlags != 0) || (x.Far != lastarg.Far) || (x.Flags != lastarg.Flags) || (x.State != lastarg.State) || -- cgit v1.1 From 862caa72a80b597ccbf1ae82300af89f9103dbf9 Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 27 Jan 2010 21:08:55 -0600 Subject: Fixes terrain editing. Changes ThrottleOutPacketType to task instead of land. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 33210d7..64e45d0 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1098,7 +1098,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); layerpack.Header.Reliable = true; - OutPacket(layerpack, ThrottleOutPacketType.Land); + OutPacket(layerpack, ThrottleOutPacketType.Task); } catch (Exception e) { -- cgit v1.1 From 9e37d246240db077fe7a4e1389f5220d72d6542c Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jan 2010 11:47:45 +0000 Subject: Prevent empty ObjectProperties packets being sent --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 64e45d0..1496f5c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3885,6 +3885,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_propertiesPacketTimer.Stop(); + if (m_propertiesBlocks.Count == 0) + return; + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; int index = 0; -- cgit v1.1 From fce9e499e4682edf6db7b4f9c5546524b4a25197 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Mar 2010 01:19:45 -0600 Subject: - parcel blocking, region crossing blocking, teleport blocking --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2c8d88b..ea73abb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -127,6 +127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ObjectDeselect OnObjectDetach; public event ObjectDrop OnObjectDrop; public event GenericCall1 OnCompleteMovementToRegion; + public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; public event AgentSit OnAgentSit; @@ -4880,7 +4881,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP UpdateAgent handlerAgentUpdate = OnAgentUpdate; lastarg = arg; // save this set of arguments for nexttime if (handlerAgentUpdate != null) + { + OnPreAgentUpdate(this, arg); OnAgentUpdate(this, arg); + } handlerAgentUpdate = null; } -- cgit v1.1 From 309f440fc04cc965e31232947bed698864308356 Mon Sep 17 00:00:00 2001 From: Thomas Grimshaw Date: Wed, 7 Apr 2010 10:13:47 +0200 Subject: Fix llDialog responses so that they can be heard throughout the region. This now conforms to the behaviour in SL. ( http://bugs.meta7.com/view.php?id=13 ) --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ebcdd62..b0e3655 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5200,7 +5200,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP args.Channel = ch; args.From = String.Empty; args.Message = Utils.BytesToString(msg); - args.Type = ChatTypeEnum.Shout; + args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance args.Position = new Vector3(); args.Scene = Scene; args.Sender = this; -- cgit v1.1 From 0f3314c04ccd07e0ff9b5be69903b0a72dd73115 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 8 Apr 2010 15:00:01 -0700 Subject: Backported GetTextureModule and IAssetService.GetCached() --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2ca2657..8b81377 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11228,9 +11228,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_groupPowers.Clear(); - for (int i = 0; i < GroupMembership.Length; i++) + if (GroupMembership != null) { - m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers; + for (int i = 0; i < GroupMembership.Length; i++) + { + m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers; + } } } } -- cgit v1.1 From 04845c1898fee6a8b8563a8103b73cbe38525416 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 30 Apr 2010 11:46:50 +0100 Subject: Fix link security issue --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8b81377..2ab713d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -6084,7 +6084,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP DelinkObjects handlerDelinkObjects = OnDelinkObjects; if (handlerDelinkObjects != null) { - handlerDelinkObjects(prims); + handlerDelinkObjects(prims, this); } return true; -- cgit v1.1 From 40e05f41098bdedac7296d84c9aa8d915c5c9ede Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 11 May 2010 09:28:46 -0700 Subject: Spin the AddNewClient process off into a new thread to avoid locking up the LLUDPServer (and therefore the entire scene) --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 41e41e4..d9aecd8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -909,7 +909,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.OnLogout += LogoutHandler; // Start the IClientAPI - client.Start(); + // Spin it off so that it doesn't clog up the LLUDPServer + Util.FireAndForget(delegate(object o) { client.Start(); }); } else { -- cgit v1.1 From 8f838c722da978da646fcef59a5af767840832bb Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 17 May 2010 14:14:19 -0700 Subject: When killing a zombie session, don't send the stop packet since it often has the effect of killing a newly connected client. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d5fda9d..5670a78 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -502,18 +502,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Client Methods + /// /// Shut down the client view /// public void Close() { + Close(true); + } + + /// + /// Shut down the client view + /// + public void Close(bool sendStop) + { m_log.DebugFormat( "[CLIENT]: Close has been called for {0} attached to scene {1}", Name, m_scene.RegionInfo.RegionName); - // Send the STOP packet - DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); - OutPacket(disable, ThrottleOutPacketType.Unknown); + if (sendStop) + { + // Send the STOP packet + DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); + OutPacket(disable, ThrottleOutPacketType.Unknown); + } IsActive = false; -- cgit v1.1 From c25c40a3f913f623cbcb3c7dcea0cdbf65f3c2c2 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 17 May 2010 15:24:28 -0700 Subject: Following on from the last commit, the stop/disconnect packet should NOT be sent when the user logs out. This eliminates the annoying "crash on log out" bug, and allows the client to commit important information at the last moment (attachment data!) --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index d9aecd8..d708055 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -926,7 +926,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_scene.TryGetClient(udpClient.AgentID, out client)) { client.IsLoggingOut = true; - client.Close(); + client.Close(false); } } -- cgit v1.1 From 91b1d17e5bd3ff6ed006744bc529b53a67af1a64 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 01:09:47 -0700 Subject: Fix for hanging on "Connecting to region".. caused by packets being processed before the presence has bound to receive events. Fixed this by adding packets to a queue and then processing them when the presence is ready. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5670a78..df6a767 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -376,6 +376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private AgentUpdateArgs lastarg; private bool m_IsActive = true; private bool m_IsLoggingOut = false; + private bool m_IsPresenceReady = false; protected Dictionary m_packetHandlers = new Dictionary(); protected Dictionary m_genericPacketHandlers = new Dictionary(); //PauPaw:Local Generic Message handlers @@ -399,6 +400,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Timer m_propertiesPacketTimer; private List m_propertiesBlocks = new List(); + private List m_pendingPackets; #endregion Class Members @@ -439,6 +441,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_IsActive; } set { m_IsActive = value; } } + public bool IsLoggingOut { get { return m_IsLoggingOut; } @@ -11196,18 +11199,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// + /// This processes packets which have accumulated while the presence was still in the process of initialising. + /// + public void ProcessPendingPackets() + { + m_IsPresenceReady = true; + foreach (Packet p in m_pendingPackets) + { + ProcessInPacket(p); + } + m_pendingPackets.Clear(); + } + + /// /// Entryway from the client to the simulator. All UDP packets from the client will end up here /// /// OpenMetaverse.packet public void ProcessInPacket(Packet Pack) { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); + if (!m_IsPresenceReady) + { + if (m_pendingPackets == null) + { + m_pendingPackets = new List(); + } + m_pendingPackets.Add(Pack); + } + else + { + if (m_debugPacketLevel >= 255) + m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); - if (!ProcessPacketMethod(Pack)) - m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); + if (!ProcessPacketMethod(Pack)) + m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); - PacketPool.Instance.ReturnPacket(Pack); + PacketPool.Instance.ReturnPacket(Pack); + } } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) -- cgit v1.1 From ed1cfb52454410e5d03b11966fdff54d9950a28c Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 02:33:41 -0700 Subject: Missed a nullref in the previous commit --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index df6a767..5b1aa86 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11204,6 +11204,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ProcessPendingPackets() { m_IsPresenceReady = true; + if (m_pendingPackets == null) + return; foreach (Packet p in m_pendingPackets) { ProcessInPacket(p); -- cgit v1.1 From af5eeab7cf86ec5b8a90aa435d7068ef954dc504 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 21 May 2010 07:37:55 +0200 Subject: Ensure that the first update sent out for any given prim is a full update --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e29ae2a..cddc7b2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -325,6 +325,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_cachedTextureSerial; private PriorityQueue m_entityUpdates; + private Dictionary m_seenPrims = new Dictionary(); /// /// List used in construction of data blocks for an object update packet. This is to stop us having to @@ -3495,7 +3496,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Compressed object updates only make sense for LL primitives if (!(update.Entity is SceneObjectPart)) + { canUseCompressed = false; + } + else + { + if (!m_seenPrims.ContainsKey(((SceneObjectPart)update.Entity).LocalId)) + { + updateFlags = PrimUpdateFlags.FullUpdate; + m_seenPrims[((SceneObjectPart)update.Entity).LocalId] = true; + } + } if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) { -- cgit v1.1 From f90d81a864c8ae1cf8125839bc883dc0ace7f214 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 26 May 2010 19:26:30 +0200 Subject: Just because there is an agent update handler, that doesn't mean there is a pre agent update handler. Null check these separately. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 173c9e5..51cc763 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4922,14 +4922,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP arg.SessionID = x.SessionID; arg.State = x.State; UpdateAgent handlerAgentUpdate = OnAgentUpdate; + UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; lastarg = arg; // save this set of arguments for nexttime - if (handlerAgentUpdate != null) - { + if (handlerPreAgentUpdate != null) OnPreAgentUpdate(this, arg); + if (handlerAgentUpdate != null) OnAgentUpdate(this, arg); - } handlerAgentUpdate = null; + handlerPreAgentUpdate = null; } } -- cgit v1.1 From 7d6680b38a1220d6709cb189c0a2c430731f58cf Mon Sep 17 00:00:00 2001 From: Mike Rieker Date: Thu, 27 May 2010 21:28:47 -0400 Subject: fix hanging output throttle arithmetic had multiply overflow and subtract wrap-around errors --- .../Region/ClientStack/LindenUDP/TokenBucket.cs | 66 +++++++++------------- 1 file changed, 27 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs index bdbd284..91e3d20 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs @@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP this.parent = parent; MaxBurst = maxBurst; DripRate = dripRate; - lastDrip = Environment.TickCount & Int32.MaxValue; + lastDrip = Environment.TickCount; } /// @@ -144,40 +144,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// the bucket, otherwise false public bool RemoveTokens(int amount) { - bool dummy; - return RemoveTokens(amount, out dummy); - } - - /// - /// Remove a given number of tokens from the bucket - /// - /// Number of tokens to remove from the bucket - /// True if tokens were added to the bucket - /// during this call, otherwise false - /// True if the requested number of tokens were removed from - /// the bucket, otherwise false - public bool RemoveTokens(int amount, out bool dripSucceeded) - { if (maxBurst == 0) { - dripSucceeded = true; return true; } - dripSucceeded = Drip(); - - if (content - amount >= 0) + if (amount > maxBurst) { - if (parent != null && !parent.RemoveTokens(amount)) - return false; + throw new Exception("amount " + amount + " exceeds maxBurst " + maxBurst); + } - content -= amount; - return true; + Drip(); + + if (content < amount) + { + return false; } - else + + if (parent != null && !parent.RemoveTokens(amount)) { return false; } + + content -= amount; + return true; } /// @@ -193,25 +183,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP content = maxBurst; return true; } - else - { - int now = Environment.TickCount & Int32.MaxValue; - int deltaMS = now - lastDrip; - if (deltaMS <= 0) - { - if (deltaMS < 0) - lastDrip = now; - return false; - } + int now = Environment.TickCount; + int deltaMS = now - lastDrip; + lastDrip = now; - int dripAmount = deltaMS * tokensPerMS; - - content = Math.Min(content + dripAmount, maxBurst); - lastDrip = now; + if (deltaMS <= 0) + { + return false; + } - return true; + long dripAmount = (long)deltaMS * (long)tokensPerMS + (long)content; + if (dripAmount > maxBurst) + { + dripAmount = maxBurst; } + content = (int)dripAmount; + return true; } } } -- cgit v1.1 From d4b4cbf5a5fead727b5e2e48f69d2016eb942cff Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 31 May 2010 19:00:02 +0200 Subject: Fix create selection getting overwritten by multiple updates for the same prim. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 51cc763..fe8475a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4561,11 +4561,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (recipientID == data.OwnerID) { - if ((data.Flags & PrimFlags.CreateSelected) != 0) + if (data.CreateSelected) { // Only send this flag once, then unset it flags |= PrimFlags.CreateSelected; - data.Flags &= ~PrimFlags.CreateSelected; + data.CreateSelected = false; } } -- cgit v1.1 From 293f775fa56c8bcb3986373e004f54e549168be6 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Wed, 2 Jun 2010 07:59:18 -0700 Subject: Always provide at least 2 packets of a texture (if the texture is larger than 1 packet). This fixes compatibility with the newer (broken) SnowGlobe and Emerald viewer(s), but also matches the behaviour of SL. --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 9869a99..5c17b0e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -202,6 +202,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_stopPacket = TexturePacketCount(); } + //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way) + if (m_stopPacket == 1 && Layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++; + m_currentPacket = StartPacket; } } -- cgit v1.1 From d570cffa39e9ca6417ebd1c05cbdfea1d3beabd2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 28 Jun 2010 01:29:30 +0200 Subject: Fix Copy on Ray, Drag Copy and other little things. Removed the wrong and nonworking ownership assignment in SOG, which messed things up before. No longer trust the client to send the ID of the person something is copied as, since it allows to run a script with someone else's permissions. Properly adjust inventory ownership and perms. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f071841..cf1dda9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -6307,8 +6307,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerObjectDuplicate != null) { handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, - dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, - AgentandGroupData.GroupID); + dupe.SharedData.DuplicateFlags, AgentId, + m_activeGroupID); } } @@ -6898,7 +6898,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerObjectDuplicateOnRay != null) { handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, - dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, + AgentId, m_activeGroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); } -- cgit v1.1 From 827d9be48f8177b5975df68208a8cf7c730b58f0 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sun, 27 Jun 2010 22:23:01 -0700 Subject: Fix the sound issue. It was caused by missing assets; once the client has made one request, it continued to wait for asset before requesting any new ones, until the TransferRequest timed out. Fixed by adding a TransferAbortPacket if the asset cannot be retrieved. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f071841..5b5dc1e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2208,6 +2208,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(sound, ThrottleOutPacketType.Task); } + public void SendTransferAbort(TransferRequestPacket transferRequest) + { + TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); + abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; + abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; + m_log.Debug("[Assets] Aborting transfer; asset request failed"); + OutPacket(abort, ThrottleOutPacketType.Task); + } + public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) { SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); @@ -11502,7 +11511,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); - m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); + if (!m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived)) + { + //We need to send a TransferAbort here, so the client doesn't wait forever for the asset, + //which causes it to not request any more for a while. Which is bad. + SendTransferAbort(transferRequest); + } } /// -- cgit v1.1 From 233c872d24c8cc9d0b883ff8f816f67e57638042 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 2 Jul 2010 09:40:58 +0200 Subject: Call client.Start() sunchronously. Calling thos async avoids some stuttering when people log in, but fatally screws up money. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index cda461c..f2bcc0b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -900,7 +900,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Start the IClientAPI // Spin it off so that it doesn't clog up the LLUDPServer - Util.FireAndForget(delegate(object o) { client.Start(); }); + //Util.FireAndForget(delegate(object o) { client.Start(); }); + + // NOTE: DO NOT CALL THIS ASYNCHRONOUSLY!!!!! + // This method will ultimately cause the modules to hook + // client events in OnNewClient. If they can't do this + // before further packets are processed, packets WILL BE LOST. + // This includes the all-important EconomyDataRequest! + // So using FireAndForget here WILL screw up money. Badly. + // You have been warned! + client.Start(); } else { -- cgit v1.1 From 4cd5e642319b31e1da838ca6fda97ae2992b2c79 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 3 Jul 2010 09:22:58 -0700 Subject: Use SendTransferAbort in a more sensible place --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 14b716b..4dfd5d1 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11511,12 +11511,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); - if (!m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived)) - { - //We need to send a TransferAbort here, so the client doesn't wait forever for the asset, - //which causes it to not request any more for a while. Which is bad. - SendTransferAbort(transferRequest); - } + + //Note, the bool returned from the below function is useless since it is always false. + m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); + } /// @@ -11565,8 +11563,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); - - // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. + + //We need to send a TransferAbort here, so the client doesn't wait forever for the asset, + //which causes it to not request any more for a while. Which is bad. + SendTransferAbort(transferRequest); return; } -- cgit v1.1 From 05b35eb57ce7cc9fa068f34b5798a6c7c3fc09a8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 8 Jul 2010 18:17:02 +0100 Subject: Correct a merge artefact --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 27 ---------------------- 1 file changed, 27 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 9f29420..ecfc68f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11496,33 +11496,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_log.Debug("asset request " + requestID); } - if (null == asset) - { - if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000)) - { - // Try the user's inventory, but only if it's different from the regions' - string userAssets = m_hyperAssets.GetUserAssetServer(AgentId); - if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) - { - m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); - if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) - transferRequest.TransferInfo.SourceType = 2222; // marker - else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) - transferRequest.TransferInfo.SourceType = 3333; // marker - - m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); - return; - } - } - - //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); - - //We need to send a TransferAbort here, so the client doesn't wait forever for the asset, - //which causes it to not request any more for a while. Which is bad. - SendTransferAbort(transferRequest); - return; - } - // Scripts cannot be retrieved by direct request if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10) return; -- cgit v1.1 From 0c445239a68688311d6fa7405ef13ceb3e773930 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 19:21:01 +0200 Subject: Remove useless quaternion parameter from AttachObject sig --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ecfc68f..82b9958 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5744,7 +5744,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (att.ObjectData.Length > 0) { - handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false); + handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, false); } } } -- cgit v1.1 From bebbe407ee166a0aa22f0ec8d14ada780924f9af Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 19:58:23 +0200 Subject: Major attachments cleanup. Remove unused AttachObject ClientView method Clean up use of AttachObject throughout, reduce number of overloads and number of parameters --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 24 ---------------------- 1 file changed, 24 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 82b9958..754127d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3687,30 +3687,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Primitive Packet/Data Sending Methods - /// - /// - /// - /// - /// - /// - public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) - { - if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD - return; - - ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); - // TODO: don't create new blocks if recycling an old packet - attach.AgentData.AgentID = AgentId; - attach.AgentData.SessionID = m_sessionId; - attach.AgentData.AttachmentPoint = attachPoint; - attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; - attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); - attach.ObjectData[0].ObjectLocalID = localID; - attach.ObjectData[0].Rotation = rotation; - attach.Header.Zerocoded = true; - OutPacket(attach, ThrottleOutPacketType.Task); - } - void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) { if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) -- cgit v1.1 From 17412389f3cbc4a98c3fb11963ebec821fcd5e11 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 17 Jul 2010 14:34:35 -0700 Subject: Revert 233c872.. "* Call client.Start() sunchronously. Calling thos async avoids some stuttering", pending fix for the core issue --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index f2bcc0b..cda461c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -900,16 +900,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Start the IClientAPI // Spin it off so that it doesn't clog up the LLUDPServer - //Util.FireAndForget(delegate(object o) { client.Start(); }); - - // NOTE: DO NOT CALL THIS ASYNCHRONOUSLY!!!!! - // This method will ultimately cause the modules to hook - // client events in OnNewClient. If they can't do this - // before further packets are processed, packets WILL BE LOST. - // This includes the all-important EconomyDataRequest! - // So using FireAndForget here WILL screw up money. Badly. - // You have been warned! - client.Start(); + Util.FireAndForget(delegate(object o) { client.Start(); }); } else { -- cgit v1.1 From fabe2206db37be39a90254da8a7fff973f2dd977 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 17 Jul 2010 15:08:59 -0700 Subject: Ensure that packets do NOT get delivered to a client before the modules that can deal with the client's response have finished loading. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 9 +++++++++ .../Region/ClientStack/LindenUDP/LLUDPClient.cs | 10 ++++++++++ .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 23 +++++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 754127d..a9f9d60 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -334,6 +334,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // protected HashSet m_attachmentsSent; private int m_moneyBalance; + private bool m_deliverPackets = true; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; private AgentUpdateArgs lastarg; @@ -378,6 +379,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_startpos; } set { m_startpos = value; } } + public bool DeliverPackets + { + get { return m_deliverPackets; } + set { + m_deliverPackets = value; + m_udpClient.m_deliverPackets = value; + } + } public UUID AgentId { get { return m_agentId; } } public UUID ActiveGroupId { get { return m_activeGroupID; } } public string ActiveGroupName { get { return m_activeGroupName; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 6232c48..eebbfa5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -149,6 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_defaultRTO = 3000; private int m_maxRTO = 60000; + public bool m_deliverPackets = true; /// /// Default constructor @@ -389,6 +390,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (category >= 0 && category < m_packetOutboxes.Length) { OpenSim.Framework.LocklessQueue queue = m_packetOutboxes[category]; + + if (m_deliverPackets == false) + { + queue.Enqueue(packet); + return true; + } + TokenBucket bucket = m_throttleCategories[category]; if (bucket.RemoveTokens(packet.Buffer.DataLength)) @@ -419,6 +427,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// True if any packets were sent, otherwise false public bool DequeueOutgoing() { + if (m_deliverPackets == false) return false; + OutgoingPacket packet; OpenSim.Framework.LocklessQueue queue; TokenBucket bucket; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index cda461c..3b63bcd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -900,7 +900,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Start the IClientAPI // Spin it off so that it doesn't clog up the LLUDPServer - Util.FireAndForget(delegate(object o) { client.Start(); }); + + //First, and very importantly: + // + //Set our DeliverPackets flag in the client to *false* + //this will prevent us from missing important messages + //before the modules are bound + client.DeliverPackets = false; + + Util.FireAndForget( + delegate + { + try + { + client.Start(); + } + finally + { + //Now, release the hounds. er, packets. + client.DeliverPackets = true; + } + } + ); } else { -- cgit v1.1 From 4a3321077163f4e93ac67609428c0e6fa4d31b9e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 4 Aug 2010 18:12:31 +0200 Subject: Send attachment updates only to the owner if it's a HUD --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a9f9d60..4ab719d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3485,6 +3485,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { + if (entity is SceneObjectPart) + { + SceneObjectPart e = (SceneObjectPart)entity; + SceneObjectGroup g = e.ParentGroup; + if (g.RootPart.Shape.State > 30) // HUD + if (g.OwnerID != AgentId) + return; // Don't send updates for other people's HUDs + } + double priority = m_prioritizer.GetUpdatePriority(this, entity); lock (m_entityUpdates.SyncRoot) -- cgit v1.1 From 8bdbcda2b70ede033c38a604af573554dd2776ad Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 5 Aug 2010 18:50:17 +0200 Subject: We already have a record of killed prims. It just wasn't used by the new JHurlicane code anymore. Use it to prevent sending updates after kills. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4ab719d..0b8b95b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3514,6 +3514,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP EntityUpdate update; while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) { + // If we have sent a kill packet for this object + // drop any updates on the floor + if (update.Entity is SceneObjectPart) + { + SceneObjectPart part = (SceneObjectPart)update.Entity; + if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + continue; + } + ++updatesThisCall; #region UpdateFlags to packet type conversion -- cgit v1.1 From 330343505ca2d6d109e89b4767f4351ab9bec91d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Aug 2010 11:39:10 -0700 Subject: Implement CreateNewOutfitAttachments. This addresses mantis #199. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0b8b95b..cd7c11b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -154,6 +154,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event RequestTaskInventory OnRequestTaskInventory; public event UpdateInventoryItem OnUpdateInventoryItem; public event CopyInventoryItem OnCopyInventoryItem; + public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; public event MoveInventoryItem OnMoveInventoryItem; public event RemoveInventoryItem OnRemoveInventoryItem; public event RemoveInventoryFolder OnRemoveInventoryFolder; @@ -4840,6 +4841,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); + AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); @@ -9349,6 +9351,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP { return true; } + + private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) + { + CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (packet.AgentData.SessionID != SessionId || + packet.AgentData.AgentID != AgentId) + return true; + } + #endregion + MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; + List items = new List(); + foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) + { + InventoryItemBase b = new InventoryItemBase(); + b.ID = n.OldItemID; + b.Folder = n.OldFolderID; + items.Add(b); + } + + handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; + if (handlerMoveItemsAndLeaveCopy != null) + { + handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); + } + + return true; + } private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) { -- cgit v1.1 From c554de75010a442753cce29ee06d2b60d7b4701a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 7 Aug 2010 05:45:52 +0200 Subject: Correct display of landmark about info. Also correct region maturity rating in LM info. Maturity is NOT the parcel's setting, that is only for the image and text. Parcel maturity is governed by region maturity. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d2d1e8f..af2dd85 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2675,7 +2675,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Bit 0: Mature, bit 7: on sale, other bits: no idea reply.Data.Flags = (byte)( - ((land.Flags & (uint)ParcelFlags.MaturePublish) != 0 ? (1 << 0) : 0) + + (info.AccessLevel > 13 ? (1 << 0) : 0) + ((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0)); Vector3 pos = land.UserLocation; @@ -2683,8 +2683,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { pos = (land.AABBMax + land.AABBMin) * 0.5f; } - reply.Data.GlobalX = info.RegionLocX * Constants.RegionSize + x; - reply.Data.GlobalY = info.RegionLocY * Constants.RegionSize + y; + reply.Data.GlobalX = info.RegionLocX + x; + reply.Data.GlobalY = info.RegionLocY + y; reply.Data.GlobalZ = pos.Z; reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SnapshotID = land.SnapshotID; -- cgit v1.1 From b017d985ab05044bf196f108516e6b0185c172f5 Mon Sep 17 00:00:00 2001 From: meta7 Date: Sat, 7 Aug 2010 08:06:41 -0700 Subject: Add some nullref checks to the UnackedPacketCollection. --- .../LindenUDP/UnackedPacketCollection.cs | 353 +++++++++++---------- 1 file changed, 184 insertions(+), 169 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index e43f7cf..c120a12 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -1,169 +1,184 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using OpenMetaverse; - -namespace OpenSim.Region.ClientStack.LindenUDP -{ - /// - /// Special collection that is optimized for tracking unacknowledged packets - /// - public sealed class UnackedPacketCollection - { - /// - /// Holds information about a pending acknowledgement - /// - private struct PendingAck - { - /// Sequence number of the packet to remove - public uint SequenceNumber; - /// Environment.TickCount value when the remove was queued. - /// This is used to update round-trip times for packets - public int RemoveTime; - /// Whether or not this acknowledgement was attached to a - /// resent packet. If so, round-trip time will not be calculated - public bool FromResend; - - public PendingAck(uint sequenceNumber, int currentTime, bool fromResend) - { - SequenceNumber = sequenceNumber; - RemoveTime = currentTime; - FromResend = fromResend; - } - } - - /// Holds the actual unacked packet data, sorted by sequence number - private Dictionary m_packets = new Dictionary(); - /// Holds packets that need to be added to the unacknowledged list - private LocklessQueue m_pendingAdds = new LocklessQueue(); - /// Holds information about pending acknowledgements - private LocklessQueue m_pendingRemoves = new LocklessQueue(); - - /// - /// Add an unacked packet to the collection - /// - /// Packet that is awaiting acknowledgement - /// True if the packet was successfully added, false if the - /// packet already existed in the collection - /// This does not immediately add the ACK to the collection, - /// it only queues it so it can be added in a thread-safe way later - public void Add(OutgoingPacket packet) - { - m_pendingAdds.Enqueue(packet); - } - - /// - /// Marks a packet as acknowledged - /// - /// Sequence number of the packet to - /// acknowledge - /// Current value of Environment.TickCount - /// This does not immediately acknowledge the packet, it only - /// queues the ack so it can be handled in a thread-safe way later - public void Remove(uint sequenceNumber, int currentTime, bool fromResend) - { - m_pendingRemoves.Enqueue(new PendingAck(sequenceNumber, currentTime, fromResend)); - } - - /// - /// Returns a list of all of the packets with a TickCount older than - /// the specified timeout - /// - /// Number of ticks (milliseconds) before a - /// packet is considered expired - /// A list of all expired packets according to the given - /// expiration timeout - /// This function is not thread safe, and cannot be called - /// multiple times concurrently - public List GetExpiredPackets(int timeoutMS) - { - ProcessQueues(); - - List expiredPackets = null; - - if (m_packets.Count > 0) - { - int now = Environment.TickCount & Int32.MaxValue; - - foreach (OutgoingPacket packet in m_packets.Values) - { - // TickCount of zero means a packet is in the resend queue - // but hasn't actually been sent over the wire yet - if (packet.TickCount == 0) - continue; - - if (now - packet.TickCount >= timeoutMS) - { - if (expiredPackets == null) - expiredPackets = new List(); - - // The TickCount will be set to the current time when the packet - // is actually sent out again - packet.TickCount = 0; - - expiredPackets.Add(packet); - } - } - } - - return expiredPackets; - } - - private void ProcessQueues() - { - // Process all the pending adds - OutgoingPacket pendingAdd; - while (m_pendingAdds.Dequeue(out pendingAdd)) - m_packets[pendingAdd.SequenceNumber] = pendingAdd; - - // Process all the pending removes, including updating statistics and round-trip times - PendingAck pendingRemove; - OutgoingPacket ackedPacket; - while (m_pendingRemoves.Dequeue(out pendingRemove)) - { - if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) - { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) - { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); - } - } - } - } - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Net; +using OpenMetaverse; + +namespace OpenSim.Region.ClientStack.LindenUDP +{ + /// + /// Special collection that is optimized for tracking unacknowledged packets + /// + public sealed class UnackedPacketCollection + { + /// + /// Holds information about a pending acknowledgement + /// + private struct PendingAck + { + /// Sequence number of the packet to remove + public uint SequenceNumber; + /// Environment.TickCount value when the remove was queued. + /// This is used to update round-trip times for packets + public int RemoveTime; + /// Whether or not this acknowledgement was attached to a + /// resent packet. If so, round-trip time will not be calculated + public bool FromResend; + + public PendingAck(uint sequenceNumber, int currentTime, bool fromResend) + { + SequenceNumber = sequenceNumber; + RemoveTime = currentTime; + FromResend = fromResend; + } + } + + /// Holds the actual unacked packet data, sorted by sequence number + private Dictionary m_packets = new Dictionary(); + /// Holds packets that need to be added to the unacknowledged list + private LocklessQueue m_pendingAdds = new LocklessQueue(); + /// Holds information about pending acknowledgements + private LocklessQueue m_pendingRemoves = new LocklessQueue(); + + /// + /// Add an unacked packet to the collection + /// + /// Packet that is awaiting acknowledgement + /// True if the packet was successfully added, false if the + /// packet already existed in the collection + /// This does not immediately add the ACK to the collection, + /// it only queues it so it can be added in a thread-safe way later + public void Add(OutgoingPacket packet) + { + m_pendingAdds.Enqueue(packet); + } + + /// + /// Marks a packet as acknowledged + /// + /// Sequence number of the packet to + /// acknowledge + /// Current value of Environment.TickCount + /// This does not immediately acknowledge the packet, it only + /// queues the ack so it can be handled in a thread-safe way later + public void Remove(uint sequenceNumber, int currentTime, bool fromResend) + { + m_pendingRemoves.Enqueue(new PendingAck(sequenceNumber, currentTime, fromResend)); + } + + /// + /// Returns a list of all of the packets with a TickCount older than + /// the specified timeout + /// + /// Number of ticks (milliseconds) before a + /// packet is considered expired + /// A list of all expired packets according to the given + /// expiration timeout + /// This function is not thread safe, and cannot be called + /// multiple times concurrently + public List GetExpiredPackets(int timeoutMS) + { + ProcessQueues(); + + List expiredPackets = null; + + if (m_packets.Count > 0) + { + int now = Environment.TickCount & Int32.MaxValue; + + foreach (OutgoingPacket packet in m_packets.Values) + { + // TickCount of zero means a packet is in the resend queue + // but hasn't actually been sent over the wire yet + if (packet.TickCount == 0) + continue; + + if (now - packet.TickCount >= timeoutMS) + { + if (expiredPackets == null) + expiredPackets = new List(); + + // The TickCount will be set to the current time when the packet + // is actually sent out again + packet.TickCount = 0; + + expiredPackets.Add(packet); + } + } + } + + return expiredPackets; + } + + private void ProcessQueues() + { + // Process all the pending adds + + OutgoingPacket pendingAdd; + if (m_pendingAdds != null) + { + while (m_pendingAdds.Dequeue(out pendingAdd)) + { + if (pendingAdd != null && m_packets != null) + { + m_packets[pendingAdd.SequenceNumber] = pendingAdd; + } + } + } + + // Process all the pending removes, including updating statistics and round-trip times + PendingAck pendingRemove; + OutgoingPacket ackedPacket; + if (m_pendingRemoves != null) + { + while (m_pendingRemoves.Dequeue(out pendingRemove)) + { + if (m_pendingRemoves != null && m_packets != null) + { + if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + { + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) + { + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); + } + } + } + } + } + } + } +} -- cgit v1.1 From 50ac61e17f4e164931dc26f01ffbe58dced9e772 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 8 Aug 2010 02:01:24 +0200 Subject: In my crusade against facelights, I am striking the killing blow. Add a DisableFacelights option to OpenSim.ini to finally kill those immersion- breaking, silly vanity lights that destroy nighttime RP. Girls, you look just fine without them. Guys, you too. Thank you. Melanie has left the building. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 16 ++++++++++++++++ OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 4 ++++ 2 files changed, 20 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index af2dd85..a0e5521 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -315,6 +315,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_cachedTextureSerial; private PriorityQueue m_entityUpdates; private Prioritizer m_prioritizer; + private bool m_disableFacelights = false; /// /// List used in construction of data blocks for an object update packet. This is to stop us having to @@ -420,6 +421,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_IsLoggingOut = value; } } + public bool DisableFacelights + { + get { return m_disableFacelights; } + set { m_disableFacelights = value; } + } + public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } #endregion Properties @@ -3522,6 +3529,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP SceneObjectPart part = (SceneObjectPart)update.Entity; if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) continue; + + if (part.ParentGroup.IsAttachment && m_disableFacelights) + { + if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && + part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) + { + part.Shape.LightEntry = false; + } + } } ++updatesThisCall; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 3b63bcd..bbbf0be 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_defaultRTO = 0; private int m_maxRTO = 0; + private bool m_disableFacelights = false; + public Socket Server { get { return null; } } public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) @@ -190,6 +192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_defaultRTO = config.GetInt("DefaultRTO", 0); m_maxRTO = config.GetInt("MaxRTO", 0); + m_disableFacelights = config.GetBoolean("DisableFacelights", false); } else { @@ -907,6 +910,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //this will prevent us from missing important messages //before the modules are bound client.DeliverPackets = false; + client.DisableFacelights = m_disableFacelights; Util.FireAndForget( delegate -- cgit v1.1 From a5a60df6879acfb5efc1f1f4a8c2cb257a4ef89d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 11 Aug 2010 02:52:52 +0200 Subject: Change chat packets to bypass the throttles. This should alleviate chat lag --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 800de8a..48465d9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -787,7 +787,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.ChatData.OwnerID = fromAgentID; reply.ChatData.SourceID = fromAgentID; - OutPacket(reply, ThrottleOutPacketType.Task); + OutPacket(reply, ThrottleOutPacketType.Unknown); } /// -- cgit v1.1 From 8613336674141c223eee464575f1df239056c338 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 21 Aug 2010 17:48:49 +0200 Subject: Don't allow oversized search reply packets --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 59 +++++++++++++++------- 1 file changed, 42 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d41df3d..fa72410 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2734,32 +2734,57 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1]; packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock(); - packet.QueryReplies = - new DirPlacesReplyPacket.QueryRepliesBlock[data.Length]; - - packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[ - data.Length]; - packet.AgentData.AgentID = AgentId; packet.QueryData[0].QueryID = queryID; + DirPlacesReplyPacket.QueryRepliesBlock[] replies = + new DirPlacesReplyPacket.QueryRepliesBlock[0]; + DirPlacesReplyPacket.StatusDataBlock[] status = + new DirPlacesReplyPacket.StatusDataBlock[0]; + int i = 0; foreach (DirPlacesReplyData d in data) { - packet.QueryReplies[i] = - new DirPlacesReplyPacket.QueryRepliesBlock(); - packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock(); - packet.QueryReplies[i].ParcelID = d.parcelID; - packet.QueryReplies[i].Name = Utils.StringToBytes(d.name); - packet.QueryReplies[i].ForSale = d.forSale; - packet.QueryReplies[i].Auction = d.auction; - packet.QueryReplies[i].Dwell = d.dwell; - packet.StatusData[i].Status = d.Status; - i++; + int idx = replies.Length; + Array.Resize(ref replies, idx + 1); + Array.Resize(ref status, idx + 1); + + replies[idx] = new DirPlacesReplyPacket.QueryRepliesBlock(); + status[idx] = new DirPlacesReplyPacket.StatusDataBlock(); + replies[idx].ParcelID = d.parcelID; + replies[idx].Name = Utils.StringToBytes(d.name); + replies[idx].ForSale = d.forSale; + replies[idx].Auction = d.auction; + replies[idx].Dwell = d.dwell; + status[idx].Status = d.Status; + + packet.QueryReplies = replies; + packet.StatusData = status; + + if (packet.Length >= 1000) + { + OutPacket(packet, ThrottleOutPacketType.Task); + + packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply); + + packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock(); + + packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1]; + packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock(); + + packet.AgentData.AgentID = AgentId; + + packet.QueryData[0].QueryID = queryID; + + replies = new DirPlacesReplyPacket.QueryRepliesBlock[0]; + status = new DirPlacesReplyPacket.StatusDataBlock[0]; + + } } - OutPacket(packet, ThrottleOutPacketType.Task); + if (replies.Length > 0) + OutPacket(packet, ThrottleOutPacketType.Task); } public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data) -- cgit v1.1 From 713c6668273ebd853db7f3f69185c9b4f119f702 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 19:49:42 +0200 Subject: Show when appearance is sent to an avatar to help track down failure \to display avatars --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 105501f..aa7de05 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3427,6 +3427,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; + m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.Task); } -- cgit v1.1 From e5936071711e35f9edf44d8393b8ad28ef4023db Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 5 Sep 2010 14:16:42 +0200 Subject: Remove "Dwell" support from core and replace it with calls to methods on IDwellModule --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a1cd30a..3dea40c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2687,6 +2687,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) { + float dwell = 0.0f; + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + if (dwellModule != null) + dwell = dwellModule.GetDwell(land.GlobalID); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); reply.AgentData.AgentID = m_agentId; reply.Data.ParcelID = parcelID; @@ -2711,7 +2715,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.GlobalZ = pos.Z; reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SnapshotID = land.SnapshotID; - reply.Data.Dwell = land.Dwell; + reply.Data.Dwell = dwell; reply.Data.SalePrice = land.SalePrice; reply.Data.AuctionID = (int)land.AuctionID; -- cgit v1.1 From 5e5260ad1b677f5ee85e065e0011ceb71d1c299a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 11 Sep 2010 20:22:10 +0100 Subject: Prevent child agents from being blacklisted in the kill record. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3dea40c..8a96389 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1529,10 +1529,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP kill.Header.Reliable = true; kill.Header.Zerocoded = true; - lock (m_entityUpdates.SyncRoot) + if (m_scene.GetScenePresence(localID) == null) { - m_killRecord.Add(localID); - OutPacket(kill, ThrottleOutPacketType.State); + lock (m_entityUpdates.SyncRoot) + { + m_killRecord.Add(localID); + OutPacket(kill, ThrottleOutPacketType.State); + } } } -- cgit v1.1 From 50b03d08a8cdec9359adcece5b4645a6dc821d26 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Oct 2010 00:04:42 +0200 Subject: Add linden prim renderer and update libOMV --- OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index c120a12..043e7d3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -143,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutgoingPacket pendingAdd; if (m_pendingAdds != null) { - while (m_pendingAdds.Dequeue(out pendingAdd)) + while (m_pendingAdds.TryDequeue(out pendingAdd)) { if (pendingAdd != null && m_packets != null) { @@ -157,7 +157,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutgoingPacket ackedPacket; if (m_pendingRemoves != null) { - while (m_pendingRemoves.Dequeue(out pendingRemove)) + while (m_pendingRemoves.TryDequeue(out pendingRemove)) { if (m_pendingRemoves != null && m_packets != null) { -- cgit v1.1 From 90f9b7b7c41927fed070cbe7a8f6cd2a258c2365 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Oct 2010 00:37:18 +0200 Subject: Fix line endings --- .../LindenUDP/UnackedPacketCollection.cs | 368 ++++++++++----------- 1 file changed, 184 insertions(+), 184 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index 043e7d3..4cb4aee 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -1,184 +1,184 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using OpenMetaverse; - -namespace OpenSim.Region.ClientStack.LindenUDP -{ - /// - /// Special collection that is optimized for tracking unacknowledged packets - /// - public sealed class UnackedPacketCollection - { - /// - /// Holds information about a pending acknowledgement - /// - private struct PendingAck - { - /// Sequence number of the packet to remove - public uint SequenceNumber; - /// Environment.TickCount value when the remove was queued. - /// This is used to update round-trip times for packets - public int RemoveTime; - /// Whether or not this acknowledgement was attached to a - /// resent packet. If so, round-trip time will not be calculated - public bool FromResend; - - public PendingAck(uint sequenceNumber, int currentTime, bool fromResend) - { - SequenceNumber = sequenceNumber; - RemoveTime = currentTime; - FromResend = fromResend; - } - } - - /// Holds the actual unacked packet data, sorted by sequence number - private Dictionary m_packets = new Dictionary(); - /// Holds packets that need to be added to the unacknowledged list - private LocklessQueue m_pendingAdds = new LocklessQueue(); - /// Holds information about pending acknowledgements - private LocklessQueue m_pendingRemoves = new LocklessQueue(); - - /// - /// Add an unacked packet to the collection - /// - /// Packet that is awaiting acknowledgement - /// True if the packet was successfully added, false if the - /// packet already existed in the collection - /// This does not immediately add the ACK to the collection, - /// it only queues it so it can be added in a thread-safe way later - public void Add(OutgoingPacket packet) - { - m_pendingAdds.Enqueue(packet); - } - - /// - /// Marks a packet as acknowledged - /// - /// Sequence number of the packet to - /// acknowledge - /// Current value of Environment.TickCount - /// This does not immediately acknowledge the packet, it only - /// queues the ack so it can be handled in a thread-safe way later - public void Remove(uint sequenceNumber, int currentTime, bool fromResend) - { - m_pendingRemoves.Enqueue(new PendingAck(sequenceNumber, currentTime, fromResend)); - } - - /// - /// Returns a list of all of the packets with a TickCount older than - /// the specified timeout - /// - /// Number of ticks (milliseconds) before a - /// packet is considered expired - /// A list of all expired packets according to the given - /// expiration timeout - /// This function is not thread safe, and cannot be called - /// multiple times concurrently - public List GetExpiredPackets(int timeoutMS) - { - ProcessQueues(); - - List expiredPackets = null; - - if (m_packets.Count > 0) - { - int now = Environment.TickCount & Int32.MaxValue; - - foreach (OutgoingPacket packet in m_packets.Values) - { - // TickCount of zero means a packet is in the resend queue - // but hasn't actually been sent over the wire yet - if (packet.TickCount == 0) - continue; - - if (now - packet.TickCount >= timeoutMS) - { - if (expiredPackets == null) - expiredPackets = new List(); - - // The TickCount will be set to the current time when the packet - // is actually sent out again - packet.TickCount = 0; - - expiredPackets.Add(packet); - } - } - } - - return expiredPackets; - } - - private void ProcessQueues() - { - // Process all the pending adds - - OutgoingPacket pendingAdd; - if (m_pendingAdds != null) - { - while (m_pendingAdds.TryDequeue(out pendingAdd)) - { - if (pendingAdd != null && m_packets != null) - { - m_packets[pendingAdd.SequenceNumber] = pendingAdd; - } - } - } - - // Process all the pending removes, including updating statistics and round-trip times - PendingAck pendingRemove; - OutgoingPacket ackedPacket; - if (m_pendingRemoves != null) - { - while (m_pendingRemoves.TryDequeue(out pendingRemove)) - { - if (m_pendingRemoves != null && m_packets != null) - { - if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) - { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) - { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); - } - } - } - } - } - } - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Net; +using OpenMetaverse; + +namespace OpenSim.Region.ClientStack.LindenUDP +{ + /// + /// Special collection that is optimized for tracking unacknowledged packets + /// + public sealed class UnackedPacketCollection + { + /// + /// Holds information about a pending acknowledgement + /// + private struct PendingAck + { + /// Sequence number of the packet to remove + public uint SequenceNumber; + /// Environment.TickCount value when the remove was queued. + /// This is used to update round-trip times for packets + public int RemoveTime; + /// Whether or not this acknowledgement was attached to a + /// resent packet. If so, round-trip time will not be calculated + public bool FromResend; + + public PendingAck(uint sequenceNumber, int currentTime, bool fromResend) + { + SequenceNumber = sequenceNumber; + RemoveTime = currentTime; + FromResend = fromResend; + } + } + + /// Holds the actual unacked packet data, sorted by sequence number + private Dictionary m_packets = new Dictionary(); + /// Holds packets that need to be added to the unacknowledged list + private LocklessQueue m_pendingAdds = new LocklessQueue(); + /// Holds information about pending acknowledgements + private LocklessQueue m_pendingRemoves = new LocklessQueue(); + + /// + /// Add an unacked packet to the collection + /// + /// Packet that is awaiting acknowledgement + /// True if the packet was successfully added, false if the + /// packet already existed in the collection + /// This does not immediately add the ACK to the collection, + /// it only queues it so it can be added in a thread-safe way later + public void Add(OutgoingPacket packet) + { + m_pendingAdds.Enqueue(packet); + } + + /// + /// Marks a packet as acknowledged + /// + /// Sequence number of the packet to + /// acknowledge + /// Current value of Environment.TickCount + /// This does not immediately acknowledge the packet, it only + /// queues the ack so it can be handled in a thread-safe way later + public void Remove(uint sequenceNumber, int currentTime, bool fromResend) + { + m_pendingRemoves.Enqueue(new PendingAck(sequenceNumber, currentTime, fromResend)); + } + + /// + /// Returns a list of all of the packets with a TickCount older than + /// the specified timeout + /// + /// Number of ticks (milliseconds) before a + /// packet is considered expired + /// A list of all expired packets according to the given + /// expiration timeout + /// This function is not thread safe, and cannot be called + /// multiple times concurrently + public List GetExpiredPackets(int timeoutMS) + { + ProcessQueues(); + + List expiredPackets = null; + + if (m_packets.Count > 0) + { + int now = Environment.TickCount & Int32.MaxValue; + + foreach (OutgoingPacket packet in m_packets.Values) + { + // TickCount of zero means a packet is in the resend queue + // but hasn't actually been sent over the wire yet + if (packet.TickCount == 0) + continue; + + if (now - packet.TickCount >= timeoutMS) + { + if (expiredPackets == null) + expiredPackets = new List(); + + // The TickCount will be set to the current time when the packet + // is actually sent out again + packet.TickCount = 0; + + expiredPackets.Add(packet); + } + } + } + + return expiredPackets; + } + + private void ProcessQueues() + { + // Process all the pending adds + + OutgoingPacket pendingAdd; + if (m_pendingAdds != null) + { + while (m_pendingAdds.TryDequeue(out pendingAdd)) + { + if (pendingAdd != null && m_packets != null) + { + m_packets[pendingAdd.SequenceNumber] = pendingAdd; + } + } + } + + // Process all the pending removes, including updating statistics and round-trip times + PendingAck pendingRemove; + OutgoingPacket ackedPacket; + if (m_pendingRemoves != null) + { + while (m_pendingRemoves.TryDequeue(out pendingRemove)) + { + if (m_pendingRemoves != null && m_packets != null) + { + if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + { + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) + { + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); + } + } + } + } + } + } + } +} -- cgit v1.1 From 52dd547863c0cdd22f53f0efcaef11ae096855a0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 11:31:52 +0200 Subject: Make SendKillObject send multiple localIDs in one packet. This avoids the halting visual behavior of large group deletes and eliminates the packet flood --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 41 ++++++++++++++-------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2b1bd97..fff4300 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1516,35 +1516,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(pc, ThrottleOutPacketType.Unknown); } - public void SendKillObject(ulong regionHandle, uint localID) + public void SendKillObject(ulong regionHandle, List localIDs) { // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet - kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; - kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - kill.ObjectData[0].ID = localID; + kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; + for (int i = 0 ; i < localIDs.Count ; i++ ) + { + kill.ObjectData[i] = new KillObjectPacket.ObjectDataBlock(); + kill.ObjectData[i].ID = localIDs[i]; + } kill.Header.Reliable = true; kill.Header.Zerocoded = true; - if (m_scene.GetScenePresence(localID) == null) + if (localIDs.Count == 1) { - lock (m_entityUpdates.SyncRoot) + if (m_scene.GetScenePresence(localIDs[0]) != null) { - m_killRecord.Add(localID); - - // The throttle queue used here must match that being used for updates. Otherwise, there is a - // chance that a kill packet put on a separate queue will be sent to the client before an existing - // update packet on another queue. Receiving updates after kills results in unowned and undeletable - // scene objects in a viewer until that viewer is relogged in. - OutPacket(kill, ThrottleOutPacketType.Task); + OutPacket(kill, ThrottleOutPacketType.State); + return; } + m_killRecord.Add(localIDs[0]); } else { - OutPacket(kill, ThrottleOutPacketType.State); + lock (m_entityUpdates.SyncRoot) + { + foreach (uint localID in localIDs) + m_killRecord.Add(localID); + } } + + // The throttle queue used here must match that being used for + // updates. Otherwise, there is a chance that a kill packet put + // on a separate queue will be sent to the client before an + // existing update packet on another queue. Receiving updates + // after kills results in unowned and undeletable + // scene objects in a viewer until that viewer is relogged in. + OutPacket(kill, ThrottleOutPacketType.Task); } /// @@ -10969,7 +10980,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // It's a ghost! tell the client to delete it from view. simClient.SendKillObject(Scene.RegionInfo.RegionHandle, - localId); + new List() { localId }); } else { -- cgit v1.1 From f985775962ae8da0010cc5ef5f903a53b550f5d2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Nov 2010 14:27:14 +0100 Subject: Revert "Fix for hanging on "Connecting to region".. caused by packets being processed before the presence has bound to receive events. Fixed this by adding packets to a queue and then processing them when the presence is ready." This reverts commit 91b1d17e5bd3ff6ed006744bc529b53a67af1a64. Conflicts: OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 42 +++------------------- 1 file changed, 5 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4c9011a..7e9a82a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -342,7 +342,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private AgentUpdateArgs lastarg; private bool m_IsActive = true; private bool m_IsLoggingOut = false; - private bool m_IsPresenceReady = false; protected Dictionary m_packetHandlers = new Dictionary(); protected Dictionary m_genericPacketHandlers = new Dictionary(); //PauPaw:Local Generic Message handlers @@ -365,7 +364,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Timer m_propertiesPacketTimer; private List m_propertiesBlocks = new List(); - private List m_pendingPackets; #endregion Class Members @@ -418,7 +416,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_IsActive; } set { m_IsActive = value; } } - public bool IsLoggingOut { get { return m_IsLoggingOut; } @@ -11355,47 +11352,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// - /// This processes packets which have accumulated while the presence was still in the process of initialising. - /// - public void ProcessPendingPackets() - { - m_IsPresenceReady = true; - if (m_pendingPackets == null) - return; - foreach (Packet p in m_pendingPackets) - { - ProcessInPacket(p); - } - m_pendingPackets.Clear(); - } - - /// /// Entryway from the client to the simulator. All UDP packets from the client will end up here /// /// OpenMetaverse.packet public void ProcessInPacket(Packet packet) { - if (m_debugPacketLevel > 0) - { - bool outputPacket = true; - - if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) - outputPacket = false; - - if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) - outputPacket = false; - - if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) - outputPacket = false; - - if (outputPacket) - m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); - } + if (m_debugPacketLevel >= 255) + m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); - if (!ProcessPacketMethod(packet)) - m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); + if (!ProcessPacketMethod(Pack)) + m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); - PacketPool.Instance.ReturnPacket(packet); + PacketPool.Instance.ReturnPacket(Pack); } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) -- cgit v1.1 From ddd3c6824ada0c2a6b87d7176f23b636caafa72f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Nov 2010 14:27:53 +0100 Subject: Revert "Spin the AddNewClient process off into a new thread to avoid locking up the LLUDPServer (and therefore the entire scene)" This reverts commit 40e05f41098bdedac7296d84c9aa8d915c5c9ede. Conflicts: OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 25 +--------------------- 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index b8c692f..626f7eb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -918,30 +918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.DisableFacelights = m_disableFacelights; // Start the IClientAPI - // Spin it off so that it doesn't clog up the LLUDPServer - - //First, and very importantly: - // - //Set our DeliverPackets flag in the client to *false* - //this will prevent us from missing important messages - //before the modules are bound - client.DeliverPackets = false; - client.DisableFacelights = m_disableFacelights; - - Util.FireAndForget( - delegate - { - try - { - client.Start(); - } - finally - { - //Now, release the hounds. er, packets. - client.DeliverPackets = true; - } - } - ); + client.Start(); } else { -- cgit v1.1 From 78448720671e364862ae5c17464ccf112bbf7034 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Nov 2010 14:46:13 +0100 Subject: Fix merge artefacts --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7e9a82a..bcfb633 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11358,12 +11358,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ProcessInPacket(Packet packet) { if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); + m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); - if (!ProcessPacketMethod(Pack)) - m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); + if (!ProcessPacketMethod(packet)) + m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); - PacketPool.Instance.ReturnPacket(Pack); + PacketPool.Instance.ReturnPacket(packet); } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) -- cgit v1.1 From 2e5ae1b013e2960f6651bc8cf2d74cfbb181012e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 17 Nov 2010 17:54:32 +0100 Subject: Fix gesture and viewer preview sounds not playing --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c6ce1b6..5419ede 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -6047,8 +6047,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP SoundTrigger handlerSoundTrigger = OnSoundTrigger; if (handlerSoundTrigger != null) { - handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, - soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, + // UUIDS are sent as zeroes by the client, substitute agent's id + handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, AgentId, + AgentId, AgentId, soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position, soundTriggerPacket.SoundData.Handle, 0); -- cgit v1.1 From 4765fd9cd0d30c97c4ddfc706aa5daa55e57df32 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 27 Nov 2010 19:31:18 +0100 Subject: Remove hard limit on prim owners. The new LibOMV autosplits packets to prevent overflow --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5419ede..f99fa16 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4432,14 +4432,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (notifyCount > 0) { - if (notifyCount > 32) - { - m_log.InfoFormat( - "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" - + " - a developer might want to investigate whether this is a hard limit", 32); - - notifyCount = 32; - } +// if (notifyCount > 32) +// { +// m_log.InfoFormat( +// "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" +// + " - a developer might want to investigate whether this is a hard limit", 32); +// +// notifyCount = 32; +// } ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; -- cgit v1.1 From 2bee150aac6d4996140ddf1f9bd09ba444901033 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 28 Nov 2010 20:45:03 +0100 Subject: Implement health monitoring of the packet receiving and sending threads --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 59968a1..ef0a178 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -946,6 +946,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP while (base.IsRunning) { + m_scene.ThreadAlive(1); try { IncomingPacket incomingPacket = null; @@ -988,6 +989,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP while (base.IsRunning) { + m_scene.ThreadAlive(2); try { m_packetSent = false; -- cgit v1.1 From 4b979362e9076344c9e96698f6cf8605945ffe61 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 4 Dec 2010 14:41:57 +0100 Subject: Add some safeguards: DOn't send someone else's HUDs, don't send deleted prims Removed some unneccessarily wordy core comments --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 9189260..478cfe6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3604,24 +3604,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) continue; - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. if (m_killRecord.Contains(part.LocalId)) - { - // m_log.WarnFormat( - // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", - // part.LocalId, Name); continue; - } + if (part.ParentGroup.IsDeleted) + continue; + + if (part.ParentGroup.IsAttachment) + { // Someone else's HUD, why are we getting these? + if (part.ParentGroup.OwnerID != AgentId && + part.ParentGroup.RootPart.Shape.State >= 30) + continue; + } + if (part.ParentGroup.IsAttachment && m_disableFacelights) { if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && -- cgit v1.1 From b9f54fca5d4c395c7028e06a0dd7ba9551b23563 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 7 Dec 2010 23:01:42 +0100 Subject: Allow TPing multiple people in the friends list in one go. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 478cfe6..f9e1e21 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -10501,11 +10501,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP StartLure handlerStartLure = OnStartLure; if (handlerStartLure != null) - handlerStartLure(startLureRequest.Info.LureType, - Utils.BytesToString( - startLureRequest.Info.Message), - startLureRequest.TargetData[0].TargetID, - this); + { + for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) + { + handlerStartLure(startLureRequest.Info.LureType, + Utils.BytesToString( + startLureRequest.Info.Message), + startLureRequest.TargetData[i].TargetID, + this); + } + } return true; } private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) -- cgit v1.1 From 80b84e4bad9c468763d42feaa7e75146dc320f66 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 8 Dec 2010 00:08:14 +0100 Subject: Prevent sending of attachment data to any client if the attachment is not actually attached to any avatar. Another stab ad fixing "HUD hair" --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f9e1e21..246aaf0 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3615,6 +3615,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.RootPart.Shape.State >= 30) continue; + ScenePresence sp; + // Owner is not in the sim, don't update it to + // anyone + if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) + continue; + + List atts = sp.Attachments; + bool found = false; + foreach (SceneObjectGroup att in atts) + { + if (att == part.ParentGroup) + { + found = true; + break; + } + } + + // It's an attachment of a valid avatar, but + // doesn't seem to be attached, skip + if (!found) + continue; } if (part.ParentGroup.IsAttachment && m_disableFacelights) -- cgit v1.1 From 6b374fa54767a22c1d236470c8a19ee59b44d937 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 13 Dec 2010 20:19:52 +0100 Subject: Revamp the viewer -> banlist packet processing so fix a number of bugs. Remove the too coarse CanEditParcel method in favor of a CanEditParcelProperties method that takes a GroupPowers argument to specify what action is to be taken. Also, make the method to set parcel data much more granular. Permissions in a deeded setting should now work. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 246aaf0..612c0d9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -8298,7 +8298,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); entry.AgentID = block.ID; entry.Flags = (AccessList)block.Flags; - entry.Time = new DateTime(); + entry.Time = Util.ToDateTime(block.Time); entries.Add(entry); } @@ -8306,8 +8306,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerParcelAccessListUpdateRequest != null) { handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, - updatePacket.AgentData.SessionID, updatePacket.Data.Flags, - updatePacket.Data.LocalID, entries, this); + updatePacket.Data.Flags, + updatePacket.Data.LocalID, + updatePacket.Data.TransactionID, + updatePacket.Data.SequenceID, + updatePacket.Data.Sections, + entries, this); } return true; } -- cgit v1.1 From 4719e925b857ca4ebbe52cdf1cae0cd31cdfd0d0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 16 Dec 2010 20:11:26 +0100 Subject: Revert the locking changes in LLCLientView --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 457 ++++++++++----------- 1 file changed, 224 insertions(+), 233 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 196ac50..6a76069 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -328,7 +328,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an /// ownerless phantom. /// - /// All manipulation of this set has to occur under a lock + /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock /// /// protected HashSet m_killRecord; @@ -1536,14 +1536,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(kill, ThrottleOutPacketType.State); return; } - lock (m_killRecord) - { - m_killRecord.Add(localIDs[0]); - } + m_killRecord.Add(localIDs[0]); } else { - lock (m_killRecord) + lock (m_entityUpdates.SyncRoot) { foreach (uint localID in localIDs) m_killRecord.Add(localID); @@ -3598,254 +3595,248 @@ namespace OpenSim.Region.ClientStack.LindenUDP int updatesThisCall = 0; EntityUpdate update; - lock (m_killRecord) + while (updatesThisCall < maxUpdates) { - while (updatesThisCall < maxUpdates) - { - lock (m_entityUpdates.SyncRoot) - if (!m_entityUpdates.TryDequeue(out update)) - break; + lock (m_entityUpdates.SyncRoot) + if (!m_entityUpdates.TryDequeue(out update)) + break; - if (update.Entity is SceneObjectPart) - { - SceneObjectPart part = (SceneObjectPart)update.Entity; - - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - if (m_killRecord.Contains(part.LocalId)) + if (update.Entity is SceneObjectPart) + { + SceneObjectPart part = (SceneObjectPart)update.Entity; + + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // will never receive an update after a prim kill. Even then, keeping the kill record may be a good + // safety measure. + // + // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update + // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs + // updates and kills on different threads with different scheduling strategies, hence this protection. + // + // This doesn't appear to apply to child prims - a client will happily ignore these updates + // after the root prim has been deleted. + if (m_killRecord.Contains(part.LocalId)) + continue; + if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + continue; + + if (part.ParentGroup.IsDeleted) + continue; + + if (part.ParentGroup.IsAttachment) + { // Someone else's HUD, why are we getting these? + if (part.ParentGroup.OwnerID != AgentId && + part.ParentGroup.RootPart.Shape.State >= 30) continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + ScenePresence sp; + // Owner is not in the sim, don't update it to + // anyone + if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) continue; - if (part.ParentGroup.IsDeleted) - continue; - - if (part.ParentGroup.IsAttachment) - { // Someone else's HUD, why are we getting these? - if (part.ParentGroup.OwnerID != AgentId && - part.ParentGroup.RootPart.Shape.State >= 30) - continue; - ScenePresence sp; - // Owner is not in the sim, don't update it to - // anyone - if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) - continue; - - List atts = sp.Attachments; - bool found = false; - foreach (SceneObjectGroup att in atts) - { - if (att == part.ParentGroup) - { - found = true; - break; - } - } - - // It's an attachment of a valid avatar, but - // doesn't seem to be attached, skip - if (!found) - continue; - } - - if (part.ParentGroup.IsAttachment && m_disableFacelights) + List atts = sp.Attachments; + bool found = false; + foreach (SceneObjectGroup att in atts) { - if (part.ParentGroup.IsAttachment && m_disableFacelights) + if (att == part.ParentGroup) { - if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && - part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) - { - part.Shape.LightEntry = false; - } - } - } - - ++updatesThisCall; - - #region UpdateFlags to packet type conversion - - PrimUpdateFlags updateFlags = update.Flags; - - bool canUseCompressed = true; - bool canUseImproved = true; - - // Compressed object updates only make sense for LL primitives - if (!(update.Entity is SceneObjectPart)) - { - canUseCompressed = false; - } - - if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) - { - canUseCompressed = false; - canUseImproved = false; - } - else - { - if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || - updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || - updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - canUseCompressed = false; - } - - if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || - updateFlags.HasFlag(PrimUpdateFlags.ParentID) || - updateFlags.HasFlag(PrimUpdateFlags.Scale) || - updateFlags.HasFlag(PrimUpdateFlags.PrimData) || - updateFlags.HasFlag(PrimUpdateFlags.Text) || - updateFlags.HasFlag(PrimUpdateFlags.NameValue) || - updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || - updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || - updateFlags.HasFlag(PrimUpdateFlags.Sound) || - updateFlags.HasFlag(PrimUpdateFlags.Particles) || - updateFlags.HasFlag(PrimUpdateFlags.Material) || - updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || - updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - canUseImproved = false; - } - } - - #endregion UpdateFlags to packet type conversion - - #region Block Construction - - // TODO: Remove this once we can build compressed updates - canUseCompressed = false; - - if (!canUseImproved && !canUseCompressed) - { - if (update.Entity is ScenePresence) - { - objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); - } - else - { - // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) - // { - // SceneObjectPart sop = (SceneObjectPart)update.Entity; - // string text = sop.Text; - // if (text.IndexOf("\n") >= 0) - // text = text.Remove(text.IndexOf("\n")); - // - // if (m_attachmentsSent.Contains(sop.ParentID)) - // { - //// m_log.DebugFormat( - //// "[CLIENT]: Sending full info about attached prim {0} text {1}", - //// sop.LocalId, text); - // - // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); - // - // m_attachmentsSent.Add(sop.LocalId); - // } - // else - // { - // m_log.DebugFormat( - // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", - // sop.LocalId, text, sop.ParentID); - // - // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); - // } - // } - // else - // { - objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); - // } + found = true; + break; } } - else if (!canUseImproved) - { - compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); - } - else + + // It's an attachment of a valid avatar, but + // doesn't seem to be attached, skip + if (!found) + continue; + } + + if (part.ParentGroup.IsAttachment && m_disableFacelights) + { + if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && + part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) { - if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) - // Self updates go into a special list - terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); - else - // Everything else goes here - terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + part.Shape.LightEntry = false; } - - #endregion Block Construction } - - #region Packet Sending - - const float TIME_DILATION = 1.0f; - ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); - - if (terseAgentUpdateBlocks.IsValueCreated) + } + + ++updatesThisCall; + + #region UpdateFlags to packet type conversion + + PrimUpdateFlags updateFlags = update.Flags; + + bool canUseCompressed = true; + bool canUseImproved = true; + + // Compressed object updates only make sense for LL primitives + if (!(update.Entity is SceneObjectPart)) + { + canUseCompressed = false; + } + + if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) + { + canUseCompressed = false; + canUseImproved = false; + } + else + { + if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || + updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || + updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { - List blocks = terseAgentUpdateBlocks.Value; - - ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; - - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; - - OutPacket(packet, ThrottleOutPacketType.Unknown, true); + canUseCompressed = false; } - - if (objectUpdateBlocks.IsValueCreated) + + if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || + updateFlags.HasFlag(PrimUpdateFlags.ParentID) || + updateFlags.HasFlag(PrimUpdateFlags.Scale) || + updateFlags.HasFlag(PrimUpdateFlags.PrimData) || + updateFlags.HasFlag(PrimUpdateFlags.Text) || + updateFlags.HasFlag(PrimUpdateFlags.NameValue) || + updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || + updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || + updateFlags.HasFlag(PrimUpdateFlags.Sound) || + updateFlags.HasFlag(PrimUpdateFlags.Particles) || + updateFlags.HasFlag(PrimUpdateFlags.Material) || + updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || + updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { - List blocks = objectUpdateBlocks.Value; - - ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; - - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; - - OutPacket(packet, ThrottleOutPacketType.Task, true); + canUseImproved = false; } - - if (compressedUpdateBlocks.IsValueCreated) + } + + #endregion UpdateFlags to packet type conversion + + #region Block Construction + + // TODO: Remove this once we can build compressed updates + canUseCompressed = false; + + if (!canUseImproved && !canUseCompressed) + { + if (update.Entity is ScenePresence) { - List blocks = compressedUpdateBlocks.Value; - - ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; - - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; - - OutPacket(packet, ThrottleOutPacketType.Task, true); + objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); } - - if (terseUpdateBlocks.IsValueCreated) + else { - List blocks = terseUpdateBlocks.Value; - - ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; - - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; - - OutPacket(packet, ThrottleOutPacketType.Task, true); +// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) +// { +// SceneObjectPart sop = (SceneObjectPart)update.Entity; +// string text = sop.Text; +// if (text.IndexOf("\n") >= 0) +// text = text.Remove(text.IndexOf("\n")); +// +// if (m_attachmentsSent.Contains(sop.ParentID)) +// { +//// m_log.DebugFormat( +//// "[CLIENT]: Sending full info about attached prim {0} text {1}", +//// sop.LocalId, text); +// +// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); +// +// m_attachmentsSent.Add(sop.LocalId); +// } +// else +// { +// m_log.DebugFormat( +// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", +// sop.LocalId, text, sop.ParentID); +// +// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); +// } +// } +// else +// { + objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); +// } } } + else if (!canUseImproved) + { + compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); + } + else + { + if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) + // Self updates go into a special list + terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + else + // Everything else goes here + terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + } + + #endregion Block Construction + } + + #region Packet Sending + + const float TIME_DILATION = 1.0f; + ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); + + if (terseAgentUpdateBlocks.IsValueCreated) + { + List blocks = terseAgentUpdateBlocks.Value; + + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; + + OutPacket(packet, ThrottleOutPacketType.Unknown, true); + } + + if (objectUpdateBlocks.IsValueCreated) + { + List blocks = objectUpdateBlocks.Value; + + ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; + + OutPacket(packet, ThrottleOutPacketType.Task, true); + } + + if (compressedUpdateBlocks.IsValueCreated) + { + List blocks = compressedUpdateBlocks.Value; + + ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; + + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; + + OutPacket(packet, ThrottleOutPacketType.Task, true); + } + + if (terseUpdateBlocks.IsValueCreated) + { + List blocks = terseUpdateBlocks.Value; + + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; + + OutPacket(packet, ThrottleOutPacketType.Task, true); } #endregion Packet Sending -- cgit v1.1 From 835e4dbc2cc5bdeea0bddfef2c15092720f5a10a Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 16 Dec 2010 20:49:40 +0100 Subject: Add locks on m_killRecord without breaking things like justin did --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6a76069..04710f1 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1529,21 +1529,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP kill.Header.Reliable = true; kill.Header.Zerocoded = true; - if (localIDs.Count == 1) + lock (m_killRecord) { - if (m_scene.GetScenePresence(localIDs[0]) != null) + if (localIDs.Count == 1) { - OutPacket(kill, ThrottleOutPacketType.State); - return; + if (m_scene.GetScenePresence(localIDs[0]) != null) + { + OutPacket(kill, ThrottleOutPacketType.State); + return; + } + m_killRecord.Add(localIDs[0]); } - m_killRecord.Add(localIDs[0]); - } - else - { - lock (m_entityUpdates.SyncRoot) + else { - foreach (uint localID in localIDs) - m_killRecord.Add(localID); + lock (m_entityUpdates.SyncRoot) + { + foreach (uint localID in localIDs) + m_killRecord.Add(localID); + } } } @@ -3615,10 +3618,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // This doesn't appear to apply to child prims - a client will happily ignore these updates // after the root prim has been deleted. - if (m_killRecord.Contains(part.LocalId)) - continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) - continue; + lock (m_killRecord) + { + if (m_killRecord.Contains(part.LocalId)) + continue; + if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + continue; + } if (part.ParentGroup.IsDeleted) continue; -- cgit v1.1 From 42d44c00f38d6c7f5a67920ff375ab20ceb24fe9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Dec 2010 03:46:57 +0100 Subject: Change the mute list parts of the client interface so that all data is provided to the module --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 870ce3e..5913246 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -9475,7 +9475,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), UpdateMuteListEntry.MuteData.MuteType, - UpdateMuteListEntry.AgentData.AgentID); + UpdateMuteListEntry.MuteData.MuteFlags); return true; } return false; @@ -9490,8 +9490,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { handlerRemoveMuteListEntry(this, RemoveMuteListEntry.MuteData.MuteID, - Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), - RemoveMuteListEntry.AgentData.AgentID); + Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); return true; } return false; -- cgit v1.1 From 2cb2bff9b2ab68c325b0142da0b37730be9a12a3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 30 Dec 2010 00:31:59 +0100 Subject: Implement SendPlacesReply --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5913246..e416d05 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -12088,7 +12088,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP //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, + PlacesReplyData[] data) + { + PlacesReplyPacket reply = null; + PlacesReplyPacket.QueryDataBlock[] dataBlocks = + new PlacesReplyPacket.QueryDataBlock[0]; + + for (int i = 0 ; i < data.Length ; i++) + { + PlacesReplyPacket.QueryDataBlock block = + new PlacesReplyPacket.QueryDataBlock(); + + block.OwnerID = data[i].OwnerID; + block.Name = Util.StringToBytes256(data[i].Name); + block.Desc = Util.StringToBytes1024(data[i].Desc); + block.ActualArea = data[i].ActualArea; + block.BillableArea = data[i].BillableArea; + block.Flags = data[i].Flags; + block.GlobalX = data[i].GlobalX; + block.GlobalY = data[i].GlobalY; + block.GlobalZ = data[i].GlobalZ; + block.SimName = Util.StringToBytes256(data[i].SimName); + block.SnapshotID = data[i].SnapshotID; + block.Dwell = data[i].Dwell; + block.Price = data[i].Price; + + if (reply != null && reply.Length + block.Length > 1400) + { + OutPacket(reply, ThrottleOutPacketType.Task); + reply = null; + dataBlocks = new PlacesReplyPacket.QueryDataBlock[0]; + } + + if (reply == null) + { + reply = (PlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.PlacesReply); + reply.AgentData = new PlacesReplyPacket.AgentDataBlock(); + reply.AgentData.AgentID = AgentId; + reply.AgentData.QueryID = queryID; + + reply.TransactionData = new PlacesReplyPacket.TransactionDataBlock(); + reply.TransactionData.TransactionID = transactionID; + + reply.QueryData = dataBlocks; + } + + Array.Resize(ref dataBlocks, dataBlocks.Length + 1); + dataBlocks[dataBlocks.Length - 1] = block; + reply.QueryData = dataBlocks; + } + if (reply != null) + OutPacket(reply, ThrottleOutPacketType.Task); } } } -- cgit v1.1 From bbbcb453989625587b4c5ff00b50480d5a524e2e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 23 Mar 2011 00:05:27 +0100 Subject: Fudge the group join permissions for god user in god mode. Allows to join every group without an invite. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3972ec9..e91d37f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -9998,6 +9998,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP groupProfileReply.GroupData.MaturePublish = d.MaturePublish; groupProfileReply.GroupData.OwnerRole = d.OwnerRole; + Scene scene = (Scene)m_scene; + if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) + { + ScenePresence p; + if (scene.TryGetScenePresence(sender.AgentId, out p)) + { + if (p.GodLevel >= 200) + { + groupProfileReply.GroupData.OpenEnrollment = true; + groupProfileReply.GroupData.MembershipFee = 0; + } + } + } + OutPacket(groupProfileReply, ThrottleOutPacketType.Task); } return true; -- cgit v1.1 From 5db8dcb5635ed39c299ff30516fb237767a041a5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 17 Apr 2011 17:11:33 +0200 Subject: Fix agent animation updates --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 287 +++++++++------------ 1 file changed, 122 insertions(+), 165 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5b2484d..4abb6e2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3703,209 +3703,166 @@ namespace OpenSim.Region.ClientStack.LindenUDP int updatesThisCall = 0; -// -// DEBUGGING CODE... REMOVE -// LogQueueProcessEvent(this.m_agentId,m_entityUpdates,m_maxUpdates); -// // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race // condition where a kill can be processed before an out-of-date update for the same object. float avgTimeDilation = 1.0f; - lock (m_killRecord) + EntityUpdate update; + Int32 timeinqueue; // this is just debugging code & can be dropped later + + while (updatesThisCall < m_maxUpdates) { - EntityUpdate update; - Int32 timeinqueue; // this is just debugging code & can be dropped later - - while (updatesThisCall < m_maxUpdates) - { - lock (m_entityUpdates.SyncRoot) - if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) - break; - avgTimeDilation += update.TimeDilation; - avgTimeDilation *= 0.5f; - - if (update.Entity is SceneObjectPart) + lock (m_entityUpdates.SyncRoot) + if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) + break; + avgTimeDilation += update.TimeDilation; + avgTimeDilation *= 0.5f; + + if (update.Entity is SceneObjectPart) + { + SceneObjectPart part = (SceneObjectPart)update.Entity; + + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // will never receive an update after a prim kill. Even then, keeping the kill record may be a good + // safety measure. + // + // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update + // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs + // updates and kills on different threads with different scheduling strategies, hence this protection. + // + // This doesn't appear to apply to child prims - a client will happily ignore these updates + // after the root prim has been deleted. + lock (m_killRecord) { - SceneObjectPart part = (SceneObjectPart)update.Entity; - - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - lock (m_killRecord) - { - if (m_killRecord.Contains(part.LocalId)) - continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) - continue; - } + if (m_killRecord.Contains(part.LocalId)) + continue; + if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + continue; + } - if (part.ParentGroup.IsDeleted) + if (part.ParentGroup.IsDeleted) + continue; + + if (part.ParentGroup.IsAttachment) + { // Someone else's HUD, why are we getting these? + if (part.ParentGroup.OwnerID != AgentId && + part.ParentGroup.RootPart.Shape.State >= 30) + continue; + ScenePresence sp; + // Owner is not in the sim, don't update it to + // anyone + if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) continue; - if (part.ParentGroup.IsAttachment) - { // Someone else's HUD, why are we getting these? - if (part.ParentGroup.OwnerID != AgentId && - part.ParentGroup.RootPart.Shape.State >= 30) - continue; - ScenePresence sp; - // Owner is not in the sim, don't update it to - // anyone - if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) - continue; - - List atts = sp.Attachments; - bool found = false; - foreach (SceneObjectGroup att in atts) + List atts = sp.Attachments; + bool found = false; + foreach (SceneObjectGroup att in atts) + { + if (att == part.ParentGroup) { - if (att == part.ParentGroup) - { - found = true; - break; - } + found = true; + break; } - - // It's an attachment of a valid avatar, but - // doesn't seem to be attached, skip - if (!found) - continue; } - if (part.ParentGroup.IsAttachment && m_disableFacelights) + // It's an attachment of a valid avatar, but + // doesn't seem to be attached, skip + if (!found) + continue; + } + + if (part.ParentGroup.IsAttachment && m_disableFacelights) + { + if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && + part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) { - if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && - part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) - { - part.Shape.LightEntry = false; - } + part.Shape.LightEntry = false; } } + } + + ++updatesThisCall; - ++updatesThisCall; + #region UpdateFlags to packet type conversion - #region UpdateFlags to packet type conversion + PrimUpdateFlags updateFlags = update.Flags; - PrimUpdateFlags updateFlags = update.Flags; + bool canUseCompressed = true; + bool canUseImproved = true; - bool canUseCompressed = true; - bool canUseImproved = true; + // Compressed object updates only make sense for LL primitives + if (!(update.Entity is SceneObjectPart)) + { + canUseCompressed = false; + } - // Compressed object updates only make sense for LL primitives - if (!(update.Entity is SceneObjectPart)) + if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) + { + canUseCompressed = false; + canUseImproved = false; + } + else + { + if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || + updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || + updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { canUseCompressed = false; } - if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) + if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || + updateFlags.HasFlag(PrimUpdateFlags.ParentID) || + updateFlags.HasFlag(PrimUpdateFlags.Scale) || + updateFlags.HasFlag(PrimUpdateFlags.PrimData) || + updateFlags.HasFlag(PrimUpdateFlags.Text) || + updateFlags.HasFlag(PrimUpdateFlags.NameValue) || + updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || + updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || + updateFlags.HasFlag(PrimUpdateFlags.Sound) || + updateFlags.HasFlag(PrimUpdateFlags.Particles) || + updateFlags.HasFlag(PrimUpdateFlags.Material) || + updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || + updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { - canUseCompressed = false; canUseImproved = false; } - else - { - if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || - updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || - updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - if (update.Entity is ScenePresence) - { - objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); - } - else - { - objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); - } - } - - if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || - updateFlags.HasFlag(PrimUpdateFlags.ParentID) || - updateFlags.HasFlag(PrimUpdateFlags.Scale) || - updateFlags.HasFlag(PrimUpdateFlags.PrimData) || - updateFlags.HasFlag(PrimUpdateFlags.Text) || - updateFlags.HasFlag(PrimUpdateFlags.NameValue) || - updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || - updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || - updateFlags.HasFlag(PrimUpdateFlags.Sound) || - updateFlags.HasFlag(PrimUpdateFlags.Particles) || - updateFlags.HasFlag(PrimUpdateFlags.Material) || - updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || - updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - canUseImproved = false; - } - } + } - #endregion UpdateFlags to packet type conversion + #endregion UpdateFlags to packet type conversion - #region Block Construction + #region Block Construction - // TODO: Remove this once we can build compressed updates - canUseCompressed = false; + // TODO: Remove this once we can build compressed updates + canUseCompressed = false; - if (!canUseImproved && !canUseCompressed) - { - if (update.Entity is ScenePresence) - { - objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); - } - else - { - // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) - // { - // SceneObjectPart sop = (SceneObjectPart)update.Entity; - // string text = sop.Text; - // if (text.IndexOf("\n") >= 0) - // text = text.Remove(text.IndexOf("\n")); - // - // if (m_attachmentsSent.Contains(sop.ParentID)) - // { - //// m_log.DebugFormat( - //// "[CLIENT]: Sending full info about attached prim {0} text {1}", - //// sop.LocalId, text); - // - // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); - // - // m_attachmentsSent.Add(sop.LocalId); - // } - // else - // { - // m_log.DebugFormat( - // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", - // sop.LocalId, text, sop.ParentID); - // - // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); - // } - // } - // else - // { - objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); - // } - } - } - else if (!canUseImproved) + if (!canUseImproved && !canUseCompressed) + { + if (update.Entity is ScenePresence) { - compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); + objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); } else { - if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) - // Self updates go into a special list - terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); - else - // Everything else goes here - terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); } - - #endregion Block Construction } + else if (!canUseImproved) + { + compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); + } + else + { + if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) + // Self updates go into a special list + terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + else + // Everything else goes here + terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); + } + + #endregion Block Construction } #region Packet Sending -- cgit v1.1 From dbf52b8cd1690e9df3501295c8c99d35988781d3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 17 Apr 2011 22:54:23 +0100 Subject: Correct the delegate for classified deletes --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e72159c..e7afbb3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -255,7 +255,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ClassifiedInfoRequest OnClassifiedInfoRequest; public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; public event ClassifiedDelete OnClassifiedDelete; - public event ClassifiedDelete OnClassifiedGodDelete; + public event ClassifiedGodDelete OnClassifiedGodDelete; public event EventNotificationAddRequest OnEventNotificationAddRequest; public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; public event EventGodDelete OnEventGodDelete; @@ -10812,6 +10812,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerClassifiedGodDelete != null) handlerClassifiedGodDelete( classifiedGodDelete.Data.ClassifiedID, + classifiedGodDelete.Data.QueryID, this); return true; } -- cgit v1.1 From ec0aa7a90b578572fc45f27b5113a174ff37643e Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 17 Apr 2011 23:17:05 +0200 Subject: Fix up client implementations --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e7afbb3..1c3ecb2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -10808,7 +10808,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion - ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; + ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; if (handlerClassifiedGodDelete != null) handlerClassifiedGodDelete( classifiedGodDelete.Data.ClassifiedID, -- cgit v1.1 From 6bac16fd884a51a7874348928d45c883f9d5968f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 May 2011 14:55:36 +0200 Subject: Fix up handling of the estate dialog to prevent duplication of ban list names. Allow more than 61 names in ban list without crashing the viewer. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 57 ++++++++++++---------- 1 file changed, 32 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7564907..05e6d27 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4372,37 +4372,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (bl[i].BannedUserID == UUID.Zero) continue; BannedUsers.Add(bl[i].BannedUserID); - } - EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); - packet.AgentData.TransactionID = UUID.Random(); - packet.AgentData.AgentID = AgentId; - packet.AgentData.SessionID = SessionId; - packet.MethodData.Invoice = invoice; - packet.MethodData.Method = Utils.StringToBytes("setaccess"); + if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0)) + { + EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); + packet.AgentData.TransactionID = UUID.Random(); + packet.AgentData.AgentID = AgentId; + packet.AgentData.SessionID = SessionId; + packet.MethodData.Invoice = invoice; + packet.MethodData.Method = Utils.StringToBytes("setaccess"); - EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; + EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; - for (int i = 0; i < (6 + BannedUsers.Count); i++) - { - returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); - } - int j = 0; + int j; + for (j = 0; j < (6 + BannedUsers.Count); j++) + { + returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); + } + j = 0; - returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - foreach (UUID banned in BannedUsers) - { - returnblock[j].Parameter = banned.GetBytes(); j++; + foreach (UUID banned in BannedUsers) + { + returnblock[j].Parameter = banned.GetBytes(); j++; + } + packet.ParamList = returnblock; + packet.Header.Reliable = true; + OutPacket(packet, ThrottleOutPacketType.Task); + + BannedUsers.Clear(); + } } - packet.ParamList = returnblock; - packet.Header.Reliable = false; - OutPacket(packet, ThrottleOutPacketType.Task); + } public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) -- cgit v1.1 From 06d5989f4d44de2dfedbb3858f706940a56361ed Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jul 2011 09:59:05 +0200 Subject: Fix parcel prim count and max reporting. Viewer already multiplies. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6048518..ecf10e4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4589,7 +4589,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (landData.SimwideArea > 0) { - int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); + int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536; + // Never report more than sim total capacity + if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) + simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; updateMessage.SimWideMaxPrims = simulatorCapacity; } else -- cgit v1.1 From 96174595da269f50d37c88c213ad00b79a7c7c83 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 23 Jul 2011 11:39:32 +0100 Subject: Fix LLTextBox to work with the updated libOMV --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 99552f1..d5419cc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12129,7 +12129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } - public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + public void SendTextBoxRequest(string message, int chatChannel, string objectname, UUID ownerID, string ownerFirstName, string ownerLastName, UUID objectId) { ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); dialog.Data.ObjectID = objectId; @@ -12145,6 +12145,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP buttons[0] = new ScriptDialogPacket.ButtonsBlock(); buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); dialog.Buttons = buttons; + + dialog.OwnerData = new ScriptDialogPacket.OwnerDataBlock[1]; + dialog.OwnerData[0] = new ScriptDialogPacket.OwnerDataBlock(); + dialog.OwnerData[0].OwnerID = ownerID; + OutPacket(dialog, ThrottleOutPacketType.Task); } -- cgit v1.1 From 04eaca2af85bd8261c426e4c1049a73b4badf072 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 27 Jul 2011 08:35:19 +0200 Subject: Ensure that packet headers get parsed correctly --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ab6674d..fead4d9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -160,6 +160,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Socket Server { get { return null; } } + private int m_malformedCount = 0; // Guard against a spamming attack + public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) : base(listenIP, (int)port) { @@ -612,6 +614,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Decoding + if (buffer.DataLength < 7) + return; // Drop undersizd packet + + int headerLen = 7; + if (buffer.Data[6] == 0xFF) + { + if (buffer.Data[7] == 0xFF) + headerLen = 10; + else + headerLen = 8; + } + + if (buffer.DataLength < headerLen) + return; // Malformed header + try { packet = Packet.BuildPacket(buffer.Data, ref packetEnd, @@ -621,6 +638,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP catch (MalformedDataException) { } + catch (IndexOutOfRangeException) + { + return; // Drop short packet + } + catch(Exception e) + { + if (m_malformedCount < 100) + m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); + m_malformedCount++; + if ((m_malformedCount % 100000) == 0) + m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); + } // Fail-safe check if (packet == null) -- cgit v1.1 From 0e9dda91cbaa0a4431772daeb338ecebf0d2268d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Aug 2011 20:55:06 +0200 Subject: Guard against a bad login leaving us with a null queue --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 95a8e23..758fd93 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // No dequeued packet waiting to be sent, try to pull one off // this queue queue = m_packetOutboxes[i]; - if (queue.Dequeue(out packet)) + if (queue != null && queue.Dequeue(out packet)) { // A packet was pulled off the queue. See if we have // enough tokens in the bucket to send it out -- cgit v1.1 From 03f6734f4367b08e2b181ed68bc80b885e76148f Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 7 Sep 2011 09:42:18 -0700 Subject: First set of merge fixes --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5c94fba..db81fea 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3747,7 +3747,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) continue; - List atts = sp.Attachments; + List atts = sp.GetAttachments(); bool found = false; foreach (SceneObjectGroup att in atts) { -- cgit v1.1 From f4de1a6d9b54a85da08de3daadf094c562f88011 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Oct 2011 06:48:40 +0200 Subject: HACK: Remove advanced property resending until it is fixed properly in core. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 575e5a2..0c92308 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4220,11 +4220,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // 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 - OutPacket(packet, ThrottleOutPacketType.Task, true, - delegate(OutgoingPacket oPacket) - { - ResendPropertyUpdates(updates, oPacket); - }); + // 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); // pbcnt += blocks.Count; // ppcnt++; @@ -4250,11 +4252,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // of the object rather than the properties when the packet was created List updates = new List(); updates.Add(familyUpdates.Value[i]); - OutPacket(packet, ThrottleOutPacketType.Task, true, - delegate(OutgoingPacket oPacket) - { - ResendPropertyUpdates(updates, oPacket); - }); + // 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); // fpcnt++; // fbcnt++; -- cgit v1.1 From ec8c93aa5e1d0af2c0adf38156b05e85421f4a81 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 4 Dec 2011 12:35:01 +0100 Subject: Implement ChangeInventoryItemFlagsPacket handling --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3186dff..effa8d0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -286,6 +286,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; + public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; public event MuteListEntryUpdate OnUpdateMuteListEntry; public event MuteListEntryRemove OnRemoveMuteListEntry; public event GodlikeMessage onGodlikeMessage; @@ -5344,6 +5345,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); + AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); AddGenericPacketHandler("autopilot", HandleAutopilot); } @@ -9822,6 +9824,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } + private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) + { + ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = + (ChangeInventoryItemFlagsPacket)packet; + ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; + if (handlerChangeInventoryItemFlags != null) + { + foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) + handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); + return true; + } + return false; + } + private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) { return true; -- cgit v1.1 From b45923983381d57e8befbdfb1953ebc349ff7d8e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 8 Dec 2011 01:08:40 +0100 Subject: Recover from an internal mess-up in the outgoing packet queues by creating a new queue object. --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 55 ++++++++++++++-------- 1 file changed, 36 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index c951071..ae72175 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -498,7 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_deliverPackets == false) return false; - OutgoingPacket packet; + OutgoingPacket packet = null; OpenSim.Framework.LocklessQueue queue; TokenBucket bucket; bool packetSent = false; @@ -530,32 +530,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP // No dequeued packet waiting to be sent, try to pull one off // this queue queue = m_packetOutboxes[i]; - if (queue != null && queue.Dequeue(out packet)) + if (queue != null) { - // A packet was pulled off the queue. See if we have - // enough tokens in the bucket to send it out - if (bucket.RemoveTokens(packet.Buffer.DataLength)) + bool success = false; + try { - // Send the packet - m_udpServer.SendPacketFinal(packet); - packetSent = true; + success = queue.Dequeue(out packet); } - else + catch { - // Save the dequeued packet for the next iteration - m_nextPackets[i] = packet; + m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); } - - // If the queue is empty after this dequeue, fire the queue - // empty callback now so it has a chance to fill before we - // get back here - if (queue.Count == 0) + if (success) + { + // A packet was pulled off the queue. See if we have + // enough tokens in the bucket to send it out + if (bucket.RemoveTokens(packet.Buffer.DataLength)) + { + // Send the packet + m_udpServer.SendPacketFinal(packet); + packetSent = true; + } + else + { + // Save the dequeued packet for the next iteration + m_nextPackets[i] = packet; + } + + // If the queue is empty after this dequeue, fire the queue + // empty callback now so it has a chance to fill before we + // get back here + if (queue.Count == 0) + emptyCategories |= CategoryToFlag(i); + } + else + { + // No packets in this queue. Fire the queue empty callback + // if it has not been called recently emptyCategories |= CategoryToFlag(i); + } } else { - // No packets in this queue. Fire the queue empty callback - // if it has not been called recently + m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); emptyCategories |= CategoryToFlag(i); } } @@ -713,4 +730,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } -} \ No newline at end of file +} -- cgit v1.1 From 5afb70b9feb58b17261bc6f04f9c923c0da588e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 17 Jan 2012 15:30:52 +0100 Subject: Fix prim calculations so that > 32767 prims are supported --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 873c56c..01e1383 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4612,7 +4612,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (landData.SimwideArea > 0) { - int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536; + int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); // Never report more than sim total capacity if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; -- cgit v1.1 From dac826da4ea2e1208f420a1fbf652417f858a8c1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Jan 2012 20:38:50 +0100 Subject: Prevent an overlong description from messing up a ParcelInfoReply --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index bbaa08e..a50a61d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2766,7 +2766,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ParcelID = parcelID; reply.Data.OwnerID = land.OwnerID; reply.Data.Name = Utils.StringToBytes(land.Name); - reply.Data.Desc = Utils.StringToBytes(land.Description); + reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); reply.Data.ActualArea = land.Area; reply.Data.BillableArea = land.Area; // TODO: what is this? -- cgit v1.1 From 0f181fe5d05e24886586e5882f4f6fe60c1dc30d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 30 Jan 2012 22:30:02 +0100 Subject: Fix displaying landmark and search info properly with long names --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a50a61d..4f09d8f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2766,7 +2766,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ParcelID = parcelID; reply.Data.OwnerID = land.OwnerID; reply.Data.Name = Utils.StringToBytes(land.Name); - reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); + if (land != null && land.Description != null && land.Description != String.Empty) + reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); + else + reply.Data.Desc = new Byte[0]; reply.Data.ActualArea = land.Area; reply.Data.BillableArea = land.Area; // TODO: what is this? -- cgit v1.1 From 07c487a28f6ce6d85cf32fba0c2ded724f7b5af7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Feb 2012 21:36:45 +0100 Subject: Make ban, eject, freeze and the scripted versions of those work. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d126f5f..8c0a7e9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4684,7 +4684,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public void SendLandAccessListData(List avatars, uint accessFlag, int localLandID) + public void SendLandAccessListData(List accessList, uint accessFlag, int localLandID) { ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); replyPacket.Data.AgentID = AgentId; @@ -4693,12 +4693,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP replyPacket.Data.SequenceID = 0; List list = new List(); - foreach (UUID avatar in avatars) + foreach (LandAccessEntry entry in accessList) { ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock(); block.Flags = accessFlag; - block.ID = avatar; - block.Time = 0; + block.ID = entry.AgentID; + block.Time = entry.Expires; list.Add(block); } @@ -8641,13 +8641,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion - List entries = new List(); + List entries = new List(); foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry entry = new LandAccessEntry(); entry.AgentID = block.ID; entry.Flags = (AccessList)block.Flags; - entry.Time = Util.ToDateTime(block.Time); + entry.Expires = block.Time; entries.Add(entry); } -- cgit v1.1 From 2d3381b795611a8857077d1effb41323c2cb8658 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 14 Feb 2012 23:16:20 +0100 Subject: Implement region crossing of sitting avatars. Edit mode and llSetPos work but unscripted default sit anim is lost. Still some Gfx glitching. Physical crossing doesn't work yet. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8ed250d..161feda 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1549,7 +1549,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(ulong regionHandle, List localIDs) { -// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); +// foreach (uint id in localIDs) +// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet -- cgit v1.1 From 56cc573d2ff71c6caa5b0f28d784f7c3c7751e52 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 12:20:20 +0100 Subject: Show avatars as sitting on proot prims only to avoid motion jitter for passengers --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 36 +++++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 161feda..1ac3b76 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4828,9 +4828,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ScenePresence presence = (ScenePresence)entity; + position = presence.OffsetPosition; + rotation = presence.Rotation; + + if (presence.ParentID != 0) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); + if (part != null && part != part.ParentGroup.RootPart) + { + position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; + rotation = presence.Rotation * part.RotationOffset; + } + } + attachPoint = 0; collisionPlane = presence.CollisionPlane; - position = presence.OffsetPosition; velocity = presence.Velocity; acceleration = Vector3.Zero; @@ -4840,7 +4852,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // acceleration = new Vector3(1, 0, 0); angularVelocity = Vector3.Zero; - rotation = presence.Rotation; if (sendTexture) textureEntry = presence.Appearance.Texture.GetBytes(); @@ -4945,13 +4956,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) { + Vector3 offsetPosition = data.OffsetPosition; + Quaternion rotation = data.Rotation; + uint parentID = data.ParentID; + + if (parentID != 0) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); + if (part != null && part != part.ParentGroup.RootPart) + { + offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; + rotation = data.Rotation * part.RotationOffset; + parentID = part.ParentGroup.RootPart.LocalId; + } + } + byte[] objectData = new byte[76]; data.CollisionPlane.ToBytes(objectData, 0); - data.OffsetPosition.ToBytes(objectData, 16); + offsetPosition.ToBytes(objectData, 16); // data.Velocity.ToBytes(objectData, 28); // data.Acceleration.ToBytes(objectData, 40); - data.Rotation.ToBytes(objectData, 52); + rotation.ToBytes(objectData, 52); //data.AngularVelocity.ToBytes(objectData, 64); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); @@ -4965,7 +4991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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; - update.ParentID = data.ParentID; + update.ParentID = parentID; update.PathCurve = 16; update.PathScaleX = 100; update.PathScaleY = 100; -- cgit v1.1 From dc835717d66678eddfd802717a068c6131e460fc Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 14:08:35 +0100 Subject: Properly sequence updates of avatars and attachments so that we don't update attachments on child avatars or intermingle agent and attachment updates, which would render the root prim of huds invisible --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1ac3b76..2e86315 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3774,6 +3774,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP // doesn't seem to be attached, skip if (!found) continue; + + // On vehicle crossing, the attachments are received + // while the avatar is still a child. Don't send + // updates here because the LocalId has not yet + // been updated and the viewer will derender the + // attachments until the avatar becomes root. + if (sp.IsChildAgent) + continue; } if (part.ParentGroup.IsAttachment && m_disableFacelights) { -- cgit v1.1 From 1c0adfa6e025045b6c309943f886f641a4df8e38 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 22:26:17 +0100 Subject: Correct sit position calculations --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2e86315..f835e56 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4845,7 +4845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part != null && part != part.ParentGroup.RootPart) { position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; - rotation = presence.Rotation * part.RotationOffset; + rotation = part.RotationOffset * presence.Rotation; } } @@ -4974,7 +4974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part != null && part != part.ParentGroup.RootPart) { offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; - rotation = data.Rotation * part.RotationOffset; + rotation = part.RotationOffset * data.Rotation; parentID = part.ParentGroup.RootPart.LocalId; } } -- cgit v1.1 From 05cdf9bda910ced0da29474b8b40a58e8a423d69 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Mar 2012 01:53:58 +0000 Subject: more changes in undo/redo. Basicly moved control to llclientview.cs. later we can move back to a dispatcher function on SOG that handles the several cases( in a viwer independent way (?)) and calls current exec funtions. made cosmetic changes replacing decimals by hexs so bits are easier to read. Changed behavour of case 12 and 28 ( 0x0c and 0x1c) to make identical to 0x0d and 0x1d ( scale only and scale plus position). DOn't see 12 and 28 in use... cases 1c and 1d still broken --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 221 ++++++++++++++------- 1 file changed, 154 insertions(+), 67 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f835e56..c7fc827 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11518,183 +11518,269 @@ namespace OpenSim.Region.ClientStack.LindenUDP // } UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; + UpdateVector handlerUpdatePrimGroupScale; + + Quaternion arot; + Vector3 ascale; + Vector3 apos; +/*ubit from ll JIRA: + * 0x01 position + * 0x02 rotation + * 0x04 scale + + * 0x08 LINK_SET + * 0x10 UNIFORM for scale + */ + switch (block.Type) { - case 1: - Vector3 pos1 = new Vector3(block.Data, 0); + case 1: //change position sp + apos = new Vector3(block.Data, 0); UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; if (handlerUpdatePrimSinglePosition != null) { + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - handlerUpdatePrimSinglePosition(localId, pos1, this); + handlerUpdatePrimSinglePosition(localId, apos, this); + + part.IgnoreUndoUpdate = false; } break; - case 2: - Quaternion rot1 = new Quaternion(block.Data, 0, true); + case 2: // rotation sp + arot = new Quaternion(block.Data, 0, true); UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; if (handlerUpdatePrimSingleRotation != null) { - // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); - handlerUpdatePrimSingleRotation(localId, rot1, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimSingleRotation(localId, arot, this); + + part.IgnoreUndoUpdate = false; } break; - case 3: - Vector3 rotPos = new Vector3(block.Data, 0); - Quaternion rot2 = new Quaternion(block.Data, 12, true); + case 3: // position plus rotation + apos = new Vector3(block.Data, 0); + arot = new Quaternion(block.Data, 12, true); UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; if (handlerUpdatePrimSingleRotationPosition != null) { - // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); - // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); - handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimSingleRotationPosition(localId, arot, apos, this); + + part.IgnoreUndoUpdate = false; } break; - case 4: - case 20: - Vector3 scale4 = new Vector3(block.Data, 0); + case 4: // scale sp + case 0x14: // uniform scale sp + ascale = new Vector3(block.Data, 0); UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { - // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); - handlerUpdatePrimScale(localId, scale4, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); + + part.IgnoreUndoUpdate = false; } break; - case 5: - Vector3 scale1 = new Vector3(block.Data, 12); - Vector3 pos11 = new Vector3(block.Data, 0); + case 5: // scale and position sp + apos = new Vector3(block.Data, 0); + ascale = new Vector3(block.Data, 12); + handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, scale1, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; + if (handlerUpdatePrimSinglePosition != null) { - handlerUpdatePrimSinglePosition(localId, pos11, this); + handlerUpdatePrimSinglePosition(localId, apos, this); } + part.IgnoreUndoUpdate = false; } break; - case 9: - Vector3 pos2 = new Vector3(block.Data, 0); + case 0x15: //uniform scale and position + apos = new Vector3(block.Data, 0); + ascale = new Vector3(block.Data, 12); + + + handlerUpdatePrimScale = OnUpdatePrimScale; + if (handlerUpdatePrimScale != null) + { + part.StoreUndoState(false); + part.IgnoreUndoUpdate = true; + + // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + handlerUpdatePrimScale(localId, ascale, this); + handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; + if (handlerUpdatePrimSinglePosition != null) + { + handlerUpdatePrimSinglePosition(localId, apos, this); + } + + part.IgnoreUndoUpdate = false; + } + break; + +// now group related (bit 4) + case 9: //( 8 + 1 )group position + apos = new Vector3(block.Data, 0); UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; if (handlerUpdateVector != null) { - handlerUpdateVector(localId, pos2, this); + part.StoreUndoState(true); + part.IgnoreUndoUpdate = true; + + handlerUpdateVector(localId, apos, this); + + part.IgnoreUndoUpdate = false; } break; - case 10: - Quaternion rot3 = new Quaternion(block.Data, 0, true); + case 0x0A: // (8 + 2) group rotation + arot = new Quaternion(block.Data, 0, true); UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; if (handlerUpdatePrimRotation != null) { // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); - handlerUpdatePrimRotation(localId, rot3, this); + part.StoreUndoState(true); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimRotation(localId, arot, this); + + part.IgnoreUndoUpdate = false; } break; - case 11: - Vector3 pos3 = new Vector3(block.Data, 0); - Quaternion rot4 = new Quaternion(block.Data, 12, true); + case 0x0B: //( 8 + 2 + 1) group rotation and position + apos = new Vector3(block.Data, 0); + arot = new Quaternion(block.Data, 12, true); handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; if (handlerUpdatePrimGroupRotation != null) { // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); - handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); + part.StoreUndoState(true); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimGroupRotation(localId, apos, arot, this); + + part.IgnoreUndoUpdate = false; } break; - case 12: - case 28: - Vector3 scale7 = new Vector3(block.Data, 0); - UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; - if (handlerUpdatePrimGroupScale != null) + case 0x0C: // (8 + 4) group scale + // only afects root prim and only sent by viewer editor object tab scaling + // mouse edition only allows uniform scaling + // SL MAY CHANGE THIS in viewers + + ascale = new Vector3(block.Data, 0); + + handlerUpdatePrimScale = OnUpdatePrimScale; + if (handlerUpdatePrimScale != null) { // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); - handlerUpdatePrimGroupScale(localId, scale7, this); + part.StoreUndoState(false); // <- SL Exception make it apply to root prim and not group + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); + + part.IgnoreUndoUpdate = false; } break; - case 13: - Vector3 scale2 = new Vector3(block.Data, 12); - Vector3 pos4 = new Vector3(block.Data, 0); + case 0x0D: //(8 + 4 + 1) group scale and position + // exception as above + apos = new Vector3(block.Data, 0); + ascale = new Vector3(block.Data, 12); + handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, scale2, this); + part.StoreUndoState(false); // <- make it apply to root prim and not group + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); // Change the position based on scale (for bug number 246) handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); if (handlerUpdatePrimSinglePosition != null) { - handlerUpdatePrimSinglePosition(localId, pos4, this); + handlerUpdatePrimSinglePosition(localId, apos, this); } + + part.IgnoreUndoUpdate = false; } break; - case 29: - Vector3 scale5 = new Vector3(block.Data, 12); - Vector3 pos5 = new Vector3(block.Data, 0); + case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM + ascale = new Vector3(block.Data, 0); handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; if (handlerUpdatePrimGroupScale != null) { - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); part.StoreUndoState(true); part.IgnoreUndoUpdate = true; - handlerUpdatePrimGroupScale(localId, scale5, this); - handlerUpdateVector = OnUpdatePrimGroupPosition; - if (handlerUpdateVector != null) - { - handlerUpdateVector(localId, pos5, this); - } + handlerUpdatePrimGroupScale(localId, ascale, this); part.IgnoreUndoUpdate = false; } - break; - case 21: - Vector3 scale6 = new Vector3(block.Data, 12); - Vector3 pos6 = new Vector3(block.Data, 0); + case 0x1D: // (UNIFORM + GROUP + SCALE + POS) + apos = new Vector3(block.Data, 0); + Vector3 scale5 = new Vector3(block.Data, 12); + - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) + handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; + if (handlerUpdatePrimGroupScale != null) { - part.StoreUndoState(false); + // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + part.StoreUndoState(true); part.IgnoreUndoUpdate = true; - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, scale6, this); - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - if (handlerUpdatePrimSinglePosition != null) + handlerUpdatePrimGroupScale(localId, scale5, this); + handlerUpdateVector = OnUpdatePrimGroupPosition; + + if (handlerUpdateVector != null) { - handlerUpdatePrimSinglePosition(localId, pos6, this); + handlerUpdateVector(localId, apos, this); } part.IgnoreUndoUpdate = false; } + break; default: @@ -11704,6 +11790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // for (int j = 0; j < parts.Length; j++) // parts[j].IgnoreUndoUpdate = false; + } } } -- cgit v1.1 From e5786ba0435bee04246fcd689a103f2df338dba9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Mar 2012 02:56:14 +0000 Subject: more changes on undo/redo group scaling seems to work better --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c7fc827..051c4fa 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11760,7 +11760,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 0x1D: // (UNIFORM + GROUP + SCALE + POS) apos = new Vector3(block.Data, 0); - Vector3 scale5 = new Vector3(block.Data, 12); + ascale = new Vector3(block.Data, 12); handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; @@ -11770,7 +11770,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP part.StoreUndoState(true); part.IgnoreUndoUpdate = true; - handlerUpdatePrimGroupScale(localId, scale5, this); + handlerUpdatePrimGroupScale(localId, ascale, this); + handlerUpdateVector = OnUpdatePrimGroupPosition; if (handlerUpdateVector != null) -- cgit v1.1 From 908abb1c3dded307e769abac71f660b835875975 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 10 Mar 2012 20:32:19 +0000 Subject: BIG MESS. changed Iclient interface so only one event is used to inform scene about position scale or rotation change by client (others can be added). Its served at SceneGraph that does permition checks, undostore and sends down to SOG. changed values are stored in a class (ObjectChangeData) and what is changed as a enum (ObjectChangeWhat) with bit fields and 'macros' of this for better readability (at top of scenegraph.cs lasy to find better place for now) this can be extended for other things clients changes and need undo/redo. SOG process acording to what is changed. Changed UNDO/redo to use this also (warning is only storing what is changed, previus stored all, this must be checked for side efects. to save all PRS change commented line in scenegraph). Still have excessive calls to ScheduleGroupForTerseUpdate. **** UNTESTED **** --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 156 +++++++++++++++++++-- 1 file changed, 143 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 051c4fa..7d51323 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -125,6 +125,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; public event UpdatePrimFlags OnUpdatePrimFlags; public event UpdatePrimTexture OnUpdatePrimTexture; + public event ClientChangeObject onClientChangeObject; public event UpdateVector OnUpdatePrimGroupPosition; public event UpdateVector OnUpdatePrimSinglePosition; public event UpdatePrimRotation OnUpdatePrimGroupRotation; @@ -11517,22 +11518,151 @@ namespace OpenSim.Region.ClientStack.LindenUDP // parts[j].IgnoreUndoUpdate = true; // } - UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; - UpdateVector handlerUpdatePrimGroupScale; +// UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; +// UpdateVector handlerUpdatePrimGroupScale; - Quaternion arot; - Vector3 ascale; - Vector3 apos; -/*ubit from ll JIRA: - * 0x01 position - * 0x02 rotation - * 0x04 scale + ClientChangeObject updatehandler = onClientChangeObject; + + if (updatehandler != null) + { + ObjectChangeData udata = new ObjectChangeData(); + + /*ubit from ll JIRA: + * 0x01 position + * 0x02 rotation + * 0x04 scale - * 0x08 LINK_SET - * 0x10 UNIFORM for scale - */ + * 0x08 LINK_SET + * 0x10 UNIFORM for scale + */ + + // translate to internal changes + // not all cases .. just the ones older code did + + switch (block.Type) + { + case 1: //change position sp + udata.position = new Vector3(block.Data, 0); + + udata.what = ObjectChangeWhat.primP; + updatehandler(localId, udata, this); + break; + + case 2: // rotation sp + udata.rotation = new Quaternion(block.Data, 0, true); + + udata.what = ObjectChangeWhat.primR; + updatehandler(localId, udata, this); + break; + + case 3: // position plus rotation + udata.position = new Vector3(block.Data, 0); + udata.rotation = new Quaternion(block.Data, 12, true); + + udata.what = ObjectChangeWhat.primPR; + updatehandler(localId, udata, this); + + break; + + case 4: // scale sp + udata.scale = new Vector3(block.Data, 0); + udata.what = ObjectChangeWhat.primS; + + updatehandler(localId, udata, this); + break; + + case 0x14: // uniform scale sp + udata.scale = new Vector3(block.Data, 0); + + udata.what = ObjectChangeWhat.primUS; + updatehandler(localId, udata, this); + break; + + case 5: // scale and position sp + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + udata.what = ObjectChangeWhat.primPS; + updatehandler(localId, udata, this); + break; + + case 0x15: //uniform scale and position + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + udata.what = ObjectChangeWhat.primPUS; + updatehandler(localId, udata, this); + break; + // now group related (bit 4) + case 9: //( 8 + 1 )group position + udata.position = new Vector3(block.Data, 0); + udata.what = ObjectChangeWhat.groupP; + updatehandler(localId, udata, this); + break; + + case 0x0A: // (8 + 2) group rotation + udata.rotation = new Quaternion(block.Data, 0, true); + + udata.what = ObjectChangeWhat.groupR; + updatehandler(localId, udata, this); + break; + + case 0x0B: //( 8 + 2 + 1) group rotation and position + udata.position = new Vector3(block.Data, 0); + udata.rotation = new Quaternion(block.Data, 12, true); + + udata.what = ObjectChangeWhat.groupPR; + updatehandler(localId, udata, this); + break; + + case 0x0C: // (8 + 4) group scale + // only afects root prim and only sent by viewer editor object tab scaling + // mouse edition only allows uniform scaling + // SL MAY CHANGE THIS in viewers + + udata.scale = new Vector3(block.Data, 0); + + // udata.what = ObjectChangeWhat.groupS; + udata.what = ObjectChangeWhat.primS; // to conform to current SL + updatehandler(localId, udata, this); + + break; + + case 0x0D: //(8 + 4 + 1) group scale and position + // exception as above + + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + // udata.what = ObjectChangeWhat.groupPS; + udata.what = ObjectChangeWhat.primPS; // to conform to current SL + updatehandler(localId, udata, this); + break; + + case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM + udata.scale = new Vector3(block.Data, 0); + + udata.what = ObjectChangeWhat.groupUS; + updatehandler(localId, udata, this); + break; + + case 0x1D: // (UNIFORM + GROUP + SCALE + POS) + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + udata.what = ObjectChangeWhat.groupPUS; + updatehandler(localId, udata, this); + break; + + default: + m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); + break; + } + } + +/* switch (block.Type) { case 1: //change position sp @@ -11788,7 +11918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); break; } - +*/ // for (int j = 0; j < parts.Length; j++) // parts[j].IgnoreUndoUpdate = false; -- cgit v1.1 From 1f7c0c2ea00154366964c0e75fb05a92d4b8f764 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 11 Mar 2012 03:28:17 +0000 Subject: cleanup + comments --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 277 --------------------- 1 file changed, 277 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7d51323..7935222 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11506,21 +11506,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { -// m_log.DebugFormat( -// "[CLIENT]: Processing block {0} type {1} for {2} {3}", -// i, block.Type, part.Name, part.LocalId); - -// // Do this once since fetch parts creates a new array. -// SceneObjectPart[] parts = part.ParentGroup.Parts; -// for (int j = 0; j < parts.Length; j++) -// { -// part.StoreUndoState(); -// parts[j].IgnoreUndoUpdate = true; -// } - -// UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; -// UpdateVector handlerUpdatePrimGroupScale; - ClientChangeObject updatehandler = onClientChangeObject; if (updatehandler != null) @@ -11561,7 +11546,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.what = ObjectChangeWhat.primPR; updatehandler(localId, udata, this); - break; case 4: // scale sp @@ -11662,270 +11646,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -/* - switch (block.Type) - { - case 1: //change position sp - apos = new Vector3(block.Data, 0); - - UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - if (handlerUpdatePrimSinglePosition != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - handlerUpdatePrimSinglePosition(localId, apos, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 2: // rotation sp - arot = new Quaternion(block.Data, 0, true); - - UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; - if (handlerUpdatePrimSingleRotation != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimSingleRotation(localId, arot, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 3: // position plus rotation - apos = new Vector3(block.Data, 0); - arot = new Quaternion(block.Data, 12, true); - - UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; - if (handlerUpdatePrimSingleRotationPosition != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimSingleRotationPosition(localId, arot, apos, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 4: // scale sp - case 0x14: // uniform scale sp - ascale = new Vector3(block.Data, 0); - - UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 5: // scale and position sp - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - - if (handlerUpdatePrimSinglePosition != null) - { - handlerUpdatePrimSinglePosition(localId, apos, this); - } - part.IgnoreUndoUpdate = false; - } - break; - - case 0x15: //uniform scale and position - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - part.StoreUndoState(false); - part.IgnoreUndoUpdate = true; - - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, ascale, this); - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - if (handlerUpdatePrimSinglePosition != null) - { - handlerUpdatePrimSinglePosition(localId, apos, this); - } - - part.IgnoreUndoUpdate = false; - } - break; - -// now group related (bit 4) - case 9: //( 8 + 1 )group position - apos = new Vector3(block.Data, 0); - - UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; - - if (handlerUpdateVector != null) - { - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdateVector(localId, apos, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0A: // (8 + 2) group rotation - arot = new Quaternion(block.Data, 0, true); - - UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; - if (handlerUpdatePrimRotation != null) - { - // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimRotation(localId, arot, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0B: //( 8 + 2 + 1) group rotation and position - apos = new Vector3(block.Data, 0); - arot = new Quaternion(block.Data, 12, true); - - handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; - if (handlerUpdatePrimGroupRotation != null) - { - // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimGroupRotation(localId, apos, arot, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0C: // (8 + 4) group scale - // only afects root prim and only sent by viewer editor object tab scaling - // mouse edition only allows uniform scaling - // SL MAY CHANGE THIS in viewers - - ascale = new Vector3(block.Data, 0); - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); - part.StoreUndoState(false); // <- SL Exception make it apply to root prim and not group - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0D: //(8 + 4 + 1) group scale and position - // exception as above - - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - part.StoreUndoState(false); // <- make it apply to root prim and not group - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - // Change the position based on scale (for bug number 246) - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - if (handlerUpdatePrimSinglePosition != null) - { - handlerUpdatePrimSinglePosition(localId, apos, this); - } - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM - ascale = new Vector3(block.Data, 0); - - handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; - if (handlerUpdatePrimGroupScale != null) - { - // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimGroupScale(localId, ascale, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x1D: // (UNIFORM + GROUP + SCALE + POS) - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - - handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; - if (handlerUpdatePrimGroupScale != null) - { - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimGroupScale(localId, ascale, this); - - handlerUpdateVector = OnUpdatePrimGroupPosition; - - if (handlerUpdateVector != null) - { - handlerUpdateVector(localId, apos, this); - } - - part.IgnoreUndoUpdate = false; - } - - break; - - default: - m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); - break; - } -*/ -// for (int j = 0; j < parts.Length; j++) -// parts[j].IgnoreUndoUpdate = false; - } } } - return true; } -- cgit v1.1 From ebcd4910a21726c830796cfe14c0792007b766b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 13:08:32 +0100 Subject: Refactor, move OjectChangeData into it's own file and rename ObjectChnageWhat what into ObjectChangeType change. What is no name for a variable or type! --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4c43c10..18af623 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11504,14 +11504,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 1: //change position sp udata.position = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.primP; + udata.change = ObjectChangeType.primP; updatehandler(localId, udata, this); break; case 2: // rotation sp udata.rotation = new Quaternion(block.Data, 0, true); - udata.what = ObjectChangeWhat.primR; + udata.change = ObjectChangeType.primR; updatehandler(localId, udata, this); break; @@ -11519,13 +11519,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.rotation = new Quaternion(block.Data, 12, true); - udata.what = ObjectChangeWhat.primPR; + udata.change = ObjectChangeType.primPR; updatehandler(localId, udata, this); break; case 4: // scale sp udata.scale = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.primS; + udata.change = ObjectChangeType.primS; updatehandler(localId, udata, this); break; @@ -11533,7 +11533,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 0x14: // uniform scale sp udata.scale = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.primUS; + udata.change = ObjectChangeType.primUS; updatehandler(localId, udata, this); break; @@ -11541,7 +11541,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - udata.what = ObjectChangeWhat.primPS; + udata.change = ObjectChangeType.primPS; updatehandler(localId, udata, this); break; @@ -11549,7 +11549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - udata.what = ObjectChangeWhat.primPUS; + udata.change = ObjectChangeType.primPUS; updatehandler(localId, udata, this); break; @@ -11557,14 +11557,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 9: //( 8 + 1 )group position udata.position = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.groupP; + udata.change = ObjectChangeType.groupP; updatehandler(localId, udata, this); break; case 0x0A: // (8 + 2) group rotation udata.rotation = new Quaternion(block.Data, 0, true); - udata.what = ObjectChangeWhat.groupR; + udata.change = ObjectChangeType.groupR; updatehandler(localId, udata, this); break; @@ -11572,7 +11572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.rotation = new Quaternion(block.Data, 12, true); - udata.what = ObjectChangeWhat.groupPR; + udata.change = ObjectChangeType.groupPR; updatehandler(localId, udata, this); break; @@ -11583,8 +11583,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.scale = new Vector3(block.Data, 0); - // udata.what = ObjectChangeWhat.groupS; - udata.what = ObjectChangeWhat.primS; // to conform to current SL + // udata.change = ObjectChangeType.groupS; + udata.change = ObjectChangeType.primS; // to conform to current SL updatehandler(localId, udata, this); break; @@ -11595,15 +11595,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - // udata.what = ObjectChangeWhat.groupPS; - udata.what = ObjectChangeWhat.primPS; // to conform to current SL + // udata.change = ObjectChangeType.groupPS; + udata.change = ObjectChangeType.primPS; // to conform to current SL updatehandler(localId, udata, this); break; case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM udata.scale = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.groupUS; + udata.change = ObjectChangeType.groupUS; updatehandler(localId, udata, this); break; @@ -11611,7 +11611,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - udata.what = ObjectChangeWhat.groupPUS; + udata.change = ObjectChangeType.groupPUS; updatehandler(localId, udata, this); break; -- cgit v1.1 From 3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Mar 2012 17:56:32 +0000 Subject: initial suport for ExtraPhysical parts parameters. Reading from llclientView to SOP including SOPserialization (not to databases). No action on physics still. No send to viewer, etc --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 18af623..23beaec 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7006,10 +7006,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP // 46,47,48 are special positions within the packet // This may change so perhaps we need a better way // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) - bool UsePhysics = (data[46] != 0) ? true : false; - bool IsTemporary = (data[47] != 0) ? true : false; - bool IsPhantom = (data[48] != 0) ? true : false; - handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); + /* + bool UsePhysics = (data[46] != 0) ? true : false; + bool IsTemporary = (data[47] != 0) ? true : false; + bool IsPhantom = (data[48] != 0) ? true : false; + handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); + */ + bool UsePhysics = flags.AgentData.UsePhysics; + bool IsPhantom = flags.AgentData.IsPhantom; + bool IsTemporary = flags.AgentData.IsTemporary; + ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics; + ExtraPhysicsData physdata = new ExtraPhysicsData(); + + if (blocks == null || blocks.Length == 0) + { + physdata.PhysShapeType = PhysShapeType.invalid; + } + else + { + ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0]; + physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType; + physdata.Bounce = phsblock.Restitution; + physdata.Density = phsblock.Density; + physdata.Friction = phsblock.Friction; + } + handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); } return true; } -- cgit v1.1 From f415eb84e17772a997e8b40ec2d7469cac40b55d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 20:06:39 +0100 Subject: Implement the cap to send extra physics params to the viewer. Not functional yet because the parameters are not actually stored anywhere yet. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 35cb575..2974058 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -96,6 +96,7 @@ namespace OpenSim.Region.ClientStack.Linden // private static readonly string m_fetchInventoryPath = "0006/"; private static readonly string m_copyFromNotecardPath = "0007/"; // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. + private static readonly string m_getObjectPhysicsDataPath = "0101/"; // These are callbacks which will be setup by the scene so that we can update scene data when we @@ -182,6 +183,8 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); + IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); + m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); // As of RC 1.22.9 of the Linden client this is // supported @@ -799,6 +802,41 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 200; return LLSDHelpers.SerialiseLLSDReply(response); } + + public string GetObjectPhysicsData(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + OSDArray object_ids = (OSDArray)req["object_ids"]; + + for (int i = 0 ; i < object_ids.Count ; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + OSDMap object_data = new OSDMap(); + + object_data["PhysicsShapeType"] = OSD.FromInteger(1); + if (false) // Check whether to include the rest + { + object_data["Density"] = OSD.FromReal(1); + object_data["Friction"] = OSD.FromReal(1); + object_data["Restitution"] = OSD.FromReal(1); + object_data["GravityMultiplier"] = OSD.FromReal(1); + } + + resp[uuid.ToString()] = object_data; + } + } + + string response = OSDParser.SerializeLLSDXmlString(resp); + Console.WriteLine(response); + return response; + } } public class AssetUploader -- cgit v1.1 From d4e6834f99db25ad0461cec72b58876fa299844b Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 20:49:16 +0100 Subject: Hook up the new cap to the SOP changes --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 2974058..df65af9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -820,14 +820,11 @@ namespace OpenSim.Region.ClientStack.Linden { OSDMap object_data = new OSDMap(); - object_data["PhysicsShapeType"] = OSD.FromInteger(1); - if (false) // Check whether to include the rest - { - object_data["Density"] = OSD.FromReal(1); - object_data["Friction"] = OSD.FromReal(1); - object_data["Restitution"] = OSD.FromReal(1); - object_data["GravityMultiplier"] = OSD.FromReal(1); - } + object_data["PhysicsShapeType"] = obj.PhysicsShapeType; + object_data["Density"] = obj.Density; + object_data["Friction"] = obj.Friction; + object_data["Restitution"] = obj.Bounciness; + object_data["GravityMultiplier"] = obj.GravityModifier; resp[uuid.ToString()] = object_data; } -- cgit v1.1 From cf9ebd301c32fa7cd991e78647ce011b0aefc796 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Mar 2012 18:24:04 +0000 Subject: bug fixs, added a default physics shape estimator based on being a mesh or not and use it on unlink if new root part as type none. Viewer doesn't get updated even with fullupdates we are missing something still --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 23beaec..160a5d1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7029,7 +7029,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP physdata.Bounce = phsblock.Restitution; physdata.Density = phsblock.Density; physdata.Friction = phsblock.Friction; + physdata.GravitationModifier = phsblock.GravityMultiplier; } + handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); } return true; -- cgit v1.1 From 84ca09f7c5cec051014181853083e52691bb7e07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Mar 2012 02:24:13 +0000 Subject: added ObjectPhysicsProperties http event message to send viewer that data. For now on caps/EventQueue, and still only used on a material change... --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 8 +++++++ .../Linden/Caps/EventQueue/EventQueueHelper.cs | 20 ++++++++++++++++ .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 ++++++++++++++++++++++ 3 files changed, 56 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 7c07c56..a91b02c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -805,5 +805,13 @@ namespace OpenSim.Region.ClientStack.Linden { return EventQueueHelper.BuildEvent(eventName, eventBody); } + + public void partPhysicsProperties(uint localID, byte physhapetype, + float density, float friction, float bounce, float gravmod,UUID avatarID) + { + OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype, + density, friction, bounce, gravmod); + Enqueue(item, avatarID); + } } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 3f49aba..b9222e3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -395,5 +395,25 @@ namespace OpenSim.Region.ClientStack.Linden return message; } + public static OSD partPhysicsProperties(uint localID, byte physhapetype, + float density, float friction, float bounce, float gravmod) + { + + OSDMap physinfo = new OSDMap(6); + physinfo["LocalID"] = localID; + physinfo["Density"] = density; + physinfo["Friction"] = friction; + physinfo["GravityMultiplier"] = gravmod; + physinfo["Restitution"] = bounce; + physinfo["PhysicsShapeType"] = (int)physhapetype; + + OSDArray array = new OSDArray(1); + array.Add(physinfo); + + OSDMap llsdBody = new OSDMap(1); + llsdBody.Add("ObjectData", array); + + return BuildEvent("ObjectPhysicsProperties", llsdBody); + } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 160a5d1..dd3b8aa 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2609,6 +2609,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SendPartPhysicsProprieties(ISceneEntity entity) + { + SceneObjectPart part = (SceneObjectPart)entity; + if (part != null && AgentId != UUID.Zero) + { + try + { + IEventQueue eq = Scene.RequestModuleInterface(); + if (eq != null) + { + uint localid = part.LocalId; + byte physshapetype = part.PhysicsShapeType; + float density = part.Density; + float friction = part.Friction; + float bounce = part.Bounciness; + float gravmod = part.GravityModifier; + + eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); + } + } + catch (Exception ex) + { + m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString()); + } + } + } + + public void SendGroupNameReply(UUID groupLLUID, string GroupName) { -- cgit v1.1 From 15ad5f492b8150ff81d969a389e32edb35227b19 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Mar 2012 10:25:18 +0000 Subject: Playing with object costs CAPS ... --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 120 ++++++++++++++++++++- 1 file changed, 118 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index df65af9..5542680 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -97,7 +97,9 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_copyFromNotecardPath = "0007/"; // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. private static readonly string m_getObjectPhysicsDataPath = "0101/"; - + private static readonly string m_getObjectCostPath = "0102/"; + private static readonly string m_ResourceCostSelectedPath = "0103/"; + // These are callbacks which will be setup by the scene so that we can update scene data when we // receive capability calls @@ -185,7 +187,12 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); - + IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); + m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); + IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); + m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + + // As of RC 1.22.9 of the Linden client this is // supported @@ -834,6 +841,115 @@ namespace OpenSim.Region.ClientStack.Linden Console.WriteLine(response); return response; } + + public string GetObjectCost(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + // see being triggered but see no efect .. have something wrong ?? + // + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + + OSDArray object_ids = (OSDArray)req["object_ids"]; + + for (int i = 0; i < object_ids.Count; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + // only see root parts .. so guess should go by SOG only + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + OSDMap object_data = new OSDMap(); + + object_data["linked_set_resource_cost"] = 1.0f; + object_data["resource_cost"] = 1.0f; + object_data["physics_cost"] = 1.0f; + object_data["linked_set_physics_cost"] = 1.0f; + + resp[uuid.ToString()] = object_data; + } + } + + string response = OSDParser.SerializeLLSDXmlString(resp); + Console.WriteLine(response); + return response; + } + + public string ResourceCostSelected(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + + + float phys=0; + float stream=0; + float simul=0; + + if (req.ContainsKey("selected_roots")) + { + OSDArray object_ids = (OSDArray)req["selected_roots"]; + + // should go by SOG suming costs for all parts + // ll v3 works ok with several objects select we get the list and adds ok + // FS calls per object so results are wrong guess fs bug + for (int i = 0; i < object_ids.Count; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + phys += 0.1f; // just to see... + stream += 0.2f; + simul += 0.5f; + } + } + } + else if (req.ContainsKey("selected_prims")) + { + OSDArray object_ids = (OSDArray)req["selected_prims"]; + + // don't see in use in any of the 2 viewers + // guess it should be for edit linked but... nothing + // should go to SOP per part + for (int i = 0; i < object_ids.Count; i++) + { + UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); + if (obj != null) + { + phys += 0.1f; + stream += 0.2f; + simul += 0.5f; + } + } + } + + if (simul != 0) + { + OSDMap object_data = new OSDMap(); + + object_data["physics"] = phys; + object_data["streaming"] = stream; + object_data["simulation"] = simul; + + resp["selected"] = object_data; + } + + string response = OSDParser.SerializeLLSDXmlString(resp); + Console.WriteLine(response); + return response; + } + + + + + } public class AssetUploader -- cgit v1.1 From ae8e089b9c73a6a675038759e3e3f9491819eb72 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Mar 2012 15:33:49 +0000 Subject: some more work on costs --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 56 +++++++++++++--------- 1 file changed, 34 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 5542680..dfd5c98 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -845,9 +845,7 @@ namespace OpenSim.Region.ClientStack.Linden public string GetObjectCost(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - // see being triggered but see no efect .. have something wrong ?? - // + { OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); OSDMap resp = new OSDMap(); @@ -856,19 +854,29 @@ namespace OpenSim.Region.ClientStack.Linden for (int i = 0; i < object_ids.Count; i++) { UUID uuid = object_ids[i].AsUUID(); + + SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); - // only see root parts .. so guess should go by SOG only - SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); - if (obj != null) + if (part != null) { - OSDMap object_data = new OSDMap(); + SceneObjectGroup grp = part.ParentGroup; + if (grp != null) + { + float linksetCost; + float linksetPhysCost; + float partCost; + float partPhysCost; - object_data["linked_set_resource_cost"] = 1.0f; - object_data["resource_cost"] = 1.0f; - object_data["physics_cost"] = 1.0f; - object_data["linked_set_physics_cost"] = 1.0f; + grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost); - resp[uuid.ToString()] = object_data; + OSDMap object_data = new OSDMap(); + object_data["linked_set_resource_cost"] = linksetCost; + object_data["resource_cost"] = partCost; + object_data["physics_cost"] = partPhysCost; + object_data["linked_set_physics_cost"] = linksetPhysCost; + + resp[uuid.ToString()] = object_data; + } } } @@ -899,13 +907,17 @@ namespace OpenSim.Region.ClientStack.Linden for (int i = 0; i < object_ids.Count; i++) { UUID uuid = object_ids[i].AsUUID(); + float Physc; + float simulc; + float streamc; - SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); - if (obj != null) + SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid); + if (grp != null) { - phys += 0.1f; // just to see... - stream += 0.2f; - simul += 0.5f; + grp.GetSelectedCosts(out Physc, out streamc, out simulc); + phys += Physc; + stream += streamc; + simul += simulc; } } } @@ -920,12 +932,12 @@ namespace OpenSim.Region.ClientStack.Linden { UUID uuid = object_ids[i].AsUUID(); - SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); - if (obj != null) + SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); + if (part != null) { - phys += 0.1f; - stream += 0.2f; - simul += 0.5f; + phys += part.PhysicsCost; + stream += part.StreamingCost; + simul += part.SimulationCost; } } } -- cgit v1.1 From 618244f285a521971808bc649be538cf831f3e66 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 19 Mar 2012 14:39:19 +0100 Subject: Remove debug output using Console.WriteLine and trim excessive whitespace --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index dfd5c98..6c44175 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -838,7 +838,6 @@ namespace OpenSim.Region.ClientStack.Linden } string response = OSDParser.SerializeLLSDXmlString(resp); - Console.WriteLine(response); return response; } @@ -881,7 +880,6 @@ namespace OpenSim.Region.ClientStack.Linden } string response = OSDParser.SerializeLLSDXmlString(resp); - Console.WriteLine(response); return response; } @@ -954,14 +952,8 @@ namespace OpenSim.Region.ClientStack.Linden } string response = OSDParser.SerializeLLSDXmlString(resp); - Console.WriteLine(response); return response; } - - - - - } public class AssetUploader -- cgit v1.1 From efd7ff31468755c7066c68fb6b5910f7b18aa3f0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 20 Mar 2012 16:46:16 +0000 Subject: add some more notifications about changes on physical parameters ( still incomple and there should be a better away ) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index dd3b8aa..ba5f4d5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2633,6 +2633,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString()); } + part.UpdatePhysRequired = false; } } -- cgit v1.1 From 2a8b9a47b2bcb7ca1c4f96ee81c8d2ae0b4930eb Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 01:15:56 +0200 Subject: Add SendRemoveInventoryFolders which allows to remove one or more folders from the viewer's inventory view. For HG v2.0. More to come --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 41 +++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c40c0ec..557ab30 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Handles new client connections /// Constructor takes a single Packet and authenticates everything /// - public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector + public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IClientIPEndpoint, IStatsCollector { /// /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. @@ -460,6 +460,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // DebugPacketLevel = 1; RegisterInterface(this); + RegisterInterface(this); RegisterInterface(this); RegisterInterface(this); @@ -12421,5 +12422,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (reply != null) OutPacket(reply, ThrottleOutPacketType.Task); } + + public void SendRemoveInventoryFolders(UUID[] folders) + { + IEventQueue eq = Scene.RequestModuleInterface(); + + if (eq == null) + { + m_log.DebugFormat("[LLCLIENT]: Null event queue"); + return; + } + + OSDMap llsd = new OSDMap(3); + + OSDMap AgentDataMap = new OSDMap(1); + AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); + + OSDArray AgentData = new OSDArray(1); + AgentData.Add(AgentDataMap); + + llsd.Add("AgentData", AgentData); + + OSDArray FolderData = new OSDArray(); + + foreach (UUID folder in folders) + { + OSDMap FolderDataMap = new OSDMap(2); + FolderDataMap.Add("FolderID", OSD.FromUUID(folder)); + FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + + FolderData.Add(FolderDataMap); + } + + llsd.Add("FolderData", FolderData); + + eq.Enqueue(BuildEvent("RemoveInventoryFolder", + llsd), AgentId); + } } } -- cgit v1.1 From 4ab63bfe978ce24c7a5621c9be568a0ec7254d58 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 02:33:15 +0200 Subject: Typo fix --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 400757f..d0920d2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12541,7 +12541,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (InventoryItemBase item in items) { OSDMap ItemDataMap = new OSDMap(); - ItemData.Add(DataMap); + ItemData.Add(ItemDataMap); } llsd.Add("ItemData", ItemData); -- cgit v1.1 From 8728b9ea8164e9bdb8da384facff84c8f269df45 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 31 Mar 2012 01:34:39 +0200 Subject: Implement bulk inventory update over CAPS (not recursive by design, do NOT CHANGE THIS, needed for HG 2.0) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 48 +++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 54fc7f4..1be282a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12455,7 +12455,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ItemData.Add(ItemDataMap); } - llsd.Add("ItemData", ItemData); + llsd.Add("InventoryData", ItemData); eq.Enqueue(BuildEvent("RemoveInventoryItem", llsd), AgentId); @@ -12499,6 +12499,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP llsd), AgentId); } + private byte[] EncodeU32(uint val) + { + byte[] ret = BitConverter.GetBytes(val); + if (BitConverter.IsLittleEndian) + Array.Reverse(ret); + return ret; + } + public void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items) { IEventQueue eq = Scene.RequestModuleInterface(); @@ -12514,6 +12522,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OSDMap AgentDataMap = new OSDMap(1); AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); + AgentDataMap.Add("TransactionID", OSD.FromUUID(UUID.Random())); OSDArray AgentData = new OSDArray(1); AgentData.Add(AgentDataMap); @@ -12541,10 +12550,47 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (InventoryItemBase item in items) { OSDMap ItemDataMap = new OSDMap(); + + ItemDataMap.Add("ItemID", OSD.FromUUID(item.ID)); + ItemDataMap.Add("FolderID", OSD.FromUUID(item.Folder)); + + ItemDataMap.Add("CreatorID", OSD.FromUUID(item.CreatorIdAsUuid)); + ItemDataMap.Add("OwnerID", OSD.FromUUID(item.Owner)); + ItemDataMap.Add("GroupID", OSD.FromUUID(item.GroupID)); + ItemDataMap.Add("BaseMask", OSD.FromBinary(EncodeU32((uint)item.BasePermissions))); + ItemDataMap.Add("OwnerMask", OSD.FromBinary(EncodeU32((uint)item.CurrentPermissions))); + ItemDataMap.Add("GroupMask", OSD.FromBinary(EncodeU32((uint)item.GroupPermissions))); + ItemDataMap.Add("EveryoneMask", OSD.FromBinary(EncodeU32((uint)item.EveryOnePermissions))); + ItemDataMap.Add("NextOwnerMask", OSD.FromBinary(EncodeU32((uint)item.NextPermissions))); + ItemDataMap.Add("GroupOwned", OSD.FromBoolean(item.GroupOwned)); + ItemDataMap.Add("AssetID", OSD.FromUUID(item.AssetID)); + ItemDataMap.Add("Type", OSD.FromInteger(item.AssetType)); + ItemDataMap.Add("InvType", OSD.FromInteger(item.InvType)); + ItemDataMap.Add("Flags", OSD.FromBinary(EncodeU32((uint)item.Flags))); + ItemDataMap.Add("SaleType", OSD.FromInteger((byte)item.SaleType)); + ItemDataMap.Add("SalePrice", OSD.FromInteger(item.SalePrice)); + ItemDataMap.Add("Name", OSD.FromString(item.Name)); + ItemDataMap.Add("Description", OSD.FromString(item.Description)); + ItemDataMap.Add("CreationDate", OSD.FromInteger(item.CreationDate)); + + ItemDataMap.Add("CRC", OSD.FromBinary(EncodeU32( + Helpers.InventoryCRC(1000, 0, (sbyte)item.InvType, + (sbyte)item.AssetType, item.AssetID, + item.GroupID, 100, + item.Owner, item.CreatorIdAsUuid, + item.ID, item.Folder, + (uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All, + (uint)PermissionMask.All) + ))); + ItemDataMap.Add("CallbackID", 0); + ItemData.Add(ItemDataMap); } llsd.Add("ItemData", ItemData); + + eq.Enqueue(BuildEvent("BulkUpdateInventory", + llsd), AgentId); } } } -- cgit v1.1 From fd19601c6ba3b474201e2dde514c7d7c94e74e82 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 26 Apr 2012 16:17:46 +0100 Subject: Help big boobies to dance (avatar visualParams). May not persist and need more lobe ? --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1004be6..40ebed1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3533,7 +3533,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); // TODO: don't create new blocks if recycling an old packet - avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; + avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; avp.ObjectData.TextureEntry = textureEntry; AvatarAppearancePacket.VisualParamBlock avblock = null; -- cgit v1.1 From 74eafb78ebe854c5c36f489b92c8c68328e2a80d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 7 May 2012 23:03:07 +0200 Subject: Fix moving no-mod objects. Fixes a regression introduced with the undo fix --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 40ebed1..bb76717 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11631,8 +11631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.scale = new Vector3(block.Data, 0); - // udata.change = ObjectChangeType.groupS; - udata.change = ObjectChangeType.primS; // to conform to current SL + udata.change = ObjectChangeType.groupS; updatehandler(localId, udata, this); break; @@ -11643,8 +11642,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - // udata.change = ObjectChangeType.groupPS; - udata.change = ObjectChangeType.primPS; // to conform to current SL + udata.change = ObjectChangeType.groupPS; updatehandler(localId, udata, this); break; -- cgit v1.1 From 7461fe4554f8104212071e3e01b07786f8eb546f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 12 May 2012 15:27:37 +0100 Subject: ªTEST MESS* reduce animation packets send. Added onchangeanim event with parameters to define if to add or remove, and if to send anims pack on that evocation, etc --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index bb76717..7db6014 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -98,6 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event AvatarPickerRequest OnAvatarPickerRequest; public event StartAnim OnStartAnim; public event StopAnim OnStopAnim; + public event ChangeAnim OnChangeAnim; public event Action OnRequestAvatarsData; public event LinkObjects OnLinkObjects; public event DelinkObjects OnDelinkObjects; @@ -6386,7 +6387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } #endregion - +/* StartAnim handlerStartAnim = null; StopAnim handlerStopAnim = null; @@ -6410,6 +6411,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } return true; +*/ + ChangeAnim handlerChangeAnim = null; + + for (int i = 0; i < AgentAni.AnimationList.Length; i++) + { + handlerChangeAnim = OnChangeAnim; + if (handlerChangeAnim != null) + { + handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); + } + } + + handlerChangeAnim = OnChangeAnim; + if (handlerChangeAnim != null) + { + handlerChangeAnim(UUID.Zero, false, true); + } + + return true; } private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) -- cgit v1.1 From 7652b3a957f4e124c5142a3480fcc09a97e08be9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 13:13:31 +0100 Subject: udp transfer: make number packets estimation coerent with number actually sent. Use the safer lower max packet size defined in os source (600) and not OMV one (1100). --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7db6014..2d46a5b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -329,6 +329,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Prioritizer m_prioritizer; private bool m_disableFacelights = false; + private const uint MaxTransferBytesPerPacket = 600; + + /// /// List used in construction of data blocks for an object update packet. This is to stop us having to /// continually recreate it. @@ -2738,7 +2741,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP else { int processedLength = 0; - int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; +// int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; + + int maxChunkSize = (int) MaxTransferBytesPerPacket; int packetNumber = 0; while (processedLength < req.AssetInf.Data.Length) @@ -12202,7 +12207,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private static int CalculateNumPackets(byte[] data) { - const uint m_maxPacketSize = 600; +// const uint m_maxPacketSize = 600; + uint m_maxPacketSize = MaxTransferBytesPerPacket; int numPackets = 1; if (data == null) -- cgit v1.1 From 4358bb8f850863aec8a519c6f533c298630dc1af Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 May 2012 00:50:47 +0200 Subject: Fix the log standing attach-from-world bug. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 50 ++++++++++++++-------- 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2d46a5b..5912a15 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3761,24 +3761,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart part = (SceneObjectPart)update.Entity; - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - lock (m_killRecord) - { - if (m_killRecord.Contains(part.LocalId)) - continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) - continue; - } - if (part.ParentGroup.IsDeleted) continue; @@ -3816,7 +3798,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP // attachments until the avatar becomes root. if (sp.IsChildAgent) continue; + + // If the object is an attachment we don't want it to be in the kill + // record. Else attaching from inworld and subsequently dropping + // it will no longer work. + lock (m_killRecord) + { + m_killRecord.Remove(part.LocalId); + m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); + } } + else + { + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // will never receive an update after a prim kill. Even then, keeping the kill record may be a good + // safety measure. + // + // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update + // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs + // updates and kills on different threads with different scheduling strategies, hence this protection. + // + // This doesn't appear to apply to child prims - a client will happily ignore these updates + // after the root prim has been deleted. + // + // We ignore this for attachments because attaching something from inworld breaks unless we do. + lock (m_killRecord) + { + if (m_killRecord.Contains(part.LocalId)) + continue; + if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + continue; + } + } + if (part.ParentGroup.IsAttachment && m_disableFacelights) { if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && -- cgit v1.1 From 4b3cb91ce8e0250a22ae60bed738bc95414d1076 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 1 Jun 2012 00:12:04 +0200 Subject: Remove the kill record. Core has removed it long ago and it really does more harm than good these days --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5912a15..77dbca7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -346,7 +346,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock /// /// - protected HashSet m_killRecord; +// protected HashSet m_killRecord; // protected HashSet m_attachmentsSent; @@ -472,7 +472,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); m_entityProps = new PriorityQueue(m_scene.Entities.Count); m_fullUpdateDataBlocksBuilder = new List(); - m_killRecord = new HashSet(); +// m_killRecord = new HashSet(); // m_attachmentsSent = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); @@ -1574,17 +1574,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race // condition where a kill can be processed before an out-of-date update for the same object. // ProcessEntityUpdates() also takes the m_killRecord lock. - lock (m_killRecord) - { - foreach (uint localID in localIDs) - m_killRecord.Add(localID); +// lock (m_killRecord) +// { +// foreach (uint localID in localIDs) +// m_killRecord.Add(localID); // The throttle queue used here must match that being used for updates. Otherwise, there is a // chance that a kill packet put on a separate queue will be sent to the client before an existing // update packet on another queue. Receiving updates after kills results in unowned and undeletable // scene objects in a viewer until that viewer is relogged in. OutPacket(kill, ThrottleOutPacketType.Task); - } +// } } } @@ -3802,11 +3802,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If the object is an attachment we don't want it to be in the kill // record. Else attaching from inworld and subsequently dropping // it will no longer work. - lock (m_killRecord) - { - m_killRecord.Remove(part.LocalId); - m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); - } +// lock (m_killRecord) +// { +// m_killRecord.Remove(part.LocalId); +// m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); +// } } else { @@ -3822,13 +3822,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // after the root prim has been deleted. // // We ignore this for attachments because attaching something from inworld breaks unless we do. - lock (m_killRecord) - { - if (m_killRecord.Contains(part.LocalId)) - continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) - continue; - } +// lock (m_killRecord) +// { +// if (m_killRecord.Contains(part.LocalId)) +// continue; +// if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) +// continue; +// } } if (part.ParentGroup.IsAttachment && m_disableFacelights) -- cgit v1.1 From 34cb8a2ab3189952cb74a16cf5246a2da3847b7c Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jun 2012 20:35:00 +0200 Subject: Fix not sending TransferInfo when an asset is not found. This clogs up the sound pipeline in the viewer. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9895402..18d8045 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2777,6 +2777,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SendAssetNotFound(AssetRequestToClient req) + { + TransferInfoPacket Transfer = new TransferInfoPacket(); + Transfer.TransferInfo.ChannelType = 2; + Transfer.TransferInfo.Status = -2; + Transfer.TransferInfo.TargetType = 0; + Transfer.TransferInfo.Params = req.Params; + Transfer.TransferInfo.Size = 0; + Transfer.TransferInfo.TransferID = req.TransferRequestID; + Transfer.Header.Zerocoded = true; + OutPacket(Transfer, ThrottleOutPacketType.Asset); + } + public void SendTexture(AssetBase TextureAsset) { @@ -12181,14 +12194,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected void AssetReceived(string id, Object sender, AssetBase asset) { - if (asset == null) - return; - TransferRequestPacket transferRequest = (TransferRequestPacket)sender; UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; + AssetRequestToClient req = new AssetRequestToClient(); + + if (asset == null) + { + req.AssetInf = null; + req.AssetRequestSource = source; + req.IsTextureRequest = false; + req.NumPackets = 0; + req.Params = transferRequest.TransferInfo.Params; + req.RequestAssetID = requestID; + req.TransferRequestID = transferRequest.TransferInfo.TransferID; + + SendAssetNotFound(req); + return; + } + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); @@ -12205,7 +12231,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; // The asset is known to exist and is in our cache, so add it to the AssetRequests list - AssetRequestToClient req = new AssetRequestToClient(); req.AssetInf = asset; req.AssetRequestSource = source; req.IsTextureRequest = false; -- cgit v1.1 From 095dbf0ece0aab1812d04695a17bff86720ab6ac Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jun 2012 20:35:00 +0200 Subject: Fix not sending TransferInfo when an asset is not found. This clogs up the sound pipeline in the viewer. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 77dbca7..5a87958 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2777,6 +2777,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SendAssetNotFound(AssetRequestToClient req) + { + TransferInfoPacket Transfer = new TransferInfoPacket(); + Transfer.TransferInfo.ChannelType = 2; + Transfer.TransferInfo.Status = -2; + Transfer.TransferInfo.TargetType = 0; + Transfer.TransferInfo.Params = req.Params; + Transfer.TransferInfo.Size = 0; + Transfer.TransferInfo.TransferID = req.TransferRequestID; + Transfer.Header.Zerocoded = true; + OutPacket(Transfer, ThrottleOutPacketType.Asset); + } + public void SendTexture(AssetBase TextureAsset) { @@ -12178,14 +12191,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected void AssetReceived(string id, Object sender, AssetBase asset) { - if (asset == null) - return; - TransferRequestPacket transferRequest = (TransferRequestPacket)sender; UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; + AssetRequestToClient req = new AssetRequestToClient(); + + if (asset == null) + { + req.AssetInf = null; + req.AssetRequestSource = source; + req.IsTextureRequest = false; + req.NumPackets = 0; + req.Params = transferRequest.TransferInfo.Params; + req.RequestAssetID = requestID; + req.TransferRequestID = transferRequest.TransferInfo.TransferID; + + SendAssetNotFound(req); + return; + } + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); @@ -12202,7 +12228,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; // The asset is known to exist and is in our cache, so add it to the AssetRequests list - AssetRequestToClient req = new AssetRequestToClient(); req.AssetInf = asset; req.AssetRequestSource = source; req.IsTextureRequest = false; -- cgit v1.1 From ba58d7a9b2dc1233e46006a20b8924788cbb53db Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:04:12 +0100 Subject: add a temp debug message --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 75f783b..3d3fb8e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -717,7 +717,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP udpClient = ((LLClientView)client).UDPClient; if (!udpClient.IsConnected) + { + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); return; + } #endregion Packet to Client Mapping -- cgit v1.1 From 646b7fb8f2e285945b70a657674e5c3dac84b931 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:10:53 +0100 Subject: i more debug --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3d3fb8e..c64b5f2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -710,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { - //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From 0de3ad530713324d23ac513e7a317a2acd539a22 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:18:12 +0100 Subject: more debug --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5a87958..80b6f64 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6402,6 +6402,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { handlerCompleteMovementToRegion(sender, true); } + else + m_log.Debug("HandleCompleteAgentMovement NULL handler"); + handlerCompleteMovementToRegion = null; return true; -- cgit v1.1 From 1468b01afc9defab4cde690293bd368cb73cd437 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:29:46 +0100 Subject: coment out some of previus debug messaged before forgetting about them... --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c64b5f2..bd8273d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -710,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); +// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -718,7 +718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!udpClient.IsConnected) { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); +// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From 38cdf77cef4964bb9eac9ccefb30334cd6737e9d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Jun 2012 03:41:04 +0100 Subject: in CreateAvatarUpdateBlock() change updateflags to 0. Original flags seem prim related only. This does fix the wrong viewer side move of a avatar in prim edition mode (anv mantis 854), with no apparent side effects .. may need more testing --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 80b6f64..9c96b52 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5078,10 +5078,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.TextureEntry = Utils.EmptyBytes; // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; +/* all this flags seem related to prims and not avatars. This allow for wrong viewer side move of a avatar in prim edition mode (anv mantis 854) update.UpdateFlags = (uint)( PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | PrimFlags.ObjectOwnerModify); +*/ + update.UpdateFlags = 0; return update; } -- cgit v1.1 From 02cb0bf80a0b67eb0316ac74e1ea9741bfce1385 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Jul 2012 17:40:02 +0100 Subject: added a timeout paramenter to PollServiceEventArgs, so each type can define it's timeout --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index a91b02c..016ed97 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -361,7 +361,7 @@ namespace OpenSim.Region.ClientStack.Linden // This will persist this beyond the expiry of the caps handlers MainServer.Instance.AddPollServiceHTTPHandler( capsBase + EventQueueGetUUID.ToString() + "/", - new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); + new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID,1000)); // 1 sec timeout Random rnd = new Random(Environment.TickCount); lock (m_ids) -- cgit v1.1 From e3fa73da96f5612da52d140425f1633494d6edef Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 17:17:59 +0200 Subject: Experimentally handle UseCircuitCode synchrnonously --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..56c0992 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,7 +701,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - Util.FireAndForget(HandleUseCircuitCode, array); + //Util.FireAndForget(HandleUseCircuitCode, array); + HandleUseCircuitCode(array); return; } -- cgit v1.1 From 8b4f7604e618ed409cd4dcb44dcf14ce22b72be7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 19:45:08 +0200 Subject: Revert "Experimentally handle UseCircuitCode synchrnonously" This reverts commit e3fa73da96f5612da52d140425f1633494d6edef. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 56c0992..bd8273d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,8 +701,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - //Util.FireAndForget(HandleUseCircuitCode, array); - HandleUseCircuitCode(array); + Util.FireAndForget(HandleUseCircuitCode, array); return; } -- cgit v1.1 From 283df0610de50f77460f980ba15e4cbb23f5b657 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 21:45:06 +0200 Subject: Save packets received while the client is added and replay them later. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..34923be 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings private bool m_sendPing; + private ExpiringCache> m_pendingCache = new ExpiringCache>(); + private int m_defaultRTO = 0; private int m_maxRTO = 0; @@ -701,6 +703,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; + lock (m_pendingCache) + m_pendingCache.AddOrUpdate(address, new Queue(), 60); Util.FireAndForget(HandleUseCircuitCode, array); return; @@ -710,6 +714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { + lock (m_pendingCache) + { + Queue queue; + if (m_pendingCache.TryGetValue(address, out queue)) + queue.Enqueue(buffer); + } + // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -943,6 +954,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) client.SceneAgent.SendInitialDataToMe(); + + // Now we know we can handle more data + Thread.Sleep(200); + + // Obtain the queue and remove it from the cache + Queue queue = null; + + lock (m_pendingCache) + { + if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) + return; + m_pendingCache.Remove(remoteEndPoint); + } + + // Reinject queued packets + while(queue.Count > 0) + { + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); + } + queue = null; } else { @@ -950,6 +982,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.WarnFormat( "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); + lock (m_pendingCache) + m_pendingCache.Remove(remoteEndPoint); } // m_log.DebugFormat( -- cgit v1.1 From b130dcea21130b65a3dbe400b0c50e1f5e461972 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 22:28:47 +0200 Subject: Testing changes and instrumentation --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 34923be..c807260 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,10 +701,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // UseCircuitCode handling if (packet.Type == PacketType.UseCircuitCode) { - object[] array = new object[] { buffer, packet }; - lock (m_pendingCache) + { + if (m_pendingCache.Contains(address)) + return; + m_pendingCache.AddOrUpdate(address, new Queue(), 60); + } + + object[] array = new object[] { buffer, packet }; + Util.FireAndForget(HandleUseCircuitCode, array); return; @@ -718,10 +724,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Queue queue; if (m_pendingCache.TryGetValue(address, out queue)) + { + m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); queue.Enqueue(buffer); + } + else + { + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + } } -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -964,10 +976,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_pendingCache) { if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) + { + m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); return; + } m_pendingCache.Remove(remoteEndPoint); } + m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); + // Reinject queued packets while(queue.Count > 0) { -- cgit v1.1 From 668723fab31976895ceb42a372cfff7ed5689a9d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 23:01:58 +0200 Subject: Remove instrumentation and fix the message delivery issue --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 52 ++++++++++++---------- 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c807260..46337b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -698,42 +698,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Packet to Client Mapping - // UseCircuitCode handling - if (packet.Type == PacketType.UseCircuitCode) + // If there is already a client for this endpoint, don't process UseCircuitCode + IClientAPI client = null; + if (!m_scene.TryGetClient(address, out client)) { - lock (m_pendingCache) + // UseCircuitCode handling + if (packet.Type == PacketType.UseCircuitCode) { - if (m_pendingCache.Contains(address)) - return; + // And if there is a UseCircuitCode pending, also drop it + lock (m_pendingCache) + { + if (m_pendingCache.Contains(address)) + return; - m_pendingCache.AddOrUpdate(address, new Queue(), 60); - } + m_pendingCache.AddOrUpdate(address, new Queue(), 60); + } - object[] array = new object[] { buffer, packet }; + object[] array = new object[] { buffer, packet }; - Util.FireAndForget(HandleUseCircuitCode, array); + Util.FireAndForget(HandleUseCircuitCode, array); - return; + return; + } } - // Determine which agent this packet came from - IClientAPI client; - if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) + // If this is a pending connection, enqueue, don't process yet + lock (m_pendingCache) { - lock (m_pendingCache) + Queue queue; + if (m_pendingCache.TryGetValue(address, out queue)) { - Queue queue; - if (m_pendingCache.TryGetValue(address, out queue)) - { - m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); - queue.Enqueue(buffer); - } - else - { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); - } + //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); + queue.Enqueue(buffer); + return; } + } + // Determine which agent this packet came from + if (client == null || !(client is LLClientView)) + { + //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From 1b81a2bd49beda587e805281e9e0b28dce033310 Mon Sep 17 00:00:00 2001 From: ubit Date: Sun, 15 Jul 2012 23:54:24 +0200 Subject: to stash --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..c64b5f2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -710,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -718,7 +718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!udpClient.IsConnected) { -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From cdd03acffa930ad9d23dc5a6c3af778c0f79567b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 15 Jul 2012 23:37:31 +0100 Subject: just a kick git --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 46337b3..ddfad82 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + using System; using System.Collections.Generic; using System.Diagnostics; -- cgit v1.1 From 5c145aa539b8190be994873a1bb9f32bfacdaa77 Mon Sep 17 00:00:00 2001 From: ubit Date: Mon, 16 Jul 2012 00:43:35 +0200 Subject: merge fix --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 9b9ccba..a7740b9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -726,15 +726,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If this is a pending connection, enqueue, don't process yet lock (m_pendingCache) { -<<<<<<< HEAD -<<<<<<< HEAD - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); -======= - lock (m_pendingCache) -======= Queue queue; if (m_pendingCache.TryGetValue(address, out queue)) ->>>>>>> 15a1ad393c3748c5c911beac981945a9bd8b200d { //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); queue.Enqueue(buffer); @@ -742,18 +735,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -<<<<<<< HEAD -<<<<<<< HEAD -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); ->>>>>>> 2606484e45138adef289386509b1e27552a32aee -======= ->>>>>>> 0baa1b557af20af3590737dc04294a9bdc8e8728 -======= // Determine which agent this packet came from if (client == null || !(client is LLClientView)) { //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); ->>>>>>> 15a1ad393c3748c5c911beac981945a9bd8b200d return; } -- cgit v1.1 From 3149eca68fce6f9662fa8b84e80f2b880f537414 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 15 Jul 2012 23:45:47 +0100 Subject: backkick git --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ddfad82..46337b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -25,7 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - using System; using System.Collections.Generic; using System.Diagnostics; -- cgit v1.1 From ce8b9e6c570f73a5c70dfc2b52bbb595637b717d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 19 Jul 2012 12:27:36 +0200 Subject: Fix slow loading of task inventory --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e6289bd..ad9074c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2122,16 +2122,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP replytask.InventoryData.TaskID = taskID; replytask.InventoryData.Serial = serial; replytask.InventoryData.Filename = fileName; - OutPacket(replytask, ThrottleOutPacketType.Asset); + OutPacket(replytask, ThrottleOutPacketType.Task); } - public void SendXferPacket(ulong xferID, uint packet, byte[] data) + public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) { + ThrottleOutPacketType type = ThrottleOutPacketType.Asset; + if (isTaskInventory) + type = ThrottleOutPacketType.Task; + SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); sendXfer.XferID.ID = xferID; sendXfer.XferID.Packet = packet; sendXfer.DataPacket.Data = data; - OutPacket(sendXfer, ThrottleOutPacketType.Asset); + OutPacket(sendXfer, type); } public void SendAbortXferPacket(ulong xferID) -- cgit v1.1 From b1b3057adcc4f4acdf8207ea2733e6400cf7143a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 21 Jul 2012 20:56:19 +0200 Subject: Fix double-ping on logout by not sending a stop packet to the client if the client told us it wants to log out in the first place. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 79e35f4..f5f9c02 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1516,7 +1516,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!client.IsLoggingOut) { client.IsLoggingOut = true; - client.Close(); + client.Close(false); } } } -- cgit v1.1 From d677db338d8cfe8de5db5f279cd3638510b360c9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 3 Aug 2012 15:22:53 +0200 Subject: Remove a merge artefaci in IsActive handling and restore commented out correct one --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1304e16..1410cf6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -517,7 +517,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void Close(bool sendStop) { -// IsActive = false; // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. lock (CloseSyncLock) @@ -525,7 +524,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!IsActive) return; -// IsActive = false; + IsActive = false; CloseWithoutChecks(sendStop); } } -- cgit v1.1 From b8ba224b4f920a1c5f89acb13100d6568cbc3d1c Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 3 Aug 2012 15:33:30 +0200 Subject: Remove another superflouous IsActive set --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1410cf6..8cac731 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -551,8 +551,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(disable, ThrottleOutPacketType.Unknown); } -// IsActive = false; - // Shutdown the image manager ImageManager.Close(); -- cgit v1.1 From 879d1cefb8c18a899d76b2e63843166d4710378c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 3 Aug 2012 15:19:31 +0100 Subject: clientview IsActive use is broken. Suspend it's use keeping it true ( to review later) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f7bb817..1304e16 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -517,7 +517,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void Close(bool sendStop) { - IsActive = false; +// IsActive = false; // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. lock (CloseSyncLock) @@ -525,7 +525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!IsActive) return; - IsActive = false; +// IsActive = false; CloseWithoutChecks(sendStop); } } @@ -552,7 +552,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(disable, ThrottleOutPacketType.Unknown); } - IsActive = false; +// IsActive = false; // Shutdown the image manager ImageManager.Close(); -- cgit v1.1 From f21fdff4f98a3916aa63ae84f335bfb763345c54 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 14 Aug 2012 21:58:07 +0200 Subject: Actually add the module --- .../ClientStack/Linden/Caps/RegionConsoleModule.cs | 234 +++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs new file mode 100644 index 0000000..36af55f --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs @@ -0,0 +1,234 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Drawing; +using System.Drawing.Imaging; +using System.Reflection; +using System.IO; +using System.Web; +using log4net; +using Nini.Config; +using Mono.Addins; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenMetaverse.Imaging; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OpenSim.Capabilities.Handlers; + +namespace OpenSim.Region.ClientStack.Linden +{ + + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionConsoleModule")] + public class RegionConsoleModule : INonSharedRegionModule, IRegionConsole + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private Scene m_scene; + private IEventQueue m_eventQueue; + private Commands m_commands = new Commands(); + public ICommands Commands { get { return m_commands; } } + + public void Initialise(IConfigSource source) + { + m_commands.AddCommand( "Help", false, "help", "help []", "Display help on a particular command or on a list of commands in a category", Help); + } + + public void AddRegion(Scene s) + { + m_scene = s; + m_scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(Scene s) + { + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene s) + { + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + m_eventQueue = m_scene.RequestModuleInterface(); + } + + public void PostInitialise() + { + } + + public void Close() { } + + public string Name { get { return "RegionConsoleModule"; } } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void RegisterCaps(UUID agentID, Caps caps) + { + if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(agentID)) + return; + + UUID capID = UUID.Random(); + + m_log.DebugFormat("[REGION CONSOLE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); + caps.RegisterHandler( + "SimConsoleAsync", + new ConsoleHandler("/CAPS/" + capID + "/", "SimConsoleAsync", agentID, this, m_scene)); + } + + public void SendConsoleOutput(UUID agentID, string message) + { + OSD osd = OSD.FromString(message); + + m_eventQueue.Enqueue(EventQueueHelper.BuildEvent("SimConsoleResponse", osd), agentID); + } + + public bool RunCommand(string command, UUID invokerID) + { + string[] parts = Parser.Parse(command); + Array.Resize(ref parts, parts.Length + 1); + parts[parts.Length - 1] = invokerID.ToString(); + + if (m_commands.Resolve(parts).Length == 0) + return false; + + return true; + } + + private void Help(string module, string[] cmd) + { + UUID agentID = new UUID(cmd[cmd.Length - 1]); + Array.Resize(ref cmd, cmd.Length - 1); + + List help = Commands.GetHelp(cmd); + + string reply = String.Empty; + + foreach (string s in help) + { + reply += s + "\n"; + } + + SendConsoleOutput(agentID, reply); + } + + public void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn) + { + m_commands.AddCommand(module, shared, command, help, longhelp, fn); + } + } + + public class ConsoleHandler : BaseStreamHandler + { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private RegionConsoleModule m_consoleModule; + private UUID m_agentID; + private bool m_isGod; + private Scene m_scene; + private bool m_consoleIsOn = false; + + public ConsoleHandler(string path, string name, UUID agentID, RegionConsoleModule module, Scene scene) + :base("POST", path, name, agentID.ToString()) + { + m_agentID = agentID; + m_consoleModule = module; + m_scene = scene; + + m_isGod = m_scene.Permissions.IsGod(agentID); + } + + public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + StreamReader reader = new StreamReader(request); + string message = reader.ReadToEnd(); + + OSD osd = OSDParser.DeserializeLLSDXml(message); + + string cmd = osd.AsString(); + if (cmd == "set console on") + { + if (m_isGod) + { + MainConsole.Instance.OnOutput += ConsoleSender; + m_consoleIsOn = true; + m_consoleModule.SendConsoleOutput(m_agentID, "Console is now on"); + } + return new byte[0]; + } + else if (cmd == "set console off") + { + MainConsole.Instance.OnOutput -= ConsoleSender; + m_consoleIsOn = false; + m_consoleModule.SendConsoleOutput(m_agentID, "Console is now off"); + return new byte[0]; + } + + if (m_consoleIsOn == false && m_consoleModule.RunCommand(osd.AsString().Trim(), m_agentID)) + return new byte[0]; + + if (m_isGod && m_consoleIsOn) + { + MainConsole.Instance.RunCommand(osd.AsString().Trim()); + } + else + { + m_consoleModule.SendConsoleOutput(m_agentID, "Unknown command"); + } + + return new byte[0]; + } + + private void ConsoleSender(string text) + { + m_consoleModule.SendConsoleOutput(m_agentID, text); + } + + private void OnMakeChildAgent(ScenePresence presence) + { + if (presence.UUID == m_agentID) + { + MainConsole.Instance.OnOutput -= ConsoleSender; + m_consoleIsOn = false; + } + } + } +} -- cgit v1.1 From 0a959343a58b06d68d86be4607003b1c3d83a981 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 18 Aug 2012 22:36:48 +0200 Subject: Make the console output from the reigon console hookable --- OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs index 36af55f..413536d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs @@ -64,6 +64,8 @@ namespace OpenSim.Region.ClientStack.Linden private Commands m_commands = new Commands(); public ICommands Commands { get { return m_commands; } } + public event ConsoleMessage OnConsoleMessage; + public void Initialise(IConfigSource source) { m_commands.AddCommand( "Help", false, "help", "help []", "Display help on a particular command or on a list of commands in a category", Help); @@ -118,6 +120,11 @@ namespace OpenSim.Region.ClientStack.Linden OSD osd = OSD.FromString(message); m_eventQueue.Enqueue(EventQueueHelper.BuildEvent("SimConsoleResponse", osd), agentID); + + ConsoleMessage handlerConsoleMessage = OnConsoleMessage; + + if (handlerConsoleMessage != null) + handlerConsoleMessage( agentID, message); } public bool RunCommand(string command, UUID invokerID) -- cgit v1.1 From 5273b6880a9682a57798c5808e04b7dc6dca8c0f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Aug 2012 21:20:20 +0200 Subject: Allow updates sent for right pec to go to the client --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8cac731..ddd8f18 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3809,7 +3809,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part.ParentGroup.IsAttachment) { // Someone else's HUD, why are we getting these? if (part.ParentGroup.OwnerID != AgentId && - part.ParentGroup.RootPart.Shape.State >= 30) + part.ParentGroup.RootPart.Shape.State > 30) continue; ScenePresence sp; // Owner is not in the sim, don't update it to -- cgit v1.1 From 7e17f4296e91129990c15cdaaa1689922a57f9aa Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Aug 2012 23:48:01 +0200 Subject: Fix background inventory loading (Viewer 3) so it won't lag out the sim --- .../Linden/Caps/WebFetchInvDescModule.cs | 152 ++++++++++++++------- 1 file changed, 103 insertions(+), 49 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 2359bd6..61387ed 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -27,12 +27,15 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Reflection; +using System.Threading; using log4net; using Nini.Config; using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -48,67 +51,49 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class WebFetchInvDescModule : INonSharedRegionModule { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; private IInventoryService m_InventoryService; private ILibraryService m_LibraryService; - private bool m_Enabled; + private WebFetchInvDescHandler m_webFetchHandler; - private string m_fetchInventoryDescendents2Url; - private string m_webFetchInventoryDescendentsUrl; + private ManualResetEvent m_ev = new ManualResetEvent(true); + private object m_lock = new object(); - private WebFetchInvDescHandler m_webFetchHandler; + private Dictionary m_capsDict = new Dictionary(); + private Dictionary m_requests = new Dictionary(); #region ISharedRegionModule Members public void Initialise(IConfigSource source) { - IConfig config = source.Configs["ClientStack.LindenCaps"]; - if (config == null) - return; - - m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty); - m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty); - - if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty) - { - m_Enabled = true; - } } public void AddRegion(Scene s) { - if (!m_Enabled) - return; - m_scene = s; } public void RemoveRegion(Scene s) { - if (!m_Enabled) - return; - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; m_scene = null; } public void RegionLoaded(Scene s) { - if (!m_Enabled) - return; - m_InventoryService = m_scene.InventoryService; m_LibraryService = m_scene.LibraryService; // We'll reuse the same handler for all requests. - if (m_fetchInventoryDescendents2Url == "localhost" || m_webFetchInventoryDescendentsUrl == "localhost") - m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); + m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); m_scene.EventManager.OnRegisterCaps += RegisterCaps; + m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; } public void PostInitialise() @@ -128,41 +113,110 @@ namespace OpenSim.Region.ClientStack.Linden private void RegisterCaps(UUID agentID, Caps caps) { - if (m_webFetchInventoryDescendentsUrl != "") - RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl); + string capUrl = "/CAPS/" + UUID.Random() + "/"; + + // Register this as a poll service + PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000); + args.Type = PollServiceEventArgs.EventType.Inventory; + MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); + + string hostName = m_scene.RegionInfo.ExternalHostName; + uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; + string protocol = "http"; + + if (MainServer.Instance.UseSSL) + { + hostName = MainServer.Instance.SSLCommonName; + port = MainServer.Instance.SSLPort; + protocol = "https"; + } + caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); - if (m_fetchInventoryDescendents2Url != "") - RegisterFetchCap(agentID, caps, "FetchInventoryDescendents2", m_fetchInventoryDescendents2Url); + m_capsDict[agentID] = capUrl; } - private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) + private void DeregisterCaps(UUID agentID, Caps caps) { string capUrl; - if (url == "localhost") + if (m_capsDict.TryGetValue(agentID, out capUrl)) { - capUrl = "/CAPS/" + UUID.Random(); + MainServer.Instance.RemoveHTTPHandler("", capUrl); + m_capsDict.Remove(agentID); + } + } - IRequestHandler reqHandler - = new RestStreamHandler( - "POST", - capUrl, - m_webFetchHandler.FetchInventoryDescendentsRequest, - "FetchInventoryDescendents2", - agentID.ToString()); + public void HttpRequestHandler(UUID requestID, Hashtable request) + { + m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); + m_requests[requestID] = request; + } - caps.RegisterHandler(capName, reqHandler); + private bool HasEvents(UUID requestID, UUID sessionID) + { + lock (m_lock) + { + if (m_ev.WaitOne(0)) + { + m_ev.Reset(); + return true; + } + return false; } - else + } + + private Hashtable NoEvents(UUID requestID, UUID sessionID) + { + m_requests.Remove(requestID); + + Hashtable response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + return response; + } + + private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) + { + Hashtable response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Internal error"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + try { - capUrl = url; + Hashtable requestHash; + if (!m_requests.TryGetValue(requestID, out requestHash)) + { + lock (m_lock) + m_ev.Set(); + response["str_response_string"] = "Invalid request"; + return response; + } + + m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); - caps.RegisterHandler(capName, capUrl); + string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null); + + m_requests.Remove(requestID); + + response["int_response_code"] = 200; + response["str_response_string"] = reply; + } + finally + { + lock (m_lock) + m_ev.Set(); } -// m_log.DebugFormat( -// "[WEB FETCH INV DESC MODULE]: Registered capability {0} at {1} in region {2} for {3}", -// capName, capUrl, m_scene.RegionInfo.RegionName, agentID); + return response; } } -} \ No newline at end of file +} -- cgit v1.1 From 6d48dbf8caaf862d096bf5a7d39fb1a28afe46b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Aug 2012 23:49:31 +0200 Subject: Remove debug spam --- OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 61387ed..b77ead3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.ClientStack.Linden public void HttpRequestHandler(UUID requestID, Hashtable request) { - m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); +// m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); m_requests[requestID] = request; } @@ -201,7 +201,7 @@ namespace OpenSim.Region.ClientStack.Linden return response; } - m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); +// m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null); -- cgit v1.1 From 378a79e7cc6be3191dea41b617c05febd7ee5cbe Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 28 Aug 2012 22:17:17 +0200 Subject: Add a queue with two priority levels. This is a drop in replacement for the BlockingQueue from OMV, but allows two priorities. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 113 ++++++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 7042c9a..f9ba14c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -110,7 +110,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Handlers for incoming packets //PacketEventDictionary packetEvents = new PacketEventDictionary(); /// Incoming packets that are awaiting handling - private OpenMetaverse.BlockingQueue packetInbox = new OpenMetaverse.BlockingQueue(); + //private OpenMetaverse.BlockingQueue packetInbox = new OpenMetaverse.BlockingQueue(); + + private DoubleQueue packetInbox = new DoubleQueue(); + /// //private UDPClientCollection m_clients = new UDPClientCollection(); /// Bandwidth throttle for this UDP server @@ -919,7 +922,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Ping Check Handling // Inbox insertion - packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); + if (packet.Type == PacketType.AgentUpdate || + packet.Type == PacketType.ChatFromViewer) + packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); + else + packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); } #region BinaryStats @@ -1519,4 +1526,106 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } + + internal class DoubleQueue where T:class + { + private Queue m_lowQueue = new Queue(); + private Queue m_highQueue = new Queue(); + + private object m_syncRoot = new object(); + private Semaphore m_s = new Semaphore(0, 1); + + public DoubleQueue() + { + } + + public virtual int Count + { + get { return m_highQueue.Count + m_lowQueue.Count; } + } + + public virtual void Enqueue(T data) + { + Enqueue(m_lowQueue, data); + } + + public virtual void EnqueueLow(T data) + { + Enqueue(m_lowQueue, data); + } + + public virtual void EnqueueHigh(T data) + { + Enqueue(m_highQueue, data); + } + + private void Enqueue(Queue q, T data) + { + lock (m_syncRoot) + { + m_lowQueue.Enqueue(data); + m_s.WaitOne(0); + m_s.Release(); + } + } + + public virtual T Dequeue() + { + return Dequeue(Timeout.Infinite); + } + + public virtual T Dequeue(int tmo) + { + return Dequeue(TimeSpan.FromMilliseconds(tmo)); + } + + public virtual T Dequeue(TimeSpan wait) + { + T res = null; + + if (!Dequeue(wait, ref res)) + return null; + + return res; + } + + public bool Dequeue(int timeout, ref T res) + { + return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); + } + + public bool Dequeue(TimeSpan wait, ref T res) + { + if (!m_s.WaitOne(wait)) + return false; + + lock (m_syncRoot) + { + if (m_highQueue.Count > 0) + res = m_highQueue.Dequeue(); + else + res = m_lowQueue.Dequeue(); + + if (m_highQueue.Count == 0 || m_lowQueue.Count == 0) + return true; + + m_s.Release(); + + return true; + } + } + + public virtual void Clear() + { + + lock (m_syncRoot) + { + // Make sure sem count is 0 + m_s.WaitOne(0); + + m_lowQueue.Clear(); + m_highQueue.Clear(); + } + } + } } -- cgit v1.1 From 34f069493894654d23c18550182561a93ec023b0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 29 Aug 2012 11:35:21 +0200 Subject: Remove Justin's addition to avoid sending incoming packets to inactive clients This also causes the initial AgentUpdate to be rejected because our processing is asynchronous. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index f9ba14c..c817e44 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1478,8 +1478,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP Packet packet = incomingPacket.Packet; LLClientView client = incomingPacket.Client; - if (client.IsActive) - { +// if (client.IsActive) +// { m_currentIncomingClient = client; try @@ -1506,13 +1506,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_currentIncomingClient = null; } - } - else - { - m_log.DebugFormat( - "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", - packet.Type, client.Name, m_scene.RegionInfo.RegionName); - } +// } +// else +// { +// m_log.DebugFormat( +// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", +// packet.Type, client.Name, m_scene.RegionInfo.RegionName); +// } } protected void LogoutHandler(IClientAPI client) -- cgit v1.1 From 74465df43f7ee92f44ba65c19c01e02fa1f13e98 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 29 Aug 2012 11:45:28 +0200 Subject: Fix issue with the quit packet being stuck int he queue and a one packet delay. Also fix semaphore excetion caused by enqueueing while dequque is taking place. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c817e44..75a47d5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1606,10 +1606,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP else res = m_lowQueue.Dequeue(); - if (m_highQueue.Count == 0 || m_lowQueue.Count == 0) + if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) return true; - m_s.Release(); + try + { + m_s.Release(); + } + catch + { + } return true; } -- cgit v1.1 From 211f4fb4114b2b26abe9c056bca9f6159ccbd125 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 30 Aug 2012 00:34:12 +0200 Subject: Sequence inventory descendents requests to reduce inventory server load and movement lag. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 75a47d5..d6513c5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -927,6 +927,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); else packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); +// packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); } #region BinaryStats -- cgit v1.1 From d4fad2ba42445f72b8a04378b21818ec82ab1089 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Sep 2012 07:32:03 +0100 Subject: a forgotten file plus minor changes. Imp and SL viewer seem to preserve flight. FS 4.2.2 does not. --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | 7 ++++++- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index b9222e3..fb41d23 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -151,6 +151,10 @@ namespace OpenSim.Region.ClientStack.Linden ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID) { + ulong tpflags = 1L << 4; // AgentManager.TeleportFlags.ViaLocation + if((flags & (uint)TeleportFlags.IsFlying) != 0) + tpflags |= 1 << 13; // IsFLying; + OSDMap info = new OSDMap(); info.Add("AgentID", OSD.FromUUID(agentID)); info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this? @@ -159,7 +163,8 @@ namespace OpenSim.Region.ClientStack.Linden info.Add("SimAccess", OSD.FromInteger(simAccess)); info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); - info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation +// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation + info.Add("TeleportFlags", OSD.FromULong(tpflags)); OSDArray infoArr = new OSDArray(); infoArr.Add(info); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ddd8f18..e78ebed 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -808,7 +808,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; - OutPacket(handshake, ThrottleOutPacketType.Task); +// OutPacket(handshake, ThrottleOutPacketType.Task); + // use same as MoveAgentIntoRegion (both should be task ) + OutPacket(handshake, ThrottleOutPacketType.Unknown); } public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) -- cgit v1.1 From c298ae9e75f00f2009c87de30b295af20dcb86a2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Sep 2012 10:51:43 +0100 Subject: bug fix --- .../ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index fb41d23..7dcf137 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -151,9 +151,11 @@ namespace OpenSim.Region.ClientStack.Linden ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID) { - ulong tpflags = 1L << 4; // AgentManager.TeleportFlags.ViaLocation - if((flags & (uint)TeleportFlags.IsFlying) != 0) - tpflags |= 1 << 13; // IsFLying; + // not sure why flags get overwritten here + if ((flags & (uint)TeleportFlags.IsFlying) != 0) + flags = (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.IsFlying; + else + flags = (uint)TeleportFlags.ViaLocation; OSDMap info = new OSDMap(); info.Add("AgentID", OSD.FromUUID(agentID)); @@ -164,7 +166,7 @@ namespace OpenSim.Region.ClientStack.Linden info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); // info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation - info.Add("TeleportFlags", OSD.FromULong(tpflags)); + info.Add("TeleportFlags", OSD.FromUInteger(flags)); OSDArray infoArr = new OSDArray(); infoArr.Add(info); -- cgit v1.1 From a91ca984d57a4177ff31898e384ee85948d4eff1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 8 Sep 2012 12:22:40 +0100 Subject: llClientView: try to have only one thread per client processing RegionHandleRequests. (code assumes packet handle is called async as it is not) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 53 ++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e78ebed..7749ef3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -8751,16 +8751,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Parcel related packets + // acumulate several HandleRegionHandleRequest consecutive overlaping requests + // to be done with minimal resources as possible + // variables temporary here while in test + + Queue RegionHandleRequests = new Queue(); + bool RegionHandleRequestsInService = false; + private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) { - RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; + UUID currentUUID; RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; - if (handlerRegionHandleRequest != null) + + if (handlerRegionHandleRequest == null) + return true; + + RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; + + lock (RegionHandleRequests) + { + if (RegionHandleRequestsInService) + { + // we are already busy doing a previus request + // so enqueue it + RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); + return true; + } + + // else do it + currentUUID = rhrPack.RequestBlock.RegionID; + RegionHandleRequestsInService = true; + } + + while (true) { - handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); + handlerRegionHandleRequest(this, currentUUID); + + lock (RegionHandleRequests) + { + // exit condition, nothing to do or closed + // current code seems to assume we may loose the handler at anytime, + // so keep checking it + handlerRegionHandleRequest = OnRegionHandleRequest; + + if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) + { + RegionHandleRequests.Clear(); + RegionHandleRequestsInService = false; + return true; + } + currentUUID = RegionHandleRequests.Dequeue(); + } } - return true; + + return true; // actually unreached } private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) -- cgit v1.1 From 657428a43906c5e65ad56ed96fa05d82f84d6c9b Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 10 Sep 2012 01:52:02 +0200 Subject: Remove commented code --- .../Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 2475b1f..e996fe8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -60,7 +60,6 @@ namespace OpenSim.Region.ClientStack.Linden private WebFetchInvDescHandler m_webFetchHandler; -// private ManualResetEvent m_ev = new ManualResetEvent(true); private object m_lock = new object(); private Dictionary m_capsDict = new Dictionary(); @@ -162,14 +161,6 @@ namespace OpenSim.Region.ClientStack.Linden { lock (m_lock) { -/* - if (m_ev.WaitOne(0)) - { - m_ev.Reset(); - return true; - } - return false; - */ return !m_busy; } } @@ -215,7 +206,6 @@ namespace OpenSim.Region.ClientStack.Linden if (!m_requests.TryGetValue(requestID, out requestHash)) { m_busy = false; - // m_ev.Set(); response["str_response_string"] = "Invalid request"; return response; } @@ -233,7 +223,6 @@ namespace OpenSim.Region.ClientStack.Linden finally { lock (m_lock) -// m_ev.Set(); m_busy = false; } -- cgit v1.1 From b7737b7273e87fcd9159d81f9cdc784381f94a25 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Sep 2012 01:20:34 +0100 Subject: webFetchInventory: change control event to simple flag, adjust locking --- .../Linden/Caps/WebFetchInvDescModule.cs | 43 ++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index b77ead3..2475b1f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -60,11 +60,12 @@ namespace OpenSim.Region.ClientStack.Linden private WebFetchInvDescHandler m_webFetchHandler; - private ManualResetEvent m_ev = new ManualResetEvent(true); +// private ManualResetEvent m_ev = new ManualResetEvent(true); private object m_lock = new object(); private Dictionary m_capsDict = new Dictionary(); private Dictionary m_requests = new Dictionary(); + bool m_busy = false; #region ISharedRegionModule Members @@ -116,7 +117,9 @@ namespace OpenSim.Region.ClientStack.Linden string capUrl = "/CAPS/" + UUID.Random() + "/"; // Register this as a poll service + // absurd large timeout to tune later to make a bit less than viewer PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000); + args.Type = PollServiceEventArgs.EventType.Inventory; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); @@ -133,6 +136,8 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); m_capsDict[agentID] = capUrl; + + m_busy = false; } private void DeregisterCaps(UUID agentID, Caps caps) @@ -149,25 +154,30 @@ namespace OpenSim.Region.ClientStack.Linden public void HttpRequestHandler(UUID requestID, Hashtable request) { // m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); - m_requests[requestID] = request; + lock(m_lock) + m_requests[requestID] = request; } private bool HasEvents(UUID requestID, UUID sessionID) { lock (m_lock) { +/* if (m_ev.WaitOne(0)) { m_ev.Reset(); return true; } return false; + */ + return !m_busy; } } private Hashtable NoEvents(UUID requestID, UUID sessionID) { - m_requests.Remove(requestID); + lock(m_lock) + m_requests.Remove(requestID); Hashtable response = new Hashtable(); @@ -177,11 +187,17 @@ namespace OpenSim.Region.ClientStack.Linden response["keepalive"] = false; response["reusecontext"] = false; + lock (m_lock) + m_busy = false; + return response; } private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) { + lock (m_lock) + m_busy = true; + Hashtable response = new Hashtable(); response["int_response_code"] = 500; @@ -192,20 +208,24 @@ namespace OpenSim.Region.ClientStack.Linden try { + Hashtable requestHash; - if (!m_requests.TryGetValue(requestID, out requestHash)) + lock (m_lock) { - lock (m_lock) - m_ev.Set(); - response["str_response_string"] = "Invalid request"; - return response; + if (!m_requests.TryGetValue(requestID, out requestHash)) + { + m_busy = false; + // m_ev.Set(); + response["str_response_string"] = "Invalid request"; + return response; + } + m_requests.Remove(requestID); } // m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null); - - m_requests.Remove(requestID); + response["int_response_code"] = 200; response["str_response_string"] = reply; @@ -213,7 +233,8 @@ namespace OpenSim.Region.ClientStack.Linden finally { lock (m_lock) - m_ev.Set(); +// m_ev.Set(); + m_busy = false; } return response; -- cgit v1.1 From a6753c14a509e11f65829b87070b440ac3b87c4a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 10:39:43 +0200 Subject: Revamp the v3 inventory sending. Uses threads and some nifty mechanics to leverage the Poll Service without blocking it's workers. --- .../Linden/Caps/WebFetchInvDescModule.cs | 198 ++++++++++++--------- 1 file changed, 117 insertions(+), 81 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index e996fe8..4908c2c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using OpenSim.Capabilities.Handlers; +using OpenSim.Framework.Monitoring; namespace OpenSim.Region.ClientStack.Linden { @@ -58,13 +59,13 @@ namespace OpenSim.Region.ClientStack.Linden private IInventoryService m_InventoryService; private ILibraryService m_LibraryService; - private WebFetchInvDescHandler m_webFetchHandler; - - private object m_lock = new object(); + private static WebFetchInvDescHandler m_webFetchHandler; private Dictionary m_capsDict = new Dictionary(); - private Dictionary m_requests = new Dictionary(); - bool m_busy = false; + private static Thread[] m_workerThreads = null; + + private static OpenMetaverse.BlockingQueue m_queue = + new OpenMetaverse.BlockingQueue(); #region ISharedRegionModule Members @@ -94,6 +95,22 @@ namespace OpenSim.Region.ClientStack.Linden m_scene.EventManager.OnRegisterCaps += RegisterCaps; m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; + + if (m_workerThreads == null) + { + m_workerThreads = new Thread[2]; + + for (uint i = 0; i < 2; i++) + { + m_workerThreads[i] = Watchdog.StartThread(DoInventoryRequests, + String.Format("InventoryWorkerThread{0}", i), + ThreadPriority.Normal, + false, + true, + null, + int.MaxValue); + } + } } public void PostInitialise() @@ -111,13 +128,103 @@ namespace OpenSim.Region.ClientStack.Linden #endregion + ~WebFetchInvDescModule() + { + foreach (Thread t in m_workerThreads) + t.Abort(); + } + + private class PollServiceInventoryEventArgs : PollServiceEventArgs + { + private List requests = + new List(); + private Dictionary responses = + new Dictionary(); + + public PollServiceInventoryEventArgs(UUID pId) : + base(null, null, null, null, pId, 30000) + { + HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; + GetEvents = (x, y, s) => + { + try + { + return this.responses[x]; + } + finally + { + responses.Remove(x); + } + }; + + Request = (x, y) => + { + y["RequestID"] = x.ToString(); + lock (this.requests) + this.requests.Add(y); + + m_queue.Enqueue(this); + }; + + NoEvents = (x, y) => + { + lock (this.requests) + { + Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); + requests.Remove(request); + } + + Hashtable response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + return response; + }; + } + + public void Process() + { + Hashtable request = null; + + try + { + lock (this.requests) + { + request = requests[0]; + requests.RemoveAt(0); + } + } + catch + { + return; + } + + UUID requestID = new UUID(request["RequestID"].ToString()); + + Hashtable response = new Hashtable(); + + response["int_response_code"] = 200; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); + + responses[requestID] = response; + } + } + private void RegisterCaps(UUID agentID, Caps caps) { string capUrl = "/CAPS/" + UUID.Random() + "/"; // Register this as a poll service // absurd large timeout to tune later to make a bit less than viewer - PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000); + PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); args.Type = PollServiceEventArgs.EventType.Inventory; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); @@ -135,8 +242,6 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); m_capsDict[agentID] = capUrl; - - m_busy = false; } private void DeregisterCaps(UUID agentID, Caps caps) @@ -150,83 +255,14 @@ namespace OpenSim.Region.ClientStack.Linden } } - public void HttpRequestHandler(UUID requestID, Hashtable request) + private void DoInventoryRequests() { -// m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); - lock(m_lock) - m_requests[requestID] = request; - } - - private bool HasEvents(UUID requestID, UUID sessionID) - { - lock (m_lock) + while (true) { - return !m_busy; - } - } - - private Hashtable NoEvents(UUID requestID, UUID sessionID) - { - lock(m_lock) - m_requests.Remove(requestID); - - Hashtable response = new Hashtable(); - - response["int_response_code"] = 500; - response["str_response_string"] = "Script timeout"; - response["content_type"] = "text/plain"; - response["keepalive"] = false; - response["reusecontext"] = false; - - lock (m_lock) - m_busy = false; + PollServiceInventoryEventArgs args = m_queue.Dequeue(); - return response; - } - - private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) - { - lock (m_lock) - m_busy = true; - - Hashtable response = new Hashtable(); - - response["int_response_code"] = 500; - response["str_response_string"] = "Internal error"; - response["content_type"] = "text/plain"; - response["keepalive"] = false; - response["reusecontext"] = false; - - try - { - - Hashtable requestHash; - lock (m_lock) - { - if (!m_requests.TryGetValue(requestID, out requestHash)) - { - m_busy = false; - response["str_response_string"] = "Invalid request"; - return response; - } - m_requests.Remove(requestID); - } - -// m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); - - string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null); - - - response["int_response_code"] = 200; - response["str_response_string"] = reply; - } - finally - { - lock (m_lock) - m_busy = false; + args.Process(); } - - return response; } } } -- cgit v1.1 From 94a8e5572b1529190a174f29f866b65e7b2ccc0e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 15:07:32 +0200 Subject: Remove the unused NewFileAgentInventoryVariablePrice module. --- .../NewFileAgentInventoryVariablePriceModule.cs | 296 --------------------- 1 file changed, 296 deletions(-) delete mode 100644 OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs deleted file mode 100644 index 52c4f44..0000000 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Reflection; -using System.IO; -using System.Web; -using Mono.Addins; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using Caps = OpenSim.Framework.Capabilities.Caps; -using OpenSim.Framework.Capabilities; - -namespace OpenSim.Region.ClientStack.Linden -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Scene m_scene; -// private IAssetService m_assetService; - private bool m_dumpAssetsToFile = false; - private bool m_enabled = true; - private int m_levelUpload = 0; - - #region IRegionModuleBase Members - - - public Type ReplaceableInterface - { - get { return null; } - } - - public void Initialise(IConfigSource source) - { - IConfig meshConfig = source.Configs["Mesh"]; - if (meshConfig == null) - return; - - m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); - m_levelUpload = meshConfig.GetInt("LevelUpload", 0); - } - - public void AddRegion(Scene pScene) - { - m_scene = pScene; - } - - public void RemoveRegion(Scene scene) - { - - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; - m_scene = null; - } - - public void RegionLoaded(Scene scene) - { - -// m_assetService = m_scene.RequestModuleInterface(); - m_scene.EventManager.OnRegisterCaps += RegisterCaps; - } - - #endregion - - - #region IRegionModule Members - - - - public void Close() { } - - public string Name { get { return "NewFileAgentInventoryVariablePriceModule"; } } - - - public void RegisterCaps(UUID agentID, Caps caps) - { - if(!m_enabled) - return; - - UUID capID = UUID.Random(); - -// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); - caps.RegisterHandler( - "NewFileAgentInventoryVariablePrice", - new LLSDStreamhandler( - "POST", - "/CAPS/" + capID.ToString(), - req => NewAgentInventoryRequest(req, agentID), - "NewFileAgentInventoryVariablePrice", - agentID.ToString())); - } - - #endregion - - public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) - { - //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit - // you need to be aware of this - - //if (llsdRequest.asset_type == "texture" || - // llsdRequest.asset_type == "animation" || - // llsdRequest.asset_type == "sound") - // { - // check user level - - ScenePresence avatar = null; - IClientAPI client = null; - m_scene.TryGetScenePresence(agentID, out avatar); - - if (avatar != null) - { - client = avatar.ControllingClient; - - if (avatar.UserLevel < m_levelUpload) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } - } - - // check funds - IMoneyModule mm = m_scene.RequestModuleInterface(); - - if (mm != null) - { - if (!mm.UploadCovered(agentID, mm.UploadCharge)) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } - } - - // } - - string assetName = llsdRequest.name; - string assetDes = llsdRequest.description; - string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/"; - UUID newAsset = UUID.Random(); - UUID newInvItem = UUID.Random(); - UUID parentFolder = llsdRequest.folder_id; - string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; - - AssetUploader uploader = - new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); - - MainServer.Instance.AddStreamHandler( - new BinaryStreamHandler( - "POST", - capsBase + uploaderPath, - uploader.uploaderCaps, - "NewFileAgentInventoryVariablePrice", - agentID.ToString())); - - string protocol = "http://"; - - if (MainServer.Instance.UseSSL) - protocol = "https://"; - - string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + - uploaderPath; - - - LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - - uploadResponse.rsvp = uploaderURL; - uploadResponse.state = "upload"; - uploadResponse.resource_cost = 0; - uploadResponse.upload_price = 0; - - uploader.OnUpLoad += //UploadCompleteHandler; - - delegate( - string passetName, string passetDescription, UUID passetID, - UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, - string passetType) - { - UploadCompleteHandler(passetName, passetDescription, passetID, - pinventoryItem, pparentFolder, pdata, pinventoryType, - passetType,agentID); - }; - - return uploadResponse; - } - - public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType,UUID AgentID) - { -// m_log.DebugFormat( -// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem); - - sbyte assType = 0; - sbyte inType = 0; - - if (inventoryType == "sound") - { - inType = 1; - assType = 1; - } - else if (inventoryType == "animation") - { - inType = 19; - assType = 20; - } - else if (inventoryType == "wearable") - { - inType = 18; - switch (assetType) - { - case "bodypart": - assType = 13; - break; - case "clothing": - assType = 5; - break; - } - } - else if (inventoryType == "mesh") - { - inType = (sbyte)InventoryType.Mesh; - assType = (sbyte)AssetType.Mesh; - } - - AssetBase asset; - asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); - asset.Data = data; - - if (m_scene.AssetService != null) - m_scene.AssetService.Store(asset); - - InventoryItemBase item = new InventoryItemBase(); - item.Owner = AgentID; - item.CreatorId = AgentID.ToString(); - item.ID = inventoryItem; - item.AssetID = asset.FullID; - item.Description = assetDescription; - item.Name = assetName; - item.AssetType = assType; - item.InvType = inType; - item.Folder = parentFolder; - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - item.BasePermissions = (uint)PermissionMask.All; - item.EveryOnePermissions = 0; - item.NextPermissions = (uint)PermissionMask.All; - item.CreationDate = Util.UnixTimeSinceEpoch(); - m_scene.AddInventoryItem(item); - } - } -} -- cgit v1.1 From bd1d9a214b7f8750427d670566c8f99ff62f33c4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:28:13 +0200 Subject: Add the option to have variable costing for uploads --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 51 +++++++++++++++++++--- 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 88c4d7f..097e224 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); - public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); + public delegate void NewInventoryItem(UUID userID, InventoryItemBase item, uint cost); public delegate void NewAsset(AssetBase asset); @@ -386,6 +386,38 @@ namespace OpenSim.Region.ClientStack.Linden return UUID.Zero; } + private delegate void UploadWithCostCompleteDelegate(string assetName, + string assetDescription, UUID assetID, UUID inventoryItem, + UUID parentFolder, byte[] data, string inventoryType, + string assetType, uint cost); + + private class AssetUploaderWithCost : AssetUploader + { + private uint m_cost; + + public event UploadWithCostCompleteDelegate OnUpLoad; + + public AssetUploaderWithCost(string assetName, string description, UUID assetID, + UUID inventoryItem, UUID parentFolderID, string invType, string assetType, + string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : + base(assetName, description, assetID, inventoryItem, parentFolderID, + invType, assetType, path, httpServer, dumpAssetsToFile) + { + m_cost = cost; + + base.OnUpLoad += UploadCompleteHandler; + } + + private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType) + { + OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, + data, inventoryType, assetType, m_cost); + } + } + + /// /// /// @@ -396,6 +428,8 @@ namespace OpenSim.Region.ClientStack.Linden //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); + uint cost = 0; + if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || llsdRequest.asset_type == "sound") @@ -428,7 +462,10 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) { - if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) + // XPTO: The cost should be calculated about here + cost = (uint)mm.UploadCharge; + + if (!mm.UploadCovered(client.AgentId, (int)cost)) { client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); @@ -449,9 +486,9 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = - new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); + AssetUploaderWithCost uploader = + new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -484,7 +521,7 @@ namespace OpenSim.Region.ClientStack.Linden /// public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) + string assetType, uint cost) { m_log.DebugFormat( "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", @@ -703,7 +740,7 @@ namespace OpenSim.Region.ClientStack.Linden if (AddNewInventoryItem != null) { - AddNewInventoryItem(m_HostCapsObj.AgentID, item); + AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); } } -- cgit v1.1 From ead4b8998c07c4c5445b56fab955dfbdf0bf212f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:28:37 +0200 Subject: Revert "Remove the unused NewFileAgentInventoryVariablePrice module." It's actually used. This reverts commit 94a8e5572b1529190a174f29f866b65e7b2ccc0e. --- .../NewFileAgentInventoryVariablePriceModule.cs | 296 +++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs new file mode 100644 index 0000000..52c4f44 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs @@ -0,0 +1,296 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using Mono.Addins; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OpenSim.Framework.Capabilities; + +namespace OpenSim.Region.ClientStack.Linden +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private Scene m_scene; +// private IAssetService m_assetService; + private bool m_dumpAssetsToFile = false; + private bool m_enabled = true; + private int m_levelUpload = 0; + + #region IRegionModuleBase Members + + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + IConfig meshConfig = source.Configs["Mesh"]; + if (meshConfig == null) + return; + + m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); + m_levelUpload = meshConfig.GetInt("LevelUpload", 0); + } + + public void AddRegion(Scene pScene) + { + m_scene = pScene; + } + + public void RemoveRegion(Scene scene) + { + + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + +// m_assetService = m_scene.RequestModuleInterface(); + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + #endregion + + + #region IRegionModule Members + + + + public void Close() { } + + public string Name { get { return "NewFileAgentInventoryVariablePriceModule"; } } + + + public void RegisterCaps(UUID agentID, Caps caps) + { + if(!m_enabled) + return; + + UUID capID = UUID.Random(); + +// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); + caps.RegisterHandler( + "NewFileAgentInventoryVariablePrice", + new LLSDStreamhandler( + "POST", + "/CAPS/" + capID.ToString(), + req => NewAgentInventoryRequest(req, agentID), + "NewFileAgentInventoryVariablePrice", + agentID.ToString())); + } + + #endregion + + public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) + { + //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit + // you need to be aware of this + + //if (llsdRequest.asset_type == "texture" || + // llsdRequest.asset_type == "animation" || + // llsdRequest.asset_type == "sound") + // { + // check user level + + ScenePresence avatar = null; + IClientAPI client = null; + m_scene.TryGetScenePresence(agentID, out avatar); + + if (avatar != null) + { + client = avatar.ControllingClient; + + if (avatar.UserLevel < m_levelUpload) + { + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); + + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; + errorResponse.state = "error"; + return errorResponse; + } + } + + // check funds + IMoneyModule mm = m_scene.RequestModuleInterface(); + + if (mm != null) + { + if (!mm.UploadCovered(agentID, mm.UploadCharge)) + { + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; + errorResponse.state = "error"; + return errorResponse; + } + } + + // } + + string assetName = llsdRequest.name; + string assetDes = llsdRequest.description; + string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/"; + UUID newAsset = UUID.Random(); + UUID newInvItem = UUID.Random(); + UUID parentFolder = llsdRequest.folder_id; + string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; + + AssetUploader uploader = + new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); + + MainServer.Instance.AddStreamHandler( + new BinaryStreamHandler( + "POST", + capsBase + uploaderPath, + uploader.uploaderCaps, + "NewFileAgentInventoryVariablePrice", + agentID.ToString())); + + string protocol = "http://"; + + if (MainServer.Instance.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + + uploaderPath; + + + LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + + uploadResponse.rsvp = uploaderURL; + uploadResponse.state = "upload"; + uploadResponse.resource_cost = 0; + uploadResponse.upload_price = 0; + + uploader.OnUpLoad += //UploadCompleteHandler; + + delegate( + string passetName, string passetDescription, UUID passetID, + UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, + string passetType) + { + UploadCompleteHandler(passetName, passetDescription, passetID, + pinventoryItem, pparentFolder, pdata, pinventoryType, + passetType,agentID); + }; + + return uploadResponse; + } + + public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType,UUID AgentID) + { +// m_log.DebugFormat( +// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem); + + sbyte assType = 0; + sbyte inType = 0; + + if (inventoryType == "sound") + { + inType = 1; + assType = 1; + } + else if (inventoryType == "animation") + { + inType = 19; + assType = 20; + } + else if (inventoryType == "wearable") + { + inType = 18; + switch (assetType) + { + case "bodypart": + assType = 13; + break; + case "clothing": + assType = 5; + break; + } + } + else if (inventoryType == "mesh") + { + inType = (sbyte)InventoryType.Mesh; + assType = (sbyte)AssetType.Mesh; + } + + AssetBase asset; + asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); + asset.Data = data; + + if (m_scene.AssetService != null) + m_scene.AssetService.Store(asset); + + InventoryItemBase item = new InventoryItemBase(); + item.Owner = AgentID; + item.CreatorId = AgentID.ToString(); + item.ID = inventoryItem; + item.AssetID = asset.FullID; + item.Description = assetDescription; + item.Name = assetName; + item.AssetType = assType; + item.InvType = inType; + item.Folder = parentFolder; + item.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + item.BasePermissions = (uint)PermissionMask.All; + item.EveryOnePermissions = 0; + item.NextPermissions = (uint)PermissionMask.All; + item.CreationDate = Util.UnixTimeSinceEpoch(); + m_scene.AddInventoryItem(item); + } + } +} -- cgit v1.1 From a6928a479eb84b14e949c5f589b9ce753edf457a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:50:55 +0200 Subject: Add cost calculation suppor tto the VariablePrice one as well --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 1 - .../NewFileAgentInventoryVariablePriceModule.cs | 52 ++++++++++++++++++---- 2 files changed, 44 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 097e224..328dc75 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -417,7 +417,6 @@ namespace OpenSim.Region.ClientStack.Linden } } - /// /// /// diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 52c4f44..6e2b52d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs @@ -127,6 +127,37 @@ namespace OpenSim.Region.ClientStack.Linden #endregion + private delegate void UploadWithCostCompleteDelegate(string assetName, + string assetDescription, UUID assetID, UUID inventoryItem, + UUID parentFolder, byte[] data, string inventoryType, + string assetType, uint cost); + + private class AssetUploaderWithCost : AssetUploader + { + private uint m_cost; + + public event UploadWithCostCompleteDelegate OnUpLoad; + + public AssetUploaderWithCost(string assetName, string description, UUID assetID, + UUID inventoryItem, UUID parentFolderID, string invType, string assetType, + string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : + base(assetName, description, assetID, inventoryItem, parentFolderID, + invType, assetType, path, httpServer, dumpAssetsToFile) + { + m_cost = cost; + + base.OnUpLoad += UploadCompleteHandler; + } + + private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType) + { + OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, + data, inventoryType, assetType, m_cost); + } + } + public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) { //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit @@ -138,6 +169,8 @@ namespace OpenSim.Region.ClientStack.Linden // { // check user level + uint cost = 0; + ScenePresence avatar = null; IClientAPI client = null; m_scene.TryGetScenePresence(agentID, out avatar); @@ -163,7 +196,10 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) { - if (!mm.UploadCovered(agentID, mm.UploadCharge)) + // XPTO: Calculate cost here + cost = (uint)mm.UploadCharge; + + if (!mm.UploadCovered(agentID, (int)cost)) { if (client != null) client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); @@ -185,9 +221,9 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; - AssetUploader uploader = - new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); + AssetUploaderWithCost uploader = + new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile, cost); MainServer.Instance.AddStreamHandler( new BinaryStreamHandler( @@ -218,11 +254,11 @@ namespace OpenSim.Region.ClientStack.Linden delegate( string passetName, string passetDescription, UUID passetID, UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, - string passetType) + string passetType, uint cost) { UploadCompleteHandler(passetName, passetDescription, passetID, pinventoryItem, pparentFolder, pdata, pinventoryType, - passetType,agentID); + passetType,agentID, cost); }; return uploadResponse; @@ -230,7 +266,7 @@ namespace OpenSim.Region.ClientStack.Linden public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType,UUID AgentID) + string assetType,UUID AgentID, uint cost) { // m_log.DebugFormat( // "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem); @@ -290,7 +326,7 @@ namespace OpenSim.Region.ClientStack.Linden item.EveryOnePermissions = 0; item.NextPermissions = (uint)PermissionMask.All; item.CreationDate = Util.UnixTimeSinceEpoch(); - m_scene.AddInventoryItem(item); + m_scene.AddUploadedInventoryItem(AgentID, item, cost); } } } -- cgit v1.1 From 375ca478dd7bebd6825e6305ba7c8a44fe119c7e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:52:24 +0200 Subject: Rename NewFileAgentInventoryVariablePrice to NewAgentInventoryVariablePrice which is the name actually used in viewer code. --- .../NewFileAgentInventoryVariablePriceModule.cs | 332 --------------------- 1 file changed, 332 deletions(-) delete mode 100644 OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs deleted file mode 100644 index 6e2b52d..0000000 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Reflection; -using System.IO; -using System.Web; -using Mono.Addins; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using Caps = OpenSim.Framework.Capabilities.Caps; -using OpenSim.Framework.Capabilities; - -namespace OpenSim.Region.ClientStack.Linden -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Scene m_scene; -// private IAssetService m_assetService; - private bool m_dumpAssetsToFile = false; - private bool m_enabled = true; - private int m_levelUpload = 0; - - #region IRegionModuleBase Members - - - public Type ReplaceableInterface - { - get { return null; } - } - - public void Initialise(IConfigSource source) - { - IConfig meshConfig = source.Configs["Mesh"]; - if (meshConfig == null) - return; - - m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); - m_levelUpload = meshConfig.GetInt("LevelUpload", 0); - } - - public void AddRegion(Scene pScene) - { - m_scene = pScene; - } - - public void RemoveRegion(Scene scene) - { - - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; - m_scene = null; - } - - public void RegionLoaded(Scene scene) - { - -// m_assetService = m_scene.RequestModuleInterface(); - m_scene.EventManager.OnRegisterCaps += RegisterCaps; - } - - #endregion - - - #region IRegionModule Members - - - - public void Close() { } - - public string Name { get { return "NewFileAgentInventoryVariablePriceModule"; } } - - - public void RegisterCaps(UUID agentID, Caps caps) - { - if(!m_enabled) - return; - - UUID capID = UUID.Random(); - -// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); - caps.RegisterHandler( - "NewFileAgentInventoryVariablePrice", - new LLSDStreamhandler( - "POST", - "/CAPS/" + capID.ToString(), - req => NewAgentInventoryRequest(req, agentID), - "NewFileAgentInventoryVariablePrice", - agentID.ToString())); - } - - #endregion - - private delegate void UploadWithCostCompleteDelegate(string assetName, - string assetDescription, UUID assetID, UUID inventoryItem, - UUID parentFolder, byte[] data, string inventoryType, - string assetType, uint cost); - - private class AssetUploaderWithCost : AssetUploader - { - private uint m_cost; - - public event UploadWithCostCompleteDelegate OnUpLoad; - - public AssetUploaderWithCost(string assetName, string description, UUID assetID, - UUID inventoryItem, UUID parentFolderID, string invType, string assetType, - string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : - base(assetName, description, assetID, inventoryItem, parentFolderID, - invType, assetType, path, httpServer, dumpAssetsToFile) - { - m_cost = cost; - - base.OnUpLoad += UploadCompleteHandler; - } - - private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) - { - OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, - data, inventoryType, assetType, m_cost); - } - } - - public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) - { - //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit - // you need to be aware of this - - //if (llsdRequest.asset_type == "texture" || - // llsdRequest.asset_type == "animation" || - // llsdRequest.asset_type == "sound") - // { - // check user level - - uint cost = 0; - - ScenePresence avatar = null; - IClientAPI client = null; - m_scene.TryGetScenePresence(agentID, out avatar); - - if (avatar != null) - { - client = avatar.ControllingClient; - - if (avatar.UserLevel < m_levelUpload) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } - } - - // check funds - IMoneyModule mm = m_scene.RequestModuleInterface(); - - if (mm != null) - { - // XPTO: Calculate cost here - cost = (uint)mm.UploadCharge; - - if (!mm.UploadCovered(agentID, (int)cost)) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } - } - - // } - - string assetName = llsdRequest.name; - string assetDes = llsdRequest.description; - string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/"; - UUID newAsset = UUID.Random(); - UUID newInvItem = UUID.Random(); - UUID parentFolder = llsdRequest.folder_id; - string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; - - AssetUploaderWithCost uploader = - new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile, cost); - - MainServer.Instance.AddStreamHandler( - new BinaryStreamHandler( - "POST", - capsBase + uploaderPath, - uploader.uploaderCaps, - "NewFileAgentInventoryVariablePrice", - agentID.ToString())); - - string protocol = "http://"; - - if (MainServer.Instance.UseSSL) - protocol = "https://"; - - string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + - uploaderPath; - - - LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - - uploadResponse.rsvp = uploaderURL; - uploadResponse.state = "upload"; - uploadResponse.resource_cost = 0; - uploadResponse.upload_price = 0; - - uploader.OnUpLoad += //UploadCompleteHandler; - - delegate( - string passetName, string passetDescription, UUID passetID, - UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, - string passetType, uint cost) - { - UploadCompleteHandler(passetName, passetDescription, passetID, - pinventoryItem, pparentFolder, pdata, pinventoryType, - passetType,agentID, cost); - }; - - return uploadResponse; - } - - public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType,UUID AgentID, uint cost) - { -// m_log.DebugFormat( -// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem); - - sbyte assType = 0; - sbyte inType = 0; - - if (inventoryType == "sound") - { - inType = 1; - assType = 1; - } - else if (inventoryType == "animation") - { - inType = 19; - assType = 20; - } - else if (inventoryType == "wearable") - { - inType = 18; - switch (assetType) - { - case "bodypart": - assType = 13; - break; - case "clothing": - assType = 5; - break; - } - } - else if (inventoryType == "mesh") - { - inType = (sbyte)InventoryType.Mesh; - assType = (sbyte)AssetType.Mesh; - } - - AssetBase asset; - asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); - asset.Data = data; - - if (m_scene.AssetService != null) - m_scene.AssetService.Store(asset); - - InventoryItemBase item = new InventoryItemBase(); - item.Owner = AgentID; - item.CreatorId = AgentID.ToString(); - item.ID = inventoryItem; - item.AssetID = asset.FullID; - item.Description = assetDescription; - item.Name = assetName; - item.AssetType = assType; - item.InvType = inType; - item.Folder = parentFolder; - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - item.BasePermissions = (uint)PermissionMask.All; - item.EveryOnePermissions = 0; - item.NextPermissions = (uint)PermissionMask.All; - item.CreationDate = Util.UnixTimeSinceEpoch(); - m_scene.AddUploadedInventoryItem(AgentID, item, cost); - } - } -} -- cgit v1.1 From 757a669924db1a68ed75640816c8b9d32a6146e1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:55:33 +0200 Subject: Re-add the module and fix a typo --- .../Caps/NewAgentInventoryVariablePriceModule.cs | 332 +++++++++++++++++++++ 1 file changed, 332 insertions(+) create mode 100644 OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs new file mode 100644 index 0000000..423ad58 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs @@ -0,0 +1,332 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; +using Mono.Addins; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OpenSim.Framework.Capabilities; + +namespace OpenSim.Region.ClientStack.Linden +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class NewAgentInventoryVariablePriceModule : INonSharedRegionModule + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private Scene m_scene; +// private IAssetService m_assetService; + private bool m_dumpAssetsToFile = false; + private bool m_enabled = true; + private int m_levelUpload = 0; + + #region IRegionModuleBase Members + + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + IConfig meshConfig = source.Configs["Mesh"]; + if (meshConfig == null) + return; + + m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); + m_levelUpload = meshConfig.GetInt("LevelUpload", 0); + } + + public void AddRegion(Scene pScene) + { + m_scene = pScene; + } + + public void RemoveRegion(Scene scene) + { + + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + +// m_assetService = m_scene.RequestModuleInterface(); + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + #endregion + + + #region IRegionModule Members + + + + public void Close() { } + + public string Name { get { return "NewAgentInventoryVariablePriceModule"; } } + + + public void RegisterCaps(UUID agentID, Caps caps) + { + if(!m_enabled) + return; + + UUID capID = UUID.Random(); + +// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); + caps.RegisterHandler( + "NewAgentInventoryVariablePrice", + new LLSDStreamhandler( + "POST", + "/CAPS/" + capID.ToString(), + req => NewAgentInventoryRequest(req, agentID), + "NewAgentInventoryVariablePrice", + agentID.ToString())); + } + + #endregion + + private delegate void UploadWithCostCompleteDelegate(string assetName, + string assetDescription, UUID assetID, UUID inventoryItem, + UUID parentFolder, byte[] data, string inventoryType, + string assetType, uint cost); + + private class AssetUploaderWithCost : AssetUploader + { + private uint m_cost; + + public event UploadWithCostCompleteDelegate OnUpLoad; + + public AssetUploaderWithCost(string assetName, string description, UUID assetID, + UUID inventoryItem, UUID parentFolderID, string invType, string assetType, + string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : + base(assetName, description, assetID, inventoryItem, parentFolderID, + invType, assetType, path, httpServer, dumpAssetsToFile) + { + m_cost = cost; + + base.OnUpLoad += UploadCompleteHandler; + } + + private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType) + { + OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, + data, inventoryType, assetType, m_cost); + } + } + + public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) + { + //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit + // you need to be aware of this + + //if (llsdRequest.asset_type == "texture" || + // llsdRequest.asset_type == "animation" || + // llsdRequest.asset_type == "sound") + // { + // check user level + + uint cost = 0; + + ScenePresence avatar = null; + IClientAPI client = null; + m_scene.TryGetScenePresence(agentID, out avatar); + + if (avatar != null) + { + client = avatar.ControllingClient; + + if (avatar.UserLevel < m_levelUpload) + { + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); + + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; + errorResponse.state = "error"; + return errorResponse; + } + } + + // check funds + IMoneyModule mm = m_scene.RequestModuleInterface(); + + if (mm != null) + { + // XPTO: Calculate cost here + cost = (uint)mm.UploadCharge; + + if (!mm.UploadCovered(agentID, (int)cost)) + { + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; + errorResponse.state = "error"; + return errorResponse; + } + } + + // } + + string assetName = llsdRequest.name; + string assetDes = llsdRequest.description; + string capsBase = "/CAPS/NewAgentInventoryVariablePrice/"; + UUID newAsset = UUID.Random(); + UUID newInvItem = UUID.Random(); + UUID parentFolder = llsdRequest.folder_id; + string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; + + AssetUploaderWithCost uploader = + new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile, cost); + + MainServer.Instance.AddStreamHandler( + new BinaryStreamHandler( + "POST", + capsBase + uploaderPath, + uploader.uploaderCaps, + "NewAgentInventoryVariablePrice", + agentID.ToString())); + + string protocol = "http://"; + + if (MainServer.Instance.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + + uploaderPath; + + + LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + + uploadResponse.rsvp = uploaderURL; + uploadResponse.state = "upload"; + uploadResponse.resource_cost = 0; + uploadResponse.upload_price = 0; + + uploader.OnUpLoad += //UploadCompleteHandler; + + delegate( + string passetName, string passetDescription, UUID passetID, + UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, + string passetType, uint pcost) + { + UploadCompleteHandler(passetName, passetDescription, passetID, + pinventoryItem, pparentFolder, pdata, pinventoryType, + passetType,agentID, pcost); + }; + + return uploadResponse; + } + + public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, + UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, + string assetType,UUID AgentID, uint cost) + { +// m_log.DebugFormat( +// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem); + + sbyte assType = 0; + sbyte inType = 0; + + if (inventoryType == "sound") + { + inType = 1; + assType = 1; + } + else if (inventoryType == "animation") + { + inType = 19; + assType = 20; + } + else if (inventoryType == "wearable") + { + inType = 18; + switch (assetType) + { + case "bodypart": + assType = 13; + break; + case "clothing": + assType = 5; + break; + } + } + else if (inventoryType == "mesh") + { + inType = (sbyte)InventoryType.Mesh; + assType = (sbyte)AssetType.Mesh; + } + + AssetBase asset; + asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); + asset.Data = data; + + if (m_scene.AssetService != null) + m_scene.AssetService.Store(asset); + + InventoryItemBase item = new InventoryItemBase(); + item.Owner = AgentID; + item.CreatorId = AgentID.ToString(); + item.ID = inventoryItem; + item.AssetID = asset.FullID; + item.Description = assetDescription; + item.Name = assetName; + item.AssetType = assType; + item.InvType = inType; + item.Folder = parentFolder; + item.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + item.BasePermissions = (uint)PermissionMask.All; + item.EveryOnePermissions = 0; + item.NextPermissions = (uint)PermissionMask.All; + item.CreationDate = Util.UnixTimeSinceEpoch(); + m_scene.AddUploadedInventoryItem(AgentID, item, cost); + } + } +} -- cgit v1.1 From 19b00a5b3ce27d3160648c6bc49699b09dc4f283 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 17:58:46 +0200 Subject: Removing the variable prica handler again. It's never called, was misnamed and probably never worked past the mesh beta. --- .../Caps/NewAgentInventoryVariablePriceModule.cs | 332 --------------------- 1 file changed, 332 deletions(-) delete mode 100644 OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs deleted file mode 100644 index 423ad58..0000000 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewAgentInventoryVariablePriceModule.cs +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Reflection; -using System.IO; -using System.Web; -using Mono.Addins; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using Caps = OpenSim.Framework.Capabilities.Caps; -using OpenSim.Framework.Capabilities; - -namespace OpenSim.Region.ClientStack.Linden -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class NewAgentInventoryVariablePriceModule : INonSharedRegionModule - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Scene m_scene; -// private IAssetService m_assetService; - private bool m_dumpAssetsToFile = false; - private bool m_enabled = true; - private int m_levelUpload = 0; - - #region IRegionModuleBase Members - - - public Type ReplaceableInterface - { - get { return null; } - } - - public void Initialise(IConfigSource source) - { - IConfig meshConfig = source.Configs["Mesh"]; - if (meshConfig == null) - return; - - m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); - m_levelUpload = meshConfig.GetInt("LevelUpload", 0); - } - - public void AddRegion(Scene pScene) - { - m_scene = pScene; - } - - public void RemoveRegion(Scene scene) - { - - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; - m_scene = null; - } - - public void RegionLoaded(Scene scene) - { - -// m_assetService = m_scene.RequestModuleInterface(); - m_scene.EventManager.OnRegisterCaps += RegisterCaps; - } - - #endregion - - - #region IRegionModule Members - - - - public void Close() { } - - public string Name { get { return "NewAgentInventoryVariablePriceModule"; } } - - - public void RegisterCaps(UUID agentID, Caps caps) - { - if(!m_enabled) - return; - - UUID capID = UUID.Random(); - -// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); - caps.RegisterHandler( - "NewAgentInventoryVariablePrice", - new LLSDStreamhandler( - "POST", - "/CAPS/" + capID.ToString(), - req => NewAgentInventoryRequest(req, agentID), - "NewAgentInventoryVariablePrice", - agentID.ToString())); - } - - #endregion - - private delegate void UploadWithCostCompleteDelegate(string assetName, - string assetDescription, UUID assetID, UUID inventoryItem, - UUID parentFolder, byte[] data, string inventoryType, - string assetType, uint cost); - - private class AssetUploaderWithCost : AssetUploader - { - private uint m_cost; - - public event UploadWithCostCompleteDelegate OnUpLoad; - - public AssetUploaderWithCost(string assetName, string description, UUID assetID, - UUID inventoryItem, UUID parentFolderID, string invType, string assetType, - string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : - base(assetName, description, assetID, inventoryItem, parentFolderID, - invType, assetType, path, httpServer, dumpAssetsToFile) - { - m_cost = cost; - - base.OnUpLoad += UploadCompleteHandler; - } - - private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) - { - OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, - data, inventoryType, assetType, m_cost); - } - } - - public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) - { - //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit - // you need to be aware of this - - //if (llsdRequest.asset_type == "texture" || - // llsdRequest.asset_type == "animation" || - // llsdRequest.asset_type == "sound") - // { - // check user level - - uint cost = 0; - - ScenePresence avatar = null; - IClientAPI client = null; - m_scene.TryGetScenePresence(agentID, out avatar); - - if (avatar != null) - { - client = avatar.ControllingClient; - - if (avatar.UserLevel < m_levelUpload) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } - } - - // check funds - IMoneyModule mm = m_scene.RequestModuleInterface(); - - if (mm != null) - { - // XPTO: Calculate cost here - cost = (uint)mm.UploadCharge; - - if (!mm.UploadCovered(agentID, (int)cost)) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } - } - - // } - - string assetName = llsdRequest.name; - string assetDes = llsdRequest.description; - string capsBase = "/CAPS/NewAgentInventoryVariablePrice/"; - UUID newAsset = UUID.Random(); - UUID newInvItem = UUID.Random(); - UUID parentFolder = llsdRequest.folder_id; - string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; - - AssetUploaderWithCost uploader = - new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile, cost); - - MainServer.Instance.AddStreamHandler( - new BinaryStreamHandler( - "POST", - capsBase + uploaderPath, - uploader.uploaderCaps, - "NewAgentInventoryVariablePrice", - agentID.ToString())); - - string protocol = "http://"; - - if (MainServer.Instance.UseSSL) - protocol = "https://"; - - string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + - uploaderPath; - - - LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - - uploadResponse.rsvp = uploaderURL; - uploadResponse.state = "upload"; - uploadResponse.resource_cost = 0; - uploadResponse.upload_price = 0; - - uploader.OnUpLoad += //UploadCompleteHandler; - - delegate( - string passetName, string passetDescription, UUID passetID, - UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType, - string passetType, uint pcost) - { - UploadCompleteHandler(passetName, passetDescription, passetID, - pinventoryItem, pparentFolder, pdata, pinventoryType, - passetType,agentID, pcost); - }; - - return uploadResponse; - } - - public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType,UUID AgentID, uint cost) - { -// m_log.DebugFormat( -// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem); - - sbyte assType = 0; - sbyte inType = 0; - - if (inventoryType == "sound") - { - inType = 1; - assType = 1; - } - else if (inventoryType == "animation") - { - inType = 19; - assType = 20; - } - else if (inventoryType == "wearable") - { - inType = 18; - switch (assetType) - { - case "bodypart": - assType = 13; - break; - case "clothing": - assType = 5; - break; - } - } - else if (inventoryType == "mesh") - { - inType = (sbyte)InventoryType.Mesh; - assType = (sbyte)AssetType.Mesh; - } - - AssetBase asset; - asset = new AssetBase(assetID, assetName, assType, AgentID.ToString()); - asset.Data = data; - - if (m_scene.AssetService != null) - m_scene.AssetService.Store(asset); - - InventoryItemBase item = new InventoryItemBase(); - item.Owner = AgentID; - item.CreatorId = AgentID.ToString(); - item.ID = inventoryItem; - item.AssetID = asset.FullID; - item.Description = assetDescription; - item.Name = assetName; - item.AssetType = assType; - item.InvType = inType; - item.Folder = parentFolder; - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - item.BasePermissions = (uint)PermissionMask.All; - item.EveryOnePermissions = 0; - item.NextPermissions = (uint)PermissionMask.All; - item.CreationDate = Util.UnixTimeSinceEpoch(); - m_scene.AddUploadedInventoryItem(AgentID, item, cost); - } - } -} -- cgit v1.1 From 245763b1b08d667aede3be7c092fa4c7200549c0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 11 Sep 2012 20:30:30 +0100 Subject: let LLSDAssetUploadRequest include asset_resources information plus let NewAgentInventoryRequest know about mesh (does nothing with it still) --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 328dc75..df43991 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -431,6 +431,7 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || + llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { ScenePresence avatar = null; -- cgit v1.1 From 013e94af5d45a7c99e46e01d9c5965a79ac1b231 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 11 Sep 2012 23:06:29 +0100 Subject: report mesh upload costs ( fake values) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 48 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index df43991..90ac8ce 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -463,7 +463,26 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) { // XPTO: The cost should be calculated about here - cost = (uint)mm.UploadCharge; + + if (llsdRequest.asset_type == "mesh") + { + if (llsdRequest.asset_resources == null) + { + client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); + + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; + } + + uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; + textures_cost *= (uint)mm.UploadCharge; + + cost = textures_cost; + } + else + cost = (uint)mm.UploadCharge; if (!mm.UploadCovered(client.AgentId, (int)cost)) { @@ -486,9 +505,14 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); + uint uploadCost = cost; + // don't charge for meshs until we done them + if (llsdRequest.asset_type == "mesh") + uploadCost = 0; + AssetUploaderWithCost uploader = new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, uploadCost); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -506,11 +530,31 @@ namespace OpenSim.Region.ClientStack.Linden string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + uploaderPath; + LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; + uploadResponse.upload_price = (int)cost; + + // use fake values for now + if (llsdRequest.asset_type == "mesh") + { + uploadResponse.data = new LLSDAssetUploadResponseData(); + uploadResponse.data.model_streaming_cost = 1.0; + uploadResponse.data.simulation_cost = 1.5; + + uploadResponse.data.physics_cost = 2.0; + uploadResponse.data.resource_cost = 3.0; + uploadResponse.data.upload_price_breakdown.mesh_instance = 1; + uploadResponse.data.upload_price_breakdown.mesh_physics = 2; + uploadResponse.data.upload_price_breakdown.mesh_streaming = 3; + uploadResponse.data.upload_price_breakdown.texture = 5; + uploadResponse.data.upload_price_breakdown.model = 4; + } + uploader.OnUpLoad += UploadCompleteHandler; return uploadResponse; + } /// -- cgit v1.1 From fd1ee58f87dfbad96e89675bf5ab002d2d3a347f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Sep 2012 22:52:11 +0200 Subject: Add a missing brace, remove a useless temp variable, enable charging. --- .../Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 90ac8ce..9982556 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -482,7 +482,9 @@ namespace OpenSim.Region.ClientStack.Linden cost = textures_cost; } else + { cost = (uint)mm.UploadCharge; + } if (!mm.UploadCovered(client.AgentId, (int)cost)) { @@ -505,14 +507,9 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - uint uploadCost = cost; - // don't charge for meshs until we done them - if (llsdRequest.asset_type == "mesh") - uploadCost = 0; - AssetUploaderWithCost uploader = new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, uploadCost); + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( -- cgit v1.1 From 5139db2638fcee945961ea8d5635def581b54a4d Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Sep 2012 12:56:59 +0200 Subject: Add a timer to time out upload caps handlers that are not used. --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 9982556..c4a9a19 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -26,6 +26,7 @@ */ using System; +using System.Timers; using System.Collections; using System.Collections.Generic; using System.IO; @@ -1106,6 +1107,7 @@ namespace OpenSim.Region.ClientStack.Linden private string m_invType = String.Empty; private string m_assetType = String.Empty; + private Timer m_timeoutTimer = new Timer(); public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, @@ -1121,6 +1123,11 @@ namespace OpenSim.Region.ClientStack.Linden m_assetType = assetType; m_invType = invType; m_dumpAssetsToFile = dumpAssetsToFile; + + m_timeoutTimer.Elapsed += TimedOut; + m_timeoutTimer.Interval = 120000; + m_timeoutTimer.AutoReset = false; + m_timeoutTimer.Start(); } /// @@ -1163,6 +1170,11 @@ namespace OpenSim.Region.ClientStack.Linden return res; } + private void TimedOut(object sender, ElapsedEventArgs args) + { + httpListener.RemoveStreamHandler("POST", uploaderPath); + } + ///Left this in and commented in case there are unforseen issues //private void SaveAssetToFile(string filename, byte[] data) //{ -- cgit v1.1 From d8e9188908bd1f6ab505e5424f02071b44f0fab1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Sep 2012 21:14:55 +0200 Subject: Stop expiry timer when upload is complete. Log if timeout is reached. --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index c4a9a19..116055a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1149,6 +1149,7 @@ namespace OpenSim.Region.ClientStack.Linden res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); httpListener.RemoveStreamHandler("POST", uploaderPath); + m_timeoutTimer.Stop(); // TODO: probably make this a better set of extensions here string extension = ".jp2"; @@ -1172,6 +1173,7 @@ namespace OpenSim.Region.ClientStack.Linden private void TimedOut(object sender, ElapsedEventArgs args) { + m_log.InfoFormat("[CAPS]: Removing URL and handler for timed out mesh upload"); httpListener.RemoveStreamHandler("POST", uploaderPath); } -- cgit v1.1 From e7932682a2405dab69cb6b4447dde952c2a5c080 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Sep 2012 21:24:09 +0200 Subject: Add a logger so the prior commit will work --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 116055a..88957ff 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1093,6 +1093,9 @@ namespace OpenSim.Region.ClientStack.Linden public class AssetUploader { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event UpLoadedAsset OnUpLoad; private UpLoadedAsset handlerUpLoad = null; -- cgit v1.1 From 45fe25de0d9636690114091565775d264a0ca96f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:14:39 +0200 Subject: Allow some more connections to try to ease lag. --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 88957ff..580c005 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -467,6 +467,8 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "mesh") { + cost += 20; // Constant for now to test showing a price + if (llsdRequest.asset_resources == null) { client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); @@ -480,7 +482,7 @@ namespace OpenSim.Region.ClientStack.Linden uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; textures_cost *= (uint)mm.UploadCharge; - cost = textures_cost; + cost += textures_cost; } else { -- cgit v1.1 From 387e59ff7f60f2b12526eaacd93581f76abe26e1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 21:24:25 +0200 Subject: Revamp the HTTP textures handler to allow a maximum of four fetches at any time and to drop requests for avatars n longer in the scene --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 223 +++++++++++++++++---- 1 file changed, 179 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 5ae9cc3..5b125ea 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -27,18 +27,13 @@ using System; using System.Collections; -using System.Collections.Specialized; -using System.Drawing; -using System.Drawing.Imaging; +using System.Collections.Generic; using System.Reflection; -using System.IO; -using System.Web; +using System.Threading; using log4net; using Nini.Config; using Mono.Addins; using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenMetaverse.Imaging; using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; @@ -47,64 +42,73 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using OpenSim.Capabilities.Handlers; +using OpenSim.Framework.Monitoring; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + /// + /// This module implements both WebFetchTextureDescendents and FetchTextureDescendents2 capabilities. + /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")] public class GetTextureModule : INonSharedRegionModule { -// private static readonly ILog m_log = -// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; - private IAssetService m_assetService; - private bool m_Enabled = false; + private static GetTextureHandler m_getTextureHandler; + + private IAssetService m_assetService = null; - // TODO: Change this to a config option - const string REDIRECT_URL = null; + private Dictionary m_capsDict = new Dictionary(); + private static Thread[] m_workerThreads = null; - private string m_URL; + private static OpenMetaverse.BlockingQueue m_queue = + new OpenMetaverse.BlockingQueue(); #region ISharedRegionModule Members public void Initialise(IConfigSource source) { - IConfig config = source.Configs["ClientStack.LindenCaps"]; - if (config == null) - return; - - m_URL = config.GetString("Cap_GetTexture", string.Empty); - // Cap doesn't exist - if (m_URL != string.Empty) - m_Enabled = true; } public void AddRegion(Scene s) { - if (!m_Enabled) - return; - m_scene = s; + m_assetService = s.AssetService; } public void RemoveRegion(Scene s) { - if (!m_Enabled) - return; - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; m_scene = null; } public void RegionLoaded(Scene s) { - if (!m_Enabled) - return; + // We'll reuse the same handler for all requests. + m_getTextureHandler = new GetTextureHandler(m_assetService); - m_assetService = m_scene.RequestModuleInterface(); m_scene.EventManager.OnRegisterCaps += RegisterCaps; + m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; + + if (m_workerThreads == null) + { + m_workerThreads = new Thread[4]; + + for (uint i = 0; i < 4; i++) + { + m_workerThreads[i] = Watchdog.StartThread(DoTextureRequests, + String.Format("TextureWorkerThread{0}", i), + ThreadPriority.Normal, + false, + true, + null, + int.MaxValue); + } + } } public void PostInitialise() @@ -122,24 +126,155 @@ namespace OpenSim.Region.ClientStack.Linden #endregion - public void RegisterCaps(UUID agentID, Caps caps) + ~GetTextureModule() + { + foreach (Thread t in m_workerThreads) + t.Abort(); + } + + private class PollServiceTextureEventArgs : PollServiceEventArgs { - UUID capID = UUID.Random(); + private List requests = + new List(); + private Dictionary responses = + new Dictionary(); + + private Scene m_scene; - //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); - if (m_URL == "localhost") + public PollServiceTextureEventArgs(UUID pId, Scene scene) : + base(null, null, null, null, pId, 30000) { -// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); - caps.RegisterHandler( - "GetTexture", - new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString())); + m_scene = scene; + + HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; + GetEvents = (x, y, s) => + { + try + { + return this.responses[x]; + } + finally + { + responses.Remove(x); + } + }; + + Request = (x, y) => + { + y["RequestID"] = x.ToString(); + lock (this.requests) + this.requests.Add(y); + + m_queue.Enqueue(this); + }; + + NoEvents = (x, y) => + { + lock (this.requests) + { + Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); + requests.Remove(request); + } + + Hashtable response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + return response; + }; } - else + + public void Process() { -// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); - caps.RegisterHandler("GetTexture", m_URL); + Hashtable response; + Hashtable request = null; + + try + { + lock (this.requests) + { + request = requests[0]; + requests.RemoveAt(0); + } + } + catch + { + return; + } + + UUID requestID = new UUID(request["RequestID"].ToString()); + + // If the avatar is gone, don't bother to get the texture + if (m_scene.GetScenePresence(Id) == null) + { + response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + responses[requestID] = response; + return; + } + + response = m_getTextureHandler.Handle(request); + + responses[requestID] = response; + } + } + + private void RegisterCaps(UUID agentID, Caps caps) + { + string capUrl = "/CAPS/" + UUID.Random() + "/"; + + // Register this as a poll service + // absurd large timeout to tune later to make a bit less than viewer + PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); + + args.Type = PollServiceEventArgs.EventType.Texture; + MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); + + string hostName = m_scene.RegionInfo.ExternalHostName; + uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; + string protocol = "http"; + + if (MainServer.Instance.UseSSL) + { + hostName = MainServer.Instance.SSLCommonName; + port = MainServer.Instance.SSLPort; + protocol = "https"; } + caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); + + m_capsDict[agentID] = capUrl; } + private void DeregisterCaps(UUID agentID, Caps caps) + { + string capUrl; + + if (m_capsDict.TryGetValue(agentID, out capUrl)) + { + MainServer.Instance.RemoveHTTPHandler("", capUrl); + m_capsDict.Remove(agentID); + } + } + + private void DoTextureRequests() + { + while (true) + { + PollServiceTextureEventArgs args = m_queue.Dequeue(); + + args.Process(); + } + } } + } -- cgit v1.1 From 5bbc4fb2a5e0f357e0c880a722617d4f2b655203 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 13:39:38 +0100 Subject: missing file for suport of mesh upload cost --- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 596 +++++++++++++++++++++ 1 file changed, 596 insertions(+) create mode 100644 OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs new file mode 100644 index 0000000..8adacab --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -0,0 +1,596 @@ +// Proprietary code of Avination Virtual Limited +// (c) 2012 Melanie Thielker, Leal Duarte +// + +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +using OpenMetaverse; +using OpenMetaverse.StructuredData; + +using OpenSim.Framework; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Framework.Capabilities; + +using ComponentAce.Compression.Libs.zlib; + +using OSDArray = OpenMetaverse.StructuredData.OSDArray; +using OSDMap = OpenMetaverse.StructuredData.OSDMap; + +namespace OpenSim.Region.ClientStack.Linden +{ + public class ModelCost + { + float ModelMinCost = 5.0f; // try to favor small meshs versus sculpts + + // scale prices relative to basic cost + const float ModelCostScale = 1.0f; + + const float primCreationCost = 0.01f; // 256 prims cost extra 2.56 + + // weigthed size to money convertion + const float bytecost = 1e-4f; + + // for mesh upload fees based on compressed data sizes + // not using streaming physics and server costs as SL apparently does ?? + + const float medSizeWth = 1f; // 2x + const float lowSizeWth = 1.5f; // 2.5x + const float lowestSizeWth = 2f; // 3x + // favor potencial optimized meshs versus automatic decomposition + const float physMeshSizeWth = 6f; // counts 7x + const float physHullSizeWth = 8f; // counts 9x + + // price compression to promote complex meshs + const float feeCompressionBase = 50.0f; // transition from linear to log cost + const float feeCompressionScale = 250.0f; // 10000 scales to 1000 + + // stream cost size factors + const float highLodFactor = 17.36f; + const float midLodFactor = 277.78f; + const float lowLodFactor = 1111.11f; + + const int bytesPerCoord = 6; // 3 coords, 2 bytes per each + + private class ameshCostParam + { + public int highLODSize; + public int medLODSize; + public int lowLODSize; + public int lowestLODSize; + public float costFee; + public float physicsCost; + } + + public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, LLSDAssetUploadResponseData meshcostdata, out string error) + { + totalcost = 0; + error = string.Empty; + + if (resources == null || + resources.instance_list == null || + resources.instance_list.Array.Count == 0) + { + error = "Unable to upload mesh model. missing information."; + return false; + } + + meshcostdata.model_streaming_cost = 0.0; + meshcostdata.simulation_cost = 0.0; + meshcostdata.physics_cost = 0.0; + meshcostdata.resource_cost = 0.0; + + meshcostdata.upload_price_breakdown.mesh_instance = 0; + meshcostdata.upload_price_breakdown.mesh_physics = 0; + meshcostdata.upload_price_breakdown.mesh_streaming = 0; + meshcostdata.upload_price_breakdown.model = 0; + + int itmp; + + // textures cost + if (resources.texture_list != null && resources.texture_list.Array.Count > 0) + { + int textures_cost = resources.texture_list.Array.Count; + textures_cost *= basicCost; + + meshcostdata.upload_price_breakdown.texture = textures_cost; + totalcost += textures_cost; + } + + float meshsfee = 0; + + // meshs assets cost + + int numberMeshs = 0; + List meshsCosts = new List(); + // a model could have no mesh actually + if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) + { + numberMeshs = resources.mesh_list.Array.Count; + + for (int i = 0; i < numberMeshs; i++) + { + ameshCostParam curCost = new ameshCostParam(); + byte[] data = (byte[])resources.mesh_list.Array[i]; + + if (!MeshCost(data, curCost, out error)) + { + return false; + } + meshsCosts.Add(curCost); + meshsfee += curCost.costFee; + } + } + + // instances (prims) cost + int numberInstances = resources.instance_list.Array.Count; + int mesh; + for (int i = 0; i < numberInstances; i++) + { + Hashtable inst = (Hashtable)resources.instance_list.Array[i]; + + // streamming cost + // assume all instances have a mesh + // but in general they can have normal prims + // but for now that seems not suported + // when they do, we will need to inspect pbs information + // and have cost funtions for all prims types + // don't check for shape type none, since + // that could be used to upload meshs with low cost + // changing later inworld + + ArrayList ascale = (ArrayList)inst["scale"]; + Vector3 scale; + double tmp; + tmp = (double)ascale[0]; + scale.X = (float)tmp; + tmp = (double)ascale[1]; + scale.Y = (float)tmp; + tmp = (double)ascale[2]; + scale.Z = (float)tmp; + + float sqdiam = scale.LengthSquared(); + + mesh = (int)inst["mesh"]; + + if(mesh >= numberMeshs) + { + error = "Unable to upload mesh model. incoerent information."; + return false; + } + + ameshCostParam curCost = meshsCosts[mesh]; + float mesh_streaming = streamingCost(curCost, sqdiam); + + meshcostdata.model_streaming_cost += mesh_streaming; + + meshcostdata.physics_cost += curCost.physicsCost; + + // unscripted and static prim server cost + meshcostdata.simulation_cost += 0.5f; + // charge for prims creation + meshsfee += primCreationCost; + } + + if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost) + meshcostdata.resource_cost = meshcostdata.model_streaming_cost; + else + meshcostdata.resource_cost = meshcostdata.physics_cost; + + if (meshsfee < ModelMinCost) + meshsfee = ModelMinCost; + + meshsfee *= ModelCostScale; + meshsfee += 0.5f; // rounding + + totalcost += (int)meshsfee; + + // breakdown prices + // don't seem to be in use so removed code for now + + return true; + } + + private bool MeshCost(byte[] data, ameshCostParam cost, out string error) + { + cost.highLODSize = 0; + cost.medLODSize = 0; + cost.lowLODSize = 0; + cost.lowestLODSize = 0; + cost.physicsCost = 0.0f; + cost.costFee = 0.0f; + + error = string.Empty; + + if (data == null || data.Length == 0) + { + error = "Unable to upload mesh model. missing information."; + return false; + } + + OSD meshOsd = null; + int start = 0; + + error = "Unable to upload mesh model. Invalid data"; + + using (MemoryStream ms = new MemoryStream(data)) + { + try + { + OSD osd = OSDParser.DeserializeLLSDBinary(ms); + if (osd is OSDMap) + meshOsd = (OSDMap)osd; + else + return false; + } + catch (Exception e) + { + return false; + } + start = (int)ms.Position; + } + + OSDMap map = (OSDMap)meshOsd; + OSDMap tmpmap; + + int highlod_size = 0; + int medlod_size = 0; + int lowlod_size = 0; + int lowestlod_size = 0; + int skin_size = 0; + + int hulls_size = 0; + int phys_nhulls; + int phys_hullsvertices = 0; + + int physmesh_size = 0; + int phys_ntriangles = 0; + + int submesh_offset = -1; + + if (map.ContainsKey("physics_convex")) + { + tmpmap = (OSDMap)map["physics_convex"]; + if (tmpmap.ContainsKey("offset")) + submesh_offset = tmpmap["offset"].AsInteger() + start; + if (tmpmap.ContainsKey("size")) + hulls_size = tmpmap["size"].AsInteger(); + } + + if (submesh_offset < 0 || hulls_size == 0) + { + error = "Unable to upload mesh model. missing physics_convex block"; + return false; + } + + if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls)) + { + error = "Unable to upload mesh model. bad physics_convex block"; + return false; + } + + submesh_offset = -1; + + // only look for LOD meshs sizes + + if (map.ContainsKey("high_lod")) + { + tmpmap = (OSDMap)map["high_lod"]; + // see at least if there is a offset for this one + if (tmpmap.ContainsKey("offset")) + submesh_offset = tmpmap["offset"].AsInteger() + start; + if (tmpmap.ContainsKey("size")) + highlod_size = tmpmap["size"].AsInteger(); + } + + if (submesh_offset < 0 || highlod_size <= 0) + { + error = "Unable to upload mesh model. missing high_lod"; + return false; + } + + bool haveprev = true; + + if (map.ContainsKey("medium_lod")) + { + tmpmap = (OSDMap)map["medium_lod"]; + if (tmpmap.ContainsKey("size")) + medlod_size = tmpmap["size"].AsInteger(); + else + haveprev = false; + } + + if (haveprev && map.ContainsKey("low_lod")) + { + tmpmap = (OSDMap)map["low_lod"]; + if (tmpmap.ContainsKey("size")) + lowlod_size = tmpmap["size"].AsInteger(); + else + haveprev = false; + } + + if (haveprev && map.ContainsKey("lowest_lod")) + { + tmpmap = (OSDMap)map["lowest_lod"]; + if (tmpmap.ContainsKey("size")) + lowestlod_size = tmpmap["size"].AsInteger(); + } + + if (map.ContainsKey("skin")) + { + tmpmap = (OSDMap)map["skin"]; + if (tmpmap.ContainsKey("size")) + skin_size = tmpmap["size"].AsInteger(); + } + + cost.highLODSize = highlod_size; + cost.medLODSize = medlod_size; + cost.lowLODSize = lowlod_size; + cost.lowestLODSize = lowestlod_size; + + submesh_offset = -1; + + if (map.ContainsKey("physics_mesh")) + { + tmpmap = (OSDMap)map["physics_mesh"]; + if (tmpmap.ContainsKey("offset")) + submesh_offset = tmpmap["offset"].AsInteger() + start; + if (tmpmap.ContainsKey("size")) + physmesh_size = tmpmap["size"].AsInteger(); + + if (submesh_offset >= 0 || physmesh_size > 0) + { + + if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles)) + { + error = "Unable to upload mesh model. parsing error"; + return false; + } + } + } + + // upload is done in convex shape type so only one hull + phys_hullsvertices++; + cost.physicsCost = 0.04f * phys_hullsvertices; + + float sfee; + + sfee = data.Length; // start with total compressed data size + + // penalize lod meshs that should be more builder optimized + sfee += medSizeWth * medlod_size; + sfee += lowSizeWth * lowlod_size; + sfee += lowestSizeWth * lowlod_size; + + // physics + // favor potencial optimized meshs versus automatic decomposition + if (physmesh_size != 0) + sfee += physMeshSizeWth * (physmesh_size + hulls_size / 4); // reduce cost of mandatory convex hull + else + sfee += physHullSizeWth * hulls_size; + + // bytes to money + sfee *= bytecost; + + // fee compression + if (sfee > feeCompressionBase) + { + sfee -= feeCompressionBase; + sfee = feeCompressionScale * (float)Math.Log10((double)sfee); + sfee += feeCompressionBase; + } + + + + cost.costFee = sfee; + return true; + } + + private bool submesh(byte[] data, int offset, int size, out int ntriangles) + { + ntriangles = 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 (ZOutputStream zOut = new ZOutputStream(outMs)) + { + byte[] readBuffer = new byte[4096]; + int readLen = 0; + while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0) + { + zOut.Write(readBuffer, 0, readLen); + } + zOut.Flush(); + outMs.Seek(0, SeekOrigin.Begin); + + byte[] decompressedBuf = outMs.GetBuffer(); + decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); + } + } + } + } + catch (Exception e) + { + return false; + } + + OSDArray decodedMeshOsdArray = null; + if ((!decodedMeshOsd is OSDArray)) + return false; + + byte[] dummy; + + decodedMeshOsdArray = (OSDArray)decodedMeshOsd; + foreach (OSD subMeshOsd in decodedMeshOsdArray) + { + if (subMeshOsd is OSDMap) + { + OSDMap subtmpmap = (OSDMap)subMeshOsd; + if (subtmpmap.ContainsKey("NoGeometry") && ((OSDBoolean)subtmpmap["NoGeometry"])) + continue; + + if (!subtmpmap.ContainsKey("Position")) + return false; + + if (subtmpmap.ContainsKey("TriangleList")) + { + dummy = subtmpmap["TriangleList"].AsBinary(); + ntriangles += dummy.Length / bytesPerCoord; + } + else + return false; + } + } + + return true; + } + + private bool hulls(byte[] data, int offset, int size, out int nvertices, out int nhulls) + { + nvertices = 0; + 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()) + { + using (ZOutputStream zOut = new ZOutputStream(outMs)) + { + byte[] readBuffer = new byte[4096]; + int readLen = 0; + while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0) + { + zOut.Write(readBuffer, 0, readLen); + } + zOut.Flush(); + outMs.Seek(0, SeekOrigin.Begin); + + byte[] decompressedBuf = outMs.GetBuffer(); + decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); + } + } + } + } + catch (Exception e) + { + return false; + } + + OSDMap cmap = (OSDMap)decodedMeshOsd; + if (cmap == null) + return false; + + byte[] dummy; + + // must have one of this + if (cmap.ContainsKey("BoundingVerts")) + { + dummy = cmap["BoundingVerts"].AsBinary(); + nvertices = dummy.Length / bytesPerCoord; + } + else + return false; + +/* upload is done with convex shape type + if (cmap.ContainsKey("HullList")) + { + dummy = cmap["HullList"].AsBinary(); + nhulls += dummy.Length; + } + + + if (cmap.ContainsKey("Positions")) + { + dummy = cmap["Positions"].AsBinary(); + nvertices = dummy.Length / bytesPerCoord; + } + */ + + return true; + } + + private float streamingCost(ameshCostParam curCost, float sqdiam) + { + // compute efective areas + float ma = 262144f; + + float mh = sqdiam * highLodFactor; + if (mh > ma) + mh = ma; + float mm = sqdiam * midLodFactor; + if (mm > ma) + mm = ma; + + float ml = sqdiam * lowLodFactor; + if (ml > ma) + ml = ma; + + float mlst = ma; + + mlst -= ml; + ml -= mm; + mm -= mh; + + if (mlst < 1.0f) + mlst = 1.0f; + if (ml < 1.0f) + ml = 1.0f; + if (mm < 1.0f) + mm = 1.0f; + if (mh < 1.0f) + mh = 1.0f; + + ma = mlst + ml + mm + mh; + + // get LODs compressed sizes + // giving 384 bytes bonus + int lst = curCost.lowestLODSize - 384; + int l = curCost.lowLODSize - 384; + int m = curCost.medLODSize - 384; + int h = curCost.highLODSize - 384; + + // use previus higher LOD size on missing ones + if (m <= 0) + m = h; + if (l <= 0) + l = m; + if (lst <= 0) + lst = l; + + // force minumum sizes + if (lst < 16) + lst = 16; + if (l < 16) + l = 16; + if (m < 16) + m = 16; + if (h < 16) + h = 16; + + // compute cost weighted by relative effective areas + + float cost = (float)lst * mlst + (float)l * ml + (float)m * mm + (float)h * mh; + cost /= ma; + + cost *= 0.004f; // overall tunning parameter + + return cost; + } + } +} -- cgit v1.1 From 5915dfc26f0fe02411588ddea2791d69cb67d1ed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 15:37:05 +0100 Subject: Make use of mesh cost functions --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 29 ++++++++-------------- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 8 +++--- 2 files changed, 13 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 580c005..ce3ca8b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -429,6 +429,7 @@ namespace OpenSim.Region.ClientStack.Linden //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); uint cost = 0; + LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || @@ -467,11 +468,15 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "mesh") { - cost += 20; // Constant for now to test showing a price + string error; + int modelcost; + ModelCost mc = new ModelCost(); - if (llsdRequest.asset_resources == null) + if (!mc.MeshModelCost(llsdRequest.asset_resources, mm.UploadCharge, out modelcost, + meshcostdata, out error)) { - client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); + + client.SendAgentAlertMessage(error, false); LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; @@ -479,10 +484,7 @@ namespace OpenSim.Region.ClientStack.Linden return errorResponse; } - uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; - textures_cost *= (uint)mm.UploadCharge; - - cost += textures_cost; + cost = (uint)modelcost; } else { @@ -536,20 +538,9 @@ namespace OpenSim.Region.ClientStack.Linden uploadResponse.state = "upload"; uploadResponse.upload_price = (int)cost; - // use fake values for now if (llsdRequest.asset_type == "mesh") { - uploadResponse.data = new LLSDAssetUploadResponseData(); - uploadResponse.data.model_streaming_cost = 1.0; - uploadResponse.data.simulation_cost = 1.5; - - uploadResponse.data.physics_cost = 2.0; - uploadResponse.data.resource_cost = 3.0; - uploadResponse.data.upload_price_breakdown.mesh_instance = 1; - uploadResponse.data.upload_price_breakdown.mesh_physics = 2; - uploadResponse.data.upload_price_breakdown.mesh_streaming = 3; - uploadResponse.data.upload_price_breakdown.texture = 5; - uploadResponse.data.upload_price_breakdown.model = 4; + uploadResponse.data = meshcostdata; } uploader.OnUpLoad += UploadCompleteHandler; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 8adacab..0b5d3fa 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -27,9 +27,6 @@ namespace OpenSim.Region.ClientStack.Linden { float ModelMinCost = 5.0f; // try to favor small meshs versus sculpts - // scale prices relative to basic cost - const float ModelCostScale = 1.0f; - const float primCreationCost = 0.01f; // 256 prims cost extra 2.56 // weigthed size to money convertion @@ -70,7 +67,7 @@ namespace OpenSim.Region.ClientStack.Linden { totalcost = 0; error = string.Empty; - + if (resources == null || resources.instance_list == null || resources.instance_list.Array.Count == 0) @@ -184,7 +181,8 @@ namespace OpenSim.Region.ClientStack.Linden if (meshsfee < ModelMinCost) meshsfee = ModelMinCost; - meshsfee *= ModelCostScale; + // scale cost with basic cost changes relative to 10 + meshsfee *= (float)basicCost / 10.0f; meshsfee += 0.5f; // rounding totalcost += (int)meshsfee; -- cgit v1.1 From df77724bbc30ab03f95508bd1b2f4539ed1206e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 15:50:59 +0100 Subject: let mesh model estimator work even without money module, so other estimations can work --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ce3ca8b..ddb69c4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -462,35 +462,35 @@ namespace OpenSim.Region.ClientStack.Linden { IMoneyModule mm = m_Scene.RequestModuleInterface(); + int baseCost = 0; if (mm != null) + baseCost = mm.UploadCharge; + + if (llsdRequest.asset_type == "mesh") { - // XPTO: The cost should be calculated about here + string error; + int modelcost; + ModelCost mc = new ModelCost(); - if (llsdRequest.asset_type == "mesh") + if (!mc.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, + meshcostdata, out error)) { - string error; - int modelcost; - ModelCost mc = new ModelCost(); - - if (!mc.MeshModelCost(llsdRequest.asset_resources, mm.UploadCharge, out modelcost, - meshcostdata, out error)) - { - - client.SendAgentAlertMessage(error, false); + client.SendAgentAlertMessage(error, false); - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); - errorResponse.uploader = ""; - errorResponse.state = "error"; - return errorResponse; - } - - cost = (uint)modelcost; - } - else - { - cost = (uint)mm.UploadCharge; + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; } + cost = (uint)modelcost; + } + else + { + cost = (uint)baseCost; + } + if (mm != null) + { if (!mm.UploadCovered(client.AgentId, (int)cost)) { client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); -- cgit v1.1 From 1740325392f9771e629ca290a608f26df85fb169 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 17:49:10 +0100 Subject: removed broken fee compression --- .../ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 0b5d3fa..622a2d9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -42,10 +42,6 @@ namespace OpenSim.Region.ClientStack.Linden const float physMeshSizeWth = 6f; // counts 7x const float physHullSizeWth = 8f; // counts 9x - // price compression to promote complex meshs - const float feeCompressionBase = 50.0f; // transition from linear to log cost - const float feeCompressionScale = 250.0f; // 10000 scales to 1000 - // stream cost size factors const float highLodFactor = 17.36f; const float midLodFactor = 277.78f; @@ -373,17 +369,7 @@ namespace OpenSim.Region.ClientStack.Linden // bytes to money sfee *= bytecost; - - // fee compression - if (sfee > feeCompressionBase) - { - sfee -= feeCompressionBase; - sfee = feeCompressionScale * (float)Math.Log10((double)sfee); - sfee += feeCompressionBase; - } - - - + cost.costFee = sfee; return true; } -- cgit v1.1 From 7f5b1182efab9e7a80293622fa658d8d1a7b1fc8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 19:09:51 +0100 Subject: same cleanup --- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 79 +++++++++++----------- 1 file changed, 41 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 622a2d9..ba73a25 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.ClientStack.Linden const float physMeshSizeWth = 6f; // counts 7x const float physHullSizeWth = 8f; // counts 9x - // stream cost size factors + // stream cost area factors const float highLodFactor = 17.36f; const float midLodFactor = 277.78f; const float lowLodFactor = 1111.11f; @@ -94,13 +94,12 @@ namespace OpenSim.Region.ClientStack.Linden totalcost += textures_cost; } - float meshsfee = 0; - // meshs assets cost - + float meshsfee = 0; int numberMeshs = 0; + bool haveMeshs = false; List meshsCosts = new List(); - // a model could have no mesh actually + if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) { numberMeshs = resources.mesh_list.Array.Count; @@ -117,6 +116,7 @@ namespace OpenSim.Region.ClientStack.Linden meshsCosts.Add(curCost); meshsfee += curCost.costFee; } + haveMeshs = true; } // instances (prims) cost @@ -126,44 +126,43 @@ namespace OpenSim.Region.ClientStack.Linden { Hashtable inst = (Hashtable)resources.instance_list.Array[i]; - // streamming cost - // assume all instances have a mesh - // but in general they can have normal prims - // but for now that seems not suported - // when they do, we will need to inspect pbs information - // and have cost funtions for all prims types - // don't check for shape type none, since - // that could be used to upload meshs with low cost - // changing later inworld - - ArrayList ascale = (ArrayList)inst["scale"]; - Vector3 scale; - double tmp; - tmp = (double)ascale[0]; - scale.X = (float)tmp; - tmp = (double)ascale[1]; - scale.Y = (float)tmp; - tmp = (double)ascale[2]; - scale.Z = (float)tmp; - - float sqdiam = scale.LengthSquared(); - - mesh = (int)inst["mesh"]; - - if(mesh >= numberMeshs) + if (haveMeshs && inst.ContainsKey("mesh")) { - error = "Unable to upload mesh model. incoerent information."; - return false; - } + mesh = (int)inst["mesh"]; - ameshCostParam curCost = meshsCosts[mesh]; - float mesh_streaming = streamingCost(curCost, sqdiam); + if (mesh >= numberMeshs) + { + error = "Unable to upload mesh model. incoerent information."; + return false; + } + + // streamming cost + ArrayList ascale = (ArrayList)inst["scale"]; + Vector3 scale; + double tmp; + tmp = (double)ascale[0]; + scale.X = (float)tmp; + tmp = (double)ascale[1]; + scale.Y = (float)tmp; + tmp = (double)ascale[2]; + scale.Z = (float)tmp; - meshcostdata.model_streaming_cost += mesh_streaming; + float sqdiam = scale.LengthSquared(); - meshcostdata.physics_cost += curCost.physicsCost; + ameshCostParam curCost = meshsCosts[mesh]; + float mesh_streaming = streamingCost(curCost, sqdiam); + + meshcostdata.model_streaming_cost += mesh_streaming; + meshcostdata.physics_cost += curCost.physicsCost; + } + else // instance as no mesh ?? + { + // to do later if needed + meshcostdata.model_streaming_cost += 0.5f; + meshcostdata.physics_cost += 1.0f; + } - // unscripted and static prim server cost + // assume unscripted and static prim server cost meshcostdata.simulation_cost += 0.5f; // charge for prims creation meshsfee += primCreationCost; @@ -174,6 +173,10 @@ namespace OpenSim.Region.ClientStack.Linden else meshcostdata.resource_cost = meshcostdata.physics_cost; + if (meshcostdata.resource_cost < meshcostdata.simulation_cost) + meshcostdata.resource_cost = meshcostdata.simulation_cost; + + if (meshsfee < ModelMinCost) meshsfee = ModelMinCost; -- cgit v1.1 From c3666c9ec3f0e32443094fbcb683dec7b457a3e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 19:38:05 +0100 Subject: make sure client still has money at upload --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ddb69c4..4ba8254 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -489,6 +489,7 @@ namespace OpenSim.Region.ClientStack.Linden cost = (uint)baseCost; } + // check funds if (mm != null) { if (!mm.UploadCovered(client.AgentId, (int)cost)) @@ -565,6 +566,21 @@ namespace OpenSim.Region.ClientStack.Linden sbyte assType = 0; sbyte inType = 0; + IClientAPI client = null; + + IMoneyModule mm = m_Scene.RequestModuleInterface(); + if (mm != null) + { + // make sure client still has enougth credit + if (!mm.UploadCovered(m_HostCapsObj.AgentID, (int)cost)) + { + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + return; + } + } + if (inventoryType == "sound") { inType = 1; -- cgit v1.1 From c1eec3b82818f91f66580cecc32c2ac9a9d2d968 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 21:15:07 +0100 Subject: on upload store mesh list contents as mesh assets. Build prims by instances not meshs. (some prims can have same mesh) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 4ba8254..ace188c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -617,6 +617,7 @@ namespace OpenSim.Region.ClientStack.Linden OSDArray texture_list = (OSDArray)request["texture_list"]; SceneObjectGroup grp = null; + // create and store texture assets List textures = new List(); for (int i = 0; i < texture_list.Count; i++) { @@ -624,14 +625,28 @@ namespace OpenSim.Region.ClientStack.Linden textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); + textureAsset = null; } + // create and store meshs assets + List meshAssets = new List(); for (int i = 0; i < mesh_list.Count; i++) { + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); + meshAsset.Data = mesh_list[i].AsBinary(); + m_assetService.Store(meshAsset); + meshAssets.Add(meshAsset.FullID); + meshAsset = null; + } + + // build prims from instances + for (int i = 0; i < instance_list.Count; i++) + { PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); Primitive.TextureEntry textureEntry = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); + OSDMap inner_instance_list = (OSDMap)instance_list[i]; OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; @@ -676,14 +691,14 @@ namespace OpenSim.Region.ClientStack.Linden pbs.TextureEntry = textureEntry.GetBytes(); - AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); - meshAsset.Data = mesh_list[i].AsBinary(); - m_assetService.Store(meshAsset); - - pbs.SculptEntry = true; - pbs.SculptTexture = meshAsset.FullID; - pbs.SculptType = (byte)SculptType.Mesh; - pbs.SculptData = meshAsset.Data; + int meshindx = inner_instance_list["mesh"].AsInteger(); + if (meshAssets.Count > meshindx) + { + pbs.SculptEntry = true; + pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction + // data will be requested from asset on rez (i hope) + } Vector3 position = inner_instance_list["position"].AsVector3(); Vector3 scale = inner_instance_list["scale"].AsVector3(); -- cgit v1.1 From fd20ef5c91f5db119d17b1974805b6d4fc2abad3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Sep 2012 22:35:36 +0100 Subject: add some locks to GetTextureModule --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 5b125ea..0ac56ec 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -149,13 +149,16 @@ namespace OpenSim.Region.ClientStack.Linden HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; GetEvents = (x, y, s) => { - try + lock (responses) { - return this.responses[x]; - } - finally - { - responses.Remove(x); + try + { + return this.responses[x]; + } + finally + { + responses.Remove(x); + } } }; @@ -218,14 +221,14 @@ namespace OpenSim.Region.ClientStack.Linden response["content_type"] = "text/plain"; response["keepalive"] = false; response["reusecontext"] = false; - - responses[requestID] = response; + lock (responses) + responses[requestID] = response; return; } response = m_getTextureHandler.Handle(request); - - responses[requestID] = response; + lock (responses) + responses[requestID] = response; } } -- cgit v1.1 From e8ba26eac8fdc438ffb72391d00c852ec1fc9950 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 18 Sep 2012 01:07:44 +0100 Subject: ***TEST*** still bad... create inventory itens for model textures and meshs. Issues: meshs get into root folder, viewer and viewer does not update inventory until relog ( the upload funtion needs to return more information) ,etc. Droping a mesh into a prim, makes viewer think we dropped a sculpt map, but it does work, viewer displays the mesh and physics work (as physics is stored at the sculpt information fields). Textures show up in Textures folder, just its to costly to find that default folder as is.. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 83 ++++++++++++++++++++-- 1 file changed, 76 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ace188c..3789ee9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -583,24 +583,24 @@ namespace OpenSim.Region.ClientStack.Linden if (inventoryType == "sound") { - inType = 1; - assType = 1; + inType = (sbyte)InventoryType.Sound; + assType = (sbyte)AssetType.Sound; } else if (inventoryType == "animation") { - inType = 19; - assType = 20; + inType = (sbyte)InventoryType.Animation; + assType = (sbyte)AssetType.Animation; } else if (inventoryType == "wearable") { - inType = 18; + inType = (sbyte)InventoryType.Wearable; switch (assetType) { case "bodypart": - assType = 13; + assType = (sbyte)AssetType.Bodypart; break; case "clothing": - assType = 5; + assType = (sbyte)AssetType.Clothing; break; } } @@ -625,7 +625,42 @@ namespace OpenSim.Region.ClientStack.Linden textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); + + // save it to inventory + if (AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Texture#" + i.ToString(); + InventoryItemBase texitem = new InventoryItemBase(); + texitem.Owner = m_HostCapsObj.AgentID; + texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + texitem.CreatorData = String.Empty; + texitem.ID = UUID.Random(); + texitem.AssetID = textureAsset.FullID; + texitem.Description = "mesh model texture"; + texitem.Name = name; + texitem.AssetType = (int)AssetType.Texture; + texitem.InvType = (int)InventoryType.Texture; + texitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + texitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + texitem.BasePermissions = (uint)PermissionMask.All; + texitem.EveryOnePermissions = 0; + texitem.NextPermissions = (uint)PermissionMask.All; + texitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + texitem = null; + } + textureAsset = null; + } // create and store meshs assets @@ -636,6 +671,40 @@ namespace OpenSim.Region.ClientStack.Linden meshAsset.Data = mesh_list[i].AsBinary(); m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); + + // save it to inventory + if (AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Mesh#" + i.ToString(); + InventoryItemBase meshitem = new InventoryItemBase(); + meshitem.Owner = m_HostCapsObj.AgentID; + meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + meshitem.CreatorData = String.Empty; + meshitem.ID = UUID.Random(); + meshitem.AssetID = meshAsset.FullID; + meshitem.Description = "mesh "; + meshitem.Name = name; + meshitem.AssetType = (int)AssetType.Mesh; + meshitem.InvType = (int)InventoryType.Mesh; + meshitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + meshitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + meshitem.BasePermissions = (uint)PermissionMask.All; + meshitem.EveryOnePermissions = 0; + meshitem.NextPermissions = (uint)PermissionMask.All; + meshitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); + meshitem = null; + } + meshAsset = null; } -- cgit v1.1 From ac2380bbfa5f7f2be8a5a9197f099a88988bce22 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 18 Sep 2012 02:12:07 +0200 Subject: Add booleans to control whether we actually crete inventory items --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 3789ee9..cb6f7a1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -116,6 +116,8 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_dumpAssetsToFile = false; private string m_regionName; private int m_levelUpload = 0; + private bool m_addNewTextures = false; + private bool m_addNewMeshes = false; public BunchOfCaps(Scene scene, Caps caps) { @@ -627,7 +629,7 @@ namespace OpenSim.Region.ClientStack.Linden textures.Add(textureAsset.FullID); // save it to inventory - if (AddNewInventoryItem != null) + if (m_addNewTextures && AddNewInventoryItem != null) { string name = assetName; if (name.Length > 25) @@ -673,7 +675,7 @@ namespace OpenSim.Region.ClientStack.Linden meshAssets.Add(meshAsset.FullID); // save it to inventory - if (AddNewInventoryItem != null) + if (m_addNewMeshes && AddNewInventoryItem != null) { string name = assetName; if (name.Length > 25) -- cgit v1.1 From 51ca84afdfc8a4c3c884b5ab9bd4dffe662087a6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Sep 2012 00:29:16 +0100 Subject: coment out mesh model upload code to add textures and individual meshs assets to inventory, since it may actually be a bad ideia since good model textures are deply related to it and there is no current use for independent mesh assets. Added the option to have a reduced free for textures (2.5 C$ as is, total textures cost rounded to nearest int) compensating for the fact that they can't be used outside the model or its parts. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 380 +++++++++++---------- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 79 +++-- 2 files changed, 255 insertions(+), 204 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index cb6f7a1..073f175 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -116,8 +116,8 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_dumpAssetsToFile = false; private string m_regionName; private int m_levelUpload = 0; - private bool m_addNewTextures = false; - private bool m_addNewMeshes = false; +// private bool m_addNewTextures = false; +// private bool m_addNewMeshes = false; public BunchOfCaps(Scene scene, Caps caps) { @@ -608,172 +608,181 @@ namespace OpenSim.Region.ClientStack.Linden } else if (inventoryType == "object") { - inType = (sbyte)InventoryType.Object; - assType = (sbyte)AssetType.Object; - - List positions = new List(); - List rotations = new List(); - OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); - OSDArray instance_list = (OSDArray)request["instance_list"]; - OSDArray mesh_list = (OSDArray)request["mesh_list"]; - OSDArray texture_list = (OSDArray)request["texture_list"]; - SceneObjectGroup grp = null; - - // create and store texture assets - List textures = new List(); - for (int i = 0; i < texture_list.Count; i++) + if (assetType == "mesh") // this code for now is for mesh models uploads only { - AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); - textureAsset.Data = texture_list[i].AsBinary(); - m_assetService.Store(textureAsset); - textures.Add(textureAsset.FullID); - - // save it to inventory - if (m_addNewTextures && AddNewInventoryItem != null) + inType = (sbyte)InventoryType.Object; + assType = (sbyte)AssetType.Object; + + List positions = new List(); + List rotations = new List(); + OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); + OSDArray instance_list = (OSDArray)request["instance_list"]; + OSDArray mesh_list = (OSDArray)request["mesh_list"]; + OSDArray texture_list = (OSDArray)request["texture_list"]; + SceneObjectGroup grp = null; + + // create and store texture assets + List textures = new List(); + for (int i = 0; i < texture_list.Count; i++) { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Texture#" + i.ToString(); - InventoryItemBase texitem = new InventoryItemBase(); - texitem.Owner = m_HostCapsObj.AgentID; - texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - texitem.CreatorData = String.Empty; - texitem.ID = UUID.Random(); - texitem.AssetID = textureAsset.FullID; - texitem.Description = "mesh model texture"; - texitem.Name = name; - texitem.AssetType = (int)AssetType.Texture; - texitem.InvType = (int)InventoryType.Texture; - texitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - texitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - texitem.BasePermissions = (uint)PermissionMask.All; - texitem.EveryOnePermissions = 0; - texitem.NextPermissions = (uint)PermissionMask.All; - texitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); - texitem = null; + AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); + textureAsset.Data = texture_list[i].AsBinary(); + m_assetService.Store(textureAsset); + textures.Add(textureAsset.FullID); + /* + don't do this + replace it by optionaly making model textures cost less than if individually uploaded + since they can't be used for other purpuses + + // save it to inventory + if (m_addNewTextures && AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Texture#" + i.ToString(); + InventoryItemBase texitem = new InventoryItemBase(); + texitem.Owner = m_HostCapsObj.AgentID; + texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + texitem.CreatorData = String.Empty; + texitem.ID = UUID.Random(); + texitem.AssetID = textureAsset.FullID; + texitem.Description = "mesh model texture"; + texitem.Name = name; + texitem.AssetType = (int)AssetType.Texture; + texitem.InvType = (int)InventoryType.Texture; + texitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + texitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + texitem.BasePermissions = (uint)PermissionMask.All; + texitem.EveryOnePermissions = 0; + texitem.NextPermissions = (uint)PermissionMask.All; + texitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + texitem = null; + } + */ + textureAsset = null; } - textureAsset = null; - - } - - // create and store meshs assets - List meshAssets = new List(); - for (int i = 0; i < mesh_list.Count; i++) - { - AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); - meshAsset.Data = mesh_list[i].AsBinary(); - m_assetService.Store(meshAsset); - meshAssets.Add(meshAsset.FullID); - - // save it to inventory - if (m_addNewMeshes && AddNewInventoryItem != null) + // create and store meshs assets + List meshAssets = new List(); + for (int i = 0; i < mesh_list.Count; i++) { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Mesh#" + i.ToString(); - InventoryItemBase meshitem = new InventoryItemBase(); - meshitem.Owner = m_HostCapsObj.AgentID; - meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - meshitem.CreatorData = String.Empty; - meshitem.ID = UUID.Random(); - meshitem.AssetID = meshAsset.FullID; - meshitem.Description = "mesh "; - meshitem.Name = name; - meshitem.AssetType = (int)AssetType.Mesh; - meshitem.InvType = (int)InventoryType.Mesh; - meshitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - meshitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - meshitem.BasePermissions = (uint)PermissionMask.All; - meshitem.EveryOnePermissions = 0; - meshitem.NextPermissions = (uint)PermissionMask.All; - meshitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); - meshitem = null; + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); + meshAsset.Data = mesh_list[i].AsBinary(); + m_assetService.Store(meshAsset); + meshAssets.Add(meshAsset.FullID); + + /* this was a test, funny and showed viewers deal with mesh inventory itens + * nut also same reason as for textures + * let integrated in a model cost eventually less than hipotetical independent meshs assets + * that will be in inventory + // save it to inventory + if (m_addNewMeshes && AddNewInventoryItem != null) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Mesh#" + i.ToString(); + InventoryItemBase meshitem = new InventoryItemBase(); + meshitem.Owner = m_HostCapsObj.AgentID; + meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); + meshitem.CreatorData = String.Empty; + meshitem.ID = UUID.Random(); + meshitem.AssetID = meshAsset.FullID; + meshitem.Description = "mesh "; + meshitem.Name = name; + meshitem.AssetType = (int)AssetType.Mesh; + meshitem.InvType = (int)InventoryType.Mesh; + meshitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + meshitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + meshitem.BasePermissions = (uint)PermissionMask.All; + meshitem.EveryOnePermissions = 0; + meshitem.NextPermissions = (uint)PermissionMask.All; + meshitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); + meshitem = null; + } + */ + meshAsset = null; } - meshAsset = null; - } - - // build prims from instances - for (int i = 0; i < instance_list.Count; i++) - { - PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); + // build prims from instances + for (int i = 0; i < instance_list.Count; i++) + { + PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); - Primitive.TextureEntry textureEntry - = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); + Primitive.TextureEntry textureEntry + = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); - OSDMap inner_instance_list = (OSDMap)instance_list[i]; + OSDMap inner_instance_list = (OSDMap)instance_list[i]; - OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; - for (uint face = 0; face < face_list.Count; face++) - { - OSDMap faceMap = (OSDMap)face_list[(int)face]; - Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face); - if(faceMap.ContainsKey("fullbright")) - f.Fullbright = faceMap["fullbright"].AsBoolean(); - if (faceMap.ContainsKey ("diffuse_color")) - f.RGBA = faceMap["diffuse_color"].AsColor4(); + OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; + for (uint face = 0; face < face_list.Count; face++) + { + OSDMap faceMap = (OSDMap)face_list[(int)face]; + Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face); + if (faceMap.ContainsKey("fullbright")) + f.Fullbright = faceMap["fullbright"].AsBoolean(); + if (faceMap.ContainsKey("diffuse_color")) + f.RGBA = faceMap["diffuse_color"].AsColor4(); - int textureNum = faceMap["image"].AsInteger(); - float imagerot = faceMap["imagerot"].AsInteger(); - float offsets = (float)faceMap["offsets"].AsReal(); - float offsett = (float)faceMap["offsett"].AsReal(); - float scales = (float)faceMap["scales"].AsReal(); - float scalet = (float)faceMap["scalet"].AsReal(); + int textureNum = faceMap["image"].AsInteger(); + float imagerot = faceMap["imagerot"].AsInteger(); + float offsets = (float)faceMap["offsets"].AsReal(); + float offsett = (float)faceMap["offsett"].AsReal(); + float scales = (float)faceMap["scales"].AsReal(); + float scalet = (float)faceMap["scalet"].AsReal(); - if(imagerot != 0) - f.Rotation = imagerot; + if (imagerot != 0) + f.Rotation = imagerot; - if(offsets != 0) - f.OffsetU = offsets; + if (offsets != 0) + f.OffsetU = offsets; - if (offsett != 0) - f.OffsetV = offsett; + if (offsett != 0) + f.OffsetV = offsett; - if (scales != 0) - f.RepeatU = scales; + if (scales != 0) + f.RepeatU = scales; - if (scalet != 0) - f.RepeatV = scalet; + if (scalet != 0) + f.RepeatV = scalet; - if (textures.Count > textureNum) - f.TextureID = textures[textureNum]; - else - f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE; + if (textures.Count > textureNum) + f.TextureID = textures[textureNum]; + else + f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE; - textureEntry.FaceTextures[face] = f; - } + textureEntry.FaceTextures[face] = f; + } - pbs.TextureEntry = textureEntry.GetBytes(); + pbs.TextureEntry = textureEntry.GetBytes(); - int meshindx = inner_instance_list["mesh"].AsInteger(); - if (meshAssets.Count > meshindx) - { - pbs.SculptEntry = true; - pbs.SculptType = (byte)SculptType.Mesh; - pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction - // data will be requested from asset on rez (i hope) - } + int meshindx = inner_instance_list["mesh"].AsInteger(); + if (meshAssets.Count > meshindx) + { + pbs.SculptEntry = true; + pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction + // data will be requested from asset on rez (i hope) + } - Vector3 position = inner_instance_list["position"].AsVector3(); - Vector3 scale = inner_instance_list["scale"].AsVector3(); - Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); + Vector3 position = inner_instance_list["position"].AsVector3(); + Vector3 scale = inner_instance_list["scale"].AsVector3(); + Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); // no longer used - begin ------------------------ // int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); @@ -793,23 +802,23 @@ namespace OpenSim.Region.ClientStack.Linden // int owner_mask = permissions["owner_mask"].AsInteger(); // no longer used - end ------------------------ - UUID owner_id = m_HostCapsObj.AgentID; + UUID owner_id = m_HostCapsObj.AgentID; - SceneObjectPart prim - = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); + SceneObjectPart prim + = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); - prim.Scale = scale; - prim.OffsetPosition = position; - rotations.Add(rotation); - positions.Add(position); - prim.UUID = UUID.Random(); - prim.CreatorID = owner_id; - prim.OwnerID = owner_id; - prim.GroupID = UUID.Zero; - prim.LastOwnerID = prim.OwnerID; - prim.CreationDate = Util.UnixTimeSinceEpoch(); - prim.Name = assetName; - prim.Description = ""; + prim.Scale = scale; + prim.OffsetPosition = position; + rotations.Add(rotation); + positions.Add(position); + prim.UUID = UUID.Random(); + prim.CreatorID = owner_id; + prim.OwnerID = owner_id; + prim.GroupID = UUID.Zero; + prim.LastOwnerID = prim.OwnerID; + prim.CreationDate = Util.UnixTimeSinceEpoch(); + prim.Name = assetName; + prim.Description = ""; // prim.BaseMask = (uint)base_mask; // prim.EveryoneMask = (uint)everyone_mask; @@ -817,32 +826,39 @@ namespace OpenSim.Region.ClientStack.Linden // prim.NextOwnerMask = (uint)next_owner_mask; // prim.OwnerMask = (uint)owner_mask; - if (grp == null) - grp = new SceneObjectGroup(prim); - else - grp.AddPart(prim); - } + if (grp == null) + grp = new SceneObjectGroup(prim); + else + grp.AddPart(prim); + } - // Fix first link number - if (grp.Parts.Length > 1) - grp.RootPart.LinkNum++; + // Fix first link number + if (grp.Parts.Length > 1) + grp.RootPart.LinkNum++; - Vector3 rootPos = positions[0]; - grp.AbsolutePosition = rootPos; - for (int i = 0; i < positions.Count; i++) - { - Vector3 offset = positions[i] - rootPos; - grp.Parts[i].OffsetPosition = offset; + Vector3 rootPos = positions[0]; + grp.AbsolutePosition = rootPos; + for (int i = 0; i < positions.Count; i++) + { + Vector3 offset = positions[i] - rootPos; + grp.Parts[i].OffsetPosition = offset; + } + + for (int i = 0; i < rotations.Count; i++) + { + if (i != 0) + grp.Parts[i].RotationOffset = rotations[i]; + } + + grp.UpdateGroupRotationR(rotations[0]); + data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); } - for (int i = 0; i < rotations.Count; i++) + else // not a mesh model { - if (i != 0) - grp.Parts[i].RotationOffset = rotations[i]; + m_log.ErrorFormat("[CAPS Asset Upload] got unsuported assetType for object upload"); + return; } - - grp.UpdateGroupRotationR(rotations[0]); - data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); } AssetBase asset; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index ba73a25..5096a91 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -25,40 +25,67 @@ namespace OpenSim.Region.ClientStack.Linden { public class ModelCost { - float ModelMinCost = 5.0f; // try to favor small meshs versus sculpts - - const float primCreationCost = 0.01f; // 256 prims cost extra 2.56 - - // weigthed size to money convertion - const float bytecost = 1e-4f; - - // for mesh upload fees based on compressed data sizes - // not using streaming physics and server costs as SL apparently does ?? - + // upload fee tunning paramenters + // fees are normalized to 1.0 + // this parameters scale them to basic cost ( so 1.0 translates to 10 ) + + public float ModelMeshCostFactor = 1.0f; // scale total cost relative to basic (excluding textures) + public float ModelTextureCostFactor = 0.25f; //(2.5c$) scale textures fee to basic. + // promote integration in a model + // since they will not show up in inventory + public float ModelMinCostFactor = 0.5f; // minimum total model free excluding textures + + // itens costs in normalized values + // ie will be multiplied by basicCost and factors above + const float primCreationCost = 0.002f; // extra cost for each prim creation overhead + // weigthed size to normalized cost + const float bytecost = 1e-5f; + + // mesh upload fees based on compressed data sizes + // several data sections are counted more that once + // to promote user optimization + // following parameters control how many extra times they are added + // to global size. + // LOD meshs const float medSizeWth = 1f; // 2x const float lowSizeWth = 1.5f; // 2.5x const float lowestSizeWth = 2f; // 3x - // favor potencial optimized meshs versus automatic decomposition + // favor potencially physical optimized meshs versus automatic decomposition const float physMeshSizeWth = 6f; // counts 7x - const float physHullSizeWth = 8f; // counts 9x - + const float physHullSizeWth = 8f; // counts 9x + // stream cost area factors + // more or less like SL const float highLodFactor = 17.36f; const float midLodFactor = 277.78f; const float lowLodFactor = 1111.11f; + // physics cost is below, identical to SL, assuming shape type convex + // server cost is below identical to SL assuming non scripted non physical object + + // internal const int bytesPerCoord = 6; // 3 coords, 2 bytes per each + // storage for a single mesh asset cost parameters private class ameshCostParam { + // LOD sizes for size dependent streaming cost public int highLODSize; public int medLODSize; public int lowLODSize; public int lowestLODSize; + // normalized fee based on compressed data sizes public float costFee; + // physics cost public float physicsCost; } + // calculates a mesh model costs + // returns false on error, with a reason on parameter error + // resources input LLSD request + // basicCost input region assets upload cost + // totalcost returns model total upload fee + // meshcostdata returns detailed costs for viewer public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, LLSDAssetUploadResponseData meshcostdata, out string error) { totalcost = 0; @@ -87,11 +114,12 @@ namespace OpenSim.Region.ClientStack.Linden // textures cost if (resources.texture_list != null && resources.texture_list.Array.Count > 0) { - int textures_cost = resources.texture_list.Array.Count; - textures_cost *= basicCost; + float textures_cost = (float)(resources.texture_list.Array.Count * basicCost); + textures_cost *= ModelTextureCostFactor; - meshcostdata.upload_price_breakdown.texture = textures_cost; - totalcost += textures_cost; + itmp = (int)(textures_cost + 0.5f); // round + meshcostdata.upload_price_breakdown.texture = itmp; + totalcost += itmp; } // meshs assets cost @@ -176,12 +204,16 @@ namespace OpenSim.Region.ClientStack.Linden if (meshcostdata.resource_cost < meshcostdata.simulation_cost) meshcostdata.resource_cost = meshcostdata.simulation_cost; + // scale cost + // at this point a cost of 1.0 whould mean basic cost + meshsfee *= ModelMeshCostFactor; + + if (meshsfee < ModelMinCostFactor) + meshsfee = ModelMinCostFactor; - if (meshsfee < ModelMinCost) - meshsfee = ModelMinCost; + // actually scale it to basic cost + meshsfee *= (float)basicCost; - // scale cost with basic cost changes relative to 10 - meshsfee *= (float)basicCost / 10.0f; meshsfee += 0.5f; // rounding totalcost += (int)meshsfee; @@ -192,6 +224,7 @@ namespace OpenSim.Region.ClientStack.Linden return true; } + // single mesh asset cost private bool MeshCost(byte[] data, ameshCostParam cost, out string error) { cost.highLODSize = 0; @@ -377,6 +410,7 @@ namespace OpenSim.Region.ClientStack.Linden return true; } + // parses a LOD or physics mesh component private bool submesh(byte[] data, int offset, int size, out int ntriangles) { ntriangles = 0; @@ -443,6 +477,7 @@ namespace OpenSim.Region.ClientStack.Linden return true; } + // parses convex hulls component private bool hulls(byte[] data, int offset, int size, out int nvertices, out int nhulls) { nvertices = 0; @@ -512,6 +547,7 @@ namespace OpenSim.Region.ClientStack.Linden return true; } + // returns streaming cost from on mesh LODs sizes in curCost and square of prim size length private float streamingCost(ameshCostParam curCost, float sqdiam) { // compute efective areas @@ -571,7 +607,6 @@ namespace OpenSim.Region.ClientStack.Linden h = 16; // compute cost weighted by relative effective areas - float cost = (float)lst * mlst + (float)l * ml + (float)m * mm + (float)h * mh; cost /= ma; -- cgit v1.1 From fb32604b413052ddedccba36247e676427c48824 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Sep 2012 01:33:16 +0100 Subject: create a single ModelCost provider for the caps instance. Let it know and check scene prim size limits. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 14 ++++-- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 56 +++++++++++++++++----- 2 files changed, 56 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 073f175..0fb6c99 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -87,6 +87,7 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_Scene; private Caps m_HostCapsObj; + private ModelCost m_ModelCost; private static readonly string m_requestPath = "0000/"; // private static readonly string m_mapLayerPath = "0001/"; @@ -123,6 +124,15 @@ namespace OpenSim.Region.ClientStack.Linden { m_Scene = scene; m_HostCapsObj = caps; + + // create a model upload cost provider + m_ModelCost = new ModelCost(); + // tell it about scene object limits + m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys; + m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; +// m_ModelCost.PrimScaleMin = ?? +// m_ModelCost.ObjectLinkedPartsMax = ?? + IConfigSource config = m_Scene.Config; if (config != null) { @@ -193,7 +203,6 @@ namespace OpenSim.Region.ClientStack.Linden { try { - // I don't think this one works... m_HostCapsObj.RegisterHandler( "NewFileAgentInventory", new LLSDStreamhandler( @@ -472,9 +481,8 @@ namespace OpenSim.Region.ClientStack.Linden { string error; int modelcost; - ModelCost mc = new ModelCost(); - if (!mc.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, + if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, meshcostdata, out error)) { client.SendAgentAlertMessage(error, false); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 5096a91..62f1d06 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -23,8 +23,14 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.ClientStack.Linden { + public struct ModelPrimLimits + { + + } + public class ModelCost { + // upload fee tunning paramenters // fees are normalized to 1.0 // this parameters scale them to basic cost ( so 1.0 translates to 10 ) @@ -66,6 +72,12 @@ namespace OpenSim.Region.ClientStack.Linden // internal const int bytesPerCoord = 6; // 3 coords, 2 bytes per each + // control prims dimensions + public float PrimScaleMin = 0.01f; + public float NonPhysicalPrimScaleMax = 256f; + public float PhysicalPrimScaleMax = 10f; + public int ObjectLinkedPartsMax = 512; + // storage for a single mesh asset cost parameters private class ameshCostParam { @@ -98,7 +110,15 @@ namespace OpenSim.Region.ClientStack.Linden error = "Unable to upload mesh model. missing information."; return false; } - + + int numberInstances = resources.instance_list.Array.Count; + + if( numberInstances > ObjectLinkedPartsMax ) + { + error = "upload failed: Model whould have two many linked prims"; + return false; + } + meshcostdata.model_streaming_cost = 0.0; meshcostdata.simulation_cost = 0.0; meshcostdata.physics_cost = 0.0; @@ -148,12 +168,35 @@ namespace OpenSim.Region.ClientStack.Linden } // instances (prims) cost - int numberInstances = resources.instance_list.Array.Count; + + int mesh; for (int i = 0; i < numberInstances; i++) { Hashtable inst = (Hashtable)resources.instance_list.Array[i]; + ArrayList ascale = (ArrayList)inst["scale"]; + Vector3 scale; + double tmp; + tmp = (double)ascale[0]; + scale.X = (float)tmp; + tmp = (double)ascale[1]; + scale.Y = (float)tmp; + tmp = (double)ascale[2]; + scale.Z = (float)tmp; + + if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin) + { + error = " upload fail: Model contains parts with a dimension lower than 0.01. Please adjust scaling"; + return false; + } + + if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax) + { + error = "upload fail: Model contains parts larger than maximum allowed. Please adjust scaling"; + return false; + } + if (haveMeshs && inst.ContainsKey("mesh")) { mesh = (int)inst["mesh"]; @@ -165,15 +208,6 @@ namespace OpenSim.Region.ClientStack.Linden } // streamming cost - ArrayList ascale = (ArrayList)inst["scale"]; - Vector3 scale; - double tmp; - tmp = (double)ascale[0]; - scale.X = (float)tmp; - tmp = (double)ascale[1]; - scale.Y = (float)tmp; - tmp = (double)ascale[2]; - scale.Z = (float)tmp; float sqdiam = scale.LengthSquared(); -- cgit v1.1 From 5317b1053f2b8fd81f71c0b95c79aaa03efb47e4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Sep 2012 03:53:51 +0100 Subject: be more tolerant to small prims, skipping them, only failing if they are more than half of total. Add a state control to NewFileAgentInventory to avoid more than one at a time per client. ( Incomplete and possible not that good) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 81 ++++++++++++++++++---- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 17 +++-- 2 files changed, 82 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0fb6c99..d66076d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -117,6 +117,17 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_dumpAssetsToFile = false; private string m_regionName; private int m_levelUpload = 0; + private float m_PrimScaleMin = 0.001f; + + private enum FileAgentInventoryState : int + { + idle = 0, + processRequest = 1, + waitUpload = 2, + processUpload = 3 + } + private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle; + // private bool m_addNewTextures = false; // private bool m_addNewMeshes = false; @@ -132,6 +143,7 @@ namespace OpenSim.Region.ClientStack.Linden m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; // m_ModelCost.PrimScaleMin = ?? // m_ModelCost.ObjectLinkedPartsMax = ?? +// m_PrimScaleMin = ?? IConfigSource config = m_Scene.Config; if (config != null) @@ -158,6 +170,8 @@ namespace OpenSim.Region.ClientStack.Linden ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; GetClient = m_Scene.SceneGraph.GetControllingClient; + + m_FileAgentInventoryState = FileAgentInventoryState.idle; } /// @@ -224,9 +238,7 @@ namespace OpenSim.Region.ClientStack.Linden IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); - m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); - - + m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); m_HostCapsObj.RegisterHandler( "CopyInventoryFromNotecard", @@ -439,6 +451,35 @@ namespace OpenSim.Region.ClientStack.Linden //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); + // start by getting the client + IClientAPI client = null; + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + + // check current state so we only have one service at a time + lock (m_ModelCost) + { + switch (m_FileAgentInventoryState) + { + case FileAgentInventoryState.processRequest: + case FileAgentInventoryState.processUpload: + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Processing previus request", false); + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; + break; + case FileAgentInventoryState.waitUpload: + // todo stop current uploader server + break; + case FileAgentInventoryState.idle: + default: + break; + } + + m_FileAgentInventoryState = FileAgentInventoryState.processRequest; + } + uint cost = 0; LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); @@ -447,15 +488,12 @@ namespace OpenSim.Region.ClientStack.Linden llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { - ScenePresence avatar = null; - IClientAPI client = null; + ScenePresence avatar = null; m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); // check user level if (avatar != null) { - client = avatar.ControllingClient; - if (avatar.UserLevel < m_levelUpload) { if (client != null) @@ -464,6 +502,8 @@ namespace OpenSim.Region.ClientStack.Linden LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } } @@ -490,6 +530,8 @@ namespace OpenSim.Region.ClientStack.Linden LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } cost = (uint)modelcost; @@ -509,6 +551,8 @@ namespace OpenSim.Region.ClientStack.Linden LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } } @@ -555,8 +599,11 @@ namespace OpenSim.Region.ClientStack.Linden } uploader.OnUpLoad += UploadCompleteHandler; - return uploadResponse; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.waitUpload; + + return uploadResponse; } /// @@ -569,6 +616,9 @@ namespace OpenSim.Region.ClientStack.Linden UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, uint cost) { + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.processUpload; + m_log.DebugFormat( "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", assetID, inventoryItem, inventoryType, assetType); @@ -730,12 +780,19 @@ namespace OpenSim.Region.ClientStack.Linden // build prims from instances for (int i = 0; i < instance_list.Count; i++) { + OSDMap inner_instance_list = (OSDMap)instance_list[i]; + + // skip prims that are 2 small + Vector3 scale = inner_instance_list["scale"].AsVector3(); + + if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin) + continue; + PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); Primitive.TextureEntry textureEntry = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); - OSDMap inner_instance_list = (OSDMap)instance_list[i]; OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; for (uint face = 0; face < face_list.Count; face++) @@ -789,7 +846,6 @@ namespace OpenSim.Region.ClientStack.Linden } Vector3 position = inner_instance_list["position"].AsVector3(); - Vector3 scale = inner_instance_list["scale"].AsVector3(); Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); // no longer used - begin ------------------------ @@ -903,6 +959,8 @@ namespace OpenSim.Region.ClientStack.Linden { AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); } + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; } /// @@ -1270,8 +1328,8 @@ namespace OpenSim.Region.ClientStack.Linden res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); - httpListener.RemoveStreamHandler("POST", uploaderPath); m_timeoutTimer.Stop(); + httpListener.RemoveStreamHandler("POST", uploaderPath); // TODO: probably make this a better set of extensions here string extension = ".jp2"; @@ -1289,7 +1347,6 @@ namespace OpenSim.Region.ClientStack.Linden { handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); } - return res; } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 62f1d06..ece40ac 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.ClientStack.Linden const int bytesPerCoord = 6; // 3 coords, 2 bytes per each // control prims dimensions - public float PrimScaleMin = 0.01f; + public float PrimScaleMin = 0.001f; public float NonPhysicalPrimScaleMax = 256f; public float PhysicalPrimScaleMax = 10f; public int ObjectLinkedPartsMax = 512; @@ -171,6 +171,7 @@ namespace OpenSim.Region.ClientStack.Linden int mesh; + int skipedSmall = 0; for (int i = 0; i < numberInstances; i++) { Hashtable inst = (Hashtable)resources.instance_list.Array[i]; @@ -187,8 +188,10 @@ namespace OpenSim.Region.ClientStack.Linden if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin) { - error = " upload fail: Model contains parts with a dimension lower than 0.01. Please adjust scaling"; - return false; +// error = " upload fail: Model contains parts with a dimension lower than 0.001. Please adjust scaling"; +// return false; + skipedSmall++; + continue; } if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax) @@ -229,7 +232,13 @@ namespace OpenSim.Region.ClientStack.Linden // charge for prims creation meshsfee += primCreationCost; } - + + if (skipedSmall >0 && skipedSmall > numberInstances / 2) + { + error = "Upload failed: Model contains too much prims smaller than minimum size to ignore"; + return false; + } + if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost) meshcostdata.resource_cost = meshcostdata.model_streaming_cost; else -- cgit v1.1 From 629138d4fa16821d9572b58abe234b973ccf945e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 19 Sep 2012 13:01:34 +0200 Subject: Change texture price back to 10 C$ --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index ece40ac..44a2914 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -36,9 +36,8 @@ namespace OpenSim.Region.ClientStack.Linden // this parameters scale them to basic cost ( so 1.0 translates to 10 ) public float ModelMeshCostFactor = 1.0f; // scale total cost relative to basic (excluding textures) - public float ModelTextureCostFactor = 0.25f; //(2.5c$) scale textures fee to basic. - // promote integration in a model - // since they will not show up in inventory + public float ModelTextureCostFactor = 1.00f; // keep full price because texture price + // is based on it's storage needs not on usability public float ModelMinCostFactor = 0.5f; // minimum total model free excluding textures // itens costs in normalized values -- cgit v1.1 From bf987f96d2339f1471ad5fc5b3df5a7a8b484d6e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 20 Sep 2012 14:32:30 +0100 Subject: Fix model upload rotations and offsets ( i hope ) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 159 ++++++++------------- 1 file changed, 56 insertions(+), 103 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index d66076d..a139ea8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -128,9 +128,6 @@ namespace OpenSim.Region.ClientStack.Linden } private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle; -// private bool m_addNewTextures = false; -// private bool m_addNewMeshes = false; - public BunchOfCaps(Scene scene, Caps caps) { m_Scene = scene; @@ -641,6 +638,7 @@ namespace OpenSim.Region.ClientStack.Linden } } + // strings to types if (inventoryType == "sound") { inType = (sbyte)InventoryType.Sound; @@ -687,45 +685,6 @@ namespace OpenSim.Region.ClientStack.Linden textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); - /* - don't do this - replace it by optionaly making model textures cost less than if individually uploaded - since they can't be used for other purpuses - - // save it to inventory - if (m_addNewTextures && AddNewInventoryItem != null) - { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Texture#" + i.ToString(); - InventoryItemBase texitem = new InventoryItemBase(); - texitem.Owner = m_HostCapsObj.AgentID; - texitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - texitem.CreatorData = String.Empty; - texitem.ID = UUID.Random(); - texitem.AssetID = textureAsset.FullID; - texitem.Description = "mesh model texture"; - texitem.Name = name; - texitem.AssetType = (int)AssetType.Texture; - texitem.InvType = (int)InventoryType.Texture; - texitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - texitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - texitem.BasePermissions = (uint)PermissionMask.All; - texitem.EveryOnePermissions = 0; - texitem.NextPermissions = (uint)PermissionMask.All; - texitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); - texitem = null; - } - */ - textureAsset = null; } // create and store meshs assets @@ -736,47 +695,9 @@ namespace OpenSim.Region.ClientStack.Linden meshAsset.Data = mesh_list[i].AsBinary(); m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); - - /* this was a test, funny and showed viewers deal with mesh inventory itens - * nut also same reason as for textures - * let integrated in a model cost eventually less than hipotetical independent meshs assets - * that will be in inventory - // save it to inventory - if (m_addNewMeshes && AddNewInventoryItem != null) - { - string name = assetName; - if (name.Length > 25) - name = name.Substring(0, 24); - name += "_Mesh#" + i.ToString(); - InventoryItemBase meshitem = new InventoryItemBase(); - meshitem.Owner = m_HostCapsObj.AgentID; - meshitem.CreatorId = m_HostCapsObj.AgentID.ToString(); - meshitem.CreatorData = String.Empty; - meshitem.ID = UUID.Random(); - meshitem.AssetID = meshAsset.FullID; - meshitem.Description = "mesh "; - meshitem.Name = name; - meshitem.AssetType = (int)AssetType.Mesh; - meshitem.InvType = (int)InventoryType.Mesh; - meshitem.Folder = UUID.Zero; // send to default - - // If we set PermissionMask.All then when we rez the item the next permissions will replace the current - // (owner) permissions. This becomes a problem if next permissions are changed. - meshitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); - - meshitem.BasePermissions = (uint)PermissionMask.All; - meshitem.EveryOnePermissions = 0; - meshitem.NextPermissions = (uint)PermissionMask.All; - meshitem.CreationDate = Util.UnixTimeSinceEpoch(); - - AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0); - meshitem = null; - } - */ - meshAsset = null; } + int skipedMeshs = 0; // build prims from instances for (int i = 0; i < instance_list.Count; i++) { @@ -784,9 +705,12 @@ namespace OpenSim.Region.ClientStack.Linden // skip prims that are 2 small Vector3 scale = inner_instance_list["scale"].AsVector3(); - + if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin) + { + skipedMeshs++; continue; + } PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); @@ -836,21 +760,33 @@ namespace OpenSim.Region.ClientStack.Linden pbs.TextureEntry = textureEntry.GetBytes(); - int meshindx = inner_instance_list["mesh"].AsInteger(); - if (meshAssets.Count > meshindx) + bool hasmesh = false; + if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ... { - pbs.SculptEntry = true; - pbs.SculptType = (byte)SculptType.Mesh; - pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction - // data will be requested from asset on rez (i hope) + int meshindx = inner_instance_list["mesh"].AsInteger(); + if (meshAssets.Count > meshindx) + { + pbs.SculptEntry = true; + pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction + // data will be requested from asset on rez (i hope) + hasmesh = true; + } } 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.prim; // default for mesh is simple convex + if(hasmesh) + physicsShapeType = (byte) PhysShapeType.convex; // default for mesh is simple convex +// int material = inner_instance_list["material"].AsInteger(); + byte material = (byte)Material.Wood; + // no longer used - begin ------------------------ -// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); -// int material = inner_instance_list["material"].AsInteger(); // int mesh = inner_instance_list["mesh"].AsInteger(); // OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; @@ -872,7 +808,7 @@ namespace OpenSim.Region.ClientStack.Linden = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); prim.Scale = scale; - prim.OffsetPosition = position; +// prim.OffsetPosition = position; rotations.Add(rotation); positions.Add(position); prim.UUID = UUID.Random(); @@ -883,6 +819,8 @@ namespace OpenSim.Region.ClientStack.Linden prim.CreationDate = Util.UnixTimeSinceEpoch(); prim.Name = assetName; prim.Description = ""; + prim.Material = material; + prim.PhysicsShapeType = physicsShapeType; // prim.BaseMask = (uint)base_mask; // prim.EveryoneMask = (uint)everyone_mask; @@ -896,25 +834,40 @@ namespace OpenSim.Region.ClientStack.Linden grp.AddPart(prim); } - // Fix first link number + Vector3 rootPos = positions[0]; + if (grp.Parts.Length > 1) + { + // Fix first link number grp.RootPart.LinkNum++; - Vector3 rootPos = positions[0]; - grp.AbsolutePosition = rootPos; - for (int i = 0; i < positions.Count; i++) - { - Vector3 offset = positions[i] - rootPos; - grp.Parts[i].OffsetPosition = offset; - } + Quaternion rootRotConj = Quaternion.Conjugate(rotations[0]); + Quaternion tmprot; + Vector3 offset; + + // fix children rotations and positions + for (int i = 1; i < rotations.Count; i++) + { + tmprot = rotations[i]; + tmprot = rootRotConj * tmprot; + + grp.Parts[i].RotationOffset = tmprot; - for (int i = 0; i < rotations.Count; i++) + offset = positions[i] - rootPos; + + offset *= rootRotConj; + grp.Parts[i].OffsetPosition = offset; + } + + grp.AbsolutePosition = rootPos; + grp.UpdateGroupRotationR(rotations[0]); + } + else { - if (i != 0) - grp.Parts[i].RotationOffset = rotations[i]; + grp.AbsolutePosition = rootPos; + grp.UpdateGroupRotationR(rotations[0]); } - grp.UpdateGroupRotationR(rotations[0]); data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); } -- cgit v1.1 From 9ff6c85325bfe8a046abaf72267e215f05ec893e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 20 Sep 2012 15:39:46 +0200 Subject: Make uploads free for now - we will have to announce this --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 44a2914..8099069 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -35,10 +35,13 @@ namespace OpenSim.Region.ClientStack.Linden // fees are normalized to 1.0 // this parameters scale them to basic cost ( so 1.0 translates to 10 ) - public float ModelMeshCostFactor = 1.0f; // scale total cost relative to basic (excluding textures) - public float ModelTextureCostFactor = 1.00f; // keep full price because texture price + public float ModelMeshCostFactor = 0f; //Free + public float ModelMinCostFactor = 0f; // Free + //public float ModelMeshCostFactor = 1.0f; // scale total cost relative to basic (excluding textures) + //public float ModelMinCostFactor = 0.5f; // minimum total model free excluding textures + + //public float ModelTextureCostFactor = 1.00f; // keep full price because texture price // is based on it's storage needs not on usability - public float ModelMinCostFactor = 0.5f; // minimum total model free excluding textures // itens costs in normalized values // ie will be multiplied by basicCost and factors above -- cgit v1.1 From 5d63c20122351296298d9ec841a569e1c008ba4b Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 20 Sep 2012 15:41:16 +0200 Subject: refix prior commit --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 8099069..da701ba 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.ClientStack.Linden //public float ModelMeshCostFactor = 1.0f; // scale total cost relative to basic (excluding textures) //public float ModelMinCostFactor = 0.5f; // minimum total model free excluding textures - //public float ModelTextureCostFactor = 1.00f; // keep full price because texture price + public float ModelTextureCostFactor = 1.00f; // keep full price because texture price // is based on it's storage needs not on usability // itens costs in normalized values -- cgit v1.1 From f9c24c9414134af04fea3dd6ff39800856aec10e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 21 Sep 2012 11:50:14 +0100 Subject: read model upload cost parameters from config [Economy] section --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 21 +++++++++++++++++++++ .../ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 6 ++---- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a139ea8..1b47fca 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -118,6 +118,7 @@ namespace OpenSim.Region.ClientStack.Linden private string m_regionName; private int m_levelUpload = 0; private float m_PrimScaleMin = 0.001f; + private bool m_enableFreeTestModelUpload = false; private enum FileAgentInventoryState : int { @@ -142,6 +143,11 @@ namespace OpenSim.Region.ClientStack.Linden // m_ModelCost.ObjectLinkedPartsMax = ?? // m_PrimScaleMin = ?? + float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor; + float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; + float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; + + IConfigSource config = m_Scene.Config; if (config != null) { @@ -156,6 +162,20 @@ namespace OpenSim.Region.ClientStack.Linden { m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); } + // economy for model upload + IConfig EconomyConfig = config.Configs["Economy"]; + if (EconomyConfig != null) + { + modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); + modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); + modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); + m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); + + m_ModelCost.ModelMeshCostFactor = modelUploadFactor; + m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; + m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; + } + } m_assetService = m_Scene.AssetService; @@ -912,6 +932,7 @@ namespace OpenSim.Region.ClientStack.Linden { AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); } + lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.idle; } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index ece40ac..830c46d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -31,14 +31,12 @@ namespace OpenSim.Region.ClientStack.Linden public class ModelCost { - // upload fee tunning paramenters + // upload fee defaults // fees are normalized to 1.0 // this parameters scale them to basic cost ( so 1.0 translates to 10 ) public float ModelMeshCostFactor = 1.0f; // scale total cost relative to basic (excluding textures) - public float ModelTextureCostFactor = 0.25f; //(2.5c$) scale textures fee to basic. - // promote integration in a model - // since they will not show up in inventory + public float ModelTextureCostFactor = 1.0f; // scale textures fee to basic. public float ModelMinCostFactor = 0.5f; // minimum total model free excluding textures // itens costs in normalized values -- cgit v1.1 From 7de67d5680b2eb028bb17fae0d80d1f78ccd3a19 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Sep 2012 12:00:14 +0100 Subject: removed unused data in MeshUploadFlag response --- .../ClientStack/Linden/Caps/MeshUploadFlagModule.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index 44a6883..0251ac4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs @@ -129,15 +129,15 @@ namespace OpenSim.Region.ClientStack.Linden // m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request"); OSDMap data = new OSDMap(); - ScenePresence sp = m_scene.GetScenePresence(m_agentID); - data["username"] = sp.Firstname + "." + sp.Lastname; - data["display_name_next_update"] = new OSDDate(DateTime.Now); - data["legacy_first_name"] = sp.Firstname; +// ScenePresence sp = m_scene.GetScenePresence(m_agentID); +// data["username"] = sp.Firstname + "." + sp.Lastname; +// data["display_name_next_update"] = new OSDDate(DateTime.Now); +// data["legacy_first_name"] = sp.Firstname; data["mesh_upload_status"] = "valid"; - data["display_name"] = sp.Firstname + " " + sp.Lastname; - data["legacy_last_name"] = sp.Lastname; - data["id"] = m_agentID; - data["is_display_name_default"] = true; +// data["display_name"] = sp.Firstname + " " + sp.Lastname; +// data["legacy_last_name"] = sp.Lastname; +// data["id"] = m_agentID; +// data["is_display_name_default"] = true; //Send back data Hashtable responsedata = new Hashtable(); -- cgit v1.1 From 4bba72b7afc104ea5a42acb6206c1c07fbba099b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Sep 2012 16:47:15 +0100 Subject: removed AssetUploaderWithCost, fixing AssetUploader. add parsing of some more needed fields in request --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 66 ++++++++-------------- 1 file changed, 24 insertions(+), 42 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 1b47fca..b64453a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -54,8 +54,8 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.ClientStack.Linden { public delegate void UpLoadedAsset( - string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, - byte[] data, string inventoryType, string assetType); + string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, + byte[] data, string inventoryType, string assetType, int cost); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -119,6 +119,7 @@ namespace OpenSim.Region.ClientStack.Linden private int m_levelUpload = 0; private float m_PrimScaleMin = 0.001f; private bool m_enableFreeTestModelUpload = false; + private bool m_enableModelUploadTextureToInventory = false; private enum FileAgentInventoryState : int { @@ -147,7 +148,6 @@ namespace OpenSim.Region.ClientStack.Linden float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; - IConfigSource config = m_Scene.Config; if (config != null) { @@ -170,12 +170,12 @@ namespace OpenSim.Region.ClientStack.Linden modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); + m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); m_ModelCost.ModelMeshCostFactor = modelUploadFactor; m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; } - } m_assetService = m_Scene.AssetService; @@ -426,37 +426,13 @@ namespace OpenSim.Region.ClientStack.Linden return UUID.Zero; } - - private delegate void UploadWithCostCompleteDelegate(string assetName, - string assetDescription, UUID assetID, UUID inventoryItem, - UUID parentFolder, byte[] data, string inventoryType, - string assetType, uint cost); - - private class AssetUploaderWithCost : AssetUploader +/* + private class AssetUploaderExtraParameters { - private uint m_cost; + public int total_cost; + public UUID textureFolder = UUID.Zero; +*/ - public event UploadWithCostCompleteDelegate OnUpLoad; - - public AssetUploaderWithCost(string assetName, string description, UUID assetID, - UUID inventoryItem, UUID parentFolderID, string invType, string assetType, - string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : - base(assetName, description, assetID, inventoryItem, parentFolderID, - invType, assetType, path, httpServer, dumpAssetsToFile) - { - m_cost = cost; - - base.OnUpLoad += UploadCompleteHandler; - } - - private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, - UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType) - { - OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, - data, inventoryType, assetType, m_cost); - } - } /// /// @@ -497,7 +473,7 @@ namespace OpenSim.Region.ClientStack.Linden m_FileAgentInventoryState = FileAgentInventoryState.processRequest; } - uint cost = 0; + int cost = 0; LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || @@ -551,11 +527,11 @@ namespace OpenSim.Region.ClientStack.Linden m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; } - cost = (uint)modelcost; + cost = modelcost; } else { - cost = (uint)baseCost; + cost = baseCost; } // check funds @@ -584,8 +560,8 @@ namespace OpenSim.Region.ClientStack.Linden UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploaderWithCost uploader = - new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + AssetUploader uploader = + new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); m_HostCapsObj.HttpListener.AddStreamHandler( @@ -631,7 +607,7 @@ namespace OpenSim.Region.ClientStack.Linden /// public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType, uint cost) + string assetType, int cost) { lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.processUpload; @@ -920,6 +896,7 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. + item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); @@ -930,7 +907,7 @@ namespace OpenSim.Region.ClientStack.Linden if (AddNewInventoryItem != null) { - AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); + AddNewInventoryItem(m_HostCapsObj.AgentID, item,(uint) cost); } lock (m_ModelCost) @@ -1247,6 +1224,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event UpLoadedAsset OnUpLoad; private UpLoadedAsset handlerUpLoad = null; @@ -1261,11 +1239,14 @@ namespace OpenSim.Region.ClientStack.Linden private string m_invType = String.Empty; private string m_assetType = String.Empty; + private int m_cost; + private Timer m_timeoutTimer = new Timer(); + public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, - IHttpServer httpServer, bool dumpAssetsToFile) + IHttpServer httpServer, bool dumpAssetsToFile, int totalCost) { m_assetName = assetName; m_assetDes = description; @@ -1277,6 +1258,7 @@ namespace OpenSim.Region.ClientStack.Linden m_assetType = assetType; m_invType = invType; m_dumpAssetsToFile = dumpAssetsToFile; + m_cost = totalCost; m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; @@ -1319,7 +1301,7 @@ namespace OpenSim.Region.ClientStack.Linden handlerUpLoad = OnUpLoad; if (handlerUpLoad != null) { - handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); + handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost); } return res; } -- cgit v1.1 From 11e05217df2de7ce7da581a2332ee4871f75a527 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Sep 2012 21:14:15 +0100 Subject: report asset upload errors the right away --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 80 +++++++++++++++++----- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 24 +++---- 2 files changed, 75 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index b64453a..a934113 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.Linden { public delegate void UpLoadedAsset( string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, - byte[] data, string inventoryType, string assetType, int cost); + byte[] data, string inventoryType, string assetType, int cost, ref string error); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -455,11 +455,14 @@ namespace OpenSim.Region.ClientStack.Linden { case FileAgentInventoryState.processRequest: case FileAgentInventoryState.processUpload: - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Processing previus request", false); + LLSDAssetUploadError resperror = new LLSDAssetUploadError(); + resperror.message = "Uploader busy processing previus request"; + resperror.identifier = UUID.Zero; + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + errorResponse.error = resperror; return errorResponse; break; case FileAgentInventoryState.waitUpload: @@ -489,12 +492,15 @@ namespace OpenSim.Region.ClientStack.Linden { if (avatar.UserLevel < m_levelUpload) { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); + LLSDAssetUploadError resperror = new LLSDAssetUploadError(); + resperror.message = "Insufficient permissions to upload"; + resperror.identifier = UUID.Zero; + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + errorResponse.error = resperror; lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; @@ -518,11 +524,15 @@ namespace OpenSim.Region.ClientStack.Linden if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, meshcostdata, out error)) { - client.SendAgentAlertMessage(error, false); + LLSDAssetUploadError resperror = new LLSDAssetUploadError(); + resperror.message = error; + resperror.identifier = UUID.Zero; LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + errorResponse.error = resperror; + lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; @@ -539,11 +549,14 @@ namespace OpenSim.Region.ClientStack.Linden { if (!mm.UploadCovered(client.AgentId, (int)cost)) { - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + LLSDAssetUploadError resperror = new LLSDAssetUploadError(); + resperror.message = "Insuficient funds"; + resperror.identifier = UUID.Zero; LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; + errorResponse.error = resperror; lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.idle; return errorResponse; @@ -607,8 +620,9 @@ namespace OpenSim.Region.ClientStack.Linden /// public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType, int cost) + string assetType, int cost, ref string error) { + lock (m_ModelCost) m_FileAgentInventoryState = FileAgentInventoryState.processUpload; @@ -619,17 +633,13 @@ namespace OpenSim.Region.ClientStack.Linden sbyte assType = 0; sbyte inType = 0; - IClientAPI client = null; - IMoneyModule mm = m_Scene.RequestModuleInterface(); if (mm != null) { // make sure client still has enougth credit if (!mm.UploadCovered(m_HostCapsObj.AgentID, (int)cost)) { - m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + error = "Insufficient funds."; return; } } @@ -668,6 +678,25 @@ namespace OpenSim.Region.ClientStack.Linden List positions = new List(); List rotations = new List(); OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); + + // compare and get updated information + + bool mismatchError = true; + + while (mismatchError) + { + mismatchError = false; + } + + if (mismatchError) + { + error = "Upload and fee estimation information don't match"; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; + + return; + } + OSDArray instance_list = (OSDArray)request["instance_list"]; OSDArray mesh_list = (OSDArray)request["mesh_list"]; OSDArray texture_list = (OSDArray)request["texture_list"]; @@ -1240,7 +1269,8 @@ namespace OpenSim.Region.ClientStack.Linden private string m_invType = String.Empty; private string m_assetType = String.Empty; private int m_cost; - + private string m_error = String.Empty; + private Timer m_timeoutTimer = new Timer(); @@ -1278,12 +1308,13 @@ namespace OpenSim.Region.ClientStack.Linden UUID inv = inventoryItemID; string res = String.Empty; LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); +/* uploadComplete.new_asset = newAssetID.ToString(); uploadComplete.new_inventory_item = inv; uploadComplete.state = "complete"; res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); - +*/ m_timeoutTimer.Stop(); httpListener.RemoveStreamHandler("POST", uploaderPath); @@ -1301,8 +1332,25 @@ namespace OpenSim.Region.ClientStack.Linden handlerUpLoad = OnUpLoad; if (handlerUpLoad != null) { - handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost); + handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost, ref m_error); } + if(m_error == String.Empty) + { + uploadComplete.new_asset = newAssetID.ToString(); + uploadComplete.new_inventory_item = inv; + uploadComplete.state = "complete"; + } + else + { + LLSDAssetUploadError resperror = new LLSDAssetUploadError(); + resperror.message = m_error; + resperror.identifier = inv; + + uploadComplete.error = resperror; + uploadComplete.state = "failed"; + } + + res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); return res; } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 830c46d..7a80c72 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -105,7 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden resources.instance_list == null || resources.instance_list.Array.Count == 0) { - error = "Unable to upload mesh model. missing information."; + error = "missing model information."; return false; } @@ -113,7 +113,7 @@ namespace OpenSim.Region.ClientStack.Linden if( numberInstances > ObjectLinkedPartsMax ) { - error = "upload failed: Model whould have two many linked prims"; + error = "Model whould have more than " + ObjectLinkedPartsMax.ToString() + " linked prims"; return false; } @@ -186,15 +186,13 @@ namespace OpenSim.Region.ClientStack.Linden if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin) { -// error = " upload fail: Model contains parts with a dimension lower than 0.001. Please adjust scaling"; -// return false; skipedSmall++; continue; } if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax) { - error = "upload fail: Model contains parts larger than maximum allowed. Please adjust scaling"; + error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale"; return false; } @@ -204,7 +202,7 @@ namespace OpenSim.Region.ClientStack.Linden if (mesh >= numberMeshs) { - error = "Unable to upload mesh model. incoerent information."; + error = "Incoerent model information."; return false; } @@ -233,7 +231,7 @@ namespace OpenSim.Region.ClientStack.Linden if (skipedSmall >0 && skipedSmall > numberInstances / 2) { - error = "Upload failed: Model contains too much prims smaller than minimum size to ignore"; + error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() + "m"; return false; } @@ -279,14 +277,14 @@ namespace OpenSim.Region.ClientStack.Linden if (data == null || data.Length == 0) { - error = "Unable to upload mesh model. missing information."; + error = "Missing model information."; return false; } OSD meshOsd = null; int start = 0; - error = "Unable to upload mesh model. Invalid data"; + error = "Invalid model data"; using (MemoryStream ms = new MemoryStream(data)) { @@ -334,13 +332,13 @@ namespace OpenSim.Region.ClientStack.Linden if (submesh_offset < 0 || hulls_size == 0) { - error = "Unable to upload mesh model. missing physics_convex block"; + error = "Missing physics_convex block"; return false; } if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls)) { - error = "Unable to upload mesh model. bad physics_convex block"; + error = "Bad physics_convex block"; return false; } @@ -360,7 +358,7 @@ namespace OpenSim.Region.ClientStack.Linden if (submesh_offset < 0 || highlod_size <= 0) { - error = "Unable to upload mesh model. missing high_lod"; + error = "Missing high_lod block"; return false; } @@ -418,7 +416,7 @@ namespace OpenSim.Region.ClientStack.Linden if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles)) { - error = "Unable to upload mesh model. parsing error"; + error = "Model data parsing error"; return false; } } -- cgit v1.1 From 64db9e41143c36ee1638f2c453b4645ff4ed008f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 23 Sep 2012 15:04:10 +0100 Subject: try to allow free uploads for testing, if users prefix names with "TEST-". Let textures get into inventory again. Both features under config control. Have direct warnings to client, including a final one on upload complete since i see nothing. problems: textures don't showup in inventory til relog, also issues with permitions. A few more changes --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 225 +++++++++++++++++---- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 26 ++- 2 files changed, 210 insertions(+), 41 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a934113..21a1005 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -55,7 +55,9 @@ namespace OpenSim.Region.ClientStack.Linden { public delegate void UpLoadedAsset( string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, - byte[] data, string inventoryType, string assetType, int cost, ref string error); + byte[] data, string inventoryType, string assetType, + int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, + bool IsAtestUpload, ref string error); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -118,8 +120,9 @@ namespace OpenSim.Region.ClientStack.Linden private string m_regionName; private int m_levelUpload = 0; private float m_PrimScaleMin = 0.001f; - private bool m_enableFreeTestModelUpload = false; + private bool m_enableFreeTestUpload = false; private bool m_enableModelUploadTextureToInventory = false; + private UUID m_testAssetsCreatorID = UUID.Zero; private enum FileAgentInventoryState : int { @@ -148,6 +151,9 @@ namespace OpenSim.Region.ClientStack.Linden float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; + // can be UUID.zero. This is me at OSG, should be a valid grid ID, is case a bad config + UUID.TryParse("58e06f33-ea8c-4ff6-9af5-420606926118", out m_testAssetsCreatorID); + IConfigSource config = m_Scene.Config; if (config != null) { @@ -169,9 +175,18 @@ namespace OpenSim.Region.ClientStack.Linden modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); - m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); + m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", false); + string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", m_testAssetsCreatorID.ToString()); + if (testcreator != "") + { + UUID id; + UUID.TryParse(testcreator, out id); + if (id != null) + m_testAssetsCreatorID = id; + } + m_ModelCost.ModelMeshCostFactor = modelUploadFactor; m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; @@ -426,13 +441,6 @@ namespace OpenSim.Region.ClientStack.Linden return UUID.Zero; } -/* - private class AssetUploaderExtraParameters - { - public int total_cost; - public UUID textureFolder = UUID.Zero; -*/ - /// /// @@ -477,6 +485,11 @@ namespace OpenSim.Region.ClientStack.Linden } int cost = 0; + int nreqtextures = 0; + int nreqmeshs= 0; + int nreqinstances = 0; + bool IsAtestUpload = false; + LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || @@ -496,7 +509,6 @@ namespace OpenSim.Region.ClientStack.Linden resperror.message = "Insufficient permissions to upload"; resperror.identifier = UUID.Zero; - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; @@ -516,13 +528,15 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) baseCost = mm.UploadCharge; + string warning = String.Empty; + if (llsdRequest.asset_type == "mesh") { string error; int modelcost; - + if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, - meshcostdata, out error)) + meshcostdata, out error, ref warning)) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); resperror.message = error; @@ -544,8 +558,21 @@ namespace OpenSim.Region.ClientStack.Linden cost = baseCost; } + if (m_enableFreeTestUpload && cost > 0 && mm != null) + { + string str = llsdRequest.name; + if (str.Length > 5 && str.StartsWith("TEST-")) + { + warning += "Upload will have no cost, but for personal test purposes only. Other uses are forbiden"; + IsAtestUpload = true; + } + } + + if (client != null && warning != String.Empty) + client.SendAgentAlertMessage(warning, true); + // check funds - if (mm != null) + if (!IsAtestUpload && mm != null && cost >0) { if (!mm.UploadCovered(client.AgentId, (int)cost)) { @@ -572,10 +599,15 @@ namespace OpenSim.Region.ClientStack.Linden UUID newInvItem = UUID.Random(); UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); + UUID texturesFolder = UUID.Zero; + + if(!IsAtestUpload && m_enableModelUploadTextureToInventory) + texturesFolder = llsdRequest.texture_folder_id; AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, - llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); + llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, + texturesFolder, nreqtextures, nreqmeshs, nreqinstances,IsAtestUpload); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -620,7 +652,9 @@ namespace OpenSim.Region.ClientStack.Linden /// public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, - string assetType, int cost, ref string error) + string assetType, int cost, + UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, + bool IsAtestUpload, ref string error) { lock (m_ModelCost) @@ -633,6 +667,18 @@ namespace OpenSim.Region.ClientStack.Linden sbyte assType = 0; sbyte inType = 0; + UUID owner_id = m_HostCapsObj.AgentID; + UUID creatorID; + + bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0); + + if (istest) + creatorID = m_testAssetsCreatorID; + else + creatorID = owner_id; + + string creatorIDstr = creatorID.ToString(); + IMoneyModule mm = m_Scene.RequestModuleInterface(); if (mm != null) { @@ -703,20 +749,56 @@ namespace OpenSim.Region.ClientStack.Linden SceneObjectGroup grp = null; // create and store texture assets + bool doTextInv = (!istest && m_enableModelUploadTextureToInventory && + texturesFolder != UUID.Zero); + + List textures = new List(); + for (int i = 0; i < texture_list.Count; i++) { - AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); + AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr); textureAsset.Data = texture_list[i].AsBinary(); m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); + + if (doTextInv) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Texture#" + i.ToString(); + InventoryItemBase texitem = new InventoryItemBase(); + texitem.Owner = m_HostCapsObj.AgentID; + texitem.CreatorId = creatorIDstr; + texitem.CreatorData = String.Empty; + texitem.ID = UUID.Random(); + texitem.AssetID = textureAsset.FullID; + texitem.Description = "mesh model texture"; + texitem.Name = name; + texitem.AssetType = (int)AssetType.Texture; + texitem.InvType = (int)InventoryType.Texture; + texitem.Folder = texturesFolder; + + texitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + texitem.BasePermissions = (uint)PermissionMask.All; + texitem.EveryOnePermissions = 0; + texitem.NextPermissions = (uint)PermissionMask.All; + texitem.CreationDate = Util.UnixTimeSinceEpoch(); + + AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + texitem = null; + // this aren't showing up in viewer until relog :( + } } // create and store meshs assets List meshAssets = new List(); for (int i = 0; i < mesh_list.Count; i++) { - AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); @@ -827,7 +909,7 @@ namespace OpenSim.Region.ClientStack.Linden // int owner_mask = permissions["owner_mask"].AsInteger(); // no longer used - end ------------------------ - UUID owner_id = m_HostCapsObj.AgentID; + SceneObjectPart prim = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); @@ -837,13 +919,29 @@ namespace OpenSim.Region.ClientStack.Linden rotations.Add(rotation); positions.Add(position); prim.UUID = UUID.Random(); - prim.CreatorID = owner_id; + prim.CreatorID = creatorID; prim.OwnerID = owner_id; prim.GroupID = UUID.Zero; - prim.LastOwnerID = prim.OwnerID; + prim.LastOwnerID = creatorID; prim.CreationDate = Util.UnixTimeSinceEpoch(); - prim.Name = assetName; - prim.Description = ""; + + if (grp == null) + prim.Name = assetName; + else + prim.Name = assetName + "#" + i.ToString(); + + if (istest) + { + prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + prim.EveryoneMask = 0; + prim.GroupMask = 0; + prim.NextOwnerMask = 0; + prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + + prim.Description = "For personal testing only. Other uses are forbiden"; + } + else + prim.Description = ""; prim.Material = material; prim.PhysicsShapeType = physicsShapeType; @@ -854,7 +952,10 @@ namespace OpenSim.Region.ClientStack.Linden // prim.OwnerMask = (uint)owner_mask; if (grp == null) + { grp = new SceneObjectGroup(prim); + grp.LastOwnerID = creatorID; + } else grp.AddPart(prim); } @@ -904,7 +1005,7 @@ namespace OpenSim.Region.ClientStack.Linden } AssetBase asset; - asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); + asset = new AssetBase(assetID, assetName, assType, creatorIDstr); asset.Data = data; if (AddNewAsset != null) AddNewAsset(asset); @@ -913,11 +1014,14 @@ namespace OpenSim.Region.ClientStack.Linden InventoryItemBase item = new InventoryItemBase(); item.Owner = m_HostCapsObj.AgentID; - item.CreatorId = m_HostCapsObj.AgentID.ToString(); + item.CreatorId = creatorIDstr; item.CreatorData = String.Empty; item.ID = inventoryItem; item.AssetID = asset.FullID; - item.Description = assetDescription; + if (istest) + item.Description = "For personal testing only. Other uses are forbiden"; + else + item.Description = assetDescription; item.Name = assetName; item.AssetType = assType; item.InvType = inType; @@ -926,17 +1030,53 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + if (istest) + { + item.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Modify); + + item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); + item.EveryOnePermissions = 0; + item.NextPermissions = 0; + } + else + { + item.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + item.BasePermissions = (uint)PermissionMask.All; + item.EveryOnePermissions = 0; + item.NextPermissions = (uint)PermissionMask.All; + } - item.BasePermissions = (uint)PermissionMask.All; - item.EveryOnePermissions = 0; - item.NextPermissions = (uint)PermissionMask.All; item.CreationDate = Util.UnixTimeSinceEpoch(); + IClientAPI client = null; + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + if (AddNewInventoryItem != null) { - AddNewInventoryItem(m_HostCapsObj.AgentID, item,(uint) cost); + if (istest) + { + AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0); + if (client != null) + client.SendAgentAlertMessage("Upload complete with no cost for personal testing purposes only. Other uses are forbiden", true); + } + else + { + AddNewInventoryItem(m_HostCapsObj.AgentID, item, (uint)cost); + if (client != null) + { + // let users see anything.. i don't so far + string str; + if (cost > 0) + // dont remember where is money unit name to put here + str = "Upload complete. charged " + cost.ToString() + "$"; + else + str = "Upload complete"; + client.SendAgentAlertMessage(str, true); + } + } } lock (m_ModelCost) @@ -1272,11 +1412,17 @@ namespace OpenSim.Region.ClientStack.Linden private string m_error = String.Empty; private Timer m_timeoutTimer = new Timer(); - + private UUID m_texturesFolder; + private int m_nreqtextures; + private int m_nreqmeshs; + private int m_nreqinstances; + private bool m_IsAtestUpload; public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolderID, string invType, string assetType, string path, - IHttpServer httpServer, bool dumpAssetsToFile, int totalCost) + IHttpServer httpServer, bool dumpAssetsToFile, + int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, + bool IsAtestUpload) { m_assetName = assetName; m_assetDes = description; @@ -1290,6 +1436,12 @@ namespace OpenSim.Region.ClientStack.Linden m_dumpAssetsToFile = dumpAssetsToFile; m_cost = totalCost; + m_texturesFolder = texturesFolder; + m_nreqtextures = nreqtextures; + m_nreqmeshs = nreqmeshs; + m_nreqinstances = nreqinstances; + m_IsAtestUpload = IsAtestUpload; + m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; m_timeoutTimer.AutoReset = false; @@ -1332,12 +1484,15 @@ namespace OpenSim.Region.ClientStack.Linden handlerUpLoad = OnUpLoad; if (handlerUpLoad != null) { - handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost, ref m_error); + 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); } if(m_error == String.Empty) { uploadComplete.new_asset = newAssetID.ToString(); uploadComplete.new_inventory_item = inv; +// if (m_texturesFolder != UUID.Zero) +// uploadComplete.new_texture_folder_id = m_texturesFolder; uploadComplete.state = "complete"; } else diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 7a80c72..f03d8d8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -96,7 +96,8 @@ namespace OpenSim.Region.ClientStack.Linden // basicCost input region assets upload cost // totalcost returns model total upload fee // meshcostdata returns detailed costs for viewer - public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, LLSDAssetUploadResponseData meshcostdata, out string error) + public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, + LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) { totalcost = 0; error = string.Empty; @@ -229,10 +230,18 @@ namespace OpenSim.Region.ClientStack.Linden meshsfee += primCreationCost; } - if (skipedSmall >0 && skipedSmall > numberInstances / 2) + if (skipedSmall > 0) { - error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() + "m"; - return false; + if (skipedSmall > numberInstances / 2) + { + error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() + + "m minimum allowed size. Please check scalling"; + return false; + } + else + warning += skipedSmall.ToString() + " of the requested " +numberInstances.ToString() + + " model prims will not upload because they are smaller than " + PrimScaleMin.ToString() + + "m minimum allowed size. Please check scalling "; } if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost) @@ -403,9 +412,14 @@ namespace OpenSim.Region.ClientStack.Linden submesh_offset = -1; - if (map.ContainsKey("physics_mesh")) - { + tmpmap = null; + if(map.ContainsKey("physics_mesh")) tmpmap = (OSDMap)map["physics_mesh"]; + else if (map.ContainsKey("physics_shape")) // old naming + tmpmap = (OSDMap)map["physics_shape"]; + + if(tmpmap != null) + { if (tmpmap.ContainsKey("offset")) submesh_offset = tmpmap["offset"].AsInteger() + start; if (tmpmap.ContainsKey("size")) -- cgit v1.1 From 68ece236a6cd8a2a9bc009287e43debdc6e9a79d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 23 Sep 2012 23:55:28 +0200 Subject: Protect the responses map with a lock. Also remove ugly "this." type of member notation. --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 14 ++++++----- .../Linden/Caps/WebFetchInvDescModule.cs | 28 ++++++++++++---------- 2 files changed, 24 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 0ac56ec..2000279 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -146,14 +146,14 @@ namespace OpenSim.Region.ClientStack.Linden { m_scene = scene; - HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; + HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y, s) => { lock (responses) { try { - return this.responses[x]; + return responses[x]; } finally { @@ -165,15 +165,15 @@ namespace OpenSim.Region.ClientStack.Linden Request = (x, y) => { y["RequestID"] = x.ToString(); - lock (this.requests) - this.requests.Add(y); + lock (requests) + requests.Add(y); m_queue.Enqueue(this); }; NoEvents = (x, y) => { - lock (this.requests) + lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); @@ -198,7 +198,7 @@ namespace OpenSim.Region.ClientStack.Linden try { - lock (this.requests) + lock (requests) { request = requests[0]; requests.RemoveAt(0); @@ -221,8 +221,10 @@ namespace OpenSim.Region.ClientStack.Linden response["content_type"] = "text/plain"; response["keepalive"] = false; response["reusecontext"] = false; + lock (responses) responses[requestID] = response; + return; } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 4908c2c..f76ea74 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -144,31 +144,34 @@ namespace OpenSim.Region.ClientStack.Linden public PollServiceInventoryEventArgs(UUID pId) : base(null, null, null, null, pId, 30000) { - HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; + HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y, s) => { - try + lock (responses) { - return this.responses[x]; - } - finally - { - responses.Remove(x); + try + { + return responses[x]; + } + finally + { + responses.Remove(x); + } } }; Request = (x, y) => { y["RequestID"] = x.ToString(); - lock (this.requests) - this.requests.Add(y); + lock (requests) + requests.Add(y); m_queue.Enqueue(this); }; NoEvents = (x, y) => { - lock (this.requests) + lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); @@ -192,7 +195,7 @@ namespace OpenSim.Region.ClientStack.Linden try { - lock (this.requests) + lock (requests) { request = requests[0]; requests.RemoveAt(0); @@ -214,7 +217,8 @@ namespace OpenSim.Region.ClientStack.Linden response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); - responses[requestID] = response; + lock (responses) + responses[requestID] = response; } } -- cgit v1.1 From ca67ee60ac0e0c26d6d32fc68d48ef63570f034d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 24 Sep 2012 21:22:08 +0100 Subject: add missing transactionID in SendInventoryItemCreateUpdate. and make use of it on inventoryAccessModule, etc. Most likelly it's needs where there is a transactionID not zero --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7749ef3..ee28914 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2067,9 +2067,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); } - /// IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase) public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) { + SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); + } + + /// IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase) + public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) + { const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; UpdateCreateInventoryItemPacket InventoryReply @@ -2079,6 +2084,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // TODO: don't create new blocks if recycling an old packet InventoryReply.AgentData.AgentID = AgentId; InventoryReply.AgentData.SimApproved = true; + InventoryReply.AgentData.TransactionID = transactionID; InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); InventoryReply.InventoryData[0].ItemID = Item.ID; -- cgit v1.1 From 421071bd8a489b90d3ddd58add7135b178f59381 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 24 Sep 2012 23:19:57 +0200 Subject: Text changes for upload messages --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 4a323d8..c705f10 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -596,7 +596,7 @@ namespace OpenSim.Region.ClientStack.Linden if(IsAtestUpload) // let user know, still showing cost estimation - warning += "Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on another region"; + warning += "Upload will have no cost, for testing purposes only. Other uses are prohibited. Items will not work after 48 hours or on other regions"; // check funds else @@ -982,7 +982,7 @@ namespace OpenSim.Region.ClientStack.Linden } if(istest) - prim.Description = "For personal testing only. Other uses are forbiden"; + prim.Description = "For testing only. Other uses are prohibited"; else prim.Description = ""; @@ -1066,7 +1066,7 @@ namespace OpenSim.Region.ClientStack.Linden item.AssetID = asset.FullID; if (istest) { - item.Description = "For personal testing only. Other uses are forbiden"; + item.Description = "For testing only. Other uses are prohibited"; item.Flags = (uint) (InventoryItemFlags.SharedSingleReference); } else @@ -1541,7 +1541,7 @@ namespace OpenSim.Region.ClientStack.Linden if (m_IsAtestUpload) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); - resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are forbiden. Item may not work on other region"; + resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are prohibited. Item will not work after 48 hours or on other regions"; resperror.identifier = inv; uploadComplete.error = resperror; -- cgit v1.1 From a1a0a90720e65ce104699abb6dcd46b5cb34a6db Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 24 Sep 2012 22:57:33 +0100 Subject: more upload changes (plus untouch prebuild.xml) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 183 ++++++++++++++------- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 13 +- 2 files changed, 128 insertions(+), 68 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 21a1005..4a323d8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -118,12 +118,20 @@ namespace OpenSim.Region.ClientStack.Linden private IAssetService m_assetService; private bool m_dumpAssetsToFile = false; private string m_regionName; + private int m_levelUpload = 0; - private float m_PrimScaleMin = 0.001f; - private bool m_enableFreeTestUpload = false; - private bool m_enableModelUploadTextureToInventory = false; + + private bool m_enableFreeTestUpload = false; // allows "TEST-" prefix hack + private bool m_ForceFreeTestUpload = false; // forces all uploads to be test + + private bool m_enableModelUploadTextureToInventory = false; // place uploaded textures also in inventory + // may not be visible till relog + + private bool m_RestrictFreeTestUploadPerms = false; // reduces also the permitions. Needs a creator defined!! private UUID m_testAssetsCreatorID = UUID.Zero; + private float m_PrimScaleMin = 0.001f; + private enum FileAgentInventoryState : int { idle = 0, @@ -143,16 +151,16 @@ namespace OpenSim.Region.ClientStack.Linden // tell it about scene object limits m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys; m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; -// m_ModelCost.PrimScaleMin = ?? + // m_ModelCost.ObjectLinkedPartsMax = ?? -// m_PrimScaleMin = ?? +// m_ModelCost.PrimScaleMin = ?? + m_PrimScaleMin = m_ModelCost.PrimScaleMin; float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor; float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; - - // can be UUID.zero. This is me at OSG, should be a valid grid ID, is case a bad config - UUID.TryParse("58e06f33-ea8c-4ff6-9af5-420606926118", out m_testAssetsCreatorID); + float modelPrimCreationCost = m_ModelCost.primCreationCost; + float modelMeshByteCost = m_ModelCost.bytecost; IConfigSource config = m_Scene.Config; if (config != null) @@ -175,10 +183,16 @@ namespace OpenSim.Region.ClientStack.Linden modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); - m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); + // next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost + modelPrimCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", modelPrimCreationCost); + modelMeshByteCost = EconomyConfig.GetFloat("ModelMeshByteCost", modelMeshByteCost); - m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", false); - string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", m_testAssetsCreatorID.ToString()); + m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory); + + m_RestrictFreeTestUploadPerms = EconomyConfig.GetBoolean("m_RestrictFreeTestUploadPerms", m_RestrictFreeTestUploadPerms); + m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", m_enableFreeTestUpload); + m_ForceFreeTestUpload = EconomyConfig.GetBoolean("ForceFreeTestUpload", m_ForceFreeTestUpload); + string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", ""); if (testcreator != "") { UUID id; @@ -190,6 +204,8 @@ namespace OpenSim.Region.ClientStack.Linden m_ModelCost.ModelMeshCostFactor = modelUploadFactor; m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; + m_ModelCost.primCreationCost = modelPrimCreationCost; + m_ModelCost.bytecost = modelMeshByteCost; } } @@ -490,6 +506,8 @@ namespace OpenSim.Region.ClientStack.Linden int nreqinstances = 0; bool IsAtestUpload = false; + string assetName = llsdRequest.name; + LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); if (llsdRequest.asset_type == "texture" || @@ -497,7 +515,7 @@ namespace OpenSim.Region.ClientStack.Linden llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { - ScenePresence avatar = null; + ScenePresence avatar = null; m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); // check user level @@ -519,7 +537,7 @@ namespace OpenSim.Region.ClientStack.Linden } } - // check funds + // check test upload and funds if (client != null) { IMoneyModule mm = m_Scene.RequestModuleInterface(); @@ -558,41 +576,53 @@ namespace OpenSim.Region.ClientStack.Linden cost = baseCost; } - if (m_enableFreeTestUpload && cost > 0 && mm != null) + if (cost > 0 && mm != null) { - string str = llsdRequest.name; - if (str.Length > 5 && str.StartsWith("TEST-")) + // check for test upload + + if (m_ForceFreeTestUpload) // all are test { - warning += "Upload will have no cost, but for personal test purposes only. Other uses are forbiden"; + if (!(assetName.Length > 5 && assetName.StartsWith("TEST-"))) // has normal name lets change it + assetName = "TEST-" + assetName; + IsAtestUpload = true; } - } - - if (client != null && warning != String.Empty) - client.SendAgentAlertMessage(warning, true); - // check funds - if (!IsAtestUpload && mm != null && cost >0) - { - if (!mm.UploadCovered(client.AgentId, (int)cost)) + else if (m_enableFreeTestUpload) // only if prefixed with "TEST-" { - LLSDAssetUploadError resperror = new LLSDAssetUploadError(); - resperror.message = "Insuficient funds"; - resperror.identifier = UUID.Zero; - LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); - errorResponse.uploader = ""; - errorResponse.state = "error"; - errorResponse.error = resperror; - lock (m_ModelCost) - m_FileAgentInventoryState = FileAgentInventoryState.idle; - return errorResponse; + IsAtestUpload = (assetName.Length > 5 && assetName.StartsWith("TEST-")); + } + + + if(IsAtestUpload) // let user know, still showing cost estimation + warning += "Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on another region"; + + // check funds + else + { + if (!mm.UploadCovered(client.AgentId, (int)cost)) + { + LLSDAssetUploadError resperror = new LLSDAssetUploadError(); + resperror.message = "Insuficient funds"; + resperror.identifier = UUID.Zero; + + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + errorResponse.error = resperror; + lock (m_ModelCost) + m_FileAgentInventoryState = FileAgentInventoryState.idle; + return errorResponse; + } } } + + if (client != null && warning != String.Empty) + client.SendAgentAlertMessage(warning, true); } } - - string assetName = llsdRequest.name; + string assetDes = llsdRequest.description; string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; UUID newAsset = UUID.Random(); @@ -607,7 +637,7 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, - texturesFolder, nreqtextures, nreqmeshs, nreqinstances,IsAtestUpload); + texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -667,12 +697,16 @@ namespace OpenSim.Region.ClientStack.Linden sbyte assType = 0; sbyte inType = 0; + IClientAPI client = null; + UUID owner_id = m_HostCapsObj.AgentID; UUID creatorID; bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0); - if (istest) + bool restrictPerms = m_RestrictFreeTestUploadPerms && istest; + + if (istest && m_testAssetsCreatorID != UUID.Zero) creatorID = m_testAssetsCreatorID; else creatorID = owner_id; @@ -755,10 +789,19 @@ namespace OpenSim.Region.ClientStack.Linden List textures = new List(); + + if (doTextInv) + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + + if(client == null) // don't put textures in inventory if there is no client + doTextInv = false; + for (int i = 0; i < texture_list.Count; i++) { AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr); textureAsset.Data = texture_list[i].AsBinary(); + if (istest) + textureAsset.Local = true; m_assetService.Store(textureAsset); textures.Add(textureAsset.FullID); @@ -788,9 +831,8 @@ namespace OpenSim.Region.ClientStack.Linden texitem.NextPermissions = (uint)PermissionMask.All; texitem.CreationDate = Util.UnixTimeSinceEpoch(); - AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); + m_Scene.AddInventoryItem(client, texitem); texitem = null; - // this aren't showing up in viewer until relog :( } } @@ -800,6 +842,8 @@ namespace OpenSim.Region.ClientStack.Linden { AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); + if (istest) + meshAsset.Local = true; m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); } @@ -908,14 +952,12 @@ namespace OpenSim.Region.ClientStack.Linden // UUID owner_id = permissions["owner_id"].AsUUID(); // int owner_mask = permissions["owner_mask"].AsInteger(); // no longer used - end ------------------------ - - + SceneObjectPart prim = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); prim.Scale = scale; -// prim.OffsetPosition = position; rotations.Add(rotation); positions.Add(position); prim.UUID = UUID.Random(); @@ -930,18 +972,20 @@ namespace OpenSim.Region.ClientStack.Linden else prim.Name = assetName + "#" + i.ToString(); - if (istest) + if (restrictPerms) { prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); prim.EveryoneMask = 0; prim.GroupMask = 0; prim.NextOwnerMask = 0; prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + } + if(istest) prim.Description = "For personal testing only. Other uses are forbiden"; - } else prim.Description = ""; + prim.Material = material; prim.PhysicsShapeType = physicsShapeType; @@ -1007,6 +1051,8 @@ namespace OpenSim.Region.ClientStack.Linden AssetBase asset; asset = new AssetBase(assetID, assetName, assType, creatorIDstr); asset.Data = data; + if (istest) + asset.Local = true; if (AddNewAsset != null) AddNewAsset(asset); else if (m_assetService != null) @@ -1019,7 +1065,10 @@ namespace OpenSim.Region.ClientStack.Linden item.ID = inventoryItem; item.AssetID = asset.FullID; if (istest) + { item.Description = "For personal testing only. Other uses are forbiden"; + item.Flags = (uint) (InventoryItemFlags.SharedSingleReference); + } else item.Description = assetDescription; item.Name = assetName; @@ -1030,7 +1079,7 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. - if (istest) + if (restrictPerms) { item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); @@ -1051,16 +1100,18 @@ namespace OpenSim.Region.ClientStack.Linden item.CreationDate = Util.UnixTimeSinceEpoch(); - IClientAPI client = null; m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); if (AddNewInventoryItem != null) { if (istest) { + m_Scene.AddInventoryItem(client, item); +/* AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0); if (client != null) - client.SendAgentAlertMessage("Upload complete with no cost for personal testing purposes only. Other uses are forbiden", true); + client.SendAgentAlertMessage("Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on a another region" , true); + */ } else { @@ -1487,22 +1538,34 @@ 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); } - if(m_error == String.Empty) - { - uploadComplete.new_asset = newAssetID.ToString(); - uploadComplete.new_inventory_item = inv; -// if (m_texturesFolder != UUID.Zero) -// uploadComplete.new_texture_folder_id = m_texturesFolder; - uploadComplete.state = "complete"; - } - else + if (m_IsAtestUpload) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); - resperror.message = m_error; + resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are forbiden. Item may not work on other region"; resperror.identifier = inv; uploadComplete.error = resperror; - uploadComplete.state = "failed"; + uploadComplete.state = "Upload4Testing"; + } + else + { + if (m_error == String.Empty) + { + uploadComplete.new_asset = newAssetID.ToString(); + uploadComplete.new_inventory_item = inv; + // if (m_texturesFolder != UUID.Zero) + // uploadComplete.new_texture_folder_id = m_texturesFolder; + uploadComplete.state = "complete"; + } + else + { + LLSDAssetUploadError resperror = new LLSDAssetUploadError(); + resperror.message = m_error; + resperror.identifier = inv; + + uploadComplete.error = resperror; + uploadComplete.state = "failed"; + } } res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 66bb429..4a3fae6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -35,18 +35,15 @@ namespace OpenSim.Region.ClientStack.Linden // fees are normalized to 1.0 // this parameters scale them to basic cost ( so 1.0 translates to 10 ) - public float ModelMeshCostFactor = 0f; //Free - public float ModelMinCostFactor = 0f; // Free - //public float ModelMeshCostFactor = 1.0f; // scale total cost relative to basic (excluding textures) - //public float ModelMinCostFactor = 0.5f; // minimum total model free excluding textures + public float ModelMeshCostFactor = 0.0f; // scale total cost relative to basic (excluding textures) + public float ModelTextureCostFactor = 1.0f; // scale textures fee to basic. + public float ModelMinCostFactor = 0.0f; // 0.5f; // minimum total model free excluding textures - public float ModelTextureCostFactor = 1.00f; // keep full price because texture price - // is based on it's storage needs not on usability // itens costs in normalized values // ie will be multiplied by basicCost and factors above - const float primCreationCost = 0.002f; // extra cost for each prim creation overhead + public float primCreationCost = 0.002f; // extra cost for each prim creation overhead // weigthed size to normalized cost - const float bytecost = 1e-5f; + public float bytecost = 1e-5f; // mesh upload fees based on compressed data sizes // several data sections are counted more that once -- cgit v1.1 From 2cb17d6fbb4cfc5157cec0f3e4589db007a117b3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Sep 2012 03:38:45 +0100 Subject: change GetTextureModule processing --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 60 +++++++++++----------- 1 file changed, 31 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 2000279..1ccddd2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -53,6 +53,14 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")] public class GetTextureModule : INonSharedRegionModule { + + struct aPollRequest + { + public PollServiceTextureEventArgs thepoll; + public UUID reqID; + public Hashtable request; + } + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; @@ -64,8 +72,8 @@ namespace OpenSim.Region.ClientStack.Linden private Dictionary m_capsDict = new Dictionary(); private static Thread[] m_workerThreads = null; - private static OpenMetaverse.BlockingQueue m_queue = - new OpenMetaverse.BlockingQueue(); + private static OpenMetaverse.BlockingQueue m_queue = + new OpenMetaverse.BlockingQueue(); #region ISharedRegionModule Members @@ -104,7 +112,7 @@ namespace OpenSim.Region.ClientStack.Linden String.Format("TextureWorkerThread{0}", i), ThreadPriority.Normal, false, - true, + false, null, int.MaxValue); } @@ -129,7 +137,8 @@ namespace OpenSim.Region.ClientStack.Linden ~GetTextureModule() { foreach (Thread t in m_workerThreads) - t.Abort(); + Watchdog.AbortThread(t.ManagedThreadId); + } private class PollServiceTextureEventArgs : PollServiceEventArgs @@ -142,7 +151,12 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; public PollServiceTextureEventArgs(UUID pId, Scene scene) : - base(null, null, null, null, pId, 30000) + base(null, null, null, null, pId, int.MaxValue) + // this should never timeout + // each request must be processed and return a response + // noevents can possible be use for nice shutdown, but not sure now + // the execution will provide a proper response even if it fails + { m_scene = scene; @@ -164,13 +178,15 @@ namespace OpenSim.Region.ClientStack.Linden Request = (x, y) => { - y["RequestID"] = x.ToString(); - lock (requests) - requests.Add(y); + aPollRequest reqinfo = new aPollRequest(); + reqinfo.thepoll = this; + reqinfo.reqID = x; + reqinfo.request = y; - m_queue.Enqueue(this); + m_queue.Enqueue(reqinfo); }; + // this should never happen except possible on shutdown NoEvents = (x, y) => { lock (requests) @@ -191,27 +207,14 @@ namespace OpenSim.Region.ClientStack.Linden }; } - public void Process() + public void Process(aPollRequest requestinfo) { Hashtable response; - Hashtable request = null; - try - { - lock (requests) - { - request = requests[0]; - requests.RemoveAt(0); - } - } - catch - { - return; - } - - UUID requestID = new UUID(request["RequestID"].ToString()); + UUID requestID = requestinfo.reqID; // If the avatar is gone, don't bother to get the texture + if (m_scene.GetScenePresence(Id) == null) { response = new Hashtable(); @@ -228,7 +231,7 @@ namespace OpenSim.Region.ClientStack.Linden return; } - response = m_getTextureHandler.Handle(request); + response = m_getTextureHandler.Handle(requestinfo.request); lock (responses) responses[requestID] = response; } @@ -275,11 +278,10 @@ namespace OpenSim.Region.ClientStack.Linden { while (true) { - PollServiceTextureEventArgs args = m_queue.Dequeue(); + aPollRequest poolreq = m_queue.Dequeue(); - args.Process(); + poolreq.thepoll.Process(poolreq); } } } - } -- cgit v1.1 From 4d681bfde617371bf14fb74da595887a33ec688b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Sep 2012 03:59:19 +0100 Subject: do the same to webFecthInvDescModule --- .../Linden/Caps/WebFetchInvDescModule.cs | 58 ++++++++++------------ 1 file changed, 25 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index f76ea74..0f305b1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -52,6 +52,13 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class WebFetchInvDescModule : INonSharedRegionModule { + struct aPollRequest + { + public PollServiceInventoryEventArgs thepoll; + public UUID reqID; + public Hashtable request; + } + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; @@ -64,8 +71,8 @@ namespace OpenSim.Region.ClientStack.Linden private Dictionary m_capsDict = new Dictionary(); private static Thread[] m_workerThreads = null; - private static OpenMetaverse.BlockingQueue m_queue = - new OpenMetaverse.BlockingQueue(); + private static OpenMetaverse.BlockingQueue m_queue = + new OpenMetaverse.BlockingQueue(); #region ISharedRegionModule Members @@ -131,18 +138,16 @@ namespace OpenSim.Region.ClientStack.Linden ~WebFetchInvDescModule() { foreach (Thread t in m_workerThreads) - t.Abort(); + Watchdog.AbortThread(t.ManagedThreadId); } private class PollServiceInventoryEventArgs : PollServiceEventArgs { - private List requests = - new List(); private Dictionary responses = new Dictionary(); public PollServiceInventoryEventArgs(UUID pId) : - base(null, null, null, null, pId, 30000) + base(null, null, null, null, pId, int.MaxValue) { HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y, s) => @@ -162,21 +167,23 @@ namespace OpenSim.Region.ClientStack.Linden Request = (x, y) => { - y["RequestID"] = x.ToString(); - lock (requests) - requests.Add(y); + aPollRequest reqinfo = new aPollRequest(); + reqinfo.thepoll = this; + reqinfo.reqID = x; + reqinfo.request = y; - m_queue.Enqueue(this); + m_queue.Enqueue(reqinfo); }; NoEvents = (x, y) => { +/* lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); } - +*/ Hashtable response = new Hashtable(); response["int_response_code"] = 500; @@ -189,24 +196,9 @@ namespace OpenSim.Region.ClientStack.Linden }; } - public void Process() + public void Process(aPollRequest requestinfo) { - Hashtable request = null; - - try - { - lock (requests) - { - request = requests[0]; - requests.RemoveAt(0); - } - } - catch - { - return; - } - - UUID requestID = new UUID(request["RequestID"].ToString()); + UUID requestID = requestinfo.reqID; Hashtable response = new Hashtable(); @@ -215,7 +207,8 @@ namespace OpenSim.Region.ClientStack.Linden response["keepalive"] = false; response["reusecontext"] = false; - response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); + response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( + requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); lock (responses) responses[requestID] = response; @@ -226,8 +219,7 @@ namespace OpenSim.Region.ClientStack.Linden { string capUrl = "/CAPS/" + UUID.Random() + "/"; - // Register this as a poll service - // absurd large timeout to tune later to make a bit less than viewer + // Register this as a poll service PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); args.Type = PollServiceEventArgs.EventType.Inventory; @@ -263,9 +255,9 @@ namespace OpenSim.Region.ClientStack.Linden { while (true) { - PollServiceInventoryEventArgs args = m_queue.Dequeue(); + aPollRequest poolreq = m_queue.Dequeue(); - args.Process(); + poolreq.thepoll.Process(poolreq); } } } -- cgit v1.1 From ef3d44240ef0f4fe714ff0ea76a89be1e23fcb4e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Sep 2012 04:03:15 +0100 Subject: missed change --- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 1ccddd2..b16076d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -189,12 +189,13 @@ namespace OpenSim.Region.ClientStack.Linden // this should never happen except possible on shutdown NoEvents = (x, y) => { +/* lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); } - +*/ Hashtable response = new Hashtable(); response["int_response_code"] = 500; -- cgit v1.1 From 654dd289f263a4eef4f2aa70a1cb8d289ec7e04c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 03:05:27 +0100 Subject: more changes to PollService --- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 7 ++++++- OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index b16076d..8a607fb 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -160,7 +160,11 @@ namespace OpenSim.Region.ClientStack.Linden { m_scene = scene; - HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; + HasEvents = (x, y) => + { + lock (responses) + return responses.ContainsKey(x); + }; GetEvents = (x, y, s) => { lock (responses) @@ -247,6 +251,7 @@ namespace OpenSim.Region.ClientStack.Linden PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); args.Type = PollServiceEventArgs.EventType.Texture; + args.GetEventsNeedsRequest = false; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); string hostName = m_scene.RegionInfo.ExternalHostName; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 0f305b1..56070c6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -223,6 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); args.Type = PollServiceEventArgs.EventType.Inventory; + args.GetEventsNeedsRequest = false; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); string hostName = m_scene.RegionInfo.ExternalHostName; -- cgit v1.1 From 7e3eba1064197024690c5b3cae4c2cf87319e48c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 15:41:57 +0100 Subject: Seems nothing actually need the request body for getevents. so change control flag to false --- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 12 ++---------- .../Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 8a607fb..5169f65 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -151,12 +151,7 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; public PollServiceTextureEventArgs(UUID pId, Scene scene) : - base(null, null, null, null, pId, int.MaxValue) - // this should never timeout - // each request must be processed and return a response - // noevents can possible be use for nice shutdown, but not sure now - // the execution will provide a proper response even if it fails - + base(null, null, null, null, pId, int.MaxValue) { m_scene = scene; @@ -219,7 +214,6 @@ namespace OpenSim.Region.ClientStack.Linden UUID requestID = requestinfo.reqID; // If the avatar is gone, don't bother to get the texture - if (m_scene.GetScenePresence(Id) == null) { response = new Hashtable(); @@ -246,12 +240,10 @@ namespace OpenSim.Region.ClientStack.Linden { string capUrl = "/CAPS/" + UUID.Random() + "/"; - // Register this as a poll service - // absurd large timeout to tune later to make a bit less than viewer + // Register this as a poll service PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); args.Type = PollServiceEventArgs.EventType.Texture; - args.GetEventsNeedsRequest = false; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); string hostName = m_scene.RegionInfo.ExternalHostName; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 56070c6..0f305b1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -223,7 +223,6 @@ namespace OpenSim.Region.ClientStack.Linden PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); args.Type = PollServiceEventArgs.EventType.Inventory; - args.GetEventsNeedsRequest = false; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); string hostName = m_scene.RegionInfo.ExternalHostName; -- cgit v1.1 From 617f1b9223375a2dda925e26c395901810d37697 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 16:17:49 +0100 Subject: just remove the damm thing --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 2 +- OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index ebfe687..e113c60 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -419,7 +419,7 @@ namespace OpenSim.Region.ClientStack.Linden } } - public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request) + public Hashtable GetEvents(UUID requestID, UUID pAgentId) { if (DebugLevel >= 2) m_log.DebugFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 5169f65..cc65981 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -160,7 +160,7 @@ namespace OpenSim.Region.ClientStack.Linden lock (responses) return responses.ContainsKey(x); }; - GetEvents = (x, y, s) => + GetEvents = (x, y) => { lock (responses) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 0f305b1..0caeddf 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -150,7 +150,7 @@ namespace OpenSim.Region.ClientStack.Linden base(null, null, null, null, pId, int.MaxValue) { HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; - GetEvents = (x, y, s) => + GetEvents = (x, y) => { lock (responses) { -- cgit v1.1 From de3ff44406943ffad5832b6b0434209a8fabc298 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 14 Oct 2012 17:10:26 +0200 Subject: Make texture sedning use only two threads to make things less harsh on bandwidth --- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index cc65981..d1a1583 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -104,9 +104,9 @@ namespace OpenSim.Region.ClientStack.Linden if (m_workerThreads == null) { - m_workerThreads = new Thread[4]; + m_workerThreads = new Thread[2]; - for (uint i = 0; i < 4; i++) + for (uint i = 0; i < 2; i++) { m_workerThreads[i] = Watchdog.StartThread(DoTextureRequests, String.Format("TextureWorkerThread{0}", i), -- cgit v1.1 From 322eefbb6f6c3cc418a327a3b51357a12ee5036f Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 17 Oct 2012 01:31:05 +0200 Subject: Allow the console to be used by gods as well as region owners. --- OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs index 413536d..0a5ad0f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs @@ -104,7 +104,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { - if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(agentID)) + if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(agentID) && !m_scene.Permissions.IsGod(agentID)) return; UUID capID = UUID.Random(); -- cgit v1.1 From 2e8e8d576e342e4036b278805137ad68066dcbad Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 18 Oct 2012 13:20:50 +0200 Subject: Remove redundant and annoyingly modal message box in upload processing. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index c705f10..650cd50 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1116,17 +1116,17 @@ namespace OpenSim.Region.ClientStack.Linden else { AddNewInventoryItem(m_HostCapsObj.AgentID, item, (uint)cost); - if (client != null) - { - // let users see anything.. i don't so far - string str; - if (cost > 0) - // dont remember where is money unit name to put here - str = "Upload complete. charged " + cost.ToString() + "$"; - else - str = "Upload complete"; - client.SendAgentAlertMessage(str, true); - } +// if (client != null) +// { +// // let users see anything.. i don't so far +// string str; +// if (cost > 0) +// // dont remember where is money unit name to put here +// str = "Upload complete. charged " + cost.ToString() + "$"; +// else +// str = "Upload complete"; +// client.SendAgentAlertMessage(str, true); +// } } } -- cgit v1.1 From 4fa088bafb4c78ad3177b0e944a4312bd6abdea7 Mon Sep 17 00:00:00 2001 From: teravus Date: Sun, 4 Nov 2012 22:57:24 -0500 Subject: Pipe Throttle Update Event to EventManager, client --> ScenePresence --> EventManager, so that modules can know when throttles are updated. The event contains no client specific data to preserve the possibility of 'multiple clients' and you must still call ControllingClient.GetThrottlesPacked(f) to see what the throttles actually are once the event fires. Hook EventManager.OnUpdateThrottle to GetTextureModule. --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 42 ++++++++++++++++++++++ .../Region/ClientStack/Linden/UDP/LLClientView.cs | 11 ++++++ 2 files changed, 53 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index d1a1583..19d4b91 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -91,6 +91,7 @@ namespace OpenSim.Region.ClientStack.Linden { m_scene.EventManager.OnRegisterCaps -= RegisterCaps; m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; + m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; m_scene = null; } @@ -101,6 +102,7 @@ namespace OpenSim.Region.ClientStack.Linden m_scene.EventManager.OnRegisterCaps += RegisterCaps; m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; + m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; if (m_workerThreads == null) { @@ -118,6 +120,46 @@ namespace OpenSim.Region.ClientStack.Linden } } } + private int ExtractImageThrottle(byte[] pthrottles) + { + + byte[] adjData; + int pos = 0; + + if (!BitConverter.IsLittleEndian) + { + byte[] newData = new byte[7 * 4]; + Buffer.BlockCopy(pthrottles, 0, newData, 0, 7 * 4); + + for (int i = 0; i < 7; i++) + Array.Reverse(newData, i * 4, 4); + + adjData = newData; + } + else + { + adjData = pthrottles; + } + + // 0.125f converts from bits to bytes + //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + pos = pos + 16; + int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + return texture; + } + + // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent. + public void ThrottleUpdate(ScenePresence p) + { + byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); + UUID user = p.UUID; + int imagethrottle = ExtractImageThrottle(throttles); + } public void PostInitialise() { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ee28914..ae9ed7f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -295,6 +295,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event MuteListEntryRemove OnRemoveMuteListEntry; public event GodlikeMessage onGodlikeMessage; public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; + public event GenericCall2 OnUpdateThrottles; #endregion Events @@ -6729,6 +6730,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion m_udpClient.SetThrottles(atpack.Throttle.Throttles); + GenericCall2 handler = OnUpdateThrottles; + if (handler != null) + { + handler(); + } return true; } @@ -11870,6 +11876,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SetChildAgentThrottle(byte[] throttles) { m_udpClient.SetThrottles(throttles); + GenericCall2 handler = OnUpdateThrottles; + if (handler != null) + { + handler(); + } } /// -- cgit v1.1 From b7b96a5e4f1e26341742e35e5253e6e14797bd15 Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 5 Nov 2012 13:10:00 -0500 Subject: Another step in the chain. Pipe the throttle update to the appropriate PollServiceTextureEventArgs. Each poll service having it's own throttle member is more consistent with the model then the region module keeping track of all of them globally and better for locking too. The Poll Services object is not set static to handle multiple nearby regions on the same simulator. Next step is hooking it up to HasEvents --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 47 ++++++++++++++++------ 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 19d4b91..4bfdbff 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -61,6 +61,13 @@ namespace OpenSim.Region.ClientStack.Linden public Hashtable request; } + public struct aPollResponse + { + public Hashtable response; + public int bytes; + } + + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; @@ -75,6 +82,8 @@ namespace OpenSim.Region.ClientStack.Linden private static OpenMetaverse.BlockingQueue m_queue = new OpenMetaverse.BlockingQueue(); + private Dictionary m_pollservices = new Dictionary(); + #region ISharedRegionModule Members public void Initialise(IConfigSource source) @@ -147,7 +156,7 @@ namespace OpenSim.Region.ClientStack.Linden // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - pos = pos + 16; + pos = pos + 20; int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); return texture; @@ -159,6 +168,11 @@ namespace OpenSim.Region.ClientStack.Linden byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); UUID user = p.UUID; int imagethrottle = ExtractImageThrottle(throttles); + PollServiceTextureEventArgs args; + if (m_pollservices.TryGetValue(user,out args)) + { + args.UpdateThrottle(imagethrottle); + } } public void PostInitialise() @@ -187,8 +201,8 @@ namespace OpenSim.Region.ClientStack.Linden { private List requests = new List(); - private Dictionary responses = - new Dictionary(); + private Dictionary responses = + new Dictionary(); private Scene m_scene; @@ -196,7 +210,7 @@ namespace OpenSim.Region.ClientStack.Linden base(null, null, null, null, pId, int.MaxValue) { m_scene = scene; - + // x is request id, y is userid HasEvents = (x, y) => { lock (responses) @@ -208,7 +222,7 @@ namespace OpenSim.Region.ClientStack.Linden { try { - return responses[x]; + return responses[x].response; } finally { @@ -216,14 +230,14 @@ namespace OpenSim.Region.ClientStack.Linden } } }; - + // x is request id, y is request data hashtable Request = (x, y) => { aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; - + m_queue.Enqueue(reqinfo); }; @@ -265,16 +279,21 @@ namespace OpenSim.Region.ClientStack.Linden response["content_type"] = "text/plain"; response["keepalive"] = false; response["reusecontext"] = false; - + lock (responses) - responses[requestID] = response; + responses[requestID] = new aPollResponse() {bytes = 0,response = response}; return; } response = m_getTextureHandler.Handle(requestinfo.request); lock (responses) - responses[requestID] = response; + responses[requestID] = new aPollResponse() { bytes = (int)response["int_bytes"], response = response}; + } + + internal void UpdateThrottle(int pimagethrottle) + { + } } @@ -299,19 +318,23 @@ namespace OpenSim.Region.ClientStack.Linden protocol = "https"; } caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); - + m_pollservices.Add(agentID, args); m_capsDict[agentID] = capUrl; } private void DeregisterCaps(UUID agentID, Caps caps) { string capUrl; - + PollServiceTextureEventArgs args; if (m_capsDict.TryGetValue(agentID, out capUrl)) { MainServer.Instance.RemoveHTTPHandler("", capUrl); m_capsDict.Remove(agentID); } + if (m_pollservices.TryGetValue(agentID, out args)) + { + m_pollservices.Remove(agentID); + } } private void DoTextureRequests() -- cgit v1.1 From 182b4872437e97762ac494dbf1815fe63aa29405 Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 5 Nov 2012 22:05:10 -0500 Subject: This implements the Caps throttler. After some testing, the system seemed to be OK with me specifying allowing 1 oversized image per 70,000b/sec with at least one. Try it out, start with a low bandwidth setting and then, set your bandwidth setting middle/high and see the difference. Tested with Two Clients on a region with 1800 textures all visible at once. --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 119 ++++++++++++++++++--- 1 file changed, 106 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 4bfdbff..8cba6c8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.Linden public Hashtable request; } - public struct aPollResponse + public class aPollResponse { public Hashtable response; public int bytes; @@ -151,13 +151,18 @@ namespace OpenSim.Region.ClientStack.Linden } // 0.125f converts from bits to bytes - //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + //pos += 4; + // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + //pos += 4; + // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + // pos += 4; + // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + // pos += 4; + // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + // pos += 4; pos = pos + 20; - int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; + int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4; //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); return texture; } @@ -205,7 +210,7 @@ namespace OpenSim.Region.ClientStack.Linden new Dictionary(); private Scene m_scene; - + private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); public PollServiceTextureEventArgs(UUID pId, Scene scene) : base(null, null, null, null, pId, int.MaxValue) { @@ -214,7 +219,12 @@ namespace OpenSim.Region.ClientStack.Linden HasEvents = (x, y) => { lock (responses) - return responses.ContainsKey(x); + { + bool ret = m_throttler.hasEvents(x, responses); + m_throttler.ProcessTime(); + return ret; + + } }; GetEvents = (x, y) => { @@ -281,19 +291,27 @@ namespace OpenSim.Region.ClientStack.Linden response["reusecontext"] = false; lock (responses) - responses[requestID] = new aPollResponse() {bytes = 0,response = response}; + responses[requestID] = new aPollResponse() {bytes = 0, response = response}; return; } - + response = m_getTextureHandler.Handle(requestinfo.request); lock (responses) - responses[requestID] = new aPollResponse() { bytes = (int)response["int_bytes"], response = response}; + { + responses[requestID] = new aPollResponse() + { + bytes = (int) response["int_bytes"], + response = response + }; + + } + m_throttler.ProcessTime(); } internal void UpdateThrottle(int pimagethrottle) { - + m_throttler.ThrottleBytes = pimagethrottle; } } @@ -347,4 +365,79 @@ namespace OpenSim.Region.ClientStack.Linden } } } + + internal sealed class CapsDataThrottler + { + + private volatile int currenttime = 0; + private volatile int lastTimeElapsed = 0; + private volatile int BytesSent = 0; + private int oversizedImages = 0; + public CapsDataThrottler(int pBytes, int max, int min) + { + ThrottleBytes = pBytes; + lastTimeElapsed = Util.EnvironmentTickCount(); + } + public bool hasEvents(UUID key, Dictionary responses) + { + PassTime(); + // Note, this is called IN LOCK + bool haskey = responses.ContainsKey(key); + if (!haskey) + { + return false; + } + GetTextureModule.aPollResponse response; + if (responses.TryGetValue(key,out response)) + { + + // Normal + if (BytesSent + response.bytes <= ThrottleBytes) + { + BytesSent += response.bytes; + //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; + //m_actions.Add(timeBasedAction); + return true; + } + // Big textures + else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes%50000) + 1)) + { + Interlocked.Increment(ref oversizedImages); + BytesSent += response.bytes; + //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; + //m_actions.Add(timeBasedAction); + return true; + } + else + { + return false; + } + } + + return haskey; + } + public void ProcessTime() + { + PassTime(); + } + + + private void PassTime() + { + currenttime = Util.EnvironmentTickCount(); + int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); + //processTimeBasedActions(responses); + if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) + { + lastTimeElapsed = Util.EnvironmentTickCount(); + BytesSent -= ThrottleBytes; + if (BytesSent < 0) BytesSent = 0; + if (BytesSent < ThrottleBytes) + { + oversizedImages = 0; + } + } + } + public int ThrottleBytes; + } } -- cgit v1.1 From cda127e30f0049cda21137363e4d759fd7fd4959 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 9 Nov 2012 23:55:30 -0500 Subject: * Prep work switching the GetMeshModule over to a poll service. * This still has the image throttler in it.. as is... so it's not suitable for live yet.... The throttler keeps track of the task throttle but doesn't balance the UDP throttle yet. --- .../ClientStack/Linden/Caps/GetMeshModule.cs | 362 ++++++++++++++++++++- .../ClientStack/Linden/Caps/GetTextureModule.cs | 121 +++---- 2 files changed, 410 insertions(+), 73 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 0d7b1fc..8deff81 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -27,11 +27,14 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Collections.Specialized; using System.Reflection; using System.IO; +using System.Threading; using System.Web; using Mono.Addins; +using OpenSim.Framework.Monitoring; using log4net; using Nini.Config; using OpenMetaverse; @@ -57,8 +60,42 @@ namespace OpenSim.Region.ClientStack.Linden private IAssetService m_AssetService; private bool m_Enabled = true; private string m_URL; + struct aPollRequest + { + public PollServiceMeshEventArgs thepoll; + public UUID reqID; + public Hashtable request; + } + + public class aPollResponse + { + public Hashtable response; + public int bytes; + } + + + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private static GetMeshHandler m_getMeshHandler; + + private IAssetService m_assetService = null; + + private Dictionary m_capsDict = new Dictionary(); + private static Thread[] m_workerThreads = null; + + private static OpenMetaverse.BlockingQueue m_queue = + new OpenMetaverse.BlockingQueue(); + + private Dictionary m_pollservices = new Dictionary(); - #region IRegionModuleBase Members + #region ISharedRegionModule Members + + ~GetMeshModule() + { + foreach (Thread t in m_workerThreads) + Watchdog.AbortThread(t.ManagedThreadId); + + } public Type ReplaceableInterface { @@ -83,6 +120,8 @@ namespace OpenSim.Region.ClientStack.Linden return; m_scene = pScene; + + m_assetService = pScene.AssetService; } public void RemoveRegion(Scene scene) @@ -91,6 +130,9 @@ namespace OpenSim.Region.ClientStack.Linden return; m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; + m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; + m_scene = null; } @@ -101,6 +143,27 @@ namespace OpenSim.Region.ClientStack.Linden m_AssetService = m_scene.RequestModuleInterface(); m_scene.EventManager.OnRegisterCaps += RegisterCaps; + // We'll reuse the same handler for all requests. + m_getMeshHandler = new GetMeshHandler(m_assetService); + m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; + m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; + + if (m_workerThreads == null) + { + m_workerThreads = new Thread[2]; + + for (uint i = 0; i < 2; i++) + { + m_workerThreads[i] = Watchdog.StartThread(DoMeshRequests, + String.Format("MeshWorkerThread{0}", i), + ThreadPriority.Normal, + false, + false, + null, + int.MaxValue); + } + } + } @@ -110,25 +173,209 @@ namespace OpenSim.Region.ClientStack.Linden #endregion + private void DoMeshRequests() + { + while (true) + { + aPollRequest poolreq = m_queue.Dequeue(); + + poolreq.thepoll.Process(poolreq); + } + } + + // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent. + public void ThrottleUpdate(ScenePresence p) + { + byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); + UUID user = p.UUID; + int imagethrottle = ExtractTaskThrottle(throttles); + PollServiceMeshEventArgs args; + if (m_pollservices.TryGetValue(user, out args)) + { + args.UpdateThrottle(imagethrottle); + } + } + + private int ExtractTaskThrottle(byte[] pthrottles) + { + + byte[] adjData; + int pos = 0; + + if (!BitConverter.IsLittleEndian) + { + byte[] newData = new byte[7 * 4]; + Buffer.BlockCopy(pthrottles, 0, newData, 0, 7 * 4); + + for (int i = 0; i < 7; i++) + Array.Reverse(newData, i * 4, 4); + + adjData = newData; + } + else + { + adjData = pthrottles; + } + + // 0.125f converts from bits to bytes + //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + //pos += 4; + // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + //pos += 4; + // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + // pos += 4; + // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + // pos += 4; + pos += 16; + int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + // pos += 4; + //int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4; + //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + return task; + } + + private class PollServiceMeshEventArgs : PollServiceEventArgs + { + private List requests = + new List(); + private Dictionary responses = + new Dictionary(); + + private Scene m_scene; + private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000, 10000); + public PollServiceMeshEventArgs(UUID pId, Scene scene) : + base(null, null, null, null, pId, int.MaxValue) + { + m_scene = scene; + // x is request id, y is userid + HasEvents = (x, y) => + { + lock (responses) + { + bool ret = m_throttler.hasEvents(x, responses); + m_throttler.ProcessTime(); + return ret; + + } + }; + GetEvents = (x, y) => + { + lock (responses) + { + try + { + return responses[x].response; + } + finally + { + responses.Remove(x); + } + } + }; + // x is request id, y is request data hashtable + Request = (x, y) => + { + aPollRequest reqinfo = new aPollRequest(); + reqinfo.thepoll = this; + reqinfo.reqID = x; + reqinfo.request = y; + + m_queue.Enqueue(reqinfo); + }; + + // this should never happen except possible on shutdown + NoEvents = (x, y) => + { + /* + lock (requests) + { + Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); + requests.Remove(request); + } + */ + Hashtable response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + return response; + }; + } + + public void Process(aPollRequest requestinfo) + { + Hashtable response; + + UUID requestID = requestinfo.reqID; + + // If the avatar is gone, don't bother to get the texture + if (m_scene.GetScenePresence(Id) == null) + { + response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + lock (responses) + responses[requestID] = new aPollResponse() { bytes = 0, response = response }; + + return; + } + + response = m_getMeshHandler.Handle(requestinfo.request); + lock (responses) + { + responses[requestID] = new aPollResponse() + { + bytes = (int)response["int_bytes"], + response = response + }; + + } + m_throttler.ProcessTime(); + } + + internal void UpdateThrottle(int pimagethrottle) + { + m_throttler.ThrottleBytes = pimagethrottle; + } + } public void RegisterCaps(UUID agentID, Caps caps) { // UUID capID = UUID.Random(); - - //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { -// m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); - GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); - IRequestHandler reqHandler - = new RestHTTPHandler( - "GET", - "/CAPS/" + UUID.Random(), - httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), - "GetMesh", - agentID.ToString()); + string capUrl = "/CAPS/" + UUID.Random() + "/"; + + // Register this as a poll service + PollServiceMeshEventArgs args = new PollServiceMeshEventArgs(agentID, m_scene); + + args.Type = PollServiceEventArgs.EventType.Mesh; + MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); + + string hostName = m_scene.RegionInfo.ExternalHostName; + uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; + string protocol = "http"; - caps.RegisterHandler("GetMesh", reqHandler); + if (MainServer.Instance.UseSSL) + { + hostName = MainServer.Instance.SSLCommonName; + port = MainServer.Instance.SSLPort; + protocol = "https"; + } + caps.RegisterHandler("GetMesh", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); + m_pollservices.Add(agentID, args); + m_capsDict[agentID] = capUrl; + + + } else { @@ -136,6 +383,95 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterHandler("GetMesh", m_URL); } } + private void DeregisterCaps(UUID agentID, Caps caps) + { + string capUrl; + PollServiceMeshEventArgs args; + if (m_capsDict.TryGetValue(agentID, out capUrl)) + { + MainServer.Instance.RemoveHTTPHandler("", capUrl); + m_capsDict.Remove(agentID); + } + if (m_pollservices.TryGetValue(agentID, out args)) + { + m_pollservices.Remove(agentID); + } + } + + internal sealed class CapsDataThrottler + { + + private volatile int currenttime = 0; + private volatile int lastTimeElapsed = 0; + private volatile int BytesSent = 0; + private int oversizedImages = 0; + public CapsDataThrottler(int pBytes, int max, int min) + { + ThrottleBytes = pBytes; + lastTimeElapsed = Util.EnvironmentTickCount(); + } + public bool hasEvents(UUID key, Dictionary responses) + { + PassTime(); + // Note, this is called IN LOCK + bool haskey = responses.ContainsKey(key); + if (!haskey) + { + return false; + } + aPollResponse response; + if (responses.TryGetValue(key, out response)) + { + + // Normal + if (BytesSent + response.bytes <= ThrottleBytes) + { + BytesSent += response.bytes; + //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; + //m_actions.Add(timeBasedAction); + return true; + } + // Big textures + else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes % 50000) + 1)) + { + Interlocked.Increment(ref oversizedImages); + BytesSent += response.bytes; + //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; + //m_actions.Add(timeBasedAction); + return true; + } + else + { + return false; + } + } + + return haskey; + } + public void ProcessTime() + { + PassTime(); + } + + + private void PassTime() + { + currenttime = Util.EnvironmentTickCount(); + int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); + //processTimeBasedActions(responses); + if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) + { + lastTimeElapsed = Util.EnvironmentTickCount(); + BytesSent -= ThrottleBytes; + if (BytesSent < 0) BytesSent = 0; + if (BytesSent < ThrottleBytes) + { + oversizedImages = 0; + } + } + } + public int ThrottleBytes; + } } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 8cba6c8..c8c709a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -364,80 +364,81 @@ namespace OpenSim.Region.ClientStack.Linden poolreq.thepoll.Process(poolreq); } } - } - - internal sealed class CapsDataThrottler - { - - private volatile int currenttime = 0; - private volatile int lastTimeElapsed = 0; - private volatile int BytesSent = 0; - private int oversizedImages = 0; - public CapsDataThrottler(int pBytes, int max, int min) - { - ThrottleBytes = pBytes; - lastTimeElapsed = Util.EnvironmentTickCount(); - } - public bool hasEvents(UUID key, Dictionary responses) + internal sealed class CapsDataThrottler { - PassTime(); - // Note, this is called IN LOCK - bool haskey = responses.ContainsKey(key); - if (!haskey) + + private volatile int currenttime = 0; + private volatile int lastTimeElapsed = 0; + private volatile int BytesSent = 0; + private int oversizedImages = 0; + public CapsDataThrottler(int pBytes, int max, int min) { - return false; + ThrottleBytes = pBytes; + lastTimeElapsed = Util.EnvironmentTickCount(); } - GetTextureModule.aPollResponse response; - if (responses.TryGetValue(key,out response)) + public bool hasEvents(UUID key, Dictionary responses) { - - // Normal - if (BytesSent + response.bytes <= ThrottleBytes) + PassTime(); + // Note, this is called IN LOCK + bool haskey = responses.ContainsKey(key); + if (!haskey) { - BytesSent += response.bytes; - //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; - //m_actions.Add(timeBasedAction); - return true; - } - // Big textures - else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes%50000) + 1)) - { - Interlocked.Increment(ref oversizedImages); - BytesSent += response.bytes; - //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; - //m_actions.Add(timeBasedAction); - return true; + return false; } - else + GetTextureModule.aPollResponse response; + if (responses.TryGetValue(key, out response)) { - return false; + + // Normal + if (BytesSent + response.bytes <= ThrottleBytes) + { + BytesSent += response.bytes; + //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; + //m_actions.Add(timeBasedAction); + return true; + } + // Big textures + else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes % 50000) + 1)) + { + Interlocked.Increment(ref oversizedImages); + BytesSent += response.bytes; + //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; + //m_actions.Add(timeBasedAction); + return true; + } + else + { + return false; + } } + + return haskey; + } + public void ProcessTime() + { + PassTime(); } - return haskey; - } - public void ProcessTime() - { - PassTime(); - } - - - private void PassTime() - { - currenttime = Util.EnvironmentTickCount(); - int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); - //processTimeBasedActions(responses); - if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) + + private void PassTime() { - lastTimeElapsed = Util.EnvironmentTickCount(); - BytesSent -= ThrottleBytes; - if (BytesSent < 0) BytesSent = 0; - if (BytesSent < ThrottleBytes) + currenttime = Util.EnvironmentTickCount(); + int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); + //processTimeBasedActions(responses); + if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) { - oversizedImages = 0; + lastTimeElapsed = Util.EnvironmentTickCount(); + BytesSent -= ThrottleBytes; + if (BytesSent < 0) BytesSent = 0; + if (BytesSent < ThrottleBytes) + { + oversizedImages = 0; + } } } + public int ThrottleBytes; } - public int ThrottleBytes; } + + } -- cgit v1.1 From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001 From: teravus Date: Thu, 15 Nov 2012 10:05:16 -0500 Subject: Revert "Merge master into teravuswork", it should have been avination, not master. This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 9 +- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 21 +- .../Caps/EventQueue/Tests/EventQueueTests.cs | 2 +- .../ClientStack/Linden/Caps/RegionConsoleModule.cs | 2 +- .../ClientStack/Linden/UDP/IncomingPacket.cs | 7 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 169 ++++------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 338 +++------------------ .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 116 ++----- .../Region/ClientStack/Linden/UDP/PacketPool.cs | 316 ------------------- .../Linden/UDP/Tests/BasicCircuitTests.cs | 7 +- .../Region/ClientStack/RegionApplicationBase.cs | 2 +- 11 files changed, 165 insertions(+), 824 deletions(-) delete mode 100644 OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index f6146a9..650cd50 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -241,8 +241,8 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler( "SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null)); -// m_log.DebugFormat( -// "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID); + m_log.DebugFormat( + "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID); //m_capsHandlers["MapLayer"] = // new LLSDStreamhandler("POST", @@ -337,12 +337,11 @@ namespace OpenSim.Region.ClientStack.Linden public string SeedCapRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - m_log.DebugFormat( - "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); +// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) { - m_log.WarnFormat( + m_log.DebugFormat( "[CAPS]: Unauthorized CAPS client {0} from {1}", m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 5bbdce8..e113c60 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); -// scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnNewClient += OnNewClient; // TODO: Leaving these open, or closing them when we // become a child is incorrect. It messes up TP in a big @@ -102,7 +102,6 @@ namespace OpenSim.Region.ClientStack.Linden // circuit is there. scene.EventManager.OnClientClosed += ClientClosed; - scene.EventManager.OnMakeChildAgent += MakeChildAgent; scene.EventManager.OnRegisterCaps += OnRegisterCaps; @@ -111,10 +110,10 @@ namespace OpenSim.Region.ClientStack.Linden false, "debug eq", "debug eq [0|1|2]", - "Turn on event queue debugging\n" - + " <= 0 - turns off all event queue logging\n" - + " >= 1 - turns on outgoing event logging\n" - + " >= 2 - turns on poll notification", + "Turn on event queue debugging" + + "<= 0 - turns off all event queue logging" + + ">= 1 - turns on outgoing event logging" + + ">= 2 - turns on poll notification", HandleDebugEq); } else @@ -227,6 +226,16 @@ namespace OpenSim.Region.ClientStack.Linden #endregion + private void OnNewClient(IClientAPI client) + { + //client.OnLogout += ClientClosed; + } + +// private void ClientClosed(IClientAPI client) +// { +// ClientClosed(client.AgentId); +// } + private void ClientClosed(UUID agentID, Scene scene) { // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index d604cf6..cd70410 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests UUID spId = TestHelpers.ParseTail(0x1); SceneHelpers.AddScenePresence(m_scene, spId); - m_scene.IncomingCloseAgent(spId, false); + m_scene.IncomingCloseAgent(spId); // TODO: Add more assertions for the other aspects of event queues Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0)); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs index fcac182..0a5ad0f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs @@ -109,7 +109,7 @@ namespace OpenSim.Region.ClientStack.Linden UUID capID = UUID.Random(); -// m_log.DebugFormat("[REGION CONSOLE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); + m_log.DebugFormat("[REGION CONSOLE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); caps.RegisterHandler( "SimConsoleAsync", new ConsoleHandler("/CAPS/" + capID + "/", "SimConsoleAsync", agentID, this, m_scene)); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs index e22670b..1b8535c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs @@ -45,12 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Packet Packet; /// - /// No arg constructor. - /// - public IncomingPacket() {} - - /// - /// Constructor + /// Default constructor /// /// Reference to the client this packet came from /// Packet data diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c9aa4ca..ae9ed7f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -47,7 +47,6 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using Timer = System.Timers.Timer; using AssetLandmark = OpenSim.Framework.AssetLandmark; -using RegionFlags = OpenMetaverse.RegionFlags; using Nini.Config; using System.IO; @@ -356,17 +355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool m_deliverPackets = true; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; - - /// - /// We retain a single AgentUpdateArgs so that we can constantly reuse it rather than construct a new one for - /// every single incoming AgentUpdate. Every client sends 10 AgentUpdate UDP messages per second, even if it - /// is doing absolutely nothing. - /// - /// - /// This does mean that agent updates must be processed synchronously, at least for each client, and called methods - /// cannot retain a reference to it outside of that method. - /// - private AgentUpdateArgs m_lastAgentUpdateArgs; + private AgentUpdateArgs lastarg; protected Dictionary m_packetHandlers = new Dictionary(); protected Dictionary m_genericPacketHandlers = new Dictionary(); //PauPaw:Local Generic Message handlers @@ -521,18 +510,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void Close() { - Close(true, false); + Close(true); } - public void Close(bool sendStop, bool force) + /// + /// Shut down the client view + /// + public void Close(bool sendStop) { // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. lock (CloseSyncLock) { - // We still perform a force close inside the sync lock since this is intended to attempt close where - // there is some unidentified connection problem, not where we have issues due to deadlock - if (!IsActive && !force) + if (!IsActive) return; IsActive = false; @@ -847,9 +837,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(mov, ThrottleOutPacketType.Unknown); } - public void SendChatMessage( - string message, byte type, Vector3 fromPos, string fromName, - UUID fromAgentID, UUID ownerID, byte source, byte audible) + public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, + UUID fromAgentID, byte source, byte audible) { ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); reply.ChatData.Audible = audible; @@ -858,7 +847,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.ChatData.SourceType = source; reply.ChatData.Position = fromPos; reply.ChatData.FromName = Util.StringToBytes256(fromName); - reply.ChatData.OwnerID = ownerID; + reply.ChatData.OwnerID = fromAgentID; reply.ChatData.SourceID = fromAgentID; OutPacket(reply, ThrottleOutPacketType.Unknown); @@ -3996,8 +3985,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { List blocks = terseAgentUpdateBlocks.Value; - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.TimeDilation = timeDilation; packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; @@ -4042,9 +4030,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { List blocks = terseUpdateBlocks.Value; - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( - PacketType.ImprovedTerseObjectUpdate); + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.TimeDilation = timeDilation; packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; @@ -4052,7 +4038,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); + OutPacket(packet, ThrottleOutPacketType.Task, true); } #endregion Packet Sending @@ -4549,7 +4535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); } - j = 0; + j = 0; returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; @@ -5053,9 +5039,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock block - = PacketPool.Instance.GetDataBlock(); - + ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); block.Data = data; if (textureEntry != null && textureEntry.Length > 0) @@ -5305,18 +5289,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void RegisterLocalPacketHandlers() { AddLocalPacketHandler(PacketType.LogoutRequest, HandleLogout); - - // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs - // for each AgentUpdate packet. AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); - AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); - AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); - AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); + AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest, false); + AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest, false); AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); @@ -5538,84 +5518,81 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar - private bool HandleAgentUpdate(IClientAPI sener, Packet packet) + private bool HandleAgentUpdate(IClientAPI sener, Packet Pack) { if (OnAgentUpdate != null) { - AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; + bool update = false; + AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; #region Packet Session and User Check - if (agentUpdate.AgentData.SessionID != SessionId || agentUpdate.AgentData.AgentID != AgentId) - { - PacketPool.Instance.ReturnPacket(packet); + if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId) return false; - } #endregion - bool update = false; - AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; + AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData; + + // We can only check when we have something to check + // against. - if (m_lastAgentUpdateArgs != null) + if (lastarg != null) { - // These should be ordered from most-likely to - // least likely to change. I've made an initial - // guess at that. update = ( - (x.BodyRotation != m_lastAgentUpdateArgs.BodyRotation) || - (x.CameraAtAxis != m_lastAgentUpdateArgs.CameraAtAxis) || - (x.CameraCenter != m_lastAgentUpdateArgs.CameraCenter) || - (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || - (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || - (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || + (x.BodyRotation != lastarg.BodyRotation) || + (x.CameraAtAxis != lastarg.CameraAtAxis) || + (x.CameraCenter != lastarg.CameraCenter) || + (x.CameraLeftAxis != lastarg.CameraLeftAxis) || + (x.CameraUpAxis != lastarg.CameraUpAxis) || + (x.ControlFlags != lastarg.ControlFlags) || (x.ControlFlags != 0) || - (x.Far != m_lastAgentUpdateArgs.Far) || - (x.Flags != m_lastAgentUpdateArgs.Flags) || - (x.State != m_lastAgentUpdateArgs.State) || - (x.HeadRotation != m_lastAgentUpdateArgs.HeadRotation) || - (x.SessionID != m_lastAgentUpdateArgs.SessionID) || - (x.AgentID != m_lastAgentUpdateArgs.AgentID) + (x.Far != lastarg.Far) || + (x.Flags != lastarg.Flags) || + (x.State != lastarg.State) || + (x.HeadRotation != lastarg.HeadRotation) || + (x.SessionID != lastarg.SessionID) || + (x.AgentID != lastarg.AgentID) ); } else { - m_lastAgentUpdateArgs = new AgentUpdateArgs(); update = true; } + // These should be ordered from most-likely to + // least likely to change. I've made an initial + // guess at that. + if (update) { // m_log.DebugFormat("[LLCLIENTVIEW]: Triggered AgentUpdate for {0}", sener.Name); - m_lastAgentUpdateArgs.AgentID = x.AgentID; - m_lastAgentUpdateArgs.BodyRotation = x.BodyRotation; - m_lastAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; - m_lastAgentUpdateArgs.CameraCenter = x.CameraCenter; - m_lastAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; - m_lastAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; - m_lastAgentUpdateArgs.ControlFlags = x.ControlFlags; - m_lastAgentUpdateArgs.Far = x.Far; - m_lastAgentUpdateArgs.Flags = x.Flags; - m_lastAgentUpdateArgs.HeadRotation = x.HeadRotation; - m_lastAgentUpdateArgs.SessionID = x.SessionID; - m_lastAgentUpdateArgs.State = x.State; - + AgentUpdateArgs arg = new AgentUpdateArgs(); + arg.AgentID = x.AgentID; + arg.BodyRotation = x.BodyRotation; + arg.CameraAtAxis = x.CameraAtAxis; + arg.CameraCenter = x.CameraCenter; + arg.CameraLeftAxis = x.CameraLeftAxis; + arg.CameraUpAxis = x.CameraUpAxis; + arg.ControlFlags = x.ControlFlags; + arg.Far = x.Far; + arg.Flags = x.Flags; + arg.HeadRotation = x.HeadRotation; + arg.SessionID = x.SessionID; + arg.State = x.State; UpdateAgent handlerAgentUpdate = OnAgentUpdate; UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; - + lastarg = arg; // save this set of arguments for nexttime if (handlerPreAgentUpdate != null) - OnPreAgentUpdate(this, m_lastAgentUpdateArgs); - + OnPreAgentUpdate(this, arg); if (handlerAgentUpdate != null) - OnAgentUpdate(this, m_lastAgentUpdateArgs); + OnAgentUpdate(this, arg); handlerAgentUpdate = null; handlerPreAgentUpdate = null; } } - PacketPool.Instance.ReturnPacket(packet); - return true; } @@ -5987,8 +5964,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP msgpack.MessageBlock.ID, msgpack.MessageBlock.Offline != 0 ? true : false, msgpack.MessageBlock.Position, - msgpack.MessageBlock.BinaryBucket, - true); + msgpack.MessageBlock.BinaryBucket); handlerInstantMessage(this, im); } @@ -9275,9 +9251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion - string method = Utils.BytesToString(messagePacket.MethodData.Method); - - switch (method) + switch (Utils.BytesToString(messagePacket.MethodData.Method)) { case "getinfo": if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) @@ -9593,17 +9567,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; default: - m_log.WarnFormat( - "[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}", - method, Name, Scene.Name); - - for (int i = 0; i < messagePacket.ParamList.Length; i++) - { - EstateOwnerMessagePacket.ParamListBlock block = messagePacket.ParamList[i]; - string data = (string)Utils.BytesToString(block.Parameter); - m_log.DebugFormat("[LLCLIENTVIEW]: Param {0}={1}", i, data); - } - + m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); return true; } @@ -11996,7 +11960,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP logPacket = false; if (DebugPacketLevel <= 50 - && (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate)) + & (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate)) logPacket = false; if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily) @@ -12070,6 +12034,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!ProcessPacketMethod(packet)) m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); + + PacketPool.Instance.ReturnPacket(packet); } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) @@ -12238,7 +12204,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Kick(reason); Thread.Sleep(1000); - Disconnect(); + Close(); } public void Disconnect() @@ -12526,10 +12492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( - PacketType.ImprovedTerseObjectUpdate); - + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.TimeDilation = timeDilation; packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b8951d9..d6513c5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -37,7 +37,6 @@ using log4net; using Nini.Config; using OpenMetaverse.Packets; using OpenSim.Framework; -using OpenSim.Framework.Console; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Scenes; using OpenMetaverse; @@ -101,11 +100,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The measured resolution of Environment.TickCount public readonly float TickCountResolution; - /// Number of prim updates to put on the queue each time the /// OnQueueEmpty event is triggered for updates public readonly int PrimUpdatesPerCallback; - /// Number of texture packets to put on the queue each time the /// OnQueueEmpty event is triggered for textures public readonly int TextureSendLimit; @@ -127,37 +124,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Manages authentication for agent circuits private AgentCircuitManager m_circuitManager; - /// Reference to the scene this UDP server is attached to protected Scene m_scene; - /// The X/Y coordinates of the scene this UDP server is attached to private 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 private int m_recvBufferSize; - /// Flag to process packets asynchronously or synchronously private bool m_asyncPacketHandling; - /// Tracks whether or not a packet was sent each round so we know /// whether or not to sleep private bool m_packetSent; /// Environment.TickCount of the last time that packet stats were reported to the scene private int m_elapsedMSSinceLastStatReport = 0; - /// Environment.TickCount of the last time the outgoing packet handler executed private int m_tickLastOutgoingPacketHandler; - /// Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped private int m_elapsedMSOutgoingPacketHandler; - /// Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed private int m_elapsed100MSOutgoingPacketHandler; - /// Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed private int m_elapsed500MSOutgoingPacketHandler; @@ -171,9 +159,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected bool m_sendPing; private ExpiringCache> m_pendingCache = new ExpiringCache>(); - private Pool m_incomingPacketPool; - - private Stat m_incomingPacketPoolStat; private int m_defaultRTO = 0; private int m_maxRTO = 0; @@ -195,9 +180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private IClientAPI m_currentIncomingClient; - public LLUDPServer( - IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, - IConfigSource configSource, AgentCircuitManager circuitManager) + public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) : base(listenIP, (int)port) { #region Environment.TickCount Measurement @@ -219,7 +202,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_circuitManager = circuitManager; int sceneThrottleBps = 0; - bool usePools = false; IConfig config = configSource.Configs["ClientStack.LindenUDP"]; if (config != null) @@ -245,16 +227,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_pausedAckTimeout = 1000 * 300; // 5 minutes } - // FIXME: This actually only needs to be done once since the PacketPool is shared across all servers. - // However, there is no harm in temporarily doing it multiple times. - IConfig packetConfig = configSource.Configs["PacketPool"]; - if (packetConfig != null) - { - PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); - PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); - usePools = packetConfig.GetBoolean("RecycleBaseUDPPackets", usePools); - } - #region BinaryStats config = configSource.Configs["Statistics.Binary"]; m_shouldCollectStats = false; @@ -282,28 +254,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_throttle = new TokenBucket(null, sceneThrottleBps); ThrottleRates = new ThrottleRates(configSource); - - if (usePools) - EnablePools(); } public void Start() { - StartInbound(); - StartOutbound(); + if (m_scene == null) + throw new InvalidOperationException("[LLUDPSERVER]: Cannot LLUDPServer.Start() without an IScene reference"); - m_elapsedMSSinceLastStatReport = Environment.TickCount; - } - - private void StartInbound() - { m_log.InfoFormat( - "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server in {0} mode with UsePools = {1}", - m_asyncPacketHandling ? "asynchronous" : "synchronous", UsePools); + "[LLUDPSERVER]: Starting the LLUDP server in {0} mode", + m_asyncPacketHandling ? "asynchronous" : "synchronous"); - base.StartInbound(m_recvBufferSize, m_asyncPacketHandling); + base.Start(m_recvBufferSize, m_asyncPacketHandling); - // This thread will process the packets received that are placed on the packetInbox + // Start the packet processing threads Watchdog.StartThread( IncomingPacketHandler, string.Format("Incoming Packets ({0})", m_scene.RegionInfo.RegionName), @@ -312,13 +276,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP true, GetWatchdogIncomingAlarmData, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); - } - - private new void StartOutbound() - { - m_log.Info("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server"); - - base.StartOutbound(); Watchdog.StartThread( OutgoingPacketHandler, @@ -328,57 +285,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP true, GetWatchdogOutgoingAlarmData, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); - } - - public void Stop() - { - m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName); - base.StopOutbound(); - base.StopInbound(); - } - protected override bool EnablePools() - { - if (!UsePools) - { - base.EnablePools(); - - m_incomingPacketPool = new Pool(() => new IncomingPacket(), 500); - - m_incomingPacketPoolStat - = new Stat( - "IncomingPacketPoolCount", - "Objects within incoming packet pool", - "The number of objects currently stored within the incoming packet pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => stat.Value = m_incomingPacketPool.Count, - StatVerbosity.Debug); - - StatsManager.RegisterStat(m_incomingPacketPoolStat); - - return true; - } - - return false; - } - - protected override bool DisablePools() - { - if (UsePools) - { - base.DisablePools(); - - StatsManager.DeregisterStat(m_incomingPacketPoolStat); - - // We won't null out the pool to avoid a race condition with code that may be in the middle of using it. - - return true; - } - - return false; + m_elapsedMSSinceLastStatReport = Environment.TickCount; } /// @@ -403,6 +311,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_currentOutgoingClient != null ? m_currentOutgoingClient.Name : "none"); } + public new void Stop() + { + m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName); + base.Stop(); + } + public void AddScene(IScene scene) { if (m_scene != null) @@ -419,117 +333,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_scene = (Scene)scene; m_location = new Location(m_scene.RegionInfo.RegionHandle); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp start", - "debug lludp start ", - "Control LLUDP packet processing.", - "No effect if packet processing has already started.\n" - + "in - start inbound processing.\n" - + "out - start outbound processing.\n" - + "all - start in and outbound processing.\n", - HandleStartCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp stop", - "debug lludp stop ", - "Stop LLUDP packet processing.", - "No effect if packet processing has already stopped.\n" - + "in - stop inbound processing.\n" - + "out - stop outbound processing.\n" - + "all - stop in and outbound processing.\n", - HandleStopCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp pool", - "debug lludp pool ", - "Turn object pooling within the lludp component on or off.", - HandlePoolCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp status", - "debug lludp status", - "Return status of LLUDP packet processing.", - HandleStatusCommand); - } - - private void HandleStartCommand(string module, string[] args) - { - if (args.Length != 4) - { - MainConsole.Instance.Output("Usage: debug lludp start "); - return; - } - - string subCommand = args[3]; - - if (subCommand == "in" || subCommand == "all") - StartInbound(); - - if (subCommand == "out" || subCommand == "all") - StartOutbound(); - } - - private void HandleStopCommand(string module, string[] args) - { - if (args.Length != 4) - { - MainConsole.Instance.Output("Usage: debug lludp stop "); - return; - } - - string subCommand = args[3]; - - if (subCommand == "in" || subCommand == "all") - StopInbound(); - - if (subCommand == "out" || subCommand == "all") - StopOutbound(); - } - - private void HandlePoolCommand(string module, string[] args) - { - if (args.Length != 4) - { - MainConsole.Instance.Output("Usage: debug lludp pool "); - return; - } - - string enabled = args[3]; - - if (enabled == "on") - { - if (EnablePools()) - MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_scene.Name); - } - else if (enabled == "off") - { - if (DisablePools()) - MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_scene.Name); - } - else - { - MainConsole.Instance.Output("Usage: debug lludp pool "); - } - } - - private void HandleStatusCommand(string module, string[] args) - { - MainConsole.Instance.OutputFormat( - "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled"); - - MainConsole.Instance.OutputFormat( - "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled"); - - MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off"); } public bool HandlesRegion(Location x) @@ -613,8 +416,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] data = packet.ToBytes(); SendPacketData(udpClient, data, packet.Type, category, method); } - - PacketPool.Instance.ReturnPacket(packet); } /// @@ -899,7 +700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP LLUDPClient udpClient = null; Packet packet = null; int packetEnd = buffer.DataLength - 1; - IPEndPoint endPoint = (IPEndPoint)buffer.RemoteEndPoint; + IPEndPoint address = (IPEndPoint)buffer.RemoteEndPoint; #region Decoding @@ -909,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // "[LLUDPSERVER]: Dropping undersized packet with {0} bytes received from {1} in {2}", // buffer.DataLength, buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName); - return; // Drop undersized packet + return; // Drop undersizd packet } int headerLen = 7; @@ -932,13 +733,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { -// packet = Packet.BuildPacket(buffer.Data, ref packetEnd, -// // Only allocate a buffer for zerodecoding if the packet is zerocoded -// ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); - // If OpenSimUDPBase.UsePool == true (which is currently separate from the PacketPool) then we - // assume that packet construction does not retain a reference to byte[] buffer.Data (instead, all - // bytes are copied out). - packet = PacketPool.Instance.GetPacket(buffer.Data, ref packetEnd, + packet = Packet.BuildPacket(buffer.Data, ref packetEnd, // Only allocate a buffer for zerodecoding if the packet is zerocoded ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); } @@ -953,13 +748,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; // Drop short packet } - catch (Exception e) + catch(Exception e) { if (m_malformedCount < 100) m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); - m_malformedCount++; - if ((m_malformedCount % 100000) == 0) m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); } @@ -979,7 +772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If there is already a client for this endpoint, don't process UseCircuitCode IClientAPI client = null; - if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) + if (!m_scene.TryGetClient(address, out client)) { // UseCircuitCode handling if (packet.Type == PacketType.UseCircuitCode) @@ -987,15 +780,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // And if there is a UseCircuitCode pending, also drop it lock (m_pendingCache) { - if (m_pendingCache.Contains(endPoint)) + if (m_pendingCache.Contains(address)) return; - m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); + m_pendingCache.AddOrUpdate(address, new Queue(), 60); } - // We need to copy the endpoint so that it doesn't get changed when another thread reuses the - // buffer. - object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; + object[] array = new object[] { buffer, packet }; Util.FireAndForget(HandleUseCircuitCode, array); @@ -1007,7 +798,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_pendingCache) { Queue queue; - if (m_pendingCache.TryGetValue(endPoint, out queue)) + if (m_pendingCache.TryGetValue(address, out queue)) { //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); queue.Enqueue(buffer); @@ -1043,10 +834,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Handle appended ACKs if (packet.Header.AppendedAcks && packet.Header.AckList != null) { -// m_log.DebugFormat( -// "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}", -// packet.Header.AckList.Length, client.Name, m_scene.Name); - for (int i = 0; i < packet.Header.AckList.Length; i++) udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent); } @@ -1056,10 +843,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { PacketAckPacket ackPacket = (PacketAckPacket)packet; -// m_log.DebugFormat( -// "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}", -// ackPacket.Packets.Length, client.Name, m_scene.Name); - for (int i = 0; i < ackPacket.Packets.Length; i++) udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent); @@ -1073,10 +856,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (packet.Header.Reliable) { -// m_log.DebugFormat( -// "[LLUDPSERVER]: Adding ack request for {0} {1} from {2} in {3}", -// packet.Type, packet.Header.Sequence, client.Name, m_scene.Name); - udpClient.PendingAcks.Enqueue(packet.Header.Sequence); // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out, @@ -1123,8 +902,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (packet.Type == PacketType.StartPingCheck) { -// m_log.DebugFormat("[LLUDPSERVER]: Handling ping from {0} in {1}", client.Name, m_scene.Name); - // We don't need to do anything else with ping checks StartPingCheckPacket startPing = (StartPingCheckPacket)packet; CompletePing(udpClient, startPing.PingID.PingID); @@ -1144,25 +921,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Ping Check Handling - IncomingPacket incomingPacket; - // Inbox insertion - if (UsePools) - { - incomingPacket = m_incomingPacketPool.GetObject(); - incomingPacket.Client = (LLClientView)client; - incomingPacket.Packet = packet; - } - else - { - incomingPacket = new IncomingPacket((LLClientView)client, packet); - } - - if (incomingPacket.Packet.Type == PacketType.AgentUpdate || - incomingPacket.Packet.Type == PacketType.ChatFromViewer) - packetInbox.EnqueueHigh(incomingPacket); + if (packet.Type == PacketType.AgentUpdate || + packet.Type == PacketType.ChatFromViewer) + packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); else - packetInbox.EnqueueLow(incomingPacket); + packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); +// packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); } #region BinaryStats @@ -1248,19 +1013,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandleUseCircuitCode(object o) { - IPEndPoint endPoint = null; + IPEndPoint remoteEndPoint = null; IClientAPI client = null; try { // DateTime startTime = DateTime.Now; object[] array = (object[])o; - endPoint = (IPEndPoint)array[0]; + UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; m_log.DebugFormat( "[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} to {1} from IP {2}", - uccp.CircuitCode.Code, m_scene.RegionInfo.RegionName, endPoint); + uccp.CircuitCode.Code, m_scene.RegionInfo.RegionName, buffer.RemoteEndPoint); + + remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; AuthenticateResponse sessionInfo; if (IsClientAuthorized(uccp, out sessionInfo)) @@ -1271,13 +1038,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.Code, uccp.CircuitCode.ID, uccp.CircuitCode.SessionID, - endPoint, + remoteEndPoint, sessionInfo); // 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); + SendAckImmediate(remoteEndPoint, uccp.Header.Sequence); // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) @@ -1291,12 +1058,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_pendingCache) { - if (!m_pendingCache.TryGetValue(endPoint, out queue)) + if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) { m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); return; } - m_pendingCache.Remove(endPoint); + m_pendingCache.Remove(remoteEndPoint); } m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); @@ -1314,9 +1081,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Don't create clients for unauthorized requesters. m_log.WarnFormat( "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", - uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); + uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, remoteEndPoint); lock (m_pendingCache) - m_pendingCache.Remove(endPoint); + m_pendingCache.Remove(remoteEndPoint); } // m_log.DebugFormat( @@ -1328,7 +1095,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.ErrorFormat( "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", - endPoint != null ? endPoint.ToString() : "n/a", + remoteEndPoint != null ? remoteEndPoint.ToString() : "n/a", client != null ? client.Name : "unknown", client != null ? client.AgentId.ToString() : "unknown", e.Message, @@ -1393,20 +1160,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP { IClientAPI client = null; - // We currently synchronize this code across the whole scene to avoid issues such as - // http://opensimulator.org/mantis/view.php?id=5365 However, once locking per agent circuit can be done - // consistently, this lock could probably be removed. - lock (this) + // In priciple there shouldn't be more than one thread here, ever. + // But in case that happens, we need to synchronize this piece of code + // because it's too important + lock (this) { if (!m_scene.TryGetClient(agentID, out client)) { LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); - + client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); client.OnLogout += LogoutHandler; - + ((LLClientView)client).DisableFacelights = m_disableFacelights; - + client.Start(); } } @@ -1445,7 +1212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // on to en-US to avoid number parsing issues Culture.SetCurrentCulture(); - while (IsRunningInbound) + while (base.IsRunning) { m_scene.ThreadAlive(1); try @@ -1461,12 +1228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } if (packetInbox.Dequeue(100, ref incomingPacket)) - { ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket); - - if (UsePools) - m_incomingPacketPool.ReturnObject(incomingPacket); - } } catch (Exception ex) { @@ -1493,7 +1255,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Action generic every round Action clientPacketHandler = ClientOutgoingPacketHandler; - while (base.IsRunningOutbound) + while (base.IsRunning) { m_scene.ThreadAlive(2); try @@ -1761,7 +1523,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!client.IsLoggingOut) { client.IsLoggingOut = true; - client.Close(false, false); + client.Close(false); } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 8bd3461..cfe7c9d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -30,8 +30,6 @@ using System.Net; using System.Net.Sockets; using System.Threading; using log4net; -using OpenSim.Framework; -using OpenSim.Framework.Monitoring; namespace OpenMetaverse { @@ -60,31 +58,17 @@ namespace OpenMetaverse /// Flag to process packets asynchronously or synchronously private bool m_asyncPacketHandling; - /// - /// Pool to use for handling data. May be null if UsePools = false; - /// - protected OpenSim.Framework.Pool m_pool; - - /// - /// Are we to use object pool(s) to reduce memory churn when receiving data? - /// - public bool UsePools { get; protected set; } - - /// Returns true if the server is currently listening for inbound packets, otherwise false - public bool IsRunningInbound { get; private set; } + /// The all important shutdown flag + private volatile bool m_shutdownFlag = true; - /// Returns true if the server is currently sending outbound packets, otherwise false - /// If IsRunningOut = false, then any request to send a packet is simply dropped. - public bool IsRunningOutbound { get; private set; } - - private Stat m_poolCountStat; + /// Returns true if the server is currently listening, otherwise false + public bool IsRunning { get { return !m_shutdownFlag; } } /// /// Default constructor /// /// Local IP address to bind the server to /// Port to listening for incoming UDP packets on - /// /// Are we to use an object pool to get objects for handing inbound data? public OpenSimUDPBase(IPAddress bindAddress, int port) { m_localBindAddress = bindAddress; @@ -92,7 +76,7 @@ namespace OpenMetaverse } /// - /// Start inbound UDP packet handling. + /// Start the UDP server /// /// The size of the receive buffer for /// the UDP socket. This value is passed up to the operating system @@ -107,11 +91,11 @@ namespace OpenMetaverse /// manner (not throwing an exception when the remote side resets the /// connection). This call is ignored on Mono where the flag is not /// necessary - public void StartInbound(int recvBufferSize, bool asyncPacketHandling) + public void Start(int recvBufferSize, bool asyncPacketHandling) { m_asyncPacketHandling = asyncPacketHandling; - if (!IsRunningInbound) + if (m_shutdownFlag) { const int SIO_UDP_CONNRESET = -1744830452; @@ -139,7 +123,8 @@ namespace OpenMetaverse m_udpSocket.Bind(ipep); - IsRunningInbound = true; + // we're not shutting down, we're starting up + m_shutdownFlag = false; // kick off an async receive. The Start() method will return, the // actual receives will occur asynchronously and will be caught in @@ -149,84 +134,28 @@ namespace OpenMetaverse } /// - /// Start outbound UDP packet handling. + /// Stops the UDP server /// - public void StartOutbound() - { - IsRunningOutbound = true; - } - - public void StopInbound() + public void Stop() { - if (IsRunningInbound) + if (!m_shutdownFlag) { // wait indefinitely for a writer lock. Once this is called, the .NET runtime // will deny any more reader locks, in effect blocking all other send/receive - // threads. Once we have the lock, we set IsRunningInbound = false to inform the other + // threads. Once we have the lock, we set shutdownFlag to inform the other // threads that the socket is closed. - IsRunningInbound = false; + m_shutdownFlag = true; m_udpSocket.Close(); } } - public void StopOutbound() - { - IsRunningOutbound = false; - } - - protected virtual bool EnablePools() - { - if (!UsePools) - { - m_pool = new Pool(() => new UDPPacketBuffer(), 500); - - m_poolCountStat - = new Stat( - "UDPPacketBufferPoolCount", - "Objects within the UDPPacketBuffer pool", - "The number of objects currently stored within the UDPPacketBuffer pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => stat.Value = m_pool.Count, - StatVerbosity.Debug); - - StatsManager.RegisterStat(m_poolCountStat); - - UsePools = true; - - return true; - } - - return false; - } - - protected virtual bool DisablePools() - { - if (UsePools) - { - UsePools = false; - StatsManager.DeregisterStat(m_poolCountStat); - - // We won't null out the pool to avoid a race condition with code that may be in the middle of using it. - - return true; - } - - return false; - } - private void AsyncBeginReceive() { - UDPPacketBuffer buf; - - if (UsePools) - buf = m_pool.GetObject(); - else - buf = new UDPPacketBuffer(); + // allocate a packet buffer + //WrappedObject wrappedBuffer = Pool.CheckOut(); + UDPPacketBuffer buf = new UDPPacketBuffer(); - if (IsRunningInbound) + if (!m_shutdownFlag) { try { @@ -279,7 +208,7 @@ namespace OpenMetaverse { // Asynchronous receive operations will complete here through the call // to AsyncBeginReceive - if (IsRunningInbound) + if (!m_shutdownFlag) { // Asynchronous mode will start another receive before the // callback for this packet is even fired. Very parallel :-) @@ -288,6 +217,8 @@ namespace OpenMetaverse // get the buffer that was created in AsyncBeginReceive // this is the received data + //WrappedObject wrappedBuffer = (WrappedObject)iar.AsyncState; + //UDPPacketBuffer buffer = wrappedBuffer.Instance; UDPPacketBuffer buffer = (UDPPacketBuffer)iar.AsyncState; try @@ -304,8 +235,7 @@ namespace OpenMetaverse catch (ObjectDisposedException) { } finally { - if (UsePools) - m_pool.ReturnObject(buffer); + //wrappedBuffer.Dispose(); // Synchronous mode waits until the packet callback completes // before starting the receive to fetch another packet @@ -318,7 +248,7 @@ namespace OpenMetaverse public void AsyncBeginSend(UDPPacketBuffer buf) { - if (IsRunningOutbound) + if (!m_shutdownFlag) { try { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs deleted file mode 100644 index 9f22fb4..0000000 --- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using OpenMetaverse; -using OpenMetaverse.Packets; -using log4net; -using OpenSim.Framework.Monitoring; - -namespace OpenSim.Region.ClientStack.LindenUDP -{ - public sealed class PacketPool - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private static readonly PacketPool instance = new PacketPool(); - - private bool packetPoolEnabled = true; - private bool dataBlockPoolEnabled = true; - - private PercentageStat m_packetsReusedStat = new PercentageStat( - "PacketsReused", - "Packets reused", - "Number of packets reused out of all requests to the packet pool", - "clientstack", - "packetpool", - StatType.Push, - null, - StatVerbosity.Debug); - - private PercentageStat m_blocksReusedStat = new PercentageStat( - "PacketDataBlocksReused", - "Packet data blocks reused", - "Number of data blocks reused out of all requests to the packet pool", - "clientstack", - "packetpool", - StatType.Push, - null, - StatVerbosity.Debug); - - /// - /// Pool of packets available for reuse. - /// - private readonly Dictionary> pool = new Dictionary>(); - - private static Dictionary> DataBlocks = new Dictionary>(); - - public static PacketPool Instance - { - get { return instance; } - } - - public bool RecyclePackets - { - set { packetPoolEnabled = value; } - get { return packetPoolEnabled; } - } - - public bool RecycleDataBlocks - { - set { dataBlockPoolEnabled = value; } - get { return dataBlockPoolEnabled; } - } - - private PacketPool() - { - StatsManager.RegisterStat(m_packetsReusedStat); - StatsManager.RegisterStat(m_blocksReusedStat); - - StatsManager.RegisterStat( - new Stat( - "PacketsPoolCount", - "Objects within the packet pool", - "The number of objects currently stored within the packet pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => { lock (pool) { stat.Value = pool.Count; } }, - StatVerbosity.Debug)); - - StatsManager.RegisterStat( - new Stat( - "PacketDataBlocksPoolCount", - "Objects within the packet data block pool", - "The number of objects currently stored within the packet data block pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => { lock (DataBlocks) { stat.Value = DataBlocks.Count; } }, - StatVerbosity.Debug)); - } - - /// - /// Gets a packet of the given type. - /// - /// - /// Guaranteed to always return a packet, whether from the pool or newly constructed. - public Packet GetPacket(PacketType type) - { - m_packetsReusedStat.Consequent++; - - Packet packet; - - if (!packetPoolEnabled) - return Packet.BuildPacket(type); - - lock (pool) - { - if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0) - { -// m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type); - - // Creating a new packet if we cannot reuse an old package - packet = Packet.BuildPacket(type); - } - else - { -// m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type); - - // Recycle old packages - m_packetsReusedStat.Antecedent++; - - packet = pool[type].Pop(); - } - } - - return packet; - } - - // private byte[] decoded_header = new byte[10]; - private static PacketType GetType(byte[] bytes) - { - byte[] decoded_header = new byte[10 + 8]; - ushort id; - PacketFrequency freq; - - if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0) - { - Helpers.ZeroDecode(bytes, 16, decoded_header); - } - else - { - Buffer.BlockCopy(bytes, 0, decoded_header, 0, 10); - } - - if (decoded_header[6] == 0xFF) - { - if (decoded_header[7] == 0xFF) - { - id = (ushort) ((decoded_header[8] << 8) + decoded_header[9]); - freq = PacketFrequency.Low; - } - else - { - id = decoded_header[7]; - freq = PacketFrequency.Medium; - } - } - else - { - id = decoded_header[6]; - freq = PacketFrequency.High; - } - - return Packet.GetType(id, freq); - } - - public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer) - { - PacketType type = GetType(bytes); - -// Array.Clear(zeroBuffer, 0, zeroBuffer.Length); - - int i = 0; - Packet packet = GetPacket(type); - if (packet == null) - m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type); - else - packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); - - return packet; - } - - /// - /// Return a packet to the packet pool - /// - /// - public void ReturnPacket(Packet packet) - { - if (dataBlockPoolEnabled) - { - switch (packet.Type) - { - case PacketType.ObjectUpdate: - ObjectUpdatePacket oup = (ObjectUpdatePacket)packet; - - foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData) - ReturnDataBlock(oupod); - - oup.ObjectData = null; - break; - - case PacketType.ImprovedTerseObjectUpdate: - ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet; - - foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData) - ReturnDataBlock(itoupod); - - itoup.ObjectData = null; - break; - } - } - - if (packetPoolEnabled) - { - switch (packet.Type) - { - // List pooling packets here - case PacketType.AgentUpdate: - case PacketType.PacketAck: - case PacketType.ObjectUpdate: - case PacketType.ImprovedTerseObjectUpdate: - lock (pool) - { - PacketType type = packet.Type; - - if (!pool.ContainsKey(type)) - { - pool[type] = new Stack(); - } - - if ((pool[type]).Count < 50) - { -// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type); - - pool[type].Push(packet); - } - } - break; - - // Other packets wont pool - default: - return; - } - } - } - - public T GetDataBlock() where T: new() - { - lock (DataBlocks) - { - m_blocksReusedStat.Consequent++; - - Stack s; - - if (DataBlocks.TryGetValue(typeof(T), out s)) - { - if (s.Count > 0) - { - m_blocksReusedStat.Antecedent++; - return (T)s.Pop(); - } - } - else - { - DataBlocks[typeof(T)] = new Stack(); - } - - return new T(); - } - } - - public void ReturnDataBlock(T block) where T: new() - { - if (block == null) - return; - - lock (DataBlocks) - { - if (!DataBlocks.ContainsKey(typeof(T))) - DataBlocks[typeof(T)] = new Stack(); - - if (DataBlocks[typeof(T)].Count < 50) - DataBlocks[typeof(T)].Push(block); - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index 556df30..109a8e1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests /// This will contain basic tests for the LindenUDP client stack /// [TestFixture] - public class BasicCircuitTests : OpenSimTestCase + public class BasicCircuitTests { private Scene m_scene; private TestLLUDPServer m_udpServer; @@ -65,9 +65,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests } [SetUp] - public override void SetUp() + public void SetUp() { - base.SetUp(); m_scene = new SceneHelpers().SetupScene(); } @@ -144,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests public void TestAddClient() { TestHelpers.InMethod(); -// TestHelpers.EnableLogging(); +// XmlConfigurator.Configure(); AddUdpServer(); diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 853b72d..4672f8a 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -76,7 +76,7 @@ namespace OpenSim.Region.ClientStack protected override void StartupSpecific() { - SceneManager = SceneManager.Instance; + SceneManager = new SceneManager(); m_clientStackManager = CreateClientStackManager(); Initialize(); -- cgit v1.1 From 5e0294815f7e3ec83b7e568e1468948ac0ff7331 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 17 Nov 2012 03:47:09 -0500 Subject: * Plumbing and basic setting of the GetMesh Cap Throttler. * Last step is to flip the throttle distribution. --- .../ClientStack/Linden/Caps/GetMeshModule.cs | 90 +++++++++++++++++----- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 12 +++ .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 4 + 3 files changed, 88 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 8deff81..96b48ad 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -60,6 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden private IAssetService m_AssetService; private bool m_Enabled = true; private string m_URL; + struct aPollRequest { public PollServiceMeshEventArgs thepoll; @@ -71,6 +72,7 @@ namespace OpenSim.Region.ClientStack.Linden { public Hashtable response; public int bytes; + public int lod; } @@ -112,6 +114,7 @@ namespace OpenSim.Region.ClientStack.Linden // Cap doesn't exist if (m_URL != string.Empty) m_Enabled = true; + } public void AddRegion(Scene pScene) @@ -192,7 +195,7 @@ namespace OpenSim.Region.ClientStack.Linden PollServiceMeshEventArgs args; if (m_pollservices.TryGetValue(user, out args)) { - args.UpdateThrottle(imagethrottle); + args.UpdateThrottle(imagethrottle, p); } } @@ -242,11 +245,12 @@ namespace OpenSim.Region.ClientStack.Linden new Dictionary(); private Scene m_scene; - private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000, 10000); + private MeshCapsDataThrottler m_throttler; public PollServiceMeshEventArgs(UUID pId, Scene scene) : base(null, null, null, null, pId, int.MaxValue) { m_scene = scene; + m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene); // x is request id, y is userid HasEvents = (x, y) => { @@ -268,6 +272,7 @@ namespace OpenSim.Region.ClientStack.Linden } finally { + m_throttler.ProcessTime(); responses.Remove(x); } } @@ -323,7 +328,7 @@ namespace OpenSim.Region.ClientStack.Linden response["reusecontext"] = false; lock (responses) - responses[requestID] = new aPollResponse() { bytes = 0, response = response }; + responses[requestID] = new aPollResponse() { bytes = 0, response = response, lod = 0 }; return; } @@ -334,6 +339,7 @@ namespace OpenSim.Region.ClientStack.Linden responses[requestID] = new aPollResponse() { bytes = (int)response["int_bytes"], + lod = (int)response["int_lod"], response = response }; @@ -341,9 +347,9 @@ namespace OpenSim.Region.ClientStack.Linden m_throttler.ProcessTime(); } - internal void UpdateThrottle(int pimagethrottle) + internal void UpdateThrottle(int pimagethrottle, ScenePresence p) { - m_throttler.ThrottleBytes = pimagethrottle; + m_throttler.UpdateThrottle(pimagethrottle, p); } } @@ -398,18 +404,31 @@ namespace OpenSim.Region.ClientStack.Linden } } - internal sealed class CapsDataThrottler + internal sealed class MeshCapsDataThrottler { private volatile int currenttime = 0; private volatile int lastTimeElapsed = 0; private volatile int BytesSent = 0; - private int oversizedImages = 0; - public CapsDataThrottler(int pBytes, int max, int min) + private int Lod3 = 0; + private int Lod2 = 0; + private int Lod1 = 0; + private int UserSetThrottle = 0; + private int UDPSetThrottle = 0; + private int CapSetThrottle = 0; + private float CapThrottleDistributon = 0.30f; + private readonly Scene m_scene; + private ThrottleOutPacketType Throttle; + + public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene) { ThrottleBytes = pBytes; lastTimeElapsed = Util.EnvironmentTickCount(); + Throttle = ThrottleOutPacketType.Task; + m_scene = pScene; } + + public bool hasEvents(UUID key, Dictionary responses) { PassTime(); @@ -427,17 +446,23 @@ namespace OpenSim.Region.ClientStack.Linden if (BytesSent + response.bytes <= ThrottleBytes) { BytesSent += response.bytes; - //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; - //m_actions.Add(timeBasedAction); + + return true; + } + // Lod3 Over + else if (response.bytes > ThrottleBytes && Lod3 <= (((ThrottleBytes * .30f) % 50000) + 1)) + { + Interlocked.Increment(ref Lod3); + BytesSent += response.bytes; + return true; } - // Big textures - else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes % 50000) + 1)) + // Lod2 Over + else if (response.bytes > ThrottleBytes && Lod2 <= (((ThrottleBytes * .30f) % 10000) + 1)) { - Interlocked.Increment(ref oversizedImages); + Interlocked.Increment(ref Lod2); BytesSent += response.bytes; - //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; - //m_actions.Add(timeBasedAction); + return true; } else @@ -448,6 +473,11 @@ namespace OpenSim.Region.ClientStack.Linden return haskey; } + public void SubtractBytes(int bytes,int lod) + { + BytesSent -= bytes; + } + public void ProcessTime() { PassTime(); @@ -459,18 +489,42 @@ namespace OpenSim.Region.ClientStack.Linden currenttime = Util.EnvironmentTickCount(); int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); //processTimeBasedActions(responses); - if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) + if (currenttime - timeElapsed >= 1000) { lastTimeElapsed = Util.EnvironmentTickCount(); BytesSent -= ThrottleBytes; if (BytesSent < 0) BytesSent = 0; if (BytesSent < ThrottleBytes) { - oversizedImages = 0; + Lod3 = 0; + Lod2 = 0; + Lod1 = 0; } } } - public int ThrottleBytes; + private void AlterThrottle(int setting, ScenePresence p) + { + p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting); + } + + public int ThrottleBytes + { + get { return CapSetThrottle; } + set { CapSetThrottle = value; } + } + + internal void UpdateThrottle(int pimagethrottle, ScenePresence p) + { + // Client set throttle ! + UserSetThrottle = pimagethrottle; + CapSetThrottle = (int)(pimagethrottle*CapThrottleDistributon); + UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon)); + if (CapSetThrottle < 4068) + CapSetThrottle = 4068; // at least two discovery mesh + p.ControllingClient.SetAgentThrottleSilent((int) Throttle, UDPSetThrottle); + ProcessTime(); + + } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ae9ed7f..533a1a8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11884,6 +11884,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// + /// Sets the throttles from values supplied by the client + /// + /// + public void SetAgentThrottleSilent(int throttle, int setting) + { + m_udpClient.ForceThrottleSetting(throttle,setting); + //m_udpClient.SetThrottles(throttles); + + } + + + /// /// Get the current throttles for this client as a packed byte array /// /// Unused diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index c472176..f675377 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -682,6 +682,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_nextOnQueueEmpty == 0) m_nextOnQueueEmpty = 1; } + internal void ForceThrottleSetting(int throttle, int setting) + { + m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); ; + } /// /// Converts a integer to a -- cgit v1.1 From 98b0cb8df8128d516c128cb78a58170e22a484b9 Mon Sep 17 00:00:00 2001 From: teravus Date: Thu, 22 Nov 2012 08:13:35 -0500 Subject: * While this is not producing any problems.. and does help in low bandwidth situations I can't demonstrate that it's better then just letting the client request what it needs in terms of responsiveness of the mesh in the scene yet. --- .../ClientStack/Linden/Caps/GetMeshModule.cs | 42 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 96b48ad..dd43328 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -250,7 +250,7 @@ namespace OpenSim.Region.ClientStack.Linden base(null, null, null, null, pId, int.MaxValue) { m_scene = scene; - m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene); + m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); // x is request id, y is userid HasEvents = (x, y) => { @@ -419,21 +419,35 @@ namespace OpenSim.Region.ClientStack.Linden private float CapThrottleDistributon = 0.30f; private readonly Scene m_scene; private ThrottleOutPacketType Throttle; + private readonly UUID User; - public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene) + public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser) { ThrottleBytes = pBytes; lastTimeElapsed = Util.EnvironmentTickCount(); Throttle = ThrottleOutPacketType.Task; m_scene = pScene; + User = puser; } public bool hasEvents(UUID key, Dictionary responses) { + const float ThirtyPercent = 0.30f; + const float FivePercent = 0.05f; PassTime(); // Note, this is called IN LOCK bool haskey = responses.ContainsKey(key); + + if (responses.Count > 2) + { + SplitThrottle(ThirtyPercent); + } + else + { + SplitThrottle(FivePercent); + } + if (!haskey) { return false; @@ -441,7 +455,8 @@ namespace OpenSim.Region.ClientStack.Linden aPollResponse response; if (responses.TryGetValue(key, out response)) { - + float LOD3Over = (((ThrottleBytes*CapThrottleDistributon)%50000) + 1); + float LOD2Over = (((ThrottleBytes*CapThrottleDistributon)%10000) + 1); // Normal if (BytesSent + response.bytes <= ThrottleBytes) { @@ -449,16 +464,16 @@ namespace OpenSim.Region.ClientStack.Linden return true; } - // Lod3 Over - else if (response.bytes > ThrottleBytes && Lod3 <= (((ThrottleBytes * .30f) % 50000) + 1)) + // Lod3 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little. + else if (response.bytes > ThrottleBytes && Lod3 <= ((LOD3Over < 1)? 1: LOD3Over) ) { Interlocked.Increment(ref Lod3); BytesSent += response.bytes; return true; } - // Lod2 Over - else if (response.bytes > ThrottleBytes && Lod2 <= (((ThrottleBytes * .30f) % 10000) + 1)) + // Lod2 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little. + else if (response.bytes > ThrottleBytes && Lod2 <= ((LOD2Over < 1) ? 1 : LOD2Over)) { Interlocked.Increment(ref Lod2); BytesSent += response.bytes; @@ -477,7 +492,20 @@ namespace OpenSim.Region.ClientStack.Linden { BytesSent -= bytes; } + private void SplitThrottle(float percentMultiplier) + { + if (CapThrottleDistributon != percentMultiplier) // don't switch it if it's already set at the % multipler + { + CapThrottleDistributon = percentMultiplier; + ScenePresence p; + if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore. + { + AlterThrottle(UserSetThrottle, p); + } + } + } + public void ProcessTime() { PassTime(); -- cgit v1.1 From 93bede4e6aa0838e14f39f5e641b028267d2683c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:26:58 +0000 Subject: revert the use of avatar skeleton and use avatar size provided by viewers, since at least for now seems good enought --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8e0b72f..2efaa79 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6248,6 +6248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Temporarily protect ourselves from the mantis #951 failure. // However, we could do this for several other handlers where a failure isn't terminal // for the client session anyway, in order to protect ourselves against bad code in plugins + Vector3 avSize = appear.AgentData.Size; try { byte[] visualparams = new byte[appear.VisualParam.Length]; @@ -6258,7 +6259,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (appear.ObjectData.TextureEntry.Length > 1) te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); - handlerSetAppearance(sender, te, visualparams); + handlerSetAppearance(sender, te, visualparams,avSize); } catch (Exception e) { -- cgit v1.1 From 0e2b717b4d262363995b2b351b4afe7c84889342 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 7 Dec 2012 20:15:32 -0500 Subject: * Should promote faster self appearance. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 52 ++++++++++++++-------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8e0b72f..c261f32 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -459,6 +459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } + private Dictionary agentWearables = new Dictionary(); #endregion Properties @@ -2749,8 +2750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } - - //m_log.Debug("sending asset " + req.RequestAssetID); + UUID WearableOut = UUID.Zero; + bool isWearable = false; + isWearable = agentWearables.TryGetValue(req.RequestAssetID, out WearableOut); + // m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; Transfer.TransferInfo.Status = 0; @@ -2772,7 +2775,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Transfer.TransferInfo.Size = req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.Header.Zerocoded = true; - OutPacket(Transfer, ThrottleOutPacketType.Asset); + OutPacket(Transfer, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); if (req.NumPackets == 1) { @@ -2783,7 +2786,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Data = req.AssetInf.Data; TransferPacket.TransferData.Status = 1; TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); } else { @@ -2816,7 +2819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Status = 1; } TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); processedLength += chunkSize; packetNumber++; @@ -3571,24 +3574,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; AgentWearablesUpdatePacket.WearableDataBlock awb; int idx = 0; - for (int i = 0; i < wearables.Length; i++) + lock (agentWearables) { - for (int j = 0; j < wearables[i].Count; j++) + agentWearables.Clear(); + for (int i = 0; i < wearables.Length; i++) { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)i; - awb.AssetID = wearables[i][j].AssetID; - awb.ItemID = wearables[i][j].ItemID; - aw.WearableData[idx] = awb; - idx++; - -// m_log.DebugFormat( -// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", -// awb.ItemID, awb.AssetID, i, Name); + for (int j = 0; j < wearables[i].Count; j++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte) i; + awb.AssetID = wearables[i][j].AssetID; + awb.ItemID = wearables[i][j].ItemID; + agentWearables.Add(awb.AssetID, awb.ItemID); + aw.WearableData[idx] = awb; + idx++; + + // m_log.DebugFormat( + // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", + // awb.ItemID, awb.AssetID, i, Name); + } } } - OutPacket(aw, ThrottleOutPacketType.Task); + OutPacket(aw, ThrottleOutPacketType.State); } public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) @@ -3613,7 +3621,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.Task); + OutPacket(avp, ThrottleOutPacketType.State); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) @@ -7770,6 +7778,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; + UUID wearableout = UUID.Zero; + if (agentWearables.TryGetValue(block.Image, out wearableout)) + { + args.Priority *= 2.0f; + } + ImageManager.EnqueueReq(args); } -- cgit v1.1 From 6c1a852137e3a66db5befa4c6ec50b3a93268304 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 8 Dec 2012 00:05:12 -0500 Subject: * This is a better way to do the last commit. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 63 +++++++++++----------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c261f32..7cf6cf1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -459,7 +459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } - private Dictionary agentWearables = new Dictionary(); + #endregion Properties @@ -585,6 +585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Disable UDP handling for this client m_udpClient.Shutdown(); + //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); @@ -2750,10 +2751,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } - UUID WearableOut = UUID.Zero; + int WearableOut = 0; bool isWearable = false; - isWearable = agentWearables.TryGetValue(req.RequestAssetID, out WearableOut); - // m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); + + if (req.AssetInf != null) + isWearable = + ((AssetType) req.AssetInf.Type == + AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); + + + //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); + + + //if (isWearable) + // m_log.Debug((AssetType)req.AssetInf.Type); + TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; Transfer.TransferInfo.Status = 0; @@ -3574,27 +3586,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; AgentWearablesUpdatePacket.WearableDataBlock awb; int idx = 0; - lock (agentWearables) - { - agentWearables.Clear(); - for (int i = 0; i < wearables.Length; i++) - { - for (int j = 0; j < wearables[i].Count; j++) + + for (int i = 0; i < wearables.Length; i++) { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte) i; - awb.AssetID = wearables[i][j].AssetID; - awb.ItemID = wearables[i][j].ItemID; - agentWearables.Add(awb.AssetID, awb.ItemID); - aw.WearableData[idx] = awb; - idx++; - - // m_log.DebugFormat( - // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", - // awb.ItemID, awb.AssetID, i, Name); - } - } - } + for (int j = 0; j < wearables[i].Count; j++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte) i; + awb.AssetID = wearables[i][j].AssetID; + awb.ItemID = wearables[i][j].ItemID; + aw.WearableData[idx] = awb; + idx++; + + // m_log.DebugFormat( + // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", + // awb.ItemID, awb.AssetID, i, Name); + } + } OutPacket(aw, ThrottleOutPacketType.State); } @@ -7777,12 +7785,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // surrounding scene if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; - - UUID wearableout = UUID.Zero; - if (agentWearables.TryGetValue(block.Image, out wearableout)) - { - args.Priority *= 2.0f; - } + int wearableout = 0; ImageManager.EnqueueReq(args); } -- cgit v1.1 From ecdd0e225f088ad1311a26f5934cd9e08aa697bd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Dec 2012 00:55:09 +0000 Subject: add velocityinterpolator packets handling but actually do nothing, since they don't do what i was looking for. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2efaa79..4ed9a0a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -331,6 +331,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Prioritizer m_prioritizer; private bool m_disableFacelights = false; + private bool m_VelocityInterpolate = false; private const uint MaxTransferBytesPerPacket = 600; @@ -5309,8 +5310,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs // for each AgentUpdate packet. AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); - + AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); + AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false); + AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false); AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); @@ -5828,6 +5831,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } + private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack) + { + VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; + if (p.AgentData.SessionID != SessionId || + p.AgentData.AgentID != AgentId) + return true; + + m_VelocityInterpolate = false; + return true; + } + + private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) + { + VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; + if (p.AgentData.SessionID != SessionId || + p.AgentData.AgentID != AgentId) + return true; + + m_VelocityInterpolate = true; + return true; + } + + private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) { AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; -- cgit v1.1 From c6430b14dbc9d39b9c9b79ead1c1ebaaff833745 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Dec 2012 11:25:30 +0000 Subject: typo fix --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4ed9a0a..ea3c6a4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3992,6 +3992,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); + if (terseAgentUpdateBlocks.IsValueCreated) { @@ -4972,7 +4973,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // in that direction, even though we don't model this on the server. Implementing this in the future // may improve movement smoothness. // acceleration = new Vector3(1, 0, 0); - + angularVelocity = Vector3.Zero; if (sendTexture) @@ -5844,7 +5845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) { - VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; + VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack; if (p.AgentData.SessionID != SessionId || p.AgentData.AgentID != AgentId) return true; -- cgit v1.1 From 20773dcfccc04d8af14e27f87746711bfaba07b1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 02:55:36 +0000 Subject: add a Check method to flotsamAssetCache, so to check if a asset is in cache without actually loading it. Make use limited use of it in avatarfactory textures check. Also on llclientview HandleAgentTextureCached that now should work. Other asset cache modules for now will return false, so are broken. baked textures logic still unchanged. *UNTESTED* --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ea3c6a4..edb1a9d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3992,7 +3992,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); - if (terseAgentUpdateBlocks.IsValueCreated) { @@ -11695,14 +11694,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; - for (int i = 0; i < cachedtex.WearableData.Length; i++) + IImprovedAssetCache cache = m_scene.RequestModuleInterface(); + if (cache == null) { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; - cachedresp.WearableData[i].HostName = new byte[0]; + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].HostName = new byte[0]; + } + } + else + { + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + if(cache.Check(cachedtex.WearableData[i].ID.ToString())) + cachedresp.WearableData[i].TextureID = UUID.Zero; + else + cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].HostName = new byte[0]; + } } - cachedresp.Header.Zerocoded = true; OutPacket(cachedresp, ThrottleOutPacketType.Task); -- cgit v1.1 From b3a77c16bd2ad83076ddf19275b2f104210bba07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 07:34:27 +0000 Subject: FIX small avatars movement on terrain. (avatar appearance getting even more messy) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index edb1a9d..4860da0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5122,7 +5122,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.PCode = (byte)PCode.Avatar; update.ProfileCurve = 1; update.PSBlock = Utils.EmptyBytes; - update.Scale = new Vector3(0.45f, 0.6f, 1.9f); + update.Scale = data.Appearance.AvatarSize; +// update.Scale.Z -= 0.2f; + update.Text = Utils.EmptyBytes; update.TextColor = new byte[4]; -- cgit v1.1 From 7a093df24b470a6c80d67b1f8572f37a2a350521 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Dec 2012 03:35:55 +0100 Subject: Prevent a failed user relogi from throwing exceptions in poll services --- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 2 +- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 6b33561..908f628 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -377,7 +377,7 @@ namespace OpenSim.Region.ClientStack.Linden protocol = "https"; } caps.RegisterHandler("GetMesh", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); - m_pollservices.Add(agentID, args); + m_pollservices[agentID] = args; m_capsDict[agentID] = capUrl; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index dd87671..d4dbfb9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -333,7 +333,7 @@ namespace OpenSim.Region.ClientStack.Linden protocol = "https"; } caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); - m_pollservices.Add(agentID, args); + m_pollservices[agentID] = args; m_capsDict[agentID] = capUrl; } -- cgit v1.1 From 77cc7ce399d1b1a710f3b3f4337932febdef66c8 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 21 Dec 2012 19:12:30 -0500 Subject: * Partial Commit for Avatar Appearance to include the functionality of Cached Bakes. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 363ee54..d18b026 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6298,12 +6298,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] visualparams = new byte[appear.VisualParam.Length]; for (int i = 0; i < appear.VisualParam.Length; i++) visualparams[i] = appear.VisualParam[i].ParamValue; - + //var b = appear.WearableData[0]; + Primitive.TextureEntry te = null; if (appear.ObjectData.TextureEntry.Length > 1) te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); + + WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; + for (int i=0; i(); + // var item = fac.GetBakedTextureFaces(AgentId); + //WearableCacheItem[] items = fac.GetCachedItems(AgentId); + IImprovedAssetCache cache = m_scene.RequestModuleInterface(); if (cache == null) { @@ -11720,7 +11732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } @@ -11730,10 +11742,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - if(cache.Check(cachedtex.WearableData[i].ID.ToString())) + + + + if (cache.Check(cachedtex.WearableData[i].ID.ToString())) cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); else - cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } -- cgit v1.1 From 6797ac14741851efa5ba60a00891e18cf7755c80 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 29 Dec 2012 08:53:58 -0500 Subject: * This finishes the implementation of AgentCachedTexture. Requires the XBakes Module and service for full functionality. Previous no-cache functionality works without the service and module. In some ways, I would have been happier not putting an AssetBase in WearableCacheItem.. but turns out it was probably unavoidable. No additional locks, yay. --- .../Linden/Caps/UploadBakedTextureModule.cs | 140 ++++++++++++++++++++- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 110 +++++++++++++--- 2 files changed, 230 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 3b0ccd7..6778ba5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -27,6 +27,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Collections.Specialized; using System.Drawing; using System.Drawing.Imaging; @@ -53,8 +54,8 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UploadBakedTextureModule")] public class UploadBakedTextureModule : INonSharedRegionModule { -// private static readonly ILog m_log = -// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// For historical reasons this is fixed, but there @@ -64,31 +65,154 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; private bool m_persistBakedTextures; + private IBakedTextureModule m_BakedTextureModule; + public void Initialise(IConfigSource source) { IConfig appearanceConfig = source.Configs["Appearance"]; if (appearanceConfig != null) m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); + + } public void AddRegion(Scene s) { m_scene = s; + } public void RemoveRegion(Scene s) { + s.EventManager.OnRegisterCaps -= RegisterCaps; + s.EventManager.OnNewPresence -= RegisterNewPresence; + s.EventManager.OnRemovePresence -= DeRegisterPresence; + m_BakedTextureModule = null; + m_scene = null; } + + public void RegionLoaded(Scene s) { m_scene.EventManager.OnRegisterCaps += RegisterCaps; + m_scene.EventManager.OnNewPresence += RegisterNewPresence; + m_scene.EventManager.OnRemovePresence += DeRegisterPresence; + + } + + private void DeRegisterPresence(UUID agentId) + { + ScenePresence presence = null; + if (m_scene.TryGetScenePresence(agentId, out presence)) + { + presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; + } + + } + + private void RegisterNewPresence(ScenePresence presence) + { + presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; + + } + + private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) + { + m_BakedTextureModule = m_scene.RequestModuleInterface(); + if (cacheItems.Length > 0) + { + m_log.Info("[Cacheitems]: " + cacheItems.Length); + for (int iter = 0; iter < cacheItems.Length; iter++) + { + m_log.Info("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + + cacheItems[iter].TextureID); + } + + ScenePresence p = null; + if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) + { + + WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; + if (existingitems == null) + { + if (m_BakedTextureModule != null) + { + WearableCacheItem[] savedcache = null; + try + { + if (p.Appearance.WearableCacheItemsDirty) + { + savedcache = m_BakedTextureModule.Get(p.UUID); + p.Appearance.WearableCacheItems = savedcache; + p.Appearance.WearableCacheItemsDirty = false; + } + + } + catch (InvalidOperationException) + { + } + + if (savedcache != null) + existingitems = savedcache; + } + } + // Existing items null means it's a fully new appearance + if (existingitems == null) + { + + for (int iter = 0; iter < cacheItems.Length; iter++) + { + + cacheItems[iter].TextureID = textureEntry.FaceTextures[cacheItems[iter].TextureIndex].TextureID; + if (m_scene.AssetService != null) + cacheItems[iter].TextureAsset = m_scene.AssetService.GetCached(cacheItems[iter].TextureID.ToString()); + + + } + } + else + + + { + // for each uploaded baked texture + for (int i = 0; i < cacheItems.Length; i++) + { + cacheItems[i].TextureID = + textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; + } + + for (int i = 0; i < cacheItems.Length; i++) + { + if (cacheItems[i].TextureAsset == null) + { + cacheItems[i].TextureAsset = m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); + } + } + } + + + + p.Appearance.WearableCacheItems = cacheItems; + + + + if (m_BakedTextureModule != null) + { + m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); + p.Appearance.WearableCacheItemsDirty = true; + + } + } + } } public void PostInitialise() { } + + public void Close() { } public string Name { get { return "UploadBakedTextureModule"; } } @@ -100,15 +224,23 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { + UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( + caps, m_scene.AssetService, m_persistBakedTextures); + + + caps.RegisterHandler( "UploadBakedTexture", new RestStreamHandler( "POST", "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, - new UploadBakedTextureHandler( - caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture, + avatarhandler.UploadBakedTexture, "UploadBakedTexture", agentID.ToString())); + + + + } } } \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d18b026..9e39699 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3629,7 +3629,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; - //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); + m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.State); } @@ -11725,32 +11725,110 @@ namespace OpenSim.Region.ClientStack.LindenUDP // var item = fac.GetBakedTextureFaces(AgentId); //WearableCacheItem[] items = fac.GetCachedItems(AgentId); - IImprovedAssetCache cache = m_scene.RequestModuleInterface(); - if (cache == null) + IAssetService cache = m_scene.AssetService; + IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); + if (bakedTextureModule != null && cache != null) { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid + + WearableCacheItem[] cacheItems = null; + ScenePresence p = m_scene.GetScenePresence(AgentId); + if (p.Appearance != null) + if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) + { + try + { + cacheItems = bakedTextureModule.Get(AgentId); + p.Appearance.WearableCacheItems = cacheItems; + p.Appearance.WearableCacheItemsDirty = false; + } + catch (InvalidOperationException) + { + cacheItems = null; + } + } + else if (p.Appearance.WearableCacheItems != null) + { + cacheItems = p.Appearance.WearableCacheItems; + } + + if (cache != null && cacheItems != null) + { + foreach (WearableCacheItem item in cacheItems) + { + + if (cache.GetCached(item.TextureID.ToString()) == null) + { + item.TextureAsset.Temporary = true; + cache.Store(item.TextureAsset); + } + + + } + } + if (cacheItems != null) + { + + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + WearableCacheItem item = + WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); + + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].HostName = new byte[0]; + if (item != null) + { + cachedresp.WearableData[i].TextureID = item.TextureID; + } + else + { + cachedresp.WearableData[i].TextureID = UUID.Zero; + } + } + } + else { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); + cachedresp.WearableData[i].HostName = new byte[0]; + } } } else { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + if (cache == null) + { + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); + cachedresp.WearableData[i].HostName = new byte[0]; + } + } + else { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - if (cache.Check(cachedtex.WearableData[i].ID.ToString())) - cachedresp.WearableData[i].TextureID = UUID.Zero; + if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) + cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - else - cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; + else + cachedresp.WearableData[i].TextureID = UUID.Zero; + // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); + cachedresp.WearableData[i].HostName = new byte[0]; + } } } cachedresp.Header.Zerocoded = true; -- cgit v1.1 From 2805ec64662494d680925c6034e59b823e051a9d Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 31 Dec 2012 23:04:28 -0500 Subject: * Fixed a bug that replayed old cached appearance when changing outfits * Added suser(bad client) DOS protection by limiting the max cacheitems to the maximum sane amount. * Prevents potential numerous loops from running amok and index errors if the client purposely provides bad cache info. * If the XBakes service wasn't running, the SetAvatarAppearance routine would crash when contacting the XBakes service even though it was in a Try/Catch for the appropriate error type. It only properly error handles with the type Exception :(. (commented on that because it's unusual) --- .../Linden/Caps/UploadBakedTextureModule.cs | 123 ++++++++++++++------- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 34 +++++- 2 files changed, 111 insertions(+), 46 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 6778ba5..6bed95f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -119,13 +119,20 @@ namespace OpenSim.Region.ClientStack.Linden private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) { + int maxCacheitemsLoop = cacheItems.Length; + if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES) + { + maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; + m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); + } + m_BakedTextureModule = m_scene.RequestModuleInterface(); if (cacheItems.Length > 0) { - m_log.Info("[Cacheitems]: " + cacheItems.Length); - for (int iter = 0; iter < cacheItems.Length; iter++) + m_log.Debug("[Cacheitems]: " + cacheItems.Length); + for (int iter = 0; iter < maxCacheitemsLoop; iter++) { - m_log.Info("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + + m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + cacheItems[iter].TextureID); } @@ -133,65 +140,99 @@ namespace OpenSim.Region.ClientStack.Linden if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) { - WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; - if (existingitems == null) + WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; + if (existingitems == null) + { + if (m_BakedTextureModule != null) { - if (m_BakedTextureModule != null) + WearableCacheItem[] savedcache = null; + try { - WearableCacheItem[] savedcache = null; - try - { - if (p.Appearance.WearableCacheItemsDirty) - { - savedcache = m_BakedTextureModule.Get(p.UUID); - p.Appearance.WearableCacheItems = savedcache; - p.Appearance.WearableCacheItemsDirty = false; - } - - } - catch (InvalidOperationException) + if (p.Appearance.WearableCacheItemsDirty) { + savedcache = m_BakedTextureModule.Get(p.UUID); + p.Appearance.WearableCacheItems = savedcache; + p.Appearance.WearableCacheItemsDirty = false; } - if (savedcache != null) - existingitems = savedcache; } + /* + * The following Catch types DO NOT WORK with m_BakedTextureModule.Get + * it jumps to the General Packet Exception Handler if you don't catch Exception! + * + catch (System.Net.Sockets.SocketException) + { + cacheItems = null; + } + catch (WebException) + { + cacheItems = null; + } + catch (InvalidOperationException) + { + cacheItems = null; + } */ + catch (Exception) + { + // The service logs a sufficient error message. + } + + + if (savedcache != null) + existingitems = savedcache; } - // Existing items null means it's a fully new appearance - if (existingitems == null) - { + } + // Existing items null means it's a fully new appearance + if (existingitems == null) + { - for (int iter = 0; iter < cacheItems.Length; iter++) + for (int i = 0; i < maxCacheitemsLoop; i++) + { + if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) { - - cacheItems[iter].TextureID = textureEntry.FaceTextures[cacheItems[iter].TextureIndex].TextureID; + cacheItems[i].TextureID = + textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; if (m_scene.AssetService != null) - cacheItems[iter].TextureAsset = m_scene.AssetService.GetCached(cacheItems[iter].TextureID.ToString()); - - + cacheItems[i].TextureAsset = + m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); + } + else + { + m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); } + + } - else - - + } + else + + + { + // for each uploaded baked texture + for (int i = 0; i < maxCacheitemsLoop; i++) { - // for each uploaded baked texture - for (int i = 0; i < cacheItems.Length; i++) + if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) { cacheItems[i].TextureID = textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; } - - for (int i = 0; i < cacheItems.Length; i++) + else { - if (cacheItems[i].TextureAsset == null) - { - cacheItems[i].TextureAsset = m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); - } + m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); } } - + for (int i = 0; i < maxCacheitemsLoop; i++) + { + if (cacheItems[i].TextureAsset == null) + { + cacheItems[i].TextureAsset = + m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); + } + } + } + + p.Appearance.WearableCacheItems = cacheItems; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9e39699..d46adb8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11727,6 +11727,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP IAssetService cache = m_scene.AssetService; IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); + //bakedTextureModule = null; + int maxWearablesLoop = cachedtex.WearableData.Length; + if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) + maxWearablesLoop = AvatarWearable.MAX_WEARABLES; + if (bakedTextureModule != null && cache != null) { // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid @@ -11742,10 +11747,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP p.Appearance.WearableCacheItems = cacheItems; p.Appearance.WearableCacheItemsDirty = false; } + + /* + * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! + * + catch (System.Net.Sockets.SocketException) + { + cacheItems = null; + } + catch (WebException) + { + cacheItems = null; + } catch (InvalidOperationException) { cacheItems = null; + } */ + catch (Exception) + { + cacheItems = null; } + } else if (p.Appearance.WearableCacheItems != null) { @@ -11766,10 +11788,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + if (cacheItems != null) { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { WearableCacheItem item = WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); @@ -11777,8 +11800,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].HostName = new byte[0]; - if (item != null) + if (item != null && cachedtex.WearableData[i].ID == item.CacheId) { + cachedresp.WearableData[i].TextureID = item.TextureID; } else @@ -11789,7 +11813,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; @@ -11803,7 +11827,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (cache == null) { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; @@ -11814,7 +11838,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; -- cgit v1.1 From 0a393b317dd6449e5a4ebbfc41dd3c8f4d9b2092 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 8 Jan 2013 22:32:39 +0100 Subject: Add the new UpdateAgentInformation cap to make maturity on more recent viewers work. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index f6146a9..b06788b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -103,6 +103,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_getObjectPhysicsDataPath = "0101/"; private static readonly string m_getObjectCostPath = "0102/"; private static readonly string m_ResourceCostSelectedPath = "0103/"; + private static readonly string m_UpdateAgentInformationPath = "0500/"; // These are callbacks which will be setup by the scene so that we can update scene data when we @@ -287,6 +288,8 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation); + m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); m_HostCapsObj.RegisterHandler( "CopyInventoryFromNotecard", @@ -1438,6 +1441,22 @@ namespace OpenSim.Region.ClientStack.Linden string response = OSDParser.SerializeLLSDXmlString(resp); return response; } + + public string UpdateAgentInformation(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); + OSDMap resp = new OSDMap(); + + OSDMap accessPrefs = new OSDMap(); + accessPrefs["max"] = "A"; + + resp["access_prefs"] = accessPrefs; + + string response = OSDParser.SerializeLLSDXmlString(resp); + return response; + } } public class AssetUploader -- cgit v1.1 From 2eb0d8b6176c223e915a2d22b1c9540156283943 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 10 Jan 2013 20:21:18 -0800 Subject: add some sanity checking to HandleAgentRequestSit handler --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d46adb8..0a865ab 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6601,8 +6601,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; if (handlerAgentRequestSit != null) - handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, - agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); + if (!(agentRequestSit.AgentData == null + || agentRequestSit.TargetObject == null + || agentRequestSit.TargetObject.TargetID == null + || agentRequestSit.TargetObject.Offset == null)) + { + var sp = m_scene.GetScenePresence(agentRequestSit.AgentData.AgentID); + if (sp == null || sp.ParentID != 0) // ignore packet if agent is already sitting + return true; + + handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, + agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); + } } return true; } -- cgit v1.1 From b263587e2104f304f084c72fcb0cc1d155dacc1e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 13 Jan 2013 15:25:51 +0000 Subject: try to patch getmesh Throttle (test) --- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 908f628..6ec1115 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -501,7 +501,8 @@ namespace OpenSim.Region.ClientStack.Linden ScenePresence p; if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore. { - AlterThrottle(UserSetThrottle, p); +// AlterThrottle(UserSetThrottle, p); + UpdateThrottle(UserSetThrottle, p); } } } @@ -546,7 +547,12 @@ namespace OpenSim.Region.ClientStack.Linden // Client set throttle ! UserSetThrottle = pimagethrottle; CapSetThrottle = (int)(pimagethrottle*CapThrottleDistributon); - UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon)); +// UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon)); + + float udp = 1.0f - CapThrottleDistributon; + if(udp < 0.5f) + udp = 0.5f; + UDPSetThrottle = (int) ((float)pimagethrottle * udp); if (CapSetThrottle < 4068) CapSetThrottle = 4068; // at least two discovery mesh p.ControllingClient.SetAgentThrottleSilent((int) Throttle, UDPSetThrottle); -- cgit v1.1 From 4d92c6b39f3ebb7a27517493b66d097d9d9d23dd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 Jan 2013 15:30:58 +0000 Subject: fix STATE udp queue data rate since it is in use again, after being removed by intel folks (?)( should it be used or removed ??) --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f675377..6485c1a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -339,7 +339,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); // State is a subcategory of task that we allocate a percentage to - int state = 0; +// int state = 0; + int state = (int)((1.0f - STATE_TASK_PERCENTAGE) * (float)task); + task = (int)(STATE_TASK_PERCENTAGE * (float)task); // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged @@ -350,6 +352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = Math.Max(task, LLUDPServer.MTU); texture = Math.Max(texture, LLUDPServer.MTU); asset = Math.Max(asset, LLUDPServer.MTU); + state = Math.Max(state, LLUDPServer.MTU); //int total = resend + land + wind + cloud + task + texture + asset; //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", -- cgit v1.1 From 85aa1804dfc9edbf41f16c312d06746eecd59bc9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 16:45:18 +0000 Subject: Complete removal of the now unused state queue --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0a865ab..3ae9daf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1607,7 +1607,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null) { - OutPacket(kill, ThrottleOutPacketType.State); + OutPacket(kill, ThrottleOutPacketType.Task); } else { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f675377..f1a1812 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -279,7 +279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string GetStats() { return string.Format( - "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7} {12,7}", + "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}", Util.EnvironmentTickCountSubtract(TickLastPacketReceived), PacketsReceived, PacketsSent, @@ -291,8 +291,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count, m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count, m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count, - m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count, - m_packetOutboxes[(int)ThrottleOutPacketType.State].Count); + m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count); } public void SendPacketStats() @@ -338,8 +337,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - // State is a subcategory of task that we allocate a percentage to - int state = 0; // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged @@ -376,9 +373,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; bucket.RequestedDripRate = task; - bucket = m_throttleCategories[(int)ThrottleOutPacketType.State]; - bucket.RequestedDripRate = state; - bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; @@ -709,9 +703,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Texture = 5, /// Non-texture assets Asset = 6, - /// Avatar and primitive data - /// This is a sub-category of Task - State = 7, */ switch (category) @@ -728,8 +719,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return ThrottleOutPacketTypeFlags.Texture; case ThrottleOutPacketType.Asset: return ThrottleOutPacketTypeFlags.Asset; - case ThrottleOutPacketType.State: - return ThrottleOutPacketTypeFlags.State; default: return 0; } -- cgit v1.1 From 91138014e21e19a3c02ee1640caab7f748472038 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 17:12:56 +0000 Subject: Change all uses of the removed state queue to the task queue for now. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3ae9daf..956c2c9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2788,7 +2788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Transfer.TransferInfo.Size = req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.Header.Zerocoded = true; - OutPacket(Transfer, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); + OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); if (req.NumPackets == 1) { @@ -2799,7 +2799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Data = req.AssetInf.Data; TransferPacket.TransferData.Status = 1; TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); } else { @@ -2832,7 +2832,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Status = 1; } TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); processedLength += chunkSize; packetNumber++; @@ -3605,7 +3605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - OutPacket(aw, ThrottleOutPacketType.State); + OutPacket(aw, ThrottleOutPacketType.Task); } public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) @@ -3630,7 +3630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.State); + OutPacket(avp, ThrottleOutPacketType.Task); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) -- cgit v1.1 From 582cb89beb597247ceb6d82cdfc8fc983ffe8496 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 19:29:27 +0100 Subject: Add a way to put things at the front of the queue for any throttle group. Adds a DoubleLocklessQueue and uses it for the outgoing buckets. Added a flag value to the Throttle Type (again) because although it's hacky, it's the best of a bad bunch to get the message through the UDP stack to where it's needed. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++-- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 54 ++++++++++++++++++---- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 +++- 3 files changed, 57 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 956c2c9..9550b5a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2788,7 +2788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Transfer.TransferInfo.Size = req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.Header.Zerocoded = true; - OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); + OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); if (req.NumPackets == 1) { @@ -2799,7 +2799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Data = req.AssetInf.Data; TransferPacket.TransferData.Status = 1; TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); } else { @@ -2832,7 +2832,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Status = 1; } TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); processedLength += chunkSize; packetNumber++; @@ -3605,7 +3605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - OutPacket(aw, ThrottleOutPacketType.Task); + OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f1a1812..e52ac37 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Packets we have sent that need to be ACKed by the client public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); /// ACKs that are queued up, waiting to be sent to the client - public readonly OpenSim.Framework.LocklessQueue PendingAcks = new OpenSim.Framework.LocklessQueue(); + public readonly DoubleLocklessQueue PendingAcks = new DoubleLocklessQueue(); /// Current packet sequence number public int CurrentSequence; @@ -146,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Throttle buckets for each packet category private readonly TokenBucket[] m_throttleCategories; /// Outgoing queues for throttled packets - private readonly OpenSim.Framework.LocklessQueue[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue[THROTTLE_CATEGORY_COUNT]; + private readonly DoubleLocklessQueue[] m_packetOutboxes = new DoubleLocklessQueue[THROTTLE_CATEGORY_COUNT]; /// A container that can hold one packet for each outbox, used to store /// dequeued packets that are being held for throttling private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; @@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ThrottleOutPacketType type = (ThrottleOutPacketType)i; // Initialize the packet outboxes, where packets sit while they are waiting for tokens - m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); + m_packetOutboxes[i] = new DoubleLocklessQueue(); // Initialize the token buckets that control the throttling for each category m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); } @@ -430,15 +430,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue) { + return EnqueueOutgoing(packet, forceQueue, false); + } + + public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue, bool highPriority) + { int category = (int)packet.Category; if (category >= 0 && category < m_packetOutboxes.Length) { - OpenSim.Framework.LocklessQueue queue = m_packetOutboxes[category]; + DoubleLocklessQueue queue = m_packetOutboxes[category]; if (m_deliverPackets == false) { - queue.Enqueue(packet); + queue.Enqueue(packet, highPriority); return true; } @@ -449,7 +454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // queued packets if (queue.Count > 0) { - queue.Enqueue(packet); + queue.Enqueue(packet, highPriority); return true; } @@ -462,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP else { // Force queue specified or not enough tokens in the bucket, queue this packet - queue.Enqueue(packet); + queue.Enqueue(packet, highPriority); return true; } } @@ -494,7 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_deliverPackets == false) return false; OutgoingPacket packet = null; - OpenSim.Framework.LocklessQueue queue; + DoubleLocklessQueue queue; TokenBucket bucket; bool packetSent = false; ThrottleOutPacketTypeFlags emptyCategories = 0; @@ -534,7 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch { - m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); + m_packetOutboxes[i] = new DoubleLocklessQueue(); } if (success) { @@ -567,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); + m_packetOutboxes[i] = new DoubleLocklessQueue(); emptyCategories |= CategoryToFlag(i); } } @@ -724,4 +729,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } + + public class DoubleLocklessQueue : OpenSim.Framework.LocklessQueue + { + OpenSim.Framework.LocklessQueue highQueue = new OpenSim.Framework.LocklessQueue(); + + public override int Count + { + get + { + return base.Count + highQueue.Count; + } + } + + public override bool Dequeue(out T item) + { + if (highQueue.Dequeue(out item)) + return true; + + return base.Dequeue(out item); + } + + public void Enqueue(T item, bool highPriority) + { + if (highPriority) + highQueue.Enqueue(item); + else + Enqueue(item); + } + } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 9a4abd4..6c72edc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -803,6 +803,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Queue or Send + 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 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); @@ -811,7 +819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // continue to display the deleted object until relog. Therefore, we need to always queue a kill object // packet so that it isn't sent before a queued update packet. bool requestQueue = type == PacketType.KillObject; - if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) + if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) SendPacketFinal(outgoingPacket); #endregion Queue or Send -- cgit v1.1 From 7bd9a0edb75ede38e71ca0f436bf89835b13d9ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 19 Jan 2013 14:30:38 +0100 Subject: Remove group IM test code also mentioning "OpenSimulator Testing" --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 +--------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9550b5a..fd82db7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -897,32 +897,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP msg.MessageBlock.Message = Util.StringToBytes1024(im.message); msg.MessageBlock.BinaryBucket = im.binaryBucket; - if (im.message.StartsWith("[grouptest]")) - { // this block is test code for implementing group IM - delete when group IM is finished - IEventQueue eq = Scene.RequestModuleInterface(); - if (eq != null) - { - im.dialog = 17; - - //eq.ChatterboxInvitation( - // new UUID("00000000-68f9-1111-024e-222222111123"), - // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0, - // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket); - - eq.ChatterboxInvitation( - new UUID("00000000-68f9-1111-024e-222222111123"), - "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, - false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing")); - - eq.ChatterBoxSessionAgentListUpdates( - new UUID("00000000-68f9-1111-024e-222222111123"), - new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false); - } - - Console.WriteLine("SendInstantMessage: " + msg); - } - else - OutPacket(msg, ThrottleOutPacketType.Task); + OutPacket(msg, ThrottleOutPacketType.Task); } } -- cgit v1.1 From 9d1989e64fa460646f9a3d52d4024c3b56888617 Mon Sep 17 00:00:00 2001 From: teravus Date: Tue, 22 Jan 2013 18:49:50 -0500 Subject: * Handle a NRE with Baked Textures that may result in a failed appearance. This may be an issue, or it may be a symptom. --- .../Linden/Caps/UploadBakedTextureModule.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 6bed95f..eca576d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -190,8 +190,15 @@ namespace OpenSim.Region.ClientStack.Linden { if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) { - cacheItems[i].TextureID = - textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; + Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; + if (face == null) + { + textureEntry.CreateFace(cacheItems[i].TextureIndex); + textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = + AppearanceManager.DEFAULT_AVATAR_TEXTURE; + continue; + } + cacheItems[i].TextureID =face.TextureID; if (m_scene.AssetService != null) cacheItems[i].TextureAsset = m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); @@ -213,8 +220,16 @@ namespace OpenSim.Region.ClientStack.Linden { if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) { + Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; + if (face == null) + { + textureEntry.CreateFace(cacheItems[i].TextureIndex); + textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = + AppearanceManager.DEFAULT_AVATAR_TEXTURE; + continue; + } cacheItems[i].TextureID = - textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; + face.TextureID; } else { -- cgit v1.1 From cc1781926b4c49c72977d4ddb16cc583a9ffeb80 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 31 Jan 2013 20:37:58 +0000 Subject: * Adds a satisfying angular roll when an avatar is flying and turning. (General, not physics). Makes flying not feel as stiff. Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fd82db7..f2b0160 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4963,8 +4963,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // in that direction, even though we don't model this on the server. Implementing this in the future // may improve movement smoothness. // acceleration = new Vector3(1, 0, 0); - - angularVelocity = Vector3.Zero; + + angularVelocity = presence.AngularVelocity; + rotation = presence.Rotation; if (sendTexture) textureEntry = presence.Appearance.Texture.GetBytes(); -- cgit v1.1 From 598f891d703593bde4b96472b5d1b1ce6aaf4c74 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Feb 2013 04:03:32 +0100 Subject: Move SoubleQueu to Util. Change HTTP inv to prioritize COF. Determine COF for SP --- .../Linden/Caps/WebFetchInvDescModule.cs | 77 +++++++++++++-- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 108 --------------------- 2 files changed, 70 insertions(+), 115 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 04cd474..a823dd8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -39,10 +39,13 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Framework.Capabilities; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using OpenSim.Capabilities.Handlers; using OpenSim.Framework.Monitoring; +using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace OpenSim.Region.ClientStack.Linden { @@ -52,11 +55,13 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")] public class WebFetchInvDescModule : INonSharedRegionModule { - struct aPollRequest + class aPollRequest { public PollServiceInventoryEventArgs thepoll; public UUID reqID; public Hashtable request; + public ScenePresence presence; + public List folders; } private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -71,8 +76,8 @@ namespace OpenSim.Region.ClientStack.Linden private Dictionary m_capsDict = new Dictionary(); private static Thread[] m_workerThreads = null; - private static OpenMetaverse.BlockingQueue m_queue = - new OpenMetaverse.BlockingQueue(); + private static DoubleQueue m_queue = + new DoubleQueue(); #region ISharedRegionModule Members @@ -143,12 +148,18 @@ namespace OpenSim.Region.ClientStack.Linden private class PollServiceInventoryEventArgs : PollServiceEventArgs { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Dictionary responses = new Dictionary(); - public PollServiceInventoryEventArgs(UUID pId) : + private Scene m_scene; + + public PollServiceInventoryEventArgs(Scene scene, UUID pId) : base(null, null, null, null, pId, int.MaxValue) { + m_scene = scene; + HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y) => { @@ -167,12 +178,64 @@ namespace OpenSim.Region.ClientStack.Linden Request = (x, y) => { + ScenePresence sp = m_scene.GetScenePresence(Id); + if (sp == null) + { + m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id); + return; + } + aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; + reqinfo.presence = sp; + reqinfo.folders = new List(); + + // Decode the request here + string request = y["body"].ToString(); + + request = request.Replace("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"); + + request = request.Replace("fetch_folders0", "fetch_folders0"); + request = request.Replace("fetch_folders1", "fetch_folders1"); + + Hashtable hash = new Hashtable(); + try + { + hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); + } + catch (LLSD.LLSDParseException e) + { + m_log.ErrorFormat("[INVENTORY]: Fetch error: {0}{1}" + e.Message, e.StackTrace); + m_log.Error("Request: " + request); + return; + } + + ArrayList foldersrequested = (ArrayList)hash["folders"]; + + bool highPriority = false; + + for (int i = 0; i < foldersrequested.Count; i++) + { + Hashtable inventoryhash = (Hashtable)foldersrequested[i]; + string folder = inventoryhash["folder_id"].ToString(); + UUID folderID; + if (UUID.TryParse(folder, out folderID)) + { + if (!reqinfo.folders.Contains(folderID)) + { + if (sp.COF != UUID.Zero && sp.COF == folderID) + highPriority = true; + reqinfo.folders.Add(folderID); + } + } + } - m_queue.Enqueue(reqinfo); + if (highPriority) + m_queue.EnqueueHigh(reqinfo); + else + m_queue.EnqueueLow(reqinfo); }; NoEvents = (x, y) => @@ -208,7 +271,7 @@ namespace OpenSim.Region.ClientStack.Linden response["reusecontext"] = false; response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( - requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); + requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); lock (responses) responses[requestID] = response; @@ -220,7 +283,7 @@ namespace OpenSim.Region.ClientStack.Linden string capUrl = "/CAPS/" + UUID.Random() + "/"; // Register this as a poll service - PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); + PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID); args.Type = PollServiceEventArgs.EventType.Inventory; MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 6c72edc..d49f1f7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1903,112 +1903,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - - internal class DoubleQueue where T:class - { - private Queue m_lowQueue = new Queue(); - private Queue m_highQueue = new Queue(); - - private object m_syncRoot = new object(); - private Semaphore m_s = new Semaphore(0, 1); - - public DoubleQueue() - { - } - - public virtual int Count - { - get { return m_highQueue.Count + m_lowQueue.Count; } - } - - public virtual void Enqueue(T data) - { - Enqueue(m_lowQueue, data); - } - - public virtual void EnqueueLow(T data) - { - Enqueue(m_lowQueue, data); - } - - public virtual void EnqueueHigh(T data) - { - Enqueue(m_highQueue, data); - } - - private void Enqueue(Queue q, T data) - { - lock (m_syncRoot) - { - m_lowQueue.Enqueue(data); - m_s.WaitOne(0); - m_s.Release(); - } - } - - public virtual T Dequeue() - { - return Dequeue(Timeout.Infinite); - } - - public virtual T Dequeue(int tmo) - { - return Dequeue(TimeSpan.FromMilliseconds(tmo)); - } - - public virtual T Dequeue(TimeSpan wait) - { - T res = null; - - if (!Dequeue(wait, ref res)) - return null; - - return res; - } - - public bool Dequeue(int timeout, ref T res) - { - return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); - } - - public bool Dequeue(TimeSpan wait, ref T res) - { - if (!m_s.WaitOne(wait)) - return false; - - lock (m_syncRoot) - { - if (m_highQueue.Count > 0) - res = m_highQueue.Dequeue(); - else - res = m_lowQueue.Dequeue(); - - if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) - return true; - - try - { - m_s.Release(); - } - catch - { - } - - return true; - } - } - - public virtual void Clear() - { - - lock (m_syncRoot) - { - // Make sure sem count is 0 - m_s.WaitOne(0); - - m_lowQueue.Clear(); - m_highQueue.Clear(); - } - } - } } -- cgit v1.1 From 6aa876a83b08390ab057eb012fd2c730010f79d8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Feb 2013 03:40:48 +0000 Subject: Rename Bounciness to Restitution --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 83347e2..d7d4708 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1316,7 +1316,7 @@ namespace OpenSim.Region.ClientStack.Linden object_data["PhysicsShapeType"] = obj.PhysicsShapeType; object_data["Density"] = obj.Density; object_data["Friction"] = obj.Friction; - object_data["Restitution"] = obj.Bounciness; + object_data["Restitution"] = obj.Restitution; object_data["GravityMultiplier"] = obj.GravityModifier; resp[uuid.ToString()] = object_data; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0a39ded..f1fe6e1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2654,7 +2654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte physshapetype = part.PhysicsShapeType; float density = part.Density; float friction = part.Friction; - float bounce = part.Bounciness; + float bounce = part.Restitution; float gravmod = part.GravityModifier; eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); -- cgit v1.1 From bbda7b94b3fe2350d5413879388cfce7309ca907 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Feb 2013 03:40:48 +0000 Subject: Rename Bounciness to Restitution --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index b06788b..2bb3d38 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1317,7 +1317,7 @@ namespace OpenSim.Region.ClientStack.Linden object_data["PhysicsShapeType"] = obj.PhysicsShapeType; object_data["Density"] = obj.Density; object_data["Friction"] = obj.Friction; - object_data["Restitution"] = obj.Bounciness; + object_data["Restitution"] = obj.Restitution; object_data["GravityMultiplier"] = obj.GravityModifier; resp[uuid.ToString()] = object_data; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f2b0160..ca15e3e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2654,7 +2654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte physshapetype = part.PhysicsShapeType; float density = part.Density; float friction = part.Friction; - float bounce = part.Bounciness; + float bounce = part.Restitution; float gravmod = part.GravityModifier; eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); -- cgit v1.1 From 04235e58e87ae42617111cad2884e42785914d4e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 01:02:16 +0100 Subject: Push updates from keyframe directly to the front of the output queue rather than through the update system. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ca15e3e..8d46415 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3721,6 +3721,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { + if ((updateFlags & PrimUpdateFlags.Immediate) != 0) + { + SendUnqueuedTerseUpdate((SceneObjectPart)entity); + return; + } + if (entity is SceneObjectPart) { SceneObjectPart e = (SceneObjectPart)entity; @@ -4075,6 +4081,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP ProcessEntityUpdates(-1); } + public void SendUnqueuedTerseUpdate(SceneObjectPart part) + { + ImprovedTerseObjectUpdatePacket packet + = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( + PacketType.ImprovedTerseObjectUpdate); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + + packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); + + OutPacket(packet, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); + } + #endregion Primitive Packet/Data Sending Methods // These are used to implement an adaptive backoff in the number -- cgit v1.1 From 048e904f051ccc38e7d00936b45288af3c6fc010 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 01:13:30 +0100 Subject: Use actual time dilation for unqueued updates --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8d46415..81a772b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4087,7 +4087,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( PacketType.ImprovedTerseObjectUpdate); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); + packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); -- cgit v1.1 From 2065590232894acb8dae15ff935dfae1405326a5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 03:15:32 +0100 Subject: Revert "Use actual time dilation for unqueued updates" This reverts commit 048e904f051ccc38e7d00936b45288af3c6fc010. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 81a772b..8d46415 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4087,7 +4087,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( PacketType.ImprovedTerseObjectUpdate); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); + packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); -- cgit v1.1 From 14c064c65da3d9cce045664f83daaeb7a79edcdd Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 03:15:40 +0100 Subject: Revert "Push updates from keyframe directly to the front of the output queue rather" This reverts commit 04235e58e87ae42617111cad2884e42785914d4e. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8d46415..ca15e3e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3721,12 +3721,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { - if ((updateFlags & PrimUpdateFlags.Immediate) != 0) - { - SendUnqueuedTerseUpdate((SceneObjectPart)entity); - return; - } - if (entity is SceneObjectPart) { SceneObjectPart e = (SceneObjectPart)entity; @@ -4081,20 +4075,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP ProcessEntityUpdates(-1); } - public void SendUnqueuedTerseUpdate(SceneObjectPart part) - { - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( - PacketType.ImprovedTerseObjectUpdate); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - - packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); - - OutPacket(packet, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); - } - #endregion Primitive Packet/Data Sending Methods // These are used to implement an adaptive backoff in the number -- cgit v1.1 From 4c7df6a1473e4e0a144e06f6e318251419f64af8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 14 Feb 2013 07:17:27 +0100 Subject: Small fix to sim features module --- OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 191bccf..8f38737 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -94,6 +94,8 @@ namespace OpenSim.Region.ClientStack.Linden { m_scene = s; m_scene.EventManager.OnRegisterCaps += RegisterCaps; + + m_scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene s) -- cgit v1.1 From 32c4e1a850fc271808f2e80c79c628ddc82e0206 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 14 Feb 2013 08:40:15 +0100 Subject: Add an event and some logic to allow customizing Simulator Features by avatar --- .../Linden/Caps/SimulatorFeaturesModule.cs | 25 ++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 8f38737..6ef8815 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.Linden // private static readonly ILog m_log = // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest; + private Scene m_scene; /// @@ -158,7 +160,7 @@ namespace OpenSim.Region.ClientStack.Linden IRequestHandler reqHandler = new RestHTTPHandler( "GET", "/CAPS/" + UUID.Random(), - HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString()); + x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString()); caps.RegisterHandler("SimulatorFeatures", reqHandler); } @@ -187,18 +189,33 @@ namespace OpenSim.Region.ClientStack.Linden return new OSDMap(m_features); } - private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod) + private OSDMap DeepCopy() + { + // This isn't the cheapest way of doing this but the rate + // of occurrence is low (on sim entry only) and it's a sure + // way to get a true deep copy. + OSD copy = OSDParser.DeserializeLLSDXml(OSDParser.SerializeLLSDXmlString(m_features)); + + return (OSDMap)copy; + } + + private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID) { // m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); + OSDMap copy = DeepCopy(); + + SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; + if (handlerOnSimulatorFeaturesRequest != null) + handlerOnSimulatorFeaturesRequest(agentID, ref copy); + //Send back data Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 200; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; - lock (m_features) - responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features); + responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(copy); return responsedata; } -- cgit v1.1 From 4be35df5fa1f1ba364ac45ae8b2585319dfbdbae Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 16 Feb 2013 05:09:27 +0100 Subject: Fix shape parameters sent for meshes tosupport the full number of faces --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ca15e3e..0267805 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3893,6 +3893,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP part.Shape.LightEntry = false; } } + + if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) + { + // Ensure that mesh has at least 8 valid faces + part.Shape.ProfileBegin = 12500; + part.Shape.ProfileEnd = 0; + part.Shape.ProfileHollow = 27500; + } } ++updatesThisCall; -- cgit v1.1 From 8c0b9080a4fb013d559966fc8c8175fb16162c2d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 18 Feb 2013 21:09:14 +0100 Subject: Fix an issue where the viewer would request the seed cap before there was a handler for it. --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 2bb3d38..248eab6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -343,6 +343,9 @@ namespace OpenSim.Region.ClientStack.Linden m_log.DebugFormat( "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); + if (!m_HostCapsObj.WaitForActivation()) + return string.Empty; + if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) { m_log.WarnFormat( -- cgit v1.1 From e0e9118f8137ec95c73fe264f0c3fcf9f7305741 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Feb 2013 18:31:49 +0100 Subject: The viewer tries to parse the error message body to LLSD - give it some. --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 986a665..f6e501d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -467,8 +467,8 @@ namespace OpenSim.Region.ClientStack.Linden responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; responsedata["reusecontext"] = false; - responsedata["str_response_string"] = "Upstream error: "; - responsedata["error_status_text"] = "Upstream error:"; + responsedata["str_response_string"] = ""; + responsedata["error_status_text"] = ""; responsedata["http_protocol_version"] = "HTTP/1.0"; return responsedata; } -- cgit v1.1 From da2b59848461d0f309067762403f9143551bb5ba Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 25 Feb 2013 18:26:59 +0100 Subject: Make banking no longer break sit rotations. Fix spinning avatars. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0267805..0388828 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4960,6 +4960,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; rotation = part.RotationOffset * presence.Rotation; } + angularVelocity = Vector3.Zero; + } + else + { + angularVelocity = presence.AngularVelocity; + rotation = presence.Rotation; } attachPoint = 0; @@ -4972,9 +4978,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // may improve movement smoothness. // acceleration = new Vector3(1, 0, 0); - angularVelocity = presence.AngularVelocity; - rotation = presence.Rotation; - if (sendTexture) textureEntry = presence.Appearance.Texture.GetBytes(); else -- cgit v1.1 From 2ad72db0ecd834ca7071aa6038f209b64f79b868 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 3 Mar 2013 11:40:46 +0100 Subject: Make a viewer sent XML error prettier --- OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index a823dd8..707cc93 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -211,6 +211,10 @@ namespace OpenSim.Region.ClientStack.Linden m_log.Error("Request: " + request); return; } + catch (System.Xml.XmlException) + { + m_log.ErrorFormat("[INVENTORY]: XML Format error"); + } ArrayList foldersrequested = (ArrayList)hash["folders"]; -- cgit v1.1 From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Mar 2013 18:56:28 +0100 Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions" --- .../Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 9 +++++---- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index eadca9b..921d3bf 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -50,6 +50,7 @@ using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using OSDArray = OpenMetaverse.StructuredData.OSDArray; using OSDMap = OpenMetaverse.StructuredData.OSDMap; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.ClientStack.Linden { @@ -830,9 +831,9 @@ namespace OpenSim.Region.ClientStack.Linden texitem.Folder = texturesFolder; texitem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); - texitem.BasePermissions = (uint)PermissionMask.All; + texitem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; texitem.EveryOnePermissions = 0; texitem.NextPermissions = (uint)PermissionMask.All; texitem.CreationDate = Util.UnixTimeSinceEpoch(); @@ -1097,9 +1098,9 @@ namespace OpenSim.Region.ClientStack.Linden else { item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); - item.BasePermissions = (uint)PermissionMask.All; + item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; item.EveryOnePermissions = 0; item.NextPermissions = (uint)PermissionMask.All; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5b2bad4..f8b9352 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -51,6 +51,7 @@ using RegionFlags = OpenMetaverse.RegionFlags; using Nini.Config; using System.IO; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -1802,7 +1803,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item) { - const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; + // Fudge this value. It's only needed to make the CRC anyway + const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply); // TODO: don't create new blocks if recycling an old packet @@ -2007,7 +2009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected void SendBulkUpdateInventoryItem(InventoryItemBase item) { - const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; + const uint FULL_MASK_PERMISSIONS = (uint)0x7ffffff; BulkUpdateInventoryPacket bulkUpdate = (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory); @@ -2066,7 +2068,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase) public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) { - const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; + const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket( -- cgit v1.1 From 6571e7ead276027e5ed86cb1fc9d1b47ddae2e6e Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Apr 2013 22:24:41 +0200 Subject: Allow callers to set the invoice parameter for GenericMessage --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f8b9352..4979be8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -903,9 +903,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public void SendGenericMessage(string method, List message) + public void SendGenericMessage(string method, UUID invoice, List message) { GenericMessagePacket gmp = new GenericMessagePacket(); + + gmp.AgentData.AgentID = AgentId; + gmp.AgentData.SessionID = m_sessionId; + gmp.AgentData.TransactionID = invoice; + gmp.MethodData.Method = Util.StringToBytes256(method); gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; int i = 0; @@ -918,9 +923,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(gmp, ThrottleOutPacketType.Task); } - public void SendGenericMessage(string method, List message) + public void SendGenericMessage(string method, UUID invoice, List message) { GenericMessagePacket gmp = new GenericMessagePacket(); + + gmp.AgentData.AgentID = AgentId; + gmp.AgentData.SessionID = m_sessionId; + gmp.AgentData.TransactionID = invoice; + gmp.MethodData.Method = Util.StringToBytes256(method); gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; int i = 0; -- cgit v1.1 From e39156c6569b10d48b0005b271f103387e16f527 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Apr 2013 01:38:21 +0200 Subject: Send 503 when throttling textures --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index d4dbfb9..a42c96c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden public PollServiceTextureEventArgs thepoll; public UUID reqID; public Hashtable request; + public bool send503; } public class aPollResponse @@ -244,7 +245,19 @@ namespace OpenSim.Region.ClientStack.Linden reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; + reqinfo.send503 = false; + lock (responses) + { + if (responses.Count > 0) + { + if (m_queue.Count >= 4) + { + // Never allow more than 4 fetches to wait + reqinfo.send503 = true; + } + } + } m_queue.Enqueue(reqinfo); }; @@ -276,6 +289,22 @@ namespace OpenSim.Region.ClientStack.Linden UUID requestID = requestinfo.reqID; + if (requestinfo.send503) + { + response = new Hashtable(); + + response["int_response_code"] = 503; + response["str_response_string"] = "Throttled"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + lock (responses) + responses[requestID] = new aPollResponse() {bytes = 0, response = response}; + + return; + } + // If the avatar is gone, don't bother to get the texture if (m_scene.GetScenePresence(Id) == null) { @@ -385,6 +414,9 @@ namespace OpenSim.Region.ClientStack.Linden GetTextureModule.aPollResponse response; if (responses.TryGetValue(key, out response)) { + // This is any error response + if (response.bytes == 0) + return true; // Normal if (BytesSent + response.bytes <= ThrottleBytes) @@ -411,12 +443,12 @@ namespace OpenSim.Region.ClientStack.Linden return haskey; } + public void ProcessTime() { PassTime(); } - private void PassTime() { currenttime = Util.EnvironmentTickCount(); -- cgit v1.1 From 40036ca05f3a34ef7f0728ed52878068a66bc502 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Apr 2013 21:35:18 +0100 Subject: Change EconomyDataRequest signature to use an IClientAPI rather than UUID. This is needed because recent LL viewer codebases call this earlier in login when the client is not yet established in the sim and can't be found by UUID. Sending the reply requires having the IClientAPI. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4979be8..98160c9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -9860,7 +9860,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EconomyDataRequest handlerEconomoyDataRequest = OnEconomyDataRequest; if (handlerEconomoyDataRequest != null) { - handlerEconomoyDataRequest(AgentId); + handlerEconomoyDataRequest(this); } return true; } -- cgit v1.1 From 0af1d8fe196e403c066f7fc3dbc9f4b897b4da2c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Apr 2013 23:35:59 +0200 Subject: Fix CAPS to work like they should - do not send caps to the viewer if they're not in the requested caps list. The previous wrong behavior caused the debug setting "UseHTTPInventory" to fail on all viewers when turned off. UDB inventory would not be correctly used in that case. --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 921d3bf..59b9585 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -355,11 +355,22 @@ namespace OpenSim.Region.ClientStack.Linden return string.Empty; } - Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true); + OSDArray capsRequested = (OSDArray)OSDParser.DeserializeLLSDXml(request); + List validCaps = new List(); + + foreach (OSD c in capsRequested) + validCaps.Add(c.AsString()); + + Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true, validCaps); // Add the external too foreach (KeyValuePair kvp in m_HostCapsObj.ExternalCapsHandlers) + { + if (!validCaps.Contains(kvp.Key)) + continue; + caps[kvp.Key] = kvp.Value; + } string result = LLSDHelpers.SerialiseLLSDReply(caps); -- cgit v1.1 From f9daf921f72e9962546fe5cfcc45db3ace8f903c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 13 May 2013 03:29:11 +0200 Subject: Explicitly zero avatar velocity on sit --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 98160c9..d5b7ec8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5124,6 +5124,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP data.CollisionPlane.ToBytes(objectData, 0); offsetPosition.ToBytes(objectData, 16); + Vector3 velocity = new Vector3(0, 0, 0); + Vector3 acceleration = new Vector3(0, 0, 0); + velocity.ToBytes(objectData, 28); + acceleration.ToBytes(objectData, 40); // data.Velocity.ToBytes(objectData, 28); // data.Acceleration.ToBytes(objectData, 40); rotation.ToBytes(objectData, 52); -- cgit v1.1 From 4cb7ee47f209ffb0c8d8d04eba462c248c4740e0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 22 May 2013 23:49:34 +0200 Subject: Let the event queue do lees work - expire every 40s as per Teravus instead of every seconds - whoever put that in.... --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 37285e3..eb40eb1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -376,7 +376,7 @@ namespace OpenSim.Region.ClientStack.Linden // TODO: Add EventQueueGet name/description for diagnostics MainServer.Instance.AddPollServiceHTTPHandler( eventQueueGetPath, - new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID, 1000)); + new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID, 40000)); // m_log.DebugFormat( // "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}", -- cgit v1.1 From 0086c3b5fb24f4a25fe2e28f9cedcaa41c70b36c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 May 2013 01:58:50 +0200 Subject: Update the money framework to allow sending the new style linden "serverside is now viewerside" messages regarding currency This will require all money modules to be refactored! --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d5b7ec8..7208f08 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -354,7 +354,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // protected HashSet m_attachmentsSent; - private int m_moneyBalance; private bool m_deliverPackets = true; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; @@ -438,7 +437,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string Name { get { return FirstName + " " + LastName; } } public uint CircuitCode { get { return m_circuitCode; } } - public int MoneyBalance { get { return m_moneyBalance; } } public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } /// @@ -502,7 +500,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_firstName = sessionInfo.LoginInfo.First; m_lastName = sessionInfo.LoginInfo.Last; m_startpos = sessionInfo.LoginInfo.StartPos; - m_moneyBalance = 1000; m_udpServer = udpServer; m_udpClient = udpClient; @@ -1526,7 +1523,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(tpProgress, ThrottleOutPacketType.Unknown); } - public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance) + public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item) { MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket)PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply); money.MoneyData.AgentID = AgentId; @@ -1534,7 +1531,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP money.MoneyData.TransactionSuccess = success; money.MoneyData.Description = description; money.MoneyData.MoneyBalance = balance; - money.TransactionInfo.ItemDescription = Util.StringToBytes256("NONE"); + money.TransactionInfo.TransactionType = transactionType; + money.TransactionInfo.SourceID = sourceID; + money.TransactionInfo.IsSourceGroup = sourceIsGroup; + money.TransactionInfo.DestID = destID; + money.TransactionInfo.IsDestGroup = destIsGroup; + money.TransactionInfo.Amount = amount; + money.TransactionInfo.ItemDescription = Util.StringToBytes256(item); + OutPacket(money, ThrottleOutPacketType.Task); } @@ -2278,6 +2282,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal) { + // Prepend a slash to make the message come up in the top right + // again. + // Allow special formats to be sent from aware modules. + if (!modal && !message.StartsWith("ALERT: ") && !message.StartsWith("NOTIFY: ") && message != "Home position set." && message != "You died and have been teleported to your home location") + message = "/" + message; AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); alertPack.AgentData.AgentID = AgentId; alertPack.AlertData.Message = Util.StringToBytes256(message); @@ -12217,17 +12226,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method); } - public bool AddMoney(int debit) - { - if (m_moneyBalance + debit >= 0) - { - m_moneyBalance += debit; - SendMoneyBalance(UUID.Zero, true, Util.StringToBytes256("Poof Poof!"), m_moneyBalance); - return true; - } - return false; - } - protected void HandleAutopilot(Object sender, string method, List args) { float locx = 0; -- cgit v1.1 From 9589a09eda2a08c12dc54a99fb04faa18e5c6de7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 31 May 2013 22:02:31 +0200 Subject: Fix multi-wear of alpha and tattoo layers. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7208f08..eebb8ae 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.CreationDate = item.CreationDate; newBlock.SalePrice = item.SalePrice; newBlock.SaleType = item.SaleType; - newBlock.Flags = item.Flags; + newBlock.Flags = item.Flags & 0xff; newBlock.CRC = Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, @@ -1991,7 +1991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.GroupID = item.GroupID; itemBlock.GroupOwned = item.GroupOwned; itemBlock.GroupMask = item.GroupPermissions; - itemBlock.Flags = item.Flags; + itemBlock.Flags = item.Flags & 0xff; itemBlock.SalePrice = item.SalePrice; itemBlock.SaleType = item.SaleType; itemBlock.CreationDate = item.CreationDate; @@ -2058,7 +2058,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[0].GroupID = item.GroupID; bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; - bulkUpdate.ItemData[0].Flags = item.Flags; + bulkUpdate.ItemData[0].Flags = item.Flags & 0xff; bulkUpdate.ItemData[0].SalePrice = item.SalePrice; bulkUpdate.ItemData[0].SaleType = item.SaleType; @@ -2112,7 +2112,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP InventoryReply.InventoryData[0].GroupID = Item.GroupID; InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; - InventoryReply.InventoryData[0].Flags = Item.Flags; + InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff; InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; InventoryReply.InventoryData[0].SaleType = Item.SaleType; InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; -- cgit v1.1 From 745a209bf2cf2465717f2d17fd5a506221c63ac5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 10 Jun 2013 01:16:22 +0200 Subject: Explicitly set uploaded mesh object perms --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 59b9585..8241e07 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -990,13 +990,20 @@ namespace OpenSim.Region.ClientStack.Linden else prim.Name = assetName + "#" + i.ToString(); + prim.EveryoneMask = 0; + prim.GroupMask = 0; + if (restrictPerms) { prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); - prim.EveryoneMask = 0; - prim.GroupMask = 0; - prim.NextOwnerMask = 0; prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); + prim.NextOwnerMask = 0; + } + else + { + prim.BaseMask = (uint)PermissionMask.All | (uint)PermissionMask.Export; + prim.OwnerMask = (uint)PermissionMask.All | (uint)PermissionMask.Export; + prim.NextOwnerMask = (uint)PermissionMask.Transfer; } if(istest) @@ -1099,21 +1106,17 @@ namespace OpenSim.Region.ClientStack.Linden if (restrictPerms) { - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Modify); - item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); + item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); item.EveryOnePermissions = 0; item.NextPermissions = 0; } else { - item.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); - item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; + item.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; item.EveryOnePermissions = 0; - item.NextPermissions = (uint)PermissionMask.All; + item.NextPermissions = (uint)PermissionMask.Transfer; } item.CreationDate = Util.UnixTimeSinceEpoch(); -- cgit v1.1 From 823e8b5d19099fcc560cefeec5943b9a19571a37 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 7 Sep 2013 17:57:02 +0200 Subject: Add support for simple external CAPS texture services --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 50 ++++++++++++++-------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index a42c96c..0570144 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -77,6 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden private Dictionary m_capsDict = new Dictionary(); private static Thread[] m_workerThreads = null; + private string m_Url = "localhost"; + private static OpenMetaverse.BlockingQueue m_queue = new OpenMetaverse.BlockingQueue(); @@ -86,6 +88,9 @@ namespace OpenSim.Region.ClientStack.Linden public void Initialise(IConfigSource source) { + IConfig config = source.Configs["ClientStack.LindenCaps"]; + if (config != null) + m_Url = config.GetString("Cap_GetTexture", "localhost"); } public void AddRegion(Scene s) @@ -343,27 +348,34 @@ namespace OpenSim.Region.ClientStack.Linden private void RegisterCaps(UUID agentID, Caps caps) { - string capUrl = "/CAPS/" + UUID.Random() + "/"; - - // Register this as a poll service - PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); - - args.Type = PollServiceEventArgs.EventType.Texture; - MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); - - string hostName = m_scene.RegionInfo.ExternalHostName; - uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; - string protocol = "http"; - - if (MainServer.Instance.UseSSL) + if (m_Url == "localhost") + { + string capUrl = "/CAPS/" + UUID.Random() + "/"; + + // Register this as a poll service + PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); + + args.Type = PollServiceEventArgs.EventType.Texture; + MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); + + string hostName = m_scene.RegionInfo.ExternalHostName; + uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; + string protocol = "http"; + + if (MainServer.Instance.UseSSL) + { + hostName = MainServer.Instance.SSLCommonName; + port = MainServer.Instance.SSLPort; + protocol = "https"; + } + caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); + m_pollservices[agentID] = args; + m_capsDict[agentID] = capUrl; + } + else { - hostName = MainServer.Instance.SSLCommonName; - port = MainServer.Instance.SSLPort; - protocol = "https"; + caps.RegisterHandler("GetTexture", m_Url); } - caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); - m_pollservices[agentID] = args; - m_capsDict[agentID] = capUrl; } private void DeregisterCaps(UUID agentID, Caps caps) -- cgit v1.1 From ddf67bf929fbc32d8319f777b248642b4da0305a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 Sep 2013 19:41:51 +0200 Subject: Mono 2.0 fix - call ToArray() explicitly --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index eebb8ae..f4ea975 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3933,6 +3933,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP part.Shape.ProfileHollow = 27500; } } + else if (update.Entity is ScenePresence) + { + ScenePresence presence = (ScenePresence)update.Entity; + + // If ParentUUID is not UUID.Zero and ParentID is 0, this + // avatar is in the process of crossing regions while + // sat on an object. In this state, we don't want any + // updates because they will visually orbit the avatar. + // Update will be forced once crossing is completed anyway. + if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0) + continue; + } ++updatesThisCall; -- cgit v1.1 From f93dac9239dc71020f143339997b3b7abc15f69d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Apr 2014 10:47:31 +0200 Subject: Implement Oren's fix to prevent a privilege escalation with groups --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f4ea975..7c62f90 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2233,9 +2233,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) { - m_activeGroupID = activegroupid; - m_activeGroupName = groupname; - m_activeGroupPowers = grouppowers; + if (agentid == AgentId) + { + m_activeGroupID = activegroupid; + m_activeGroupName = groupname; + m_activeGroupPowers = grouppowers; + } AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; -- cgit v1.1 From 5c661baf6c197caef73e6a8fe5a2223d00a2a6ba Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 26 Apr 2014 02:42:30 +0200 Subject: Allow opening a https port using only http so that nginx can be used for ssl --- .../Region/ClientStack/RegionApplicationBase.cs | 26 ++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 853b72d..287c278 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -100,13 +100,25 @@ namespace OpenSim.Region.ClientStack // "OOB" Server if (m_networkServersInfo.ssl_listener) { - BaseHttpServer server = new BaseHttpServer( - m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, - m_networkServersInfo.cert_pass); + if (!m_networkServersInfo.ssl_external) + { + BaseHttpServer server = new BaseHttpServer( + m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, + m_networkServersInfo.cert_pass); - m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); - MainServer.AddHttpServer(server); - server.Start(); + m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); + MainServer.AddHttpServer(server); + server.Start(); + } + else + { + BaseHttpServer server = new BaseHttpServer( + m_networkServersInfo.https_port); + + m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port); + MainServer.AddHttpServer(server); + server.Start(); + } } base.StartupSpecific(); @@ -132,4 +144,4 @@ namespace OpenSim.Region.ClientStack return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); } } -} \ No newline at end of file +} -- cgit v1.1 From 5000a5c038ddc2a8d5cd8cd46e9dcb9a0845faae Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Jul 2014 00:17:35 +0200 Subject: Fix coalesced objects not showing up as "piles" of prims (AVN only bug) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f599342..b4a0a98 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1794,7 +1794,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.CreationDate = item.CreationDate; newBlock.SalePrice = item.SalePrice; newBlock.SaleType = item.SaleType; - newBlock.Flags = item.Flags & 0xff; + newBlock.Flags = item.Flags & 0x2000ff; newBlock.CRC = Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, @@ -2048,7 +2048,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.GroupID = item.GroupID; itemBlock.GroupOwned = item.GroupOwned; itemBlock.GroupMask = item.GroupPermissions; - itemBlock.Flags = item.Flags & 0xff; + itemBlock.Flags = item.Flags & 0x2000ff; itemBlock.SalePrice = item.SalePrice; itemBlock.SaleType = item.SaleType; itemBlock.CreationDate = item.CreationDate; @@ -2115,7 +2115,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[0].GroupID = item.GroupID; bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; - bulkUpdate.ItemData[0].Flags = item.Flags & 0xff; + bulkUpdate.ItemData[0].Flags = item.Flags & 0x2000ff; bulkUpdate.ItemData[0].SalePrice = item.SalePrice; bulkUpdate.ItemData[0].SaleType = item.SaleType; @@ -2169,7 +2169,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP InventoryReply.InventoryData[0].GroupID = Item.GroupID; InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; - InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff; + InventoryReply.InventoryData[0].Flags = Item.Flags & 0x2000ff; InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; InventoryReply.InventoryData[0].SaleType = Item.SaleType; InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; -- cgit v1.1 From a5fcc0c0c0f41ea3cf490e8061f71a6a2afeca02 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Jul 2014 14:47:35 +0100 Subject: remove avn hack on sitted avatars positions --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 30 +++------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b4a0a98..f7338fc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5132,22 +5132,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP position = presence.OffsetPosition; rotation = presence.Rotation; - - if (presence.ParentID != 0) - { - SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); - if (part != null && part != part.ParentGroup.RootPart) - { - position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; - rotation = part.RotationOffset * presence.Rotation; - } - angularVelocity = Vector3.Zero; - } - else - { - angularVelocity = presence.AngularVelocity; - rotation = presence.Rotation; - } + angularVelocity = presence.AngularVelocity; + rotation = presence.Rotation; attachPoint = 0; // m_log.DebugFormat( @@ -5266,17 +5252,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Vector3 offsetPosition = data.OffsetPosition; Quaternion rotation = data.Rotation; uint parentID = data.ParentID; - - if (parentID != 0) - { - SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); - if (part != null && part != part.ParentGroup.RootPart) - { - offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; - rotation = part.RotationOffset * data.Rotation; - parentID = part.ParentGroup.RootPart.LocalId; - } - } + // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending full update to {0} with position {1} in {2}", Name, data.OffsetPosition, m_scene.Name); -- cgit v1.1 From 3e73e96befad493a2e647567683566dc2b52823f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Jul 2014 01:49:42 +0100 Subject: fix HUD attachment update filter to allow avatar center etc --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f7338fc..779e563 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3805,7 +3805,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart e = (SceneObjectPart)entity; SceneObjectGroup g = e.ParentGroup; - if (g.RootPart.Shape.State > 30) // HUD + if (g.RootPart.Shape.State > 30 && g.RootPart.Shape.State < 39) // HUD if (g.OwnerID != AgentId) return; // Don't send updates for other people's HUDs } @@ -3925,7 +3925,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part.ParentGroup.IsAttachment) { // Someone else's HUD, why are we getting these? if (part.ParentGroup.OwnerID != AgentId && - part.ParentGroup.RootPart.Shape.State > 30) + part.ParentGroup.RootPart.Shape.State > 30 && part.ParentGroup.RootPart.Shape.State < 39) continue; ScenePresence sp; // Owner is not in the sim, don't update it to -- cgit v1.1 From ee951f7a1038eee5f0760674b0cffab9a6d0328f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Jul 2014 17:14:14 +0100 Subject: EventQueueGetModule: dont reuse queues, we dont know whats there; make pool silently loose requests for unknown avatars, or they will stay active until timeout after close ( possible not a big problem after not reusing queues ? ) --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index ffb53af..e0ce35b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -307,12 +307,12 @@ namespace OpenSim.Region.ClientStack.Linden lock (m_AvatarQueueUUIDMapping) { // Reuse open queues. The client does! - if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) - { +// if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) +// { //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); - eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; - } - else +// eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; +// } +// else { eventQueueGetUUID = UUID.Random(); //m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); @@ -345,9 +345,6 @@ namespace OpenSim.Region.ClientStack.Linden public bool HasEvents(UUID requestID, UUID agentID) { - // Don't use this, because of race conditions at agent closing time - //Queue queue = TryGetQueue(agentID); - Queue queue = GetQueue(agentID); if (queue != null) lock (queue) @@ -356,7 +353,8 @@ namespace OpenSim.Region.ClientStack.Linden return queue.Count > 0; } - return false; + m_log.WarnFormat("POLLED FOR EVENTS BY {0} unknown agent", agentID); + return true; } /// @@ -382,7 +380,8 @@ namespace OpenSim.Region.ClientStack.Linden Queue queue = GetQueue(pAgentId); if (queue == null) { - return NoEvents(requestID, pAgentId); + //return NoEvents(requestID, pAgentId); + return null; } OSD element; -- cgit v1.1 From 86a9710e77b76fb8a37faf9dacd22a0973628d92 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Jul 2014 23:32:39 +0100 Subject: change previus code, send a NoEvents response back to http server, even if we know there is no one there, so that the server finishes handling it. --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index e0ce35b..4a2ac86 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -380,8 +380,7 @@ namespace OpenSim.Region.ClientStack.Linden Queue queue = GetQueue(pAgentId); if (queue == null) { - //return NoEvents(requestID, pAgentId); - return null; + return NoEvents(requestID, pAgentId); } OSD element; -- cgit v1.1 From fa59cddc28c107e47f8549b3944fa5f14f561926 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Jul 2014 13:03:40 +0100 Subject: remove old and dead code that its only making it hard to understand --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 305 ++------------------- 1 file changed, 18 insertions(+), 287 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 4a2ac86..ddae267 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -77,7 +77,6 @@ namespace OpenSim.Region.ClientStack.Linden private Dictionary m_ids = new Dictionary(); private Dictionary> queues = new Dictionary>(); - private Dictionary m_QueueUUIDAvatarMapping = new Dictionary(); private Dictionary m_AvatarQueueUUIDMapping = new Dictionary(); #region INonSharedRegionModule methods @@ -254,28 +253,13 @@ namespace OpenSim.Region.ClientStack.Linden lock (queues) queues.Remove(agentID); - List removeitems = new List(); lock (m_AvatarQueueUUIDMapping) m_AvatarQueueUUIDMapping.Remove(agentID); - UUID searchval = UUID.Zero; - - removeitems.Clear(); - - lock (m_QueueUUIDAvatarMapping) + lock (m_ids) { - foreach (UUID ky in m_QueueUUIDAvatarMapping.Keys) - { - searchval = m_QueueUUIDAvatarMapping[ky]; - - if (searchval == agentID) - { - removeitems.Add(ky); - } - } - - foreach (UUID ky in removeitems) - m_QueueUUIDAvatarMapping.Remove(ky); + if (!m_ids.ContainsKey(agentID)) + m_ids.Remove(agentID); } // m_log.DebugFormat("[EVENTQUEUE]: Deleted queues for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); @@ -307,28 +291,18 @@ namespace OpenSim.Region.ClientStack.Linden lock (m_AvatarQueueUUIDMapping) { // Reuse open queues. The client does! -// if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) -// { - //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); -// eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; -// } -// else + // Its reuse caps path not queues those are been reused already + if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) { - eventQueueGetUUID = UUID.Random(); - //m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); + m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); + eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; } - } - - lock (m_QueueUUIDAvatarMapping) - { - if (!m_QueueUUIDAvatarMapping.ContainsKey(eventQueueGetUUID)) - m_QueueUUIDAvatarMapping.Add(eventQueueGetUUID, agentID); - } - - lock (m_AvatarQueueUUIDMapping) - { - if (!m_AvatarQueueUUIDMapping.ContainsKey(agentID)) + else + { + eventQueueGetUUID = UUID.Random(); m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); + m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); + } } caps.RegisterPollHandler( @@ -336,10 +310,14 @@ namespace OpenSim.Region.ClientStack.Linden new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); Random rnd = new Random(Environment.TickCount); + int nrnd = rnd.Next(30000000); + lock (m_ids) { if (!m_ids.ContainsKey(agentID)) - m_ids.Add(agentID, rnd.Next(30000000)); + m_ids.Add(agentID, nrnd); + else + m_ids[agentID] = nrnd; } } @@ -455,254 +433,7 @@ namespace OpenSim.Region.ClientStack.Linden return responsedata; } -// public Hashtable ProcessQueue(Hashtable request, UUID agentID, Caps caps) -// { -// // TODO: this has to be redone to not busy-wait (and block the thread), -// // TODO: as soon as we have a non-blocking way to handle HTTP-requests. -// -//// if (m_log.IsDebugEnabled) -//// { -//// String debug = "[EVENTQUEUE]: Got request for agent {0} in region {1} from thread {2}: [ "; -//// foreach (object key in request.Keys) -//// { -//// debug += key.ToString() + "=" + request[key].ToString() + " "; -//// } -//// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name); -//// } -// -// Queue queue = TryGetQueue(agentID); -// OSD element; -// -// lock (queue) -// element = queue.Dequeue(); // 15s timeout -// -// Hashtable responsedata = new Hashtable(); -// -// int thisID = 0; -// lock (m_ids) -// thisID = m_ids[agentID]; -// -// if (element == null) -// { -// //m_log.ErrorFormat("[EVENTQUEUE]: Nothing to process in " + m_scene.RegionInfo.RegionName); -// if (thisID == -1) // close-request -// { -// m_log.ErrorFormat("[EVENTQUEUE]: 404 in " + m_scene.RegionInfo.RegionName); -// responsedata["int_response_code"] = 404; //501; //410; //404; -// responsedata["content_type"] = "text/plain"; -// responsedata["keepalive"] = false; -// responsedata["str_response_string"] = "Closed EQG"; -// return responsedata; -// } -// responsedata["int_response_code"] = 502; -// responsedata["content_type"] = "text/plain"; -// responsedata["keepalive"] = false; -// responsedata["str_response_string"] = "Upstream error: "; -// responsedata["error_status_text"] = "Upstream error:"; -// responsedata["http_protocol_version"] = "HTTP/1.0"; -// return responsedata; -// } -// -// OSDArray array = new OSDArray(); -// if (element == null) // didn't have an event in 15s -// { -// // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! -// array.Add(EventQueueHelper.KeepAliveEvent()); -// //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); -// } -// else -// { -// array.Add(element); -// -// if (element is OSDMap) -// { -// OSDMap ev = (OSDMap)element; -// m_log.DebugFormat( -// "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}", -// ev["message"], m_scene.GetScenePresence(agentID).Name); -// } -// -// lock (queue) -// { -// while (queue.Count > 0) -// { -// element = queue.Dequeue(); -// -// if (element is OSDMap) -// { -// OSDMap ev = (OSDMap)element; -// m_log.DebugFormat( -// "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}", -// ev["message"], m_scene.GetScenePresence(agentID).Name); -// } -// -// array.Add(element); -// thisID++; -// } -// } -// } -// -// OSDMap events = new OSDMap(); -// events.Add("events", array); -// -// events.Add("id", new OSDInteger(thisID)); -// lock (m_ids) -// { -// m_ids[agentID] = thisID + 1; -// } -// -// responsedata["int_response_code"] = 200; -// responsedata["content_type"] = "application/xml"; -// responsedata["keepalive"] = false; -// responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); -// -// m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); -// -// return responsedata; -// } - -// public Hashtable EventQueuePath2(Hashtable request) -// { -// string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/",""); -// // pull off the last "/" in the path. -// Hashtable responsedata = new Hashtable(); -// capuuid = capuuid.Substring(0, capuuid.Length - 1); -// capuuid = capuuid.Replace("/CAPS/EQG/", ""); -// UUID AvatarID = UUID.Zero; -// UUID capUUID = UUID.Zero; -// -// // parse the path and search for the avatar with it registered -// if (UUID.TryParse(capuuid, out capUUID)) -// { -// lock (m_QueueUUIDAvatarMapping) -// { -// if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID)) -// { -// AvatarID = m_QueueUUIDAvatarMapping[capUUID]; -// } -// } -// -// if (AvatarID != UUID.Zero) -// { -// return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsForUser(AvatarID)); -// } -// else -// { -// responsedata["int_response_code"] = 404; -// responsedata["content_type"] = "text/plain"; -// responsedata["keepalive"] = false; -// responsedata["str_response_string"] = "Not Found"; -// responsedata["error_status_text"] = "Not Found"; -// responsedata["http_protocol_version"] = "HTTP/1.0"; -// return responsedata; -// // return 404 -// } -// } -// else -// { -// responsedata["int_response_code"] = 404; -// responsedata["content_type"] = "text/plain"; -// responsedata["keepalive"] = false; -// responsedata["str_response_string"] = "Not Found"; -// responsedata["error_status_text"] = "Not Found"; -// responsedata["http_protocol_version"] = "HTTP/1.0"; -// return responsedata; -// // return 404 -// } -// } - - public OSD EventQueueFallBack(string path, OSD request, string endpoint) - { - // This is a fallback element to keep the client from loosing EventQueueGet - // Why does CAPS fail sometimes!? - m_log.Warn("[EVENTQUEUE]: In the Fallback handler! We lost the Queue in the rest handler!"); - string capuuid = path.Replace("/CAPS/EQG/",""); - capuuid = capuuid.Substring(0, capuuid.Length - 1); - -// UUID AvatarID = UUID.Zero; - UUID capUUID = UUID.Zero; - if (UUID.TryParse(capuuid, out capUUID)) - { -/* Don't remove this yet code cleaners! - * Still testing this! - * - lock (m_QueueUUIDAvatarMapping) - { - if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID)) - { - AvatarID = m_QueueUUIDAvatarMapping[capUUID]; - } - } - - - if (AvatarID != UUID.Zero) - { - // Repair the CAP! - //OpenSim.Framework.Capabilities.Caps caps = m_scene.GetCapsHandlerForUser(AvatarID); - //string capsBase = "/CAPS/EQG/"; - //caps.RegisterHandler("EventQueueGet", - //new RestHTTPHandler("POST", capsBase + capUUID.ToString() + "/", - //delegate(Hashtable m_dhttpMethod) - //{ - // return ProcessQueue(m_dhttpMethod, AvatarID, caps); - //})); - // start new ID sequence. - Random rnd = new Random(System.Environment.TickCount); - lock (m_ids) - { - if (!m_ids.ContainsKey(AvatarID)) - m_ids.Add(AvatarID, rnd.Next(30000000)); - } - - - int thisID = 0; - lock (m_ids) - thisID = m_ids[AvatarID]; - - BlockingLLSDQueue queue = GetQueue(AvatarID); - OSDArray array = new OSDArray(); - LLSD element = queue.Dequeue(15000); // 15s timeout - if (element == null) - { - - array.Add(EventQueueHelper.KeepAliveEvent()); - } - else - { - array.Add(element); - while (queue.Count() > 0) - { - array.Add(queue.Dequeue(1)); - thisID++; - } - } - OSDMap events = new OSDMap(); - events.Add("events", array); - - events.Add("id", new LLSDInteger(thisID)); - - lock (m_ids) - { - m_ids[AvatarID] = thisID + 1; - } - - return events; - } - else - { - return new LLSD(); - } -* -*/ - } - else - { - //return new LLSD(); - } - - return new OSDString("shutdown404!"); - } - + public void DisableSimulator(ulong handle, UUID avatarID) { OSD item = EventQueueHelper.DisableSimulator(handle); -- cgit v1.1 From 70890e211a495c2120c801ac68b21fc3dbf51cbf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Jul 2014 17:29:41 +0100 Subject: add queue transition code needs review/more testing --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 194 ++++++++++++--------- 1 file changed, 115 insertions(+), 79 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index ddae267..b0d30b6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -176,27 +176,6 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// Always returns a valid queue - /// - /// - /// - private Queue TryGetQueue(UUID agentId) - { - lock (queues) - { - if (!queues.ContainsKey(agentId)) - { - m_log.DebugFormat( - "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", - agentId, m_scene.RegionInfo.RegionName); - queues[agentId] = new Queue(); - } - - return queues[agentId]; - } - } - - /// /// May return a null queue /// /// @@ -278,47 +257,95 @@ namespace OpenSim.Region.ClientStack.Linden public void OnRegisterCaps(UUID agentID, Caps caps) { // Register an event queue for the client - m_log.DebugFormat( "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", agentID, caps, m_scene.RegionInfo.RegionName); - // Let's instantiate a Queue for this agent right now - TryGetQueue(agentID); - UUID eventQueueGetUUID; + Queue queue; + Random rnd = new Random(Environment.TickCount); + int nrnd = rnd.Next(30000000); + if (nrnd < 0) + nrnd = -nrnd; - lock (m_AvatarQueueUUIDMapping) + lock (queues) { - // Reuse open queues. The client does! - // Its reuse caps path not queues those are been reused already - if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) + if (queues.ContainsKey(agentID)) + queue = queues[agentID]; + else + queue = null; + + if (queue == null) { - m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); - eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; + queue = new Queue(); + queues[agentID] = queue; + + // push markers to handle old responses still waiting + // this will cost at most viewer getting two forced noevents + // even being a new queue better be safe + queue.Enqueue(null); + queue.Enqueue(null); // one should be enough + + lock (m_AvatarQueueUUIDMapping) + { + eventQueueGetUUID = UUID.Random(); + if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) + { + // oops this should not happen ? + m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID without a queue"); + eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; + } + m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); + } + lock (m_ids) + { + if (!m_ids.ContainsKey(agentID)) + m_ids.Add(agentID, nrnd); + else + m_ids[agentID] = nrnd; + } } else { - eventQueueGetUUID = UUID.Random(); - m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); - m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); + // push markers to handle old responses still waiting + // this will cost at most viewer getting two forced noevents + // even being a new queue better be safe + queue.Enqueue(null); + queue.Enqueue(null); // one should be enough + + // reuse or not to reuse TODO FIX + lock (m_AvatarQueueUUIDMapping) + { + // Reuse open queues. The client does! + // Its reuse caps path not queues those are been reused already + if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) + { + m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); + eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; + } + else + { + eventQueueGetUUID = UUID.Random(); + m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); + m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); + } + } + lock (m_ids) + { + // change to negative numbers so they are changed at end of sending first marker + // old data on a queue may be sent on a response for a new caps + // but at least will be sent with coerent IDs + if (!m_ids.ContainsKey(agentID)) + m_ids.Add(agentID, -nrnd); // should not happen + else + m_ids[agentID] = -m_ids[agentID]; + } } } caps.RegisterPollHandler( "EventQueueGet", new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); - - Random rnd = new Random(Environment.TickCount); - int nrnd = rnd.Next(30000000); - - lock (m_ids) - { - if (!m_ids.ContainsKey(agentID)) - m_ids.Add(agentID, nrnd); - else - m_ids[agentID] = nrnd; - } } public bool HasEvents(UUID requestID, UUID agentID) @@ -361,55 +388,65 @@ namespace OpenSim.Region.ClientStack.Linden return NoEvents(requestID, pAgentId); } - OSD element; + OSD element = null;; + OSDArray array = new OSDArray(); + int thisID = 0; + bool negativeID = false; + lock (queue) { if (queue.Count == 0) return NoEvents(requestID, pAgentId); - element = queue.Dequeue(); // 15s timeout - } - - int thisID = 0; - lock (m_ids) - thisID = m_ids[pAgentId]; - - OSDArray array = new OSDArray(); - if (element == null) // didn't have an event in 15s - { - // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! - array.Add(EventQueueHelper.KeepAliveEvent()); - //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName); - } - else - { - if (DebugLevel > 0) - LogOutboundDebugMessage(element, pAgentId); - array.Add(element); + lock (m_ids) + thisID = m_ids[pAgentId]; - lock (queue) + if (thisID < 0) { - while (queue.Count > 0) - { - element = queue.Dequeue(); + negativeID = true; + thisID = -thisID; + } + + while (queue.Count > 0) + { + element = queue.Dequeue(); + // add elements until a marker is found + // so they get into a response + if (element == null) + break; + if (DebugLevel > 0) + LogOutboundDebugMessage(element, pAgentId); + array.Add(element); + thisID++; + } + } - if (DebugLevel > 0) - LogOutboundDebugMessage(element, pAgentId); + OSDMap events = null; - array.Add(element); - thisID++; - } - } + if (array.Count > 0) + { + events = new OSDMap(); + events.Add("events", array); + events.Add("id", new OSDInteger(thisID)); } - OSDMap events = new OSDMap(); - events.Add("events", array); + if (negativeID && element == null) + { + Random rnd = new Random(Environment.TickCount); + thisID = rnd.Next(30000000); + if (thisID < 0) + thisID = -thisID; + } - events.Add("id", new OSDInteger(thisID)); lock (m_ids) { m_ids[pAgentId] = thisID + 1; } + + // if there where no elements before a marker send a NoEvents + if (array.Count == 0) + return NoEvents(requestID, pAgentId); + Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 200; responsedata["content_type"] = "application/xml"; @@ -432,7 +469,6 @@ namespace OpenSim.Region.ClientStack.Linden responsedata["http_protocol_version"] = "HTTP/1.0"; return responsedata; } - public void DisableSimulator(ulong handle, UUID avatarID) { -- cgit v1.1 From 55df2b317c720888f42b9a4ec7d750f3657cecb4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 27 Jul 2014 12:02:59 +0100 Subject: dont send packets twice --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 50dae2a..b7c8594 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1079,7 +1079,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // packet so that it isn't sent before a queued update packet. bool requestQueue = type == PacketType.KillObject; if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) - if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) { SendPacketFinal(outgoingPacket); return true; -- cgit v1.1 From 477b5b5623dd58a6ccc8812223df4bb436d450d1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jul 2014 03:40:05 +0200 Subject: Add new fields to parcel update --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 779e563..969d946 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4974,7 +4974,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP IEventQueue eq = Scene.RequestModuleInterface(); if (eq != null) { - eq.ParcelProperties(updateMessage, this.AgentId); + OSD message_body = updateMessage.Serialize(); + // Add new fields here until OMV has them + OSDMap parcelData = (OSDMap)message_body; + parcelData["SeeAVs"] = OSD.FromBoolean(true); + parcelData["AnyAVSounds"] = OSD.FromBoolean(true); + parcelData["GroupAVSounds"] = OSD.FromBoolean(true); + OSDMap message = new OSDMap(); + message.Add("message", OSD.FromString("ParcelProperties")); + message.Add("body", message_body); + eq.Enqueue (message, this.AgentId); + //eq.ParcelProperties(updateMessage, this.AgentId); } else { -- cgit v1.1 From dfa9780c8c09c795bdd0dec6174ee8680c534e47 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jul 2014 04:19:01 +0200 Subject: Send new parcel permissions to activate viewer options - done right this time --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 969d946..3c44c5f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4976,10 +4976,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP { OSD message_body = updateMessage.Serialize(); // Add new fields here until OMV has them - OSDMap parcelData = (OSDMap)message_body; - parcelData["SeeAVs"] = OSD.FromBoolean(true); - parcelData["AnyAVSounds"] = OSD.FromBoolean(true); - parcelData["GroupAVSounds"] = OSD.FromBoolean(true); + OSDMap bodyMap = (OSDMap)message_body; + OSDArray parcelDataArray = (OSDArray)bodyMap["ParcelData"]; + OSDMap parcelData = (OSDMap)parcelDataArray[0]; + parcelData["SeeAVs"] = OSD.FromBoolean(landData.SeeAVs); + parcelData["AnyAVSounds"] = OSD.FromBoolean(landData.AnyAVSounds); + parcelData["GroupAVSounds"] = OSD.FromBoolean(landData.GroupAVSounds); OSDMap message = new OSDMap(); message.Add("message", OSD.FromString("ParcelProperties")); message.Add("body", message_body); -- cgit v1.1 From 30f00bfb14cce582382bd37b1e22062af664ec64 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 30 Jul 2014 21:11:11 +0100 Subject: make HandlerRegionHandshakeReply processing async and delay it a bit. This delays things like terrain height map sending, giving chance to completemovent to send more priority information. POssible things on this should be on other event trigger when its more apropriate really done. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3c44c5f..34a2797 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4879,7 +4879,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { // m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); - + LandData landData = lo.LandData; ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); @@ -5517,7 +5517,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); + +// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); + AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); @@ -6473,6 +6476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { + Thread.Sleep(500); handlerRegionHandShakeReply(this); } -- cgit v1.1 From 9f5e19127d79a8790c31e80a4c6ae8d04d79d6ac Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 00:22:21 +0100 Subject: comment out a debug msg. more on gods being Gods --- .../Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index b0d30b6..ca6c3ca 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -358,7 +358,7 @@ namespace OpenSim.Region.ClientStack.Linden return queue.Count > 0; } - m_log.WarnFormat("POLLED FOR EVENTS BY {0} unknown agent", agentID); + //m_log.WarnFormat("POLLED FOR EVENTS BY {0} unknown agent", agentID); return true; } -- cgit v1.1 From 05a2feba5d780c57c252891a20071800fd9f2e3e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 19:57:47 +0100 Subject: start sending terrain in scenePresence after well defined avatar. Minor change on significante AgentUpdate check. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 +++++++++++++----- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 +++++++++++----------- 2 files changed, 37 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 34a2797..7d61577 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -577,7 +577,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Fire the callback for this connection closing if (OnConnectionClosed != null) + { OnConnectionClosed(this); + } + // Flush all of the packets out of the UDP server for this client if (m_udpServer != null) @@ -5518,8 +5521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); -// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); @@ -5732,10 +5734,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar // Threshold for body rotation to be a significant agent update - private const float QDELTA = 0.000001f; + // private const float QDELTA = 0.000001f; + // QDELTA is now relative to abs of cos of angle between orientations + + private const float QDELTABODY = 1 - 0.0001f; + private const float QDELTAHEAD = 1 - 0.0001f; + // Threshold for camera rotation to be a significant agent update private const float VDELTA = 0.01f; - + /// /// This checks the update significance against the last update made. /// @@ -5755,13 +5762,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); + // float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); + // now using abs of cos + float qdelta1 = (float)Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); + float qdelta2 = (float)Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); bool movementSignificant = - (qdelta1 > QDELTA) // significant if body rotation above threshold - // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack +// (qdelta1 > QDELTA) // significant if body rotation above threshold + (qdelta1 < QDELTABODY) // higher angle lower cos +// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold + || (qdelta2 < QDELTAHEAD) // using cos above || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed @@ -6476,7 +6488,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { - Thread.Sleep(500); +// Thread.Sleep(500); handlerRegionHandShakeReply(this); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b7c8594..a3fdae1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1750,25 +1750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); - // 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); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. - if (client != null) - { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); - 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(); - } - // Now we know we can handle more data - Thread.Sleep(200); +// Thread.Sleep(200); - // Obtain the queue and remove it from the cache + // Obtain the pending queue and remove it from the cache Queue queue = null; lock (m_pendingCache) @@ -1790,6 +1775,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketReceived(buf); } 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); + + // We only want to send initial data to new clients, not ones which are being converted from child to root. + if (client != null) + { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + 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 { -- cgit v1.1 From 3d81f25e34cd7d536ad0e36242703ac1bc56038d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 20:32:11 +0100 Subject: Revert "start sending terrain in scenePresence after well defined avatar. Minor" This reverts commit 05a2feba5d780c57c252891a20071800fd9f2e3e. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 +++++------------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 +++++++++++----------- 2 files changed, 25 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7d61577..34a2797 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -577,10 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Fire the callback for this connection closing if (OnConnectionClosed != null) - { OnConnectionClosed(this); - } - // Flush all of the packets out of the UDP server for this client if (m_udpServer != null) @@ -5521,7 +5518,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); +// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); @@ -5734,15 +5732,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar // Threshold for body rotation to be a significant agent update - // private const float QDELTA = 0.000001f; - // QDELTA is now relative to abs of cos of angle between orientations - - private const float QDELTABODY = 1 - 0.0001f; - private const float QDELTAHEAD = 1 - 0.0001f; - + private const float QDELTA = 0.000001f; // Threshold for camera rotation to be a significant agent update private const float VDELTA = 0.01f; - + /// /// This checks the update significance against the last update made. /// @@ -5762,18 +5755,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - // float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); + float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); - // now using abs of cos - float qdelta1 = (float)Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); - float qdelta2 = (float)Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); bool movementSignificant = -// (qdelta1 > QDELTA) // significant if body rotation above threshold - (qdelta1 < QDELTABODY) // higher angle lower cos -// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack + (qdelta1 > QDELTA) // significant if body rotation above threshold + // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold - || (qdelta2 < QDELTAHEAD) // using cos above || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed @@ -6488,7 +6476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { -// Thread.Sleep(500); + Thread.Sleep(500); handlerRegionHandShakeReply(this); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index a3fdae1..b7c8594 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1750,10 +1750,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); + // 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); + + // We only want to send initial data to new clients, not ones which are being converted from child to root. + if (client != null) + { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + 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(); + } + // Now we know we can handle more data -// Thread.Sleep(200); + Thread.Sleep(200); - // Obtain the pending queue and remove it from the cache + // Obtain the queue and remove it from the cache Queue queue = null; lock (m_pendingCache) @@ -1775,21 +1790,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketReceived(buf); } 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); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. - if (client != null) - { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); - 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 { -- cgit v1.1 From 3cca5ec6674b413a419d3f1c42467e57fb883f56 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 21:52:29 +0100 Subject: check... --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b7c8594..a3fdae1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1750,25 +1750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); - // 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); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. - if (client != null) - { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); - 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(); - } - // Now we know we can handle more data - Thread.Sleep(200); +// Thread.Sleep(200); - // Obtain the queue and remove it from the cache + // Obtain the pending queue and remove it from the cache Queue queue = null; lock (m_pendingCache) @@ -1790,6 +1775,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketReceived(buf); } 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); + + // We only want to send initial data to new clients, not ones which are being converted from child to root. + if (client != null) + { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + 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 { -- cgit v1.1 From bd3d58dd00ceafab961d684208c10fae20f89dc2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 6 Aug 2014 04:54:14 +0100 Subject: try to make the baked textures cache work --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 73 ++++++++++++---------- 1 file changed, 40 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 34a2797..7f25f78 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6535,7 +6535,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; for (int i=0; i AvatarWearable.MAX_WEARABLES) maxWearablesLoop = AvatarWearable.MAX_WEARABLES; - if (bakedTextureModule != null && cache != null) +// if (bakedTextureModule != null && cache != null) + if (cache != null) { // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid WearableCacheItem[] cacheItems = null; ScenePresence p = m_scene.GetScenePresence(AgentId); if (p.Appearance != null) - if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) + { + if (p.Appearance.WearableCacheItems == null) { - try + if (bakedTextureModule != null) { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; - } + try + { + if (p.Appearance.WearableCacheItemsDirty) + { + cacheItems = bakedTextureModule.Get(AgentId); + p.Appearance.WearableCacheItems = cacheItems; + p.Appearance.WearableCacheItemsDirty = false; + } + } - /* - * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! - * - catch (System.Net.Sockets.SocketException) - { - cacheItems = null; - } - catch (WebException) - { - cacheItems = null; - } - catch (InvalidOperationException) - { - cacheItems = null; - } */ - catch (Exception) - { - cacheItems = null; + /* + * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! + * + catch (System.Net.Sockets.SocketException) + { + cacheItems = null; + } + catch (WebException) + { + cacheItems = null; + } + catch (InvalidOperationException) + { + cacheItems = null; + } */ + catch (Exception) + { + cacheItems = null; + } } - } else if (p.Appearance.WearableCacheItems != null) { cacheItems = p.Appearance.WearableCacheItems; } + } if (cache != null && cacheItems != null) { @@ -12077,8 +12088,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP item.TextureAsset.Temporary = true; cache.Store(item.TextureAsset); } - - } } @@ -12136,13 +12145,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - - if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - else - cachedresp.WearableData[i].TextureID = UUID.Zero; +// else +// cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } -- cgit v1.1 From 66dea8fe05dbf0f9783f520cddf4d3aa700015d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 6 Aug 2014 05:17:30 +0100 Subject: some debug to remove later --- OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | 6 ++++++ OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 47988dd..19afe97 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -268,6 +268,12 @@ namespace OpenSim.Region.ClientStack.Linden } } } + + for (int iter = 0; iter < maxCacheitemsLoop; iter++) + { + m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + + cacheItems[iter].TextureID); + } } public void PostInitialise() diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7f25f78..0e8c7ca 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12041,6 +12041,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (bakedTextureModule != null) { + m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); try { if (p.Appearance.WearableCacheItemsDirty) @@ -12072,7 +12073,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - else if (p.Appearance.WearableCacheItems != null) + + if (p.Appearance.WearableCacheItems != null) { cacheItems = p.Appearance.WearableCacheItems; } -- cgit v1.1 From 552b4e45e8700cc71bbbea18b5bad167998a74e4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 6 Aug 2014 05:56:10 +0100 Subject: bakemodule didnt like last changes --- .../ClientStack/Linden/Caps/UploadBakedTextureModule.cs | 8 +++----- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 13 +++++-------- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 19afe97..2da653d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -254,18 +254,16 @@ namespace OpenSim.Region.ClientStack.Linden } } - - p.Appearance.WearableCacheItems = cacheItems; - - - + if (m_BakedTextureModule != null) { m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); p.Appearance.WearableCacheItemsDirty = true; } + else + p.Appearance.WearableCacheItemsDirty = false; } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0e8c7ca..08b6cb4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12037,19 +12037,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP ScenePresence p = m_scene.GetScenePresence(AgentId); if (p.Appearance != null) { - if (p.Appearance.WearableCacheItems == null) + if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) { if (bakedTextureModule != null) { m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); try { - if (p.Appearance.WearableCacheItemsDirty) - { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; - } + cacheItems = bakedTextureModule.Get(AgentId); + p.Appearance.WearableCacheItems = cacheItems; + p.Appearance.WearableCacheItemsDirty = false; } /* @@ -12074,7 +12071,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - if (p.Appearance.WearableCacheItems != null) + else if (p.Appearance.WearableCacheItems != null) { cacheItems = p.Appearance.WearableCacheItems; } -- cgit v1.1 From c3f9c99fb32d15e57b24502b71c79fe028ed3007 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 05:20:45 +0100 Subject: DANGER... changed bakedtextures caching. Assuming grid baking is cache only, reduced number of accesses to it. TESTING --- .../Linden/Caps/UploadBakedTextureModule.cs | 124 ++++++++++----------- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 110 +++++++----------- 2 files changed, 99 insertions(+), 135 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 2da653d..50e9275 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -96,9 +96,7 @@ namespace OpenSim.Region.ClientStack.Linden s.EventManager.OnRemovePresence -= DeRegisterPresence; m_BakedTextureModule = null; m_scene = null; - } - - + } public void RegionLoaded(Scene s) { @@ -110,44 +108,58 @@ namespace OpenSim.Region.ClientStack.Linden private void DeRegisterPresence(UUID agentId) { - ScenePresence presence = null; - if (m_scene.TryGetScenePresence(agentId, out presence)) +// ScenePresence presence = null; +// if (m_scene.TryGetScenePresence(agentId, out presence)) { - presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; +// presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; } } private void RegisterNewPresence(ScenePresence presence) { - presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; - +// presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; } - private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) - { - int maxCacheitemsLoop = cacheItems.Length; - if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES) - { - maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; - m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); - } - - m_BakedTextureModule = m_scene.RequestModuleInterface(); - if (cacheItems.Length > 0) - { - m_log.Debug("[Cacheitems]: " + cacheItems.Length); - for (int iter = 0; iter < maxCacheitemsLoop; iter++) - { - m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + - cacheItems[iter].TextureID); - } - - ScenePresence p = null; - if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) +/* not in use. work done in AvatarFactoryModule ValidateBakedTextureCache() and UpdateBakedTextureCache() + private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) { + // if cacheItems.Length > 0 viewer is giving us current textures information. + // baked ones should had been uploaded and in assets cache as local itens + + + if (cacheItems.Length == 0) + return; // no textures information, nothing to do + + ScenePresence p = null; + if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) + return; // what are we doing if there is no presence to cache for? + + if (p.IsDeleted) + return; // does this really work? + + int maxCacheitemsLoop = cacheItems.Length; + if (maxCacheitemsLoop > 20) + { + maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; + m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); + } + + m_BakedTextureModule = m_scene.RequestModuleInterface(); + + + // some nice debug + m_log.Debug("[Cacheitems]: " + cacheItems.Length); + for (int iter = 0; iter < maxCacheitemsLoop; iter++) + { + m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + + cacheItems[iter].TextureID); + } + + // p.Appearance.WearableCacheItems is in memory primary cashID to textures mapper WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; + if (existingitems == null) { if (m_BakedTextureModule != null) @@ -161,38 +173,22 @@ namespace OpenSim.Region.ClientStack.Linden p.Appearance.WearableCacheItems = savedcache; p.Appearance.WearableCacheItemsDirty = false; } - } - /* - * The following Catch types DO NOT WORK with m_BakedTextureModule.Get - * it jumps to the General Packet Exception Handler if you don't catch Exception! - * - catch (System.Net.Sockets.SocketException) - { - cacheItems = null; - } - catch (WebException) - { - cacheItems = null; - } - catch (InvalidOperationException) - { - cacheItems = null; - } */ + catch (Exception) { - // The service logs a sufficient error message. + // The service logs a sufficient error message. } - + if (savedcache != null) existingitems = savedcache; } } + // Existing items null means it's a fully new appearance if (existingitems == null) { - for (int i = 0; i < maxCacheitemsLoop; i++) { if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) @@ -205,7 +201,7 @@ namespace OpenSim.Region.ClientStack.Linden AppearanceManager.DEFAULT_AVATAR_TEXTURE; continue; } - cacheItems[i].TextureID =face.TextureID; + cacheItems[i].TextureID = face.TextureID; if (m_scene.AssetService != null) cacheItems[i].TextureAsset = m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); @@ -214,15 +210,10 @@ namespace OpenSim.Region.ClientStack.Linden { m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); } - - } } else - - - { - // for each uploaded baked texture + { for (int i = 0; i < maxCacheitemsLoop; i++) { if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) @@ -253,27 +244,24 @@ namespace OpenSim.Region.ClientStack.Linden } } } - p.Appearance.WearableCacheItems = cacheItems; - + if (m_BakedTextureModule != null) { m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); p.Appearance.WearableCacheItemsDirty = true; - + } else p.Appearance.WearableCacheItemsDirty = false; - } - } - - for (int iter = 0; iter < maxCacheitemsLoop; iter++) - { - m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + - cacheItems[iter].TextureID); - } - } + for (int iter = 0; iter < maxCacheitemsLoop; iter++) + { + m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + + cacheItems[iter].TextureID); + } + } + */ public void PostInitialise() { } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 08b6cb4..38a9af3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3684,6 +3684,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; + + // this need be use in future + // avp.AppearanceData[0].AppearanceVersion = 0; + // avp.AppearanceData[0].CofVersion = 0; + //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.Task); } @@ -12006,8 +12011,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); if (cachedtex.AgentData.SessionID != SessionId) - return false; - + return false; // TODO: don't create new blocks if recycling an old packet cachedresp.AgentData.AgentID = AgentId; @@ -12022,23 +12026,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP //WearableCacheItem[] items = fac.GetCachedItems(AgentId); IAssetService cache = m_scene.AssetService; - IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); //bakedTextureModule = null; int maxWearablesLoop = cachedtex.WearableData.Length; if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) maxWearablesLoop = AvatarWearable.MAX_WEARABLES; -// if (bakedTextureModule != null && cache != null) + int cacheHits = 0; + if (cache != null) { // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid WearableCacheItem[] cacheItems = null; + ScenePresence p = m_scene.GetScenePresence(AgentId); - if (p.Appearance != null) + + if (p!= null && p.Appearance != null) { - if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) + /* we should only check bakedTextureModule at login or when appearance changes + if (p.Appearance.WearableCacheItems == null) // currently with a caching only bakemodule Appearance.Wearables.dirty as no use { + IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); if (bakedTextureModule != null) { m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); @@ -12047,23 +12055,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP cacheItems = bakedTextureModule.Get(AgentId); p.Appearance.WearableCacheItems = cacheItems; p.Appearance.WearableCacheItemsDirty = false; - } - /* - * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! - * - catch (System.Net.Sockets.SocketException) - { - cacheItems = null; - } - catch (WebException) - { - cacheItems = null; + if (cacheItems != null) + { + foreach (WearableCacheItem item in cacheItems) + { + if (item.TextureAsset != null) + { + item.TextureAsset.Temporary = true; + item.TextureAsset.Local = true; + cache.Store(item.TextureAsset); + } + } + } } - catch (InvalidOperationException) - { - cacheItems = null; - } */ + catch (Exception) { cacheItems = null; @@ -12075,36 +12081,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cacheItems = p.Appearance.WearableCacheItems; } +*/ + cacheItems = p.Appearance.WearableCacheItems; } - if (cache != null && cacheItems != null) - { - foreach (WearableCacheItem item in cacheItems) - { - - if (cache.GetCached(item.TextureID.ToString()) == null) - { - item.TextureAsset.Temporary = true; - cache.Store(item.TextureAsset); - } - } - } - if (cacheItems != null) { - for (int i = 0; i < maxWearablesLoop; i++) { - WearableCacheItem item = - WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); + int idx = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].HostName = new byte[0]; - if (item != null && cachedtex.WearableData[i].ID == item.CacheId) + if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) { - - cachedresp.WearableData[i].TextureID = item.TextureID; + cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; + cacheHits++; } else { @@ -12124,36 +12117,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - else + else // no cache { - if (cache == null) + for (int i = 0; i < maxWearablesLoop; i++) { - for (int i = 0; i < maxWearablesLoop; i++) - { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; - //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; - } - } - else - { - for (int i = 0; i < maxWearablesLoop; i++) - { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - - if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) - cachedresp.WearableData[i].TextureID = UUID.Zero; - //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); -// else -// cachedresp.WearableData[i].TextureID = UUID.Zero; - // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; - } + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].HostName = new byte[0]; } } + + m_log.DebugFormat("texture cached: hits {0}", cacheHits); + cachedresp.Header.Zerocoded = true; OutPacket(cachedresp, ThrottleOutPacketType.Task); -- cgit v1.1 From 1408c9eee7eb8b73b49255f6c7bf81f4a759d01c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 07:55:56 +0100 Subject: reply to cached checks with same serial number --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 38a9af3..def1f8e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12016,8 +12016,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // TODO: don't create new blocks if recycling an old packet cachedresp.AgentData.AgentID = AgentId; cachedresp.AgentData.SessionID = m_sessionId; - cachedresp.AgentData.SerialNum = m_cachedTextureSerial; - m_cachedTextureSerial++; +// cachedresp.AgentData.SerialNum = m_cachedTextureSerial; +// m_cachedTextureSerial++; + cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; @@ -12094,7 +12095,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].HostName = new byte[0]; - if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) + if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) { cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; cacheHits++; -- cgit v1.1 From dfa9ba0937f6e2d30e1d541d64533ede4ecb671e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 08:47:03 +0100 Subject: minor clean, dont check for cache if we aren't using it.. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 104 +++++---------------- 1 file changed, 22 insertions(+), 82 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index def1f8e..e9a087b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12011,120 +12011,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); if (cachedtex.AgentData.SessionID != SessionId) - return false; + return false; // TODO: don't create new blocks if recycling an old packet cachedresp.AgentData.AgentID = AgentId; cachedresp.AgentData.SessionID = m_sessionId; -// cachedresp.AgentData.SerialNum = m_cachedTextureSerial; -// m_cachedTextureSerial++; cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; - //IAvatarFactoryModule fac = m_scene.RequestModuleInterface(); - // var item = fac.GetBakedTextureFaces(AgentId); - //WearableCacheItem[] items = fac.GetCachedItems(AgentId); - - IAssetService cache = m_scene.AssetService; - //bakedTextureModule = null; int maxWearablesLoop = cachedtex.WearableData.Length; if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) maxWearablesLoop = AvatarWearable.MAX_WEARABLES; int cacheHits = 0; - if (cache != null) - { - // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid - - WearableCacheItem[] cacheItems = null; - - ScenePresence p = m_scene.GetScenePresence(AgentId); - - if (p!= null && p.Appearance != null) - { - /* we should only check bakedTextureModule at login or when appearance changes - if (p.Appearance.WearableCacheItems == null) // currently with a caching only bakemodule Appearance.Wearables.dirty as no use - { - IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); - if (bakedTextureModule != null) - { - m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); - try - { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; + // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid - if (cacheItems != null) - { - foreach (WearableCacheItem item in cacheItems) - { - if (item.TextureAsset != null) - { - item.TextureAsset.Temporary = true; - item.TextureAsset.Local = true; - cache.Store(item.TextureAsset); - } - } - } - } + WearableCacheItem[] cacheItems = null; - catch (Exception) - { - cacheItems = null; - } - } - } + ScenePresence p = m_scene.GetScenePresence(AgentId); - else if (p.Appearance.WearableCacheItems != null) - { - cacheItems = p.Appearance.WearableCacheItems; - } -*/ - cacheItems = p.Appearance.WearableCacheItems; - } + if (p != null && p.Appearance != null) + { + cacheItems = p.Appearance.WearableCacheItems; + } - if (cacheItems != null) + if (cacheItems != null) + { + for (int i = 0; i < maxWearablesLoop; i++) { - for (int i = 0; i < maxWearablesLoop; i++) - { - int idx = cachedtex.WearableData[i].TextureIndex; + int idx = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].HostName = new byte[0]; - if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) - { - cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; - cacheHits++; - } - else - { - cachedresp.WearableData[i].TextureID = UUID.Zero; - } + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].HostName = new byte[0]; + if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) + { + cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; + cacheHits++; } - } - else - { - for (int i = 0; i < maxWearablesLoop; i++) + else { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].TextureID = UUID.Zero; - //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; } } } - else // no cache + else { for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } -- cgit v1.1 From 5628c0bcd68b032c0d819656d53b5b39bc83d68d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 7 Aug 2014 23:54:38 +0200 Subject: Reduce delay time on regin handshake reply to speed up terrain sending. Terrain IS more important than avatar! --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e9a087b..8a28faf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6481,7 +6481,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { - Thread.Sleep(500); + Thread.Sleep(100); handlerRegionHandShakeReply(this); } -- cgit v1.1 From 2eb1c1c37765a42fd24467f26cf53e7443d5a75b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 9 Aug 2014 15:15:27 +0100 Subject: move from RegisterInventoryServiceHandlers to RegisterRegionServiceHandlers what belongs there ( readabilitly only ) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 613bc24..3949f8b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -248,7 +248,19 @@ namespace OpenSim.Region.ClientStack.Linden //m_capsHandlers["MapLayer"] = // new LLSDStreamhandler("POST", // capsBase + m_mapLayerPath, - // GetMapLayer); + // GetMapLayer); + + IRequestHandler getObjectPhysicsDataHandler + = new RestStreamHandler( + "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null); + m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); + + IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); + m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); + IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); + m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + + IRequestHandler req = new RestStreamHandler( "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); @@ -283,14 +295,7 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); - IRequestHandler getObjectPhysicsDataHandler - = new RestStreamHandler( - "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null); - m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); - IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); - m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); - IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); - m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); + IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler( -- cgit v1.1 From 601c50dc1e2e590a227a7b641be68cbcde6c279d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 9 Aug 2014 16:19:07 +0100 Subject: return even zero costs ( prims on other regions ) --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 3949f8b..0141940 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1448,7 +1448,7 @@ namespace OpenSim.Region.ClientStack.Linden } } - if (simul != 0) + // if (simul != 0) { OSDMap object_data = new OSDMap(); -- cgit v1.1 From c84a3c3630fe678d618667ee472a0852f2921f64 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 9 Aug 2014 16:22:46 +0100 Subject: also on other case --- .../Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0141940..61b9045 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1384,6 +1384,17 @@ namespace OpenSim.Region.ClientStack.Linden resp[uuid.ToString()] = object_data; } + else + { + OSDMap object_data = new OSDMap(); + object_data["linked_set_resource_cost"] = 0; + object_data["resource_cost"] = 0; + object_data["physics_cost"] = 0; + object_data["linked_set_physics_cost"] = 0; + + resp[uuid.ToString()] = object_data; + } + } } -- cgit v1.1 From ebc18a80bf87ca204c5d590bec0b2415f010ff83 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 10 Aug 2014 14:49:58 +0100 Subject: OutgoingPacketHandler can not be paced by hits on SendPacket() --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index a3fdae1..e317fc0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1418,6 +1418,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP queue.Enqueue(buffer); return; } + else if (packet.Type == PacketType.CompleteAgentMovement) { // Send ack straight away to let the viewer know that we got it. @@ -2150,13 +2151,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If nothing was sent, sleep for the minimum amount of time before a // token bucket could get more tokens - //if (!m_packetSent) - // Thread.Sleep((int)TickCountResolution); + + if (!m_packetSent) +// Thread.Sleep((int)TickCountResolution); + Thread.Sleep(20); // be independent of TickCountResolution // // Instead, now wait for data present to be explicitly signalled. Evidence so far is that with // modern mono it reduces CPU base load since there is no more continuous polling. - if (!m_packetSent) - m_dataPresentEvent.WaitOne(100); + // this misses heavy load cases +// if (!m_packetSent) +// m_dataPresentEvent.WaitOne(100); Watchdog.UpdateThread(); } -- cgit v1.1 From c0378d54304b2b6bde4a3c24eb137f664716ae81 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 10 Aug 2014 16:36:20 +0100 Subject: actually let delay match throttles as original design --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index e317fc0..0bb53c4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -301,8 +301,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// This allows the outbound loop to only operate when there is data to send rather than continuously polling. /// Some data is sent immediately and not queued. That data would not trigger this event. + /// WRONG use. May be usefull in future revision /// - private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); +// private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); private Pool m_incomingPacketPool; @@ -990,8 +991,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketPool.Instance.ReturnPacket(packet); - if (packetQueued) - m_dataPresentEvent.Set(); + /// WRONG use. May be usefull in future revision +// if (packetQueued) +// m_dataPresentEvent.Set(); } /// @@ -2153,14 +2155,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // token bucket could get more tokens if (!m_packetSent) -// Thread.Sleep((int)TickCountResolution); - Thread.Sleep(20); // be independent of TickCountResolution - // - // Instead, now wait for data present to be explicitly signalled. Evidence so far is that with - // modern mono it reduces CPU base load since there is no more continuous polling. - // this misses heavy load cases -// if (!m_packetSent) -// m_dataPresentEvent.WaitOne(100); + Thread.Sleep((int)TickCountResolution); + + // .... wrong core code removed + Watchdog.UpdateThread(); } -- cgit v1.1 From dbbfaf3ac375a8d8f95327c334183e74b9fa70be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 22:17:15 +0100 Subject: force AgentUpdate after CompleteAgentMovement to pass by significance test --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8a28faf..89deafd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5764,14 +5764,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); bool movementSignificant = - (qdelta1 > QDELTA) // significant if body rotation above threshold - // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold - || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed + (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands - || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed + || (qdelta1 > QDELTA) // significant if body rotation above threshold + // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack + // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold + || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed ; //if (movementSignificant) //{ @@ -6751,6 +6751,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { + + m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; + m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; + Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { -- cgit v1.1 From b9224a70c488ac53726dcf53e18c718bbb9948d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 22:27:50 +0100 Subject: no need to go from cos into squared sin when just abs of cos is as good --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 89deafd..0b82ce9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5737,7 +5737,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar // Threshold for body rotation to be a significant agent update - private const float QDELTA = 0.000001f; + // use the abs of cos + private const float QDELTABody = 1.0f - 0.0001f; + private const float QDELTAHead = 1.0f - 0.0001f; // Threshold for camera rotation to be a significant agent update private const float VDELTA = 0.01f; @@ -5760,17 +5762,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); - //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); + float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); + //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); bool movementSignificant = (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed - || (qdelta1 > QDELTA) // significant if body rotation above threshold + || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold + // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed ; //if (movementSignificant) -- cgit v1.1 From f811efde852e921d6deb82b45b31629bdd04ab11 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 22:36:17 +0100 Subject: do the significance test invalidation at MoveAgentToRegion --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0b82ce9..f5bb70b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -856,6 +856,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { + m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; + m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; + AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); mov.SimData.ChannelVersion = m_channelVersion; mov.AgentData.SessionID = m_sessionId; @@ -6753,10 +6756,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { - - m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; - m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; - Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { -- cgit v1.1 From 20b3cab5d1cb1bbbe951a90ae6de7ffb495e6375 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 23:57:41 +0100 Subject: take agentUpdate checks out of llUDPserver (disabling useless debug) and do it only where its supposed to be done.. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 56 ++++++++++++---------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 22 ++------- 2 files changed, 35 insertions(+), 43 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f5bb70b..9462bdc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5819,55 +5819,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP return cameraSignificant; } - private bool HandleAgentUpdate(IClientAPI sener, Packet packet) - { + private bool HandleAgentUpdate(IClientAPI sender, Packet packet) + { // We got here, which means that something in agent update was significant AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; if (x.AgentID != AgentId || x.SessionID != SessionId) + { + PacketPool.Instance.ReturnPacket(packet); return false; + } + + TotalAgentUpdates++; - // Before we update the current m_thisAgentUpdateArgs, let's check this again - // to see what exactly changed bool movement = CheckAgentMovementUpdateSignificance(x); bool camera = CheckAgentCameraUpdateSignificance(x); - m_thisAgentUpdateArgs.AgentID = x.AgentID; - m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; - m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; - m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; - m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; - m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; - m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; - m_thisAgentUpdateArgs.Far = x.Far; - m_thisAgentUpdateArgs.Flags = x.Flags; - m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; - m_thisAgentUpdateArgs.SessionID = x.SessionID; - m_thisAgentUpdateArgs.State = x.State; - - UpdateAgent handlerAgentUpdate = OnAgentUpdate; - UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; - UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; - // Was there a significant movement/state change? if (movement) { + m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; + m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; + m_thisAgentUpdateArgs.Far = x.Far; + m_thisAgentUpdateArgs.Flags = x.Flags; + m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; + m_thisAgentUpdateArgs.SessionID = x.SessionID; + m_thisAgentUpdateArgs.State = x.State; + + UpdateAgent handlerAgentUpdate = OnAgentUpdate; + UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; + if (handlerPreAgentUpdate != null) OnPreAgentUpdate(this, m_thisAgentUpdateArgs); if (handlerAgentUpdate != null) OnAgentUpdate(this, m_thisAgentUpdateArgs); + + handlerAgentUpdate = null; + handlerPreAgentUpdate = null; } + // Was there a significant camera(s) change? if (camera) + { + m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; + m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; + m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; + m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; + + UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; + if (handlerAgentCameraUpdate != null) handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); - handlerAgentUpdate = null; - handlerPreAgentUpdate = null; - handlerAgentCameraUpdate = null; + handlerAgentCameraUpdate = null; + } PacketPool.Instance.ReturnPacket(packet); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 0bb53c4..15d0316 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -731,7 +731,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP "debug lludp status", "Return status of LLUDP packet processing.", HandleStatusCommand); - +/* disabled MainConsole.Instance.Commands.AddCommand( "Debug", false, @@ -739,6 +739,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP "debug lludp toggle agentupdate", "Toggle whether agentupdate packets are processed or simply discarded.", HandleAgentUpdateCommand); + */ } private void HandlePacketCommand(string module, string[] args) @@ -1553,24 +1554,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length); #endregion BinaryStats - if (packet.Type == PacketType.AgentUpdate) - { - if (m_discardAgentUpdates) - return; - - ((LLClientView)client).TotalAgentUpdates++; - - AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; - - LLClientView llClient = client as LLClientView; - if (agentUpdate.AgentData.SessionID != client.SessionId - || agentUpdate.AgentData.AgentID != client.AgentId - || !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) ) - { - PacketPool.Instance.ReturnPacket(packet); - return; - } - } +// AgentUpdate mess removed from here #region Ping Check Handling -- cgit v1.1 From 0760fa3106955147d9a4dc96e5ef81635275c164 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 13 Aug 2014 00:17:03 +0100 Subject: process AgentUpdates in order with rest of packets. Only give higher priority to chat --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 15d0316..2e9ac4c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1595,11 +1595,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP incomingPacket = new IncomingPacket((LLClientView)client, packet); } - if (incomingPacket.Packet.Type == PacketType.AgentUpdate || - incomingPacket.Packet.Type == PacketType.ChatFromViewer) +// if (incomingPacket.Packet.Type == PacketType.AgentUpdate || +// incomingPacket.Packet.Type == PacketType.ChatFromViewer) + if (incomingPacket.Packet.Type == PacketType.ChatFromViewer) packetInbox.EnqueueHigh(incomingPacket); else packetInbox.EnqueueLow(incomingPacket); + } #region BinaryStats -- cgit v1.1 From cf48b814ebbc28761571c1b219376da445f844c9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 13 Aug 2014 01:42:16 +0100 Subject: remove HandleCompleteMovementIntoRegion delay hack from llUDPserver. If we need a delay, we need to do it at end of HandleUseCircuitCode before feeding pending packets (including that one) into processing queue. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++-- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 22 +++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9462bdc..73d7a6c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5845,7 +5845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_thisAgentUpdateArgs.Far = x.Far; m_thisAgentUpdateArgs.Flags = x.Flags; m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; - m_thisAgentUpdateArgs.SessionID = x.SessionID; +// m_thisAgentUpdateArgs.SessionID = x.SessionID; m_thisAgentUpdateArgs.State = x.State; UpdateAgent handlerAgentUpdate = OnAgentUpdate; @@ -6762,8 +6762,10 @@ 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"); + Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 2e9ac4c..fe79f87 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1422,6 +1422,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } +/* else if (packet.Type == PacketType.CompleteAgentMovement) { // Send ack straight away to let the viewer know that we got it. @@ -1435,6 +1436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } + */ } // Determine which agent this packet came from @@ -1718,7 +1720,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { - // DateTime startTime = DateTime.Now; +// DateTime startTime = DateTime.Now; object[] array = (object[])o; endPoint = (IPEndPoint)array[0]; UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; @@ -1738,9 +1740,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.SessionID, endPoint, sessionInfo); - + // 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; @@ -1751,6 +1753,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); return; + } m_pendingCache.Remove(endPoint); } @@ -1758,11 +1761,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets - while(queue.Count > 0) + while (queue.Count > 0) { UDPPacketBuffer buf = queue.Dequeue(); PacketReceived(buf); } + queue = null; // Send ack straight away to let the viewer know that the connection is active. @@ -1788,8 +1792,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); lock (m_pendingCache) m_pendingCache.Remove(endPoint); - } - + } // m_log.DebugFormat( // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); @@ -1806,8 +1809,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP e.StackTrace); } } - - private void HandleCompleteMovementIntoRegion(object o) +/* + private void HandleCompleteMovementIntoRegion(object o) { IPEndPoint endPoint = null; IClientAPI client = null; @@ -1916,6 +1919,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP e.StackTrace); } } +*/ /// /// Send an ack immediately to the given endpoint. @@ -2053,7 +2057,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_incomingPacketPool.ReturnObject(incomingPacket); } } - catch (Exception ex) + catch(Exception ex) { m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex); } -- cgit v1.1 From ecae45a21e4dff4986ff90f10a6eae54f95b391c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 13 Aug 2014 03:05:25 +0200 Subject: Revert "make HandlerRegionHandshakeReply processing async and delay it a bit. This" This reverts commit 30f00bfb14cce582382bd37b1e22062af664ec64. Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8a28faf..aa742ef 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4884,7 +4884,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { // m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); - + LandData landData = lo.LandData; ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); @@ -5522,10 +5522,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); - -// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); - + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); @@ -6481,7 +6478,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { - Thread.Sleep(100); handlerRegionHandShakeReply(this); } -- cgit v1.1 From 8c657e48377213e7ee66c05a4047085cee6084ea Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 20:41:36 +0100 Subject: add a estimator of client ping time, and painfully make it visible in show connections console command --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++++++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 16 ++++++++++++++++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 18 +++++++++++++----- 3 files changed, 41 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 59d1c69..e69bf23 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -419,6 +419,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } + public int PingTimeMS + { + get + { + if (UDPClient != null) + return UDPClient.PingTimeMS; + return 0; + } + } + /// /// Entity update queues /// @@ -461,6 +471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_disableFacelights = value; } } + public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } @@ -1638,6 +1649,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP pc.PingID.OldestUnacked = 0; OutPacket(pc, ThrottleOutPacketType.Unknown); + UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); } public void SendKillObject(List localIDs) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index bd4e617..9cf65d7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -163,6 +163,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_maxRTO = 60000; public bool m_deliverPackets = true; + public int m_lastStartpingTimeMS; + public int m_pingMS; + + public int PingTimeMS + { + get + { + if (m_pingMS < 20) + return 20; + if(m_pingMS > 2000) + return 2000; + return m_pingMS; + } + } + /// /// This is the percentage of the udp texture queue to add to the task queue since /// textures are now generally handled through http. @@ -225,6 +240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize this to a sane value to prevent early disconnects TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; + m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0; } /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index fe79f87..910d7cf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -293,6 +293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings protected bool m_sendPing; + private ExpiringCache> m_pendingCache = new ExpiringCache>(); /// @@ -369,16 +370,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Measure the resolution of Environment.TickCount TickCountResolution = 0f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { int start = Environment.TickCount; int now = start; while (now == start) now = Environment.TickCount; - TickCountResolution += (float)(now - start) * 0.2f; + TickCountResolution += (float)(now - start) * 0.1f; } - m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); TickCountResolution = (float)Math.Ceiling(TickCountResolution); + m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); #endregion Environment.TickCount Measurement @@ -386,6 +387,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP int sceneThrottleBps = 0; bool usePools = false; + + IConfig config = configSource.Configs["ClientStack.LindenUDP"]; if (config != null) { @@ -1128,6 +1131,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP pc.PingID.OldestUnacked = 0; SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); + udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); } public void CompletePing(LLUDPClient udpClient, byte pingID) @@ -1567,7 +1571,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We don't need to do anything else with ping checks StartPingCheckPacket startPing = (StartPingCheckPacket)packet; CompletePing(udpClient, startPing.PingID.PingID); - + if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) { udpClient.SendPacketStats(); @@ -1577,7 +1581,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else if (packet.Type == PacketType.CompletePingCheck) { - // We don't currently track client ping times + int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); + int c = udpClient.m_pingMS; + c = 900 * c + 100 * t; + c /= 1000; + udpClient.m_pingMS = c; return; } -- cgit v1.1 From a46d6004dfdc353678271e36aafff5eaafd3fd91 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 21:04:30 +0100 Subject: reduce ping filter time constant --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 910d7cf..bd192dc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1583,7 +1583,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); int c = udpClient.m_pingMS; - c = 900 * c + 100 * t; + c = 800 * c + 200 * t; c /= 1000; udpClient.m_pingMS = c; return; -- cgit v1.1 From 0ae8fed4c20f53921193b7b8f0b5b2f4ab1b61b3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 21:18:58 +0100 Subject: reduce ping cliping lower limit --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 9cf65d7..fe31bd9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -170,8 +170,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { get { - if (m_pingMS < 20) - return 20; + if (m_pingMS < 10) + return 10; if(m_pingMS > 2000) return 2000; return m_pingMS; -- cgit v1.1 From 1edaf29149c767a2742b44d69308edb2e2d64428 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 13:43:26 +0100 Subject: NextAnimationSequenceNumber be a udpserver variable with random start --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++++-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e69bf23..6f41ac8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -358,7 +358,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // protected HashSet m_attachmentsSent; private bool m_deliverPackets = true; - private int m_animationSequenceNumber = 1; + private bool m_SendLogoutPacketWhenClosing = true; /// @@ -450,7 +450,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string Name { get { return FirstName + " " + LastName; } } public uint CircuitCode { get { return m_circuitCode; } } - public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } + public int NextAnimationSequenceNumber + { + get { return m_udpServer.NextAnimationSequenceNumber; } + } /// /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd192dc..3b0312d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -293,6 +293,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings protected bool m_sendPing; + private int m_animationSequenceNumber; + + public int NextAnimationSequenceNumber + { + get + { + m_animationSequenceNumber++; + if (m_animationSequenceNumber > 2147482624) + m_animationSequenceNumber = 1; + return m_animationSequenceNumber; + } + } + + private ExpiringCache> m_pendingCache = new ExpiringCache>(); @@ -438,6 +452,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_throttle = new TokenBucket(null, sceneThrottleBps); ThrottleRates = new ThrottleRates(configSource); + Random rnd = new Random(Util.EnvironmentTickCount()); + m_animationSequenceNumber = rnd.Next(11474826); + if (usePools) EnablePools(); } -- cgit v1.1 From 4c46ebdbf501733e1b9d7e23943da095c4f60bce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 03:47:26 +0100 Subject: fix a missed blocking of sending updates the the new attach points above hud indexes --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6f41ac8..8f69b3e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3828,8 +3828,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart e = (SceneObjectPart)entity; SceneObjectGroup g = e.ParentGroup; - if (g.RootPart.Shape.State > 30 && g.RootPart.Shape.State < 39) // HUD - if (g.OwnerID != AgentId) + if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) return; // Don't send updates for other people's HUDs } -- cgit v1.1 From 505cbf9983ffd70d473299e517bf792f3f04d46d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 03:58:16 +0100 Subject: still another ... --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8f69b3e..608b739 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3946,8 +3946,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part.ParentGroup.IsAttachment) { // Someone else's HUD, why are we getting these? - if (part.ParentGroup.OwnerID != AgentId && - part.ParentGroup.RootPart.Shape.State > 30 && part.ParentGroup.RootPart.Shape.State < 39) + if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint) continue; ScenePresence sp; // Owner is not in the sim, don't update it to -- cgit v1.1 From 8f0d35e59a77ec44c7ee55296a02882b424b469f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 09:04:20 +0100 Subject: fix the encoding of rotation in updates, not just using the next field to override w bytes. ( specially having it commented ) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 608b739..6eb0c5e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5291,16 +5291,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] objectData = new byte[76]; + Vector3 velocity = data.Velocity; + Vector3 acceleration = new Vector3(0, 0, 0); + rotation.Normalize(); + Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); + data.CollisionPlane.ToBytes(objectData, 0); offsetPosition.ToBytes(objectData, 16); - Vector3 velocity = new Vector3(0, 0, 0); - Vector3 acceleration = new Vector3(0, 0, 0); velocity.ToBytes(objectData, 28); acceleration.ToBytes(objectData, 40); -// data.Velocity.ToBytes(objectData, 28); -// data.Acceleration.ToBytes(objectData, 40); - rotation.ToBytes(objectData, 52); - //data.AngularVelocity.ToBytes(objectData, 64); + vrot.ToBytes(objectData, 52); + data.AngularVelocity.ToBytes(objectData, 64); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); @@ -5356,15 +5357,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP data.RelativePosition.ToBytes(objectData, 0); data.Velocity.ToBytes(objectData, 12); data.Acceleration.ToBytes(objectData, 24); - try - { - data.RotationOffset.ToBytes(objectData, 36); - } - catch (Exception e) - { - m_log.Warn("[LLClientView]: exception converting quaternion to bytes, using Quaternion.Identity. Exception: " + e.ToString()); - OpenMetaverse.Quaternion.Identity.ToBytes(objectData, 36); - } + + Quaternion rotation = data.RotationOffset; + rotation.Normalize(); + Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); + vrot.ToBytes(objectData, 36); data.AngularVelocity.ToBytes(objectData, 48); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); -- cgit v1.1 From 919aef157385c694b598439e3a50a2fe7a4f9e98 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 10:03:04 +0100 Subject: send zero velocity again on avatar full update or its ugly --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6eb0c5e..b0cb4ea 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5291,7 +5291,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] objectData = new byte[76]; - Vector3 velocity = data.Velocity; + Vector3 velocity = new Vector3(0, 0, 0); Vector3 acceleration = new Vector3(0, 0, 0); rotation.Normalize(); Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); -- cgit v1.1 From 542118adf1791075bfb904d805a2c29cf303237e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Aug 2014 18:55:06 +0100 Subject: remove from use the UpdatesResend on resending udp packets. Just resend the UDP packet. Also just loose packets we tried to send 6 times already (ll says 3) A viewer may just beeing ignoring them, or then the link is just dead. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 80 ++++++++++++---------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 +++ 2 files changed, 54 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b0cb4ea..475cfe2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3838,47 +3838,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } - /// - /// Requeue an EntityUpdate when it was not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdate(EntityUpdate update) - { - // If the update exists in priority queue, it will be updated. - // If it does not exist then it will be added with the current (rather than its original) priority - uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); + /* dont use this + udp packet resent must be done at udp level only + re map from a packet to original updates just doesnt work - lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, update); - } + /// + /// Requeue an EntityUpdate when it was not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdate(EntityUpdate update) + { + // If the update exists in priority queue, it will be updated. + // If it does not exist then it will be added with the current (rather than its original) priority + uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); - /// - /// Requeue a list of EntityUpdates when they were not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) - { - // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Enqueue(priority, update); + } - // Remove the update packet from the list of packets waiting for acknowledgement - // because we are requeuing the list of updates. They will be resent in new packets - // with the most recent state and priority. - m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); - // Count this as a resent packet since we are going to requeue all of the updates contained in it - Interlocked.Increment(ref m_udpClient.PacketsResent); + /// + /// Requeue a list of EntityUpdates when they were not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) + { + // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); - // We're not going to worry about interlock yet since its not currently critical that this total count - // is 100% correct - m_udpServer.PacketsResentCount++; + // Remove the update packet from the list of packets waiting for acknowledgement + // because we are requeuing the list of updates. They will be resent in new packets + // with the most recent state and priority. + m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); - foreach (EntityUpdate update in updates) - ResendPrimUpdate(update); - } + // Count this as a resent packet since we are going to requeue all of the updates contained in it + Interlocked.Increment(ref m_udpClient.PacketsResent); + + // We're not going to worry about interlock yet since its not currently critical that this total count + // is 100% correct + m_udpServer.PacketsResentCount++; + + foreach (EntityUpdate update in updates) + ResendPrimUpdate(update); + } + */ // OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); // OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -4197,7 +4203,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); +// OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); + // use default udp retry + OutPacket(packet, ThrottleOutPacketType.Task, true); } #endregion Packet Sending diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3b0312d..bf44152 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1207,6 +1207,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed", // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount); + // Bump up the resend count on this packet + Interlocked.Increment(ref outgoingPacket.ResendCount); + + // loose packets we retried more than 6 times + // sl says 3 so lets be more tolerant + // we can't not keep hammering with packets a viewer may just beeing ignoring + + if (outgoingPacket.ResendCount > 6) + return; + // Set the resent flag outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT); outgoingPacket.Category = ThrottleOutPacketType.Resend; -- cgit v1.1 From ea1c232f92549d0282532779169ebf4b1811d0c4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Aug 2014 00:08:43 +0100 Subject: revert droping udp packet resends after 6 retries, keep resending. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bf44152..3b0312d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1207,16 +1207,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed", // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount); - // Bump up the resend count on this packet - Interlocked.Increment(ref outgoingPacket.ResendCount); - - // loose packets we retried more than 6 times - // sl says 3 so lets be more tolerant - // we can't not keep hammering with packets a viewer may just beeing ignoring - - if (outgoingPacket.ResendCount > 6) - return; - // Set the resent flag outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT); outgoingPacket.Category = ThrottleOutPacketType.Resend; -- cgit v1.1 From 5bf145a3977a55c474106bbe2a6c107dd9457f0d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Aug 2014 00:49:10 +0100 Subject: add a direct sendpartfullUpdate to send a full object update to a part, optionally overriding its parentID. check what it does to attachments --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 475cfe2..06f1301 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4208,9 +4208,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task, true); } + + #endregion Packet Sending + } + // hack.. dont use + public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) + { + if (ent is SceneObjectPart) + { + SceneObjectPart part = (SceneObjectPart)ent; + ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = 1; + packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; + + ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId); + if (parentID.HasValue) + { + blk.ParentID = parentID.Value; + } + + packet.ObjectData[0] = blk; + + OutPacket(packet, ThrottleOutPacketType.Task, true); + } + } + public void ReprioritizeUpdates() { lock (m_entityUpdates.SyncRoot) -- cgit v1.1 From 63d1916f511fdbbec8bc111f4bf80b3e4e0bc267 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Aug 2014 20:59:11 +0100 Subject: Remove entities from updates queues on kill. Do it sync so enqueues after the kill work --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 06f1301..3d02f36 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1660,6 +1660,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // foreach (uint id in localIDs) // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); + // remove pending entities + lock (m_entityProps.SyncRoot) + m_entityProps.Remove(localIDs); + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Remove(localIDs); + KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; -- cgit v1.1 From d55041d9349c6d846fc32c01ea28083f40fd4263 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Aug 2014 21:13:30 +0100 Subject: on updates, send rotations using livomv Quaternion.toBytes() again --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3d02f36..e62bea6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5334,13 +5334,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP Vector3 velocity = new Vector3(0, 0, 0); Vector3 acceleration = new Vector3(0, 0, 0); rotation.Normalize(); - Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); data.CollisionPlane.ToBytes(objectData, 0); offsetPosition.ToBytes(objectData, 16); velocity.ToBytes(objectData, 28); acceleration.ToBytes(objectData, 40); - vrot.ToBytes(objectData, 52); + rotation.ToBytes(objectData, 52); data.AngularVelocity.ToBytes(objectData, 64); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); @@ -5400,8 +5399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Quaternion rotation = data.RotationOffset; rotation.Normalize(); - Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); - vrot.ToBytes(objectData, 36); + rotation.ToBytes(objectData, 36); data.AngularVelocity.ToBytes(objectData, 48); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); -- cgit v1.1 From f4a6be86546b3bfeefbdbade33f2faabdd080c1f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Aug 2014 00:44:14 +0100 Subject: clean sendKill a bit, remove a IsChild that is set too early in a calling path --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 24 ++-------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e62bea6..e19877c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1677,28 +1677,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP kill.Header.Reliable = true; kill.Header.Zerocoded = true; - if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null) - { - OutPacket(kill, ThrottleOutPacketType.Task); - } - else - { - // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race - // condition where a kill can be processed before an out-of-date update for the same object. - // ProcessEntityUpdates() also takes the m_killRecord lock. -// lock (m_killRecord) -// { -// foreach (uint localID in localIDs) -// m_killRecord.Add(localID); - - // The throttle queue used here must match that being used for updates. Otherwise, there is a - // chance that a kill packet put on a separate queue will be sent to the client before an existing - // update packet on another queue. Receiving updates after kills results in unowned and undeletable - // scene objects in a viewer until that viewer is relogged in. - OutPacket(kill, ThrottleOutPacketType.Task); -// } - } - } + OutPacket(kill, ThrottleOutPacketType.Task); + } /// /// Send information about the items contained in a folder to the client. -- cgit v1.1 From c24601bc6a9be5ab84a8c7b4600382ef9f0c895e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 21:49:39 +0100 Subject: change enconding of attachment updates NameValue and State fields --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e19877c..b45d561 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5393,6 +5393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //update.JointType = 0; update.Material = data.Material; update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim +/* if (data.ParentGroup.IsAttachment) { update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); @@ -5406,6 +5407,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP // case for attachments may contain conflicting values that can end up crashing the viewer. update.State = data.ParentGroup.RootPart.Shape.State; } + */ + + if (data.ParentGroup.IsAttachment) + { + if (data.UUID != data.ParentGroup.RootPart.UUID) + { + update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); + } + else + update.NameValue = Utils.EmptyBytes; + + int st = (int)data.ParentGroup.RootPart.Shape.State; + st = (st & 0xf0) >> 4 + (st & 0x0f) << 4; + update.State = (byte)st; + } +// else +// update.State = data.Shape.State; // not sure about this + // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending state {0} for {1} {2} to {3}", -- cgit v1.1 From 75cbe620c025dba998d8291277e499ecb27a250c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 22:45:31 +0100 Subject: *test* cleanup the bugs nest --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b45d561..0663983 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5411,19 +5411,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (data.ParentGroup.IsAttachment) { - if (data.UUID != data.ParentGroup.RootPart.UUID) + if (data.UUID == data.ParentGroup.RootPart.UUID) { update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); } else update.NameValue = Utils.EmptyBytes; - int st = (int)data.ParentGroup.RootPart.Shape.State; - st = (st & 0xf0) >> 4 + (st & 0x0f) << 4; - update.State = (byte)st; + int st = (int)data.ParentGroup.AttachmentPoint; + update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; + } + else + { + update.NameValue = Utils.EmptyBytes; + update.State = data.Shape.State; // not sure about this } -// else -// update.State = data.Shape.State; // not sure about this // m_log.DebugFormat( -- cgit v1.1 From 6857afe2a4ca73da904b9928c282c0087ff4b3bf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 23:31:04 +0100 Subject: *test* back to no sog kills, little retouch on attachment updates, NameValue AttachItemID is a root part thing only --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0663983..7087bb7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5411,7 +5411,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (data.ParentGroup.IsAttachment) { - if (data.UUID == data.ParentGroup.RootPart.UUID) + if (data.IsRoot) { update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); } -- cgit v1.1 From 92b0b27caff9f73f619e1df32a430706b53f6782 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Aug 2014 17:42:44 +0100 Subject: dont append acks to a resend packet --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3b0312d..dea9d7f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1245,7 +1245,7 @@ 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) + if (!isZerocoded && !isResend) { // Keep appending ACKs until there is no room left in the buffer or there are // no more ACKs to append -- cgit v1.1 From 1e888d61caf80c3ac5748fb3550dd8137818f4cd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Aug 2014 01:33:09 +0100 Subject: enqueue also if m_nextPackets[category] is not null. This is really the top element of a category queue, equivalente to using a queue.peek() if avaiable --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index fe31bd9..8852715 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -364,6 +364,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + int total = resend + land + wind + cloud + task + texture + asset; + total /= 128; + // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged resend = Math.Max(resend, LLUDPServer.MTU); @@ -379,8 +382,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // the task queue (e.g. object updates) task = task + (int)(m_cannibalrate * texture); texture = (int)((1 - m_cannibalrate) * texture); - - //int total = resend + land + wind + cloud + task + texture + asset; + + total = resend + land + wind + cloud + task + texture + asset; + total /= 128; //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", // AgentID, resend, land, wind, cloud, task, texture, asset, total); @@ -484,7 +488,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Don't send this packet if there is already a packet waiting in the queue // even if we have the tokens to send it, tokens should go to the already // queued packets - if (queue.Count > 0) + if (queue.Count > 0 || m_nextPackets[category] != null) { queue.Enqueue(packet, highPriority); return true; @@ -528,7 +532,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// True if any packets were sent, otherwise false public bool DequeueOutgoing() { - if (m_deliverPackets == false) return false; +// if (m_deliverPackets == false) return false; OutgoingPacket packet = null; DoubleLocklessQueue queue; -- cgit v1.1 From ade4bf69b173958fb8b8309760cee9b87cfe2927 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 10:38:31 +0100 Subject: if we send wearables with ThrottleOutPacketType.HighPriority, then we should send other avatarinformation with same priority on same Task category ( plus cleanup ) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 111 +-------------------- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 32 +++--- 2 files changed, 18 insertions(+), 125 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7087bb7..e82f1d7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3694,7 +3694,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // avp.AppearanceData[0].CofVersion = 0; //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.Task); + OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) @@ -3722,7 +3722,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ani.AnimationSourceList[i].ObjectID = objectIDs[i]; } ani.Header.Reliable = false; - OutPacket(ani, ThrottleOutPacketType.Task); + OutPacket(ani, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } #endregion @@ -3751,7 +3751,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); - OutPacket(objupdate, ThrottleOutPacketType.Task); + OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); // We need to record the avatar local id since the root prim of an attachment points to this. // m_attachmentsSent.Add(avatar.LocalId); @@ -3824,65 +3824,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } - /* dont use this - udp packet resent must be done at udp level only - re map from a packet to original updates just doesnt work - - /// - /// Requeue an EntityUpdate when it was not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdate(EntityUpdate update) - { - // If the update exists in priority queue, it will be updated. - // If it does not exist then it will be added with the current (rather than its original) priority - uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); - - lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, update); - } - - - /// - /// Requeue a list of EntityUpdates when they were not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) - { - // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); - - // Remove the update packet from the list of packets waiting for acknowledgement - // because we are requeuing the list of updates. They will be resent in new packets - // with the most recent state and priority. - m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); - - // Count this as a resent packet since we are going to requeue all of the updates contained in it - Interlocked.Increment(ref m_udpClient.PacketsResent); - - // We're not going to worry about interlock yet since its not currently critical that this total count - // is 100% correct - m_udpServer.PacketsResentCount++; - - foreach (EntityUpdate update in updates) - ResendPrimUpdate(update); - } - */ - -// OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy>(); -// -// OpenSim.Framework.Lazy> objectUpdates = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> compressedUpdates = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseUpdates = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseAgentUpdates = new OpenSim.Framework.Lazy>(); - - private void ProcessEntityUpdates(int maxUpdates) { OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -3895,15 +3836,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OpenSim.Framework.Lazy> terseUpdates = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> terseAgentUpdates = new OpenSim.Framework.Lazy>(); -// objectUpdateBlocks.Value.Clear(); -// compressedUpdateBlocks.Value.Clear(); -// terseUpdateBlocks.Value.Clear(); -// terseAgentUpdateBlocks.Value.Clear(); -// objectUpdates.Value.Clear(); -// compressedUpdates.Value.Clear(); -// terseUpdates.Value.Clear(); -// terseAgentUpdates.Value.Clear(); - // Check to see if this is a flush if (maxUpdates <= 0) { @@ -3970,36 +3902,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (sp.IsChildAgent) continue; - // If the object is an attachment we don't want it to be in the kill - // record. Else attaching from inworld and subsequently dropping - // it will no longer work. -// lock (m_killRecord) -// { -// m_killRecord.Remove(part.LocalId); -// m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); -// } - } - else - { - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - // - // We ignore this for attachments because attaching something from inworld breaks unless we do. -// lock (m_killRecord) -// { -// if (m_killRecord.Contains(part.LocalId)) -// continue; -// if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) -// continue; -// } } if (part.ParentGroup.IsAttachment && m_disableFacelights) @@ -4188,16 +4090,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - -// OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); - // use default udp retry + OutPacket(packet, ThrottleOutPacketType.Task, true); } - - #endregion Packet Sending - } // hack.. dont use diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 8852715..bb68921 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -364,9 +364,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - int total = resend + land + wind + cloud + task + texture + asset; - total /= 128; - // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged resend = Math.Max(resend, LLUDPServer.MTU); @@ -383,8 +380,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = task + (int)(m_cannibalrate * texture); texture = (int)((1 - m_cannibalrate) * texture); - total = resend + land + wind + cloud + task + texture + asset; - total /= 128; + // int total = resend + land + wind + cloud + task + texture + asset; + //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", // AgentID, resend, land, wind, cloud, task, texture, asset, total); @@ -428,25 +425,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP int i = 0; // multiply by 8 to convert bytes back to bits - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate * 8 * multiplier; + multiplier *= 8; + + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; m_packedThrottles = data; @@ -485,19 +484,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP TokenBucket bucket = m_throttleCategories[category]; - // Don't send this packet if there is already a packet waiting in the queue - // even if we have the tokens to send it, tokens should go to the already - // queued packets + // Don't send this packet if queue is not empty if (queue.Count > 0 || m_nextPackets[category] != null) { queue.Enqueue(packet, highPriority); return true; } - - + if (!forceQueue && bucket.RemoveTokens(packet.Buffer.DataLength)) { - // Enough tokens were removed from the bucket, the packet will not be queued + // enough tokens so it can be sent imediatly by caller return false; } else -- cgit v1.1 From ff4df688ba548aa6050bcec232b98bd5a4ac4ffd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 12:55:31 +0100 Subject: send all presences terseupdates in same batch --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e82f1d7..7227964 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4015,8 +4015,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) - // Self updates go into a special list + if (update.Entity is ScenePresence) + // ALL presence updates go into a special list terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); else // Everything else goes here @@ -4028,7 +4028,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Packet Sending - const float TIME_DILATION = 1.0f; +// const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); if (terseAgentUpdateBlocks.IsValueCreated) -- cgit v1.1 From 5a2d4fd47f64a656b36fd428473715d9f764729b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 16:49:32 +0100 Subject: add some functions for estimation of number of bytes that can be send in a category in specified time --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 8 ++++++++ OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index bb68921..7c55b37 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -453,6 +453,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP return data; } + + public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) + { + TokenBucket bucket = m_throttleCategories[(int)cat]; + int bytes = timeMS * (int)(bucket.RequestedDripRate / 1000); + bytes += (int)bucket.CurrentTokenCount(); + return bytes; + } /// /// Queue an outgoing packet if appropriate. diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 4c33db5..2a60b48 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -274,6 +274,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } + public long CurrentTokenCount() + { + return m_tokenCount; + } + /// /// Deposit tokens into the bucket from a child bucket that did /// not use all of its available tokens -- cgit v1.1 From 9839904ebe82f9c7a2084d7d7cf4e5399c679ce5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 18:51:55 +0100 Subject: try to make sense of throttle rate limits --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 16 +++++++++++++--- OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 7c55b37..84c0d03 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -217,6 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_maxRTO = maxRTO; // Create a token bucket throttle for this client that has the scene token bucket as a parent + // 2500000 bits/s max m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); // Create a token bucket throttle for the total categary with the client bucket as a throttle m_throttleCategory = new TokenBucket(m_throttleClient, 0); @@ -224,7 +225,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; m_cannibalrate = rates.CannibalizeTextureRate; - + + long totalrate = 0; + long catrate = 0; + for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { ThrottleOutPacketType type = (ThrottleOutPacketType)i; @@ -232,9 +236,13 @@ 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_throttleCategory, rates.GetRate(type)); + catrate = rates.GetRate(type); + totalrate += catrate; + m_throttleCategories[i] = new TokenBucket(m_throttleCategory, catrate); } + m_throttleCategory.RequestedDripRate = totalrate; + // Default the retransmission timeout to one second RTO = m_defaultRTO; @@ -380,7 +388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = task + (int)(m_cannibalrate * texture); texture = (int)((1 - m_cannibalrate) * texture); - // int total = resend + land + wind + cloud + task + texture + asset; + int total = resend + land + wind + cloud + task + texture + asset; //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", // AgentID, resend, land, wind, cloud, task, texture, asset, total); @@ -409,6 +417,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; + m_throttleCategory.RequestedDripRate = total; + // Reset the packed throttles cached data m_packedThrottles = null; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index e5bae6e..2b307c7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs @@ -80,7 +80,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP Texture = throttleConfig.GetInt("texture_default", 18500); Asset = throttleConfig.GetInt("asset_default", 10500); - Total = throttleConfig.GetInt("client_throttle_max_bps", 0); + // 2500000 bps max + Total = throttleConfig.GetInt("client_throttle_max_bps",312500); AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); -- cgit v1.1 From 894b5c10c61d7cc88c4f95b888111216590efff5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 18:54:08 +0100 Subject: remove misplaced comment --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 84c0d03..89a9401 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -217,7 +217,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_maxRTO = maxRTO; // Create a token bucket throttle for this client that has the scene token bucket as a parent - // 2500000 bits/s max m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); // Create a token bucket throttle for the total categary with the client bucket as a throttle m_throttleCategory = new TokenBucket(m_throttleClient, 0); -- cgit v1.1 From 986863a0cd9cf79111865cee2729aa6edd7a8ffa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 22:26:03 +0100 Subject: try to reduce insane high data rate udp bursts. This needs testing on a region with a lot of contents. Should not affect much average rates. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 ++ OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 89a9401..e760513 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -616,6 +616,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // No packets in this queue. Fire the queue empty callback // if it has not been called recently + + bucket.Tick(); // tick the bucket emptyCategories |= CategoryToFlag(i); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 2a60b48..b1f2236 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -312,6 +312,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Determine the interval over which we are adding tokens, never add // more than a single quantum of tokens + + // No... add no more than the estimated time between checks + Int32 deltaMS = Math.Min(Util.EnvironmentTickCountSubtract(m_lastDrip), m_ticksPerQuantum); m_lastDrip = Util.EnvironmentTickCount(); @@ -322,6 +325,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP Deposit(deltaMS * DripRate / m_ticksPerQuantum); } + + public void Tick() + { + m_lastDrip = Util.EnvironmentTickCount(); + } } public class AdaptiveTokenBucket : TokenBucket @@ -333,7 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// packet per second. Open the throttle to 15 packets per second /// or about 160kbps. /// - protected const Int64 m_minimumFlow = m_minimumDripRate * 15; + protected const Int64 m_minimumFlow = m_minimumDripRate; // // The maximum rate for flow control. Drip rate can never be -- cgit v1.1 From 6f590c2f799d5c6109fffa6ce32f2e751ec9c59e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 00:05:57 +0100 Subject: disable first drip --- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index b1f2236..a2ff884 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -180,7 +180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP RequestedDripRate = dripRate; // TotalDripRequest = dripRate; // this will be overwritten when a child node registers // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); - m_lastDrip = Util.EnvironmentTickCount(); + m_lastDrip = Util.EnvironmentTickCount() + 100000; } #endregion Constructor -- cgit v1.1 From 438798202fc1f578864a2796cb8a66b3199a77e0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 13:26:30 +0100 Subject: replace the tick() by a limit on the maximum number of tokens that can be acumulated ( variable named BurtRate, not exactly a rate...) --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 - .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 52 ++++++++++++++++------ 2 files changed, 39 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index e760513..89a9401 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -616,8 +616,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // No packets in this queue. Fire the queue empty callback // if it has not been called recently - - bucket.Tick(); // tick the bucket emptyCategories |= CategoryToFlag(i); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index a2ff884..3147095 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -53,10 +53,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected const Int32 m_ticksPerQuantum = 1000; /// - /// This is the number of quantums worth of packets that can - /// be accommodated during a burst + /// 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 + /// /// - protected const Double m_quantumsPerBurst = 1.5; + protected const Double m_quantumsPerBurst = 15; /// /// @@ -91,22 +94,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// - /// Maximum burst rate in bytes per second. This is the maximum number + /// This is the maximum number /// of tokens that can accumulate in the bucket at any one time. This /// also sets the total request for leaf nodes + /// this is not a rate. /// protected Int64 m_burstRate; public Int64 RequestedBurstRate { get { return m_burstRate; } - set { m_burstRate = (value < 0 ? 0 : value); } + set { + double rate = (value < 0 ? 0 : value); + if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + else if (rate > m_minimumDripRate * m_quantumsPerBurst) + rate = m_minimumDripRate * m_quantumsPerBurst; + + m_burstRate = (Int64)rate; + } } public Int64 BurstRate { get { double rate = RequestedBurstRate * BurstRateModifier(); - if (rate < m_minimumDripRate * m_quantumsPerBurst) + if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + else if (rate > m_minimumDripRate * m_quantumsPerBurst) rate = m_minimumDripRate * m_quantumsPerBurst; return (Int64) rate; @@ -126,8 +140,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } set { m_dripRate = (value < 0 ? 0 : value); - m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); m_totalDripRequest = m_dripRate; + + double rate = m_dripRate; + if (rate > m_minimumDripRate * m_quantumsPerBurst) + rate = m_minimumDripRate * m_quantumsPerBurst; + else if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + + m_burstRate = (Int64)rate; + + m_tokenCount = 0; + if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); } @@ -325,11 +349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Deposit(deltaMS * DripRate / m_ticksPerQuantum); } - - public void Tick() - { - m_lastDrip = Util.EnvironmentTickCount(); - } } public class AdaptiveTokenBucket : TokenBucket @@ -364,7 +383,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_dripRate; } set { m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); - m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); + + double rate = m_dripRate; + if (rate > m_minimumDripRate * m_quantumsPerBurst) + rate = m_minimumDripRate * m_quantumsPerBurst; + else if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + m_burstRate = (Int64)rate; + if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); } -- cgit v1.1 From fd0a635302f11ee7a39b9d0cab55c05276be12f6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 15:13:46 +0100 Subject: reduce burst --- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 3147095..26467bc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// to recheck a bucket in ms /// /// - protected const Double m_quantumsPerBurst = 15; + protected const Double m_quantumsPerBurst = 5; /// /// -- cgit v1.1 From 7351d92a76ac24edce848fe7410e920f17962101 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 16:19:30 +0100 Subject: add method to get a category throttle rate --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 67 +++++++++++----------- 2 files changed, 37 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7227964..12ee3b2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12306,16 +12306,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// - /// Sets the throttles from values supplied by the client + /// Sets the throttles from values supplied caller /// /// public void SetAgentThrottleSilent(int throttle, int setting) { m_udpClient.ForceThrottleSetting(throttle,setting); - //m_udpClient.SetThrottles(throttles); - } + public int GetAgentThrottleSilent(int throttle) + { + return m_udpClient.GetThrottleSetting(throttle); + } /// /// Get the current throttles for this client as a packed byte array diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 89a9401..f91abfe 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -688,6 +688,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP RTO = Math.Min(RTO * 2, m_maxRTO); } + + const int MIN_CALLBACK_MS = 30; + /// /// Does an early check to see if this queue empty callback is already /// running, then asynchronously firing the event @@ -695,24 +698,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Throttle categories to fire the callback for private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories) { -// if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) - if (!m_isQueueEmptyRunning && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) + if (!m_isQueueEmptyRunning) { - m_isQueueEmptyRunning = true; - int start = Environment.TickCount & Int32.MaxValue; - const int MIN_CALLBACK_MS = 30; + + if (start < m_nextOnQueueEmpty) + return; + + m_isQueueEmptyRunning = true; m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; if (m_nextOnQueueEmpty == 0) m_nextOnQueueEmpty = 1; - // Use a value of 0 to signal that FireQueueEmpty is running -// m_nextOnQueueEmpty = 0; - - m_categories = categories; - - if (HasUpdates(m_categories)) + if (HasUpdates(categories)) { // Asynchronously run the callback Util.FireAndForget(FireQueueEmpty, categories); @@ -725,7 +724,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } private bool m_isQueueEmptyRunning; - private ThrottleOutPacketTypeFlags m_categories = 0; + /// /// Fires the OnQueueEmpty callback and sets the minimum time that it @@ -736,35 +735,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// signature private void FireQueueEmpty(object o) { -// int start = Environment.TickCount & Int32.MaxValue; -// const int MIN_CALLBACK_MS = 30; - -// if (m_udpServer.IsRunningOutbound) -// { - ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; - QueueEmpty callback = OnQueueEmpty; + ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; + QueueEmpty callback = OnQueueEmpty; - if (callback != null) - { -// if (m_udpServer.IsRunningOutbound) -// { - try { callback(categories); } - catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } -// } - } -// } - -// m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; -// if (m_nextOnQueueEmpty == 0) -// m_nextOnQueueEmpty = 1; - -// } + if (callback != null) + { + // if (m_udpServer.IsRunningOutbound) + // { + try { callback(categories); } + catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } + // } + } m_isQueueEmptyRunning = false; } + internal void ForceThrottleSetting(int throttle, int setting) { - m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); ; + if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT) + m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); + } + + internal int GetThrottleSetting(int throttle) + { + if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT) + return (int)m_throttleCategories[throttle].RequestedDripRate; + else + return 0; } /// -- cgit v1.1 From 18de5c8a2da2577246485f8df100e1e155a30d56 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 16:30:49 +0100 Subject: make use of it in GetMeshModule, and meshs are Assets not Task itens, reduce MeshModule impact on udp rate --- .../ClientStack/Linden/Caps/GetMeshModule.cs | 47 ++-------------------- 1 file changed, 4 insertions(+), 43 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 7b15284..a381a1b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -189,9 +189,8 @@ namespace OpenSim.Region.ClientStack.Linden // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent. public void ThrottleUpdate(ScenePresence p) { - byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); UUID user = p.UUID; - int imagethrottle = ExtractTaskThrottle(throttles); + int imagethrottle = p.ControllingClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Asset); PollServiceMeshEventArgs args; if (m_pollservices.TryGetValue(user, out args)) { @@ -199,44 +198,6 @@ namespace OpenSim.Region.ClientStack.Linden } } - private int ExtractTaskThrottle(byte[] pthrottles) - { - - byte[] adjData; - int pos = 0; - - if (!BitConverter.IsLittleEndian) - { - byte[] newData = new byte[7 * 4]; - Buffer.BlockCopy(pthrottles, 0, newData, 0, 7 * 4); - - for (int i = 0; i < 7; i++) - Array.Reverse(newData, i * 4, 4); - - adjData = newData; - } - else - { - adjData = pthrottles; - } - - // 0.125f converts from bits to bytes - //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - //pos += 4; - // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - //pos += 4; - // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - // pos += 4; - // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - // pos += 4; - pos += 16; - int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - // pos += 4; - //int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4; - //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - return task; - } - private class PollServiceMeshEventArgs : PollServiceEventArgs { private List requests = @@ -425,7 +386,7 @@ namespace OpenSim.Region.ClientStack.Linden { ThrottleBytes = pBytes; lastTimeElapsed = Util.EnvironmentTickCount(); - Throttle = ThrottleOutPacketType.Task; + Throttle = ThrottleOutPacketType.Asset; m_scene = pScene; User = puser; } @@ -550,8 +511,8 @@ namespace OpenSim.Region.ClientStack.Linden // UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon)); float udp = 1.0f - CapThrottleDistributon; - if(udp < 0.5f) - udp = 0.5f; + if(udp < 0.7f) + udp = 0.7f; UDPSetThrottle = (int) ((float)pimagethrottle * udp); if (CapSetThrottle < 4068) CapSetThrottle = 4068; // at least two discovery mesh -- cgit v1.1 From 50433e089b548d3e9233b897568b7def489323fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Sep 2014 15:48:59 +0100 Subject: *needs testing, not that good* change throttles math using floats and not int64, etc. Limite brust bytes to the total rate client requested times a look ahead estimation time, Avoid queues starvation with updates waiting... --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 61 ++++---- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- .../Region/ClientStack/Linden/UDP/ThrottleRates.cs | 13 +- .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 161 ++++++++------------- 4 files changed, 112 insertions(+), 125 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f91abfe..45013b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -144,8 +144,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_throttleClient; } } - /// Throttle bucket for this agent's connection - private readonly TokenBucket m_throttleCategory; /// Throttle buckets for each packet category private readonly TokenBucket[] m_throttleCategories; /// Outgoing queues for throttled packets @@ -163,6 +161,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_maxRTO = 60000; public bool m_deliverPackets = true; + private float m_burstTime; + public int m_lastStartpingTimeMS; public int m_pingMS; @@ -216,17 +216,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (maxRTO != 0) m_maxRTO = maxRTO; + m_burstTime = rates.BrustTime; + float m_burst = rates.ClientMaxRate * m_burstTime; + // Create a token bucket throttle for this client that has the scene token bucket as a parent - m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); - // Create a token bucket throttle for the total categary with the client bucket as a throttle - m_throttleCategory = new TokenBucket(m_throttleClient, 0); + m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled); // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; m_cannibalrate = rates.CannibalizeTextureRate; - long totalrate = 0; - long catrate = 0; + m_burst = rates.Total * rates.BrustTime; for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { @@ -235,13 +235,9 @@ 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 - catrate = rates.GetRate(type); - totalrate += catrate; - m_throttleCategories[i] = new TokenBucket(m_throttleCategory, catrate); + m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); } - m_throttleCategory.RequestedDripRate = totalrate; - // Default the retransmission timeout to one second RTO = m_defaultRTO; @@ -285,7 +281,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; - m_info.totalThrottle = (int)m_throttleCategory.DripRate; + m_info.totalThrottle = (int)m_throttleClient.DripRate; return m_info; } @@ -373,6 +369,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged + +/* not using floats resend = Math.Max(resend, LLUDPServer.MTU); land = Math.Max(land, LLUDPServer.MTU); wind = Math.Max(wind, LLUDPServer.MTU); @@ -380,6 +378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = Math.Max(task, LLUDPServer.MTU); texture = Math.Max(texture, LLUDPServer.MTU); asset = Math.Max(asset, LLUDPServer.MTU); +*/ // Since most textures are now delivered through http, make it possible // to cannibalize some of the bw from the texture throttle to use for @@ -388,7 +387,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP texture = (int)((1 - m_cannibalrate) * texture); int total = resend + land + wind + cloud + task + texture + asset; - + + float m_burst = total * m_burstTime; + //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", // AgentID, resend, land, wind, cloud, task, texture, asset, total); @@ -397,26 +398,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; bucket.RequestedDripRate = resend; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land]; bucket.RequestedDripRate = land; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind]; bucket.RequestedDripRate = wind; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud]; bucket.RequestedDripRate = cloud; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset]; bucket.RequestedDripRate = asset; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; bucket.RequestedDripRate = task; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; - - m_throttleCategory.RequestedDripRate = total; + bucket.RequestedBurst = m_burst; // Reset the packed throttles cached data m_packedThrottles = null; @@ -465,10 +471,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) { - TokenBucket bucket = m_throttleCategories[(int)cat]; - int bytes = timeMS * (int)(bucket.RequestedDripRate / 1000); - bytes += (int)bucket.CurrentTokenCount(); - return bytes; + int icat = (int)cat; + if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT) + { + TokenBucket bucket = m_throttleCategories[icat]; + return bucket.GetCatBytesCanSend(timeMS); + } + else + return 0; } /// @@ -572,6 +582,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; + + if (m_packetOutboxes[i].Count < 5) + emptyCategories |= CategoryToFlag(i); } } else @@ -599,6 +612,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; + + if (queue.Count < 5) + emptyCategories |= CategoryToFlag(i); } else { @@ -606,11 +622,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_nextPackets[i] = packet; } - // If the queue is empty after this dequeue, fire the queue - // empty callback now so it has a chance to fill before we - // get back here - if (queue.Count == 0) - emptyCategories |= CategoryToFlag(i); } else { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index dea9d7f..9b3802d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -449,7 +449,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion BinaryStats - m_throttle = new TokenBucket(null, sceneThrottleBps); + m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f); ThrottleRates = new ThrottleRates(configSource); Random rnd = new Random(Util.EnvironmentTickCount()); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index 2b307c7..451dee5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs @@ -62,6 +62,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Amount of the texture throttle to steal for the task throttle public double CannibalizeTextureRate; + public int ClientMaxRate; + public float BrustTime; + /// /// Default constructor /// @@ -80,8 +83,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP Texture = throttleConfig.GetInt("texture_default", 18500); Asset = throttleConfig.GetInt("asset_default", 10500); - // 2500000 bps max - Total = throttleConfig.GetInt("client_throttle_max_bps",312500); + Total = Resend + Land + Wind + Cloud + Task + Texture + Asset; + // 3000000 bps default max + ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 375000); + if (ClientMaxRate > 1000000) + ClientMaxRate = 1000000; // no more than 8Mbps + + BrustTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10); + BrustTime *= 1e-3f; AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 26467bc..384439c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -44,13 +44,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static Int32 m_counter = 0; -// private Int32 m_identifier; - - /// - /// Number of ticks (ms) per quantum, drip rate and max burst - /// are defined over this interval. - /// - protected const Int32 m_ticksPerQuantum = 1000; +// private Int32 m_identifier; + + protected const float m_timeScale = 1e-3f; /// /// This is the number of m_minimumDripRate bytes @@ -59,11 +55,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// to recheck a bucket in ms /// /// - protected const Double m_quantumsPerBurst = 5; + protected const float m_quantumsPerBurst = 5; /// /// - protected const Int32 m_minimumDripRate = 1400; + protected const float m_minimumDripRate = 1400; /// Time of the last drip, in system ticks protected Int32 m_lastDrip; @@ -72,12 +68,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The number of bytes that can be sent at this moment. This is the /// current number of tokens in the bucket /// - protected Int64 m_tokenCount; + protected float m_tokenCount; /// /// Map of children buckets and their requested maximum burst rate /// - protected Dictionary m_children = new Dictionary(); + protected Dictionary m_children = new Dictionary(); #region Properties @@ -97,33 +93,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// This is the maximum number /// of tokens that can accumulate in the bucket at any one time. This /// also sets the total request for leaf nodes - /// this is not a rate. /// - protected Int64 m_burstRate; - public Int64 RequestedBurstRate + protected float m_burst; + public float RequestedBurst { - get { return m_burstRate; } + get { return m_burst; } set { - double rate = (value < 0 ? 0 : value); + float rate = (value < 0 ? 0 : value); if (rate < m_minimumDripRate) rate = m_minimumDripRate; else if (rate > m_minimumDripRate * m_quantumsPerBurst) rate = m_minimumDripRate * m_quantumsPerBurst; - m_burstRate = (Int64)rate; + m_burst = rate; } } - public Int64 BurstRate + public float Burst { get { - double rate = RequestedBurstRate * BurstRateModifier(); + float rate = RequestedBurst * BurstModifier(); if (rate < m_minimumDripRate) rate = m_minimumDripRate; - else if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; - - return (Int64) rate; + return (float)rate; } } @@ -134,40 +126,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Tokens are added to the bucket any time /// is called, at the granularity of /// the system tick interval (typically around 15-22ms) - protected Int64 m_dripRate; - public virtual Int64 RequestedDripRate + protected float m_dripRate; + public virtual float RequestedDripRate { get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } set { m_dripRate = (value < 0 ? 0 : value); m_totalDripRequest = m_dripRate; - double rate = m_dripRate; - if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; - else if (rate < m_minimumDripRate) - rate = m_minimumDripRate; - - m_burstRate = (Int64)rate; - - m_tokenCount = 0; - if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); } } - public virtual Int64 DripRate + public virtual float DripRate { get { + float rate = Math.Min(RequestedDripRate,TotalDripRequest); if (m_parent == null) - return Math.Min(RequestedDripRate,TotalDripRequest); - - double rate = (double)RequestedDripRate * m_parent.DripRateModifier(); + return rate; + + rate *= m_parent.DripRateModifier(); if (rate < m_minimumDripRate) rate = m_minimumDripRate; - return (Int64)rate; + return (float)rate; } } @@ -175,8 +158,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The current total of the requested maximum burst rates of /// this bucket's children buckets. /// - protected Int64 m_totalDripRequest; - public Int64 TotalDripRequest + protected float m_totalDripRequest; + public float TotalDripRequest { get { return m_totalDripRequest; } set { m_totalDripRequest = value; } @@ -195,13 +178,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// zero if this bucket has no maximum capacity /// Rate that the bucket fills, in bytes per /// second. If zero, the bucket always remains full - public TokenBucket(TokenBucket parent, Int64 dripRate) + public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst) { // m_identifier = m_counter++; m_counter++; Parent = parent; RequestedDripRate = dripRate; + RequestedBurst = MaxBurst; // TotalDripRequest = dripRate; // this will be overwritten when a child node registers // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); m_lastDrip = Util.EnvironmentTickCount() + 100000; @@ -216,15 +200,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// hierarchy. However, if any of the parents is over-booked, then /// the modifier will be less than 1. /// - protected double DripRateModifier() + protected float DripRateModifier() { - Int64 driprate = DripRate; - return driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest; + float driprate = DripRate; + return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; } /// /// - protected double BurstRateModifier() + protected float BurstModifier() { // for now... burst rate is always m_quantumsPerBurst (constant) // larger than drip rate so the ratio of burst requests is the @@ -236,7 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Register drip rate requested by a child of this throttle. Pass the /// changes up the hierarchy. /// - public void RegisterRequest(TokenBucket child, Int64 request) + public void RegisterRequest(TokenBucket child, float request) { lock (m_children) { @@ -244,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_totalDripRequest = m_children.Values.Sum(); m_totalDripRequest = 0; - foreach (KeyValuePair cref in m_children) + foreach (KeyValuePair cref in m_children) m_totalDripRequest += cref.Value; } @@ -265,7 +249,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_totalDripRequest = m_children.Values.Sum(); m_totalDripRequest = 0; - foreach (KeyValuePair cref in m_children) + foreach (KeyValuePair cref in m_children) m_totalDripRequest += cref.Value; } @@ -281,7 +265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Number of tokens to remove from the bucket /// True if the requested number of tokens were removed from /// the bucket, otherwise false - public bool RemoveTokens(Int64 amount) + public bool RemoveTokens(int amount) { // Deposit tokens for this interval Drip(); @@ -298,24 +282,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - public long CurrentTokenCount() - { - return m_tokenCount; - } - - /// - /// Deposit tokens into the bucket from a child bucket that did - /// not use all of its available tokens - /// - protected void Deposit(Int64 count) + public int GetCatBytesCanSend(int timeMS) { - m_tokenCount += count; - - // Deposit the overflow in the parent bucket, this is how we share - // unused bandwidth - Int64 burstrate = BurstRate; - if (m_tokenCount > burstrate) - m_tokenCount = burstrate; +// return (int)(m_tokenCount + timeMS * m_dripRate * 1e-3); + return (int)(timeMS * m_dripRate * 1e-3); } /// @@ -334,12 +304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } - // Determine the interval over which we are adding tokens, never add - // more than a single quantum of tokens - - // No... add no more than the estimated time between checks - - Int32 deltaMS = Math.Min(Util.EnvironmentTickCountSubtract(m_lastDrip), m_ticksPerQuantum); + Int32 deltaMS = Util.EnvironmentTickCountSubtract(m_lastDrip); m_lastDrip = Util.EnvironmentTickCount(); // This can be 0 in the very unusual case that the timer wrapped @@ -347,7 +312,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (deltaMS <= 0) return; - Deposit(deltaMS * DripRate / m_ticksPerQuantum); + m_tokenCount += deltaMS * DripRate * m_timeScale; + + float burst = Burst; + if (m_tokenCount > burst) + m_tokenCount = burst; } } @@ -357,20 +326,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// The minimum rate for flow control. Minimum drip rate is one - /// packet per second. Open the throttle to 15 packets per second - /// or about 160kbps. + /// packet per second. /// - protected const Int64 m_minimumFlow = m_minimumDripRate; + + protected const float m_minimumFlow = 50000; // // The maximum rate for flow control. Drip rate can never be // greater than this. // - protected Int64 m_maxDripRate = 0; - protected Int64 MaxDripRate + + protected float m_maxDripRate = 0; + public float MaxDripRate { get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } - set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } + set + { + m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow)); + } } private bool m_enabled = false; @@ -378,18 +351,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // // - public virtual Int64 AdjustedDripRate + public virtual float AdjustedDripRate { get { return m_dripRate; } set { - m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); - - double rate = m_dripRate; - if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; - else if (rate < m_minimumDripRate) - rate = m_minimumDripRate; - m_burstRate = (Int64)rate; + m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); @@ -399,16 +365,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // // - public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate) + public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate,float maxBurst, bool enabled) + : base(parent, maxDripRate,maxBurst) { m_enabled = enabled; + + MaxDripRate = maxDripRate; - if (m_enabled) - { - // m_log.DebugFormat("[TOKENBUCKET] Adaptive throttle enabled"); - MaxDripRate = maxDripRate; - AdjustedDripRate = m_minimumFlow; - } + if (enabled) + AdjustedDripRate = m_maxDripRate * .5f; + else + AdjustedDripRate = m_maxDripRate; } // -- cgit v1.1 From 6611e75a2beba8d28aed4e1ea56135da491328c0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Sep 2014 16:11:46 +0100 Subject: void time change between gettime calls --- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 384439c..1877cf0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -304,11 +304,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } - Int32 deltaMS = Util.EnvironmentTickCountSubtract(m_lastDrip); - m_lastDrip = Util.EnvironmentTickCount(); + Int32 now = Util.EnvironmentTickCount(); + Int32 deltaMS = now - m_lastDrip; + m_lastDrip = now; - // This can be 0 in the very unusual case that the timer wrapped - // It can be 0 if we try add tokens at a sub-tick rate if (deltaMS <= 0) return; -- cgit v1.1 From 0514679b15d12d9481a11637c9f0d43d90cfd94d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Sep 2014 18:51:49 +0100 Subject: reduce MIN_CALLBACK_MS guard time. A value too high introduces a extra throttle and makes more packets to be sent in bursts and not in steady state flow. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 45013b3..33375ff 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -700,7 +700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } - const int MIN_CALLBACK_MS = 30; + const int MIN_CALLBACK_MS = 10; /// /// Does an early check to see if this queue empty callback is already -- cgit v1.1 From 42b2248960b9b8e539f551093ed2241ce8d3b68d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 13 Sep 2014 00:49:32 +0200 Subject: If a client's SceneAgent is null, that client is not fully logged in or crashed while logging out. Don't reuse it, create a new one. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 9b3802d..5ce82a5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -2002,6 +2002,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) { IClientAPI client = null; + bool createNew = false; // We currently synchronize this code across the whole scene to avoid issues such as // http://opensimulator.org/mantis/view.php?id=5365 However, once locking per agent circuit can be done @@ -2010,6 +2011,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (!m_scene.TryGetClient(agentID, out client)) { + createNew = true; + } + else + { + if (client.SceneAgent == null) + { + m_scene.CloseAgent(agentID, true); + createNew = true; + } + } + + if (createNew) + { LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); -- cgit v1.1 From 908e0e1cef792456fc1ba6394ff9119110870dc4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 Sep 2014 20:37:20 +0100 Subject: do not use a blind expire of m_pendingCache. Entries must be valid while respective HandleUseCircuitCode, no matter how long it takes, so a viewer retry doesnt start a overlapping one. It HandleUseCircuitCode responsability to always remove entries, even on fails. Remove a client even if m_scene.CloseAgent fails. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 38 +++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 5ce82a5..18d5606 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -308,8 +308,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP - private ExpiringCache> m_pendingCache = new ExpiringCache>(); - +// private ExpiringCache> m_pendingCache = new ExpiringCache>(); + private Dictionary> m_pendingCache = new Dictionary>(); /// /// Event used to signal when queued packets are available for sending. /// @@ -1416,10 +1416,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // And if there is a UseCircuitCode pending, also drop it lock (m_pendingCache) { - if (m_pendingCache.Contains(endPoint)) +// if (m_pendingCache.Contains(endPoint)) + if (m_pendingCache.ContainsKey(endPoint)) return; - m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); +// m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); + m_pendingCache.Add(endPoint, new Queue()); } // We need to copy the endpoint so that it doesn't get changed when another thread reuses the @@ -1765,10 +1767,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.SessionID, endPoint, sessionInfo); - - // Now we know we can handle more data - Thread.Sleep(200); - + // Obtain the pending queue and remove it from the cache Queue queue = null; @@ -1786,13 +1785,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets - while (queue.Count > 0) + if (queue != null) { - UDPPacketBuffer buf = queue.Dequeue(); - PacketReceived(buf); - } + while (queue.Count > 0) + { + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); + } - queue = null; + 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 @@ -1815,6 +1817,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.WarnFormat( "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); + lock (m_pendingCache) m_pendingCache.Remove(endPoint); } @@ -1825,6 +1828,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception e) { + // this may already be done.. or not.. + lock (m_pendingCache) + m_pendingCache.Remove(endPoint); + m_log.ErrorFormat( "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", endPoint != null ? endPoint.ToString() : "n/a", @@ -2058,11 +2065,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); - if (!client.SceneAgent.IsChildAgent) + if (client.SceneAgent != null && !client.SceneAgent.IsChildAgent) client.Kick("Simulator logged you out due to connection timeout."); } - m_scene.CloseAgent(client.AgentId, true); + if (!m_scene.CloseAgent(client.AgentId, true)) + client.Close(true,true); } private void IncomingPacketHandler() -- cgit v1.1 From 3d9f25a19dda7c54ae50fd9b4da38247371018f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 Sep 2014 02:28:42 +0100 Subject: revert changes to m_pendingCache and remove client close if there is no SP, as requested --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 35 +++++++++------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 18d5606..d811b64 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -308,8 +308,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP -// private ExpiringCache> m_pendingCache = new ExpiringCache>(); - private Dictionary> m_pendingCache = new Dictionary>(); + private ExpiringCache> m_pendingCache = new ExpiringCache>(); + /// /// Event used to signal when queued packets are available for sending. /// @@ -1416,12 +1416,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // And if there is a UseCircuitCode pending, also drop it lock (m_pendingCache) { -// if (m_pendingCache.Contains(endPoint)) - if (m_pendingCache.ContainsKey(endPoint)) + if (m_pendingCache.Contains(endPoint)) return; -// m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); - m_pendingCache.Add(endPoint, new Queue()); + m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); } // We need to copy the endpoint so that it doesn't get changed when another thread reuses the @@ -1767,7 +1765,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.SessionID, endPoint, sessionInfo); - + + // Now we know we can handle more data + Thread.Sleep(200); + // Obtain the pending queue and remove it from the cache Queue queue = null; @@ -1785,17 +1786,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets - if (queue != null) + while (queue.Count > 0) { - while (queue.Count > 0) - { - UDPPacketBuffer buf = queue.Dequeue(); - PacketReceived(buf); - } - - queue = null; + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); } + 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. @@ -1828,10 +1826,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception e) { - // this may already be done.. or not.. - lock (m_pendingCache) - m_pendingCache.Remove(endPoint); - m_log.ErrorFormat( "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", endPoint != null ? endPoint.ToString() : "n/a", @@ -2069,8 +2063,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.Kick("Simulator logged you out due to connection timeout."); } - if (!m_scene.CloseAgent(client.AgentId, true)) - client.Close(true,true); + m_scene.CloseAgent(client.AgentId, true); } private void IncomingPacketHandler() -- cgit v1.1 From d43d3df724b62d0bf2765f25794e83dacd6c60c1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 14 Sep 2014 20:46:22 +0200 Subject: Reinstate closing the client if CloseAgen returns false. This was part of the last Ubit patch. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index d811b64..3539100 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -2063,7 +2063,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.Kick("Simulator logged you out due to connection timeout."); } - m_scene.CloseAgent(client.AgentId, true); + if (!m_scene.CloseAgent(client.AgentId, true)) + client.Close(true,true); } private void IncomingPacketHandler() -- cgit v1.1 From 8014ce7f1aaec0c418248e2e24a65c3cff0b3d27 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 15 Sep 2014 23:15:27 +0200 Subject: Fix a nullref in a debug message. If we have no SceneAgent, we can't output data from it. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3539100..99e7aba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -2055,12 +2055,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ClientLogoutsDueToNoReceives++; - m_log.WarnFormat( - "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", - client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); + if (client.SceneAgent != null) + { + m_log.WarnFormat( + "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", + client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); - if (client.SceneAgent != null && !client.SceneAgent.IsChildAgent) - client.Kick("Simulator logged you out due to connection timeout."); + if (!client.SceneAgent.IsChildAgent) + client.Kick("Simulator logged you out due to connection timeout."); + } } if (!m_scene.CloseAgent(client.AgentId, true)) -- cgit v1.1 From 18cc33e2c55539596363a0233bc680034bfacef6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Sep 2014 13:35:30 +0100 Subject: add animationset to upload assets, for now no cost --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 61b9045..593bd52 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -757,6 +757,12 @@ namespace OpenSim.Region.ClientStack.Linden inType = (sbyte)InventoryType.Animation; assType = (sbyte)AssetType.Animation; } + else if (inventoryType == "animationset") + { + inType = (sbyte)CustomInventoryType.AnimationSet; + assType = (sbyte)CustomAssetType.AnimationSet; + m_log.Debug("got animationset upload request"); + } else if (inventoryType == "wearable") { inType = (sbyte)InventoryType.Wearable; -- cgit v1.1 From f51779bb05b29558e3908ad9931ed61ddc61f390 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Sep 2014 14:10:44 +0100 Subject: add also the name animset until its clear the name liru will use --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 593bd52..01d4248 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -757,12 +757,19 @@ namespace OpenSim.Region.ClientStack.Linden inType = (sbyte)InventoryType.Animation; assType = (sbyte)AssetType.Animation; } +// add add both animationset and animset until is clear what name Liru will use else if (inventoryType == "animationset") { inType = (sbyte)CustomInventoryType.AnimationSet; assType = (sbyte)CustomAssetType.AnimationSet; m_log.Debug("got animationset upload request"); } + else if (inventoryType == "animset") + { + inType = (sbyte)CustomInventoryType.AnimationSet; + assType = (sbyte)CustomAssetType.AnimationSet; + m_log.Debug("got animset upload request"); + } else if (inventoryType == "wearable") { inType = (sbyte)InventoryType.Wearable; -- cgit v1.1 From 57166878b54ca1495e244a2a1ef791129b42d70f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Sep 2014 16:37:43 +0100 Subject: fix animation asset name to "animatn", use "animset" for the new animationSet --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 01d4248..9b12dd2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -530,6 +530,7 @@ namespace OpenSim.Region.ClientStack.Linden if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || + llsdRequest.asset_type == "animatn" || // this is the asset name actually used by viewers llsdRequest.asset_type == "mesh" || llsdRequest.asset_type == "sound") { @@ -757,13 +758,6 @@ namespace OpenSim.Region.ClientStack.Linden inType = (sbyte)InventoryType.Animation; assType = (sbyte)AssetType.Animation; } -// add add both animationset and animset until is clear what name Liru will use - else if (inventoryType == "animationset") - { - inType = (sbyte)CustomInventoryType.AnimationSet; - assType = (sbyte)CustomAssetType.AnimationSet; - m_log.Debug("got animationset upload request"); - } else if (inventoryType == "animset") { inType = (sbyte)CustomInventoryType.AnimationSet; @@ -1121,7 +1115,15 @@ namespace OpenSim.Region.ClientStack.Linden // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. - if (restrictPerms) + if (inType == (sbyte)CustomInventoryType.AnimationSet) + { + item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + item.CurrentPermissions = (uint)(PermissionMask.Copy| PermissionMask.Modify); + item.EveryOnePermissions = 0; + item.NextPermissions = 0; + } + + else if (restrictPerms) { item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); -- cgit v1.1 From 3a42ea52792438b44c6ddbd17eaad93c32263bbb Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Sep 2014 21:21:20 +0200 Subject: Extend upload verification to all upload paths --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 9b12dd2..0e38d05 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_getObjectCostPath = "0102/"; private static readonly string m_ResourceCostSelectedPath = "0103/"; private static readonly string m_UpdateAgentInformationPath = "0500/"; + private static readonly string m_animSetTaskUpdatePath = "0260/"; // These are callbacks which will be setup by the scene so that we can update scene data when we // receive capability calls @@ -267,6 +268,12 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); + +// IRequestHandler animSetRequestHandler +// = new RestStreamHandler( +// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null); + +// m_HostCapsObj.RegisterHandler("UpdateAnimSetTaskInventory", animSetRequestHandler); } catch (Exception e) { @@ -292,6 +299,7 @@ namespace OpenSim.Region.ClientStack.Linden "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null); m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); + m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); -- cgit v1.1 From 5f57b55dc97eb943af4c0429a68f074b490fffd7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:08:21 +0100 Subject: use central animationset permitions define --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0e38d05..a32593a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,8 +1125,8 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify); - item.CurrentPermissions = (uint)(PermissionMask.Copy| PermissionMask.Modify); + item.BasePermissions = AnimationSet.allowedPermitions; + item.CurrentPermissions = AnimationSet.allowedPermitions; item.EveryOnePermissions = 0; item.NextPermissions = 0; } -- cgit v1.1 From fcad64209c29c55cbec78ae94f221120e9956ebf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:17:01 +0100 Subject: make c# more happy --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a32593a..a31532b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,10 +1125,7 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - item.BasePermissions = AnimationSet.allowedPermitions; - item.CurrentPermissions = AnimationSet.allowedPermitions; - item.EveryOnePermissions = 0; - item.NextPermissions = 0; + AnimationSet.enforceItemPermitions(ref item); } else if (restrictPerms) -- cgit v1.1 From 90cad824050ffbd081baf5338638e2e6d95903f2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:22:54 +0100 Subject: remove unnecessary argument ref --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a31532b..1e28db0 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,7 +1125,7 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - AnimationSet.enforceItemPermitions(ref item); + AnimationSet.enforceItemPermitions(item); } else if (restrictPerms) -- cgit v1.1 From 46caea6987a24e07f61e3c3bef24ab4495899bda Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 15:03:33 +0100 Subject: change it again... --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 1e28db0..75634e0 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1125,7 +1125,7 @@ namespace OpenSim.Region.ClientStack.Linden if (inType == (sbyte)CustomInventoryType.AnimationSet) { - AnimationSet.enforceItemPermitions(item); + AnimationSet.setCreateItemPermitions(item); } else if (restrictPerms) -- cgit v1.1 From 49bf83ecb834ee7fccbc705d319d036d9f153583 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Sep 2014 23:31:55 +0100 Subject: do global position X and Y with double precision in autopilot, so corrected viewers do work --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 12ee3b2..6385aed 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -607,7 +607,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Disable UDP handling for this client m_udpClient.Shutdown(); - + //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); @@ -4912,6 +4912,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IEventQueue eq = Scene.RequestModuleInterface(); if (eq != null) { + OSD message_body = updateMessage.Serialize(); // Add new fields here until OMV has them OSDMap bodyMap = (OSDMap)message_body; @@ -4923,8 +4924,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP OSDMap message = new OSDMap(); message.Add("message", OSD.FromString("ParcelProperties")); message.Add("body", message_body); + eq.Enqueue (message, this.AgentId); - //eq.ParcelProperties(updateMessage, this.AgentId); + +// eq.ParcelProperties(updateMessage, this.AgentId); } else { @@ -12420,8 +12423,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP uint regionY = 0; Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY); - locx = Convert.ToSingle(args[0]) - (float)regionX; - locy = Convert.ToSingle(args[1]) - (float)regionY; + locx = (float)(Convert.ToDouble(args[0]) - (double)regionX); + locy = (float)(Convert.ToDouble(args[1]) - (double)regionY); locz = Convert.ToSingle(args[2]); Action handlerAutoPilotGo = OnAutoPilotGo; -- cgit v1.1 From 1a6ef2d60e4aff73e614ef45a0040c45316707f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 10:01:26 +0100 Subject: check for avatar skeleton data on meshs headers on cost estimation. Dont let a model have more than one mesh with skeleton, for testing create a mesh inventory item, for this meshs. Add also option to read a avatar collider replacement. This information still needs to be saved somewhere so it can be checked on attachment, etc, without parsing the mesh asset again. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 68 ++++++++++++++++++++-- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 44 ++++++++++++-- 2 files changed, 101 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 75634e0..3a070c3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -58,7 +58,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); + bool IsAtestUpload, bool avatarSkeleton, bool avatarCollider, ref string error); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -531,6 +531,8 @@ namespace OpenSim.Region.ClientStack.Linden int nreqmeshs= 0; int nreqinstances = 0; bool IsAtestUpload = false; + bool avatarSkeleton = false; + bool avatarCollider = false; string assetName = llsdRequest.name; @@ -580,8 +582,9 @@ 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 avatarSkeleton, out avatarCollider, out error, ref warning)) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); resperror.message = error; @@ -664,7 +667,7 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, - texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); + texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, avatarSkeleton, avatarCollider); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -711,7 +714,7 @@ namespace OpenSim.Region.ClientStack.Linden 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) + bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider, ref string error) { lock (m_ModelCost) @@ -877,12 +880,60 @@ namespace OpenSim.Region.ClientStack.Linden List meshAssets = new List(); for (int i = 0; i < mesh_list.Count; i++) { +/* + // do we really need this heavy thing? + OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]); + if (osd is OSDMap) + { + OSDMap mosd = (OSDMap)osd; + if (mosd.ContainsKey("skeleton")) + { + OSDMap skeleton = (OSDMap)mosd["skeleton"]; + int sksize = skeleton["size"].AsInteger(); + } + } +*/ + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); if (istest) meshAsset.Local = true; m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); + + + // test code + if (avatarSkeleton) + { + string name = assetName; + if (name.Length > 25) + name = name.Substring(0, 24); + name += "_Mesh#" + i.ToString(); + InventoryItemBase meshitem = new InventoryItemBase(); + meshitem.Owner = m_HostCapsObj.AgentID; + meshitem.CreatorId = creatorIDstr; + meshitem.CreatorData = String.Empty; + meshitem.ID = UUID.Random(); + meshitem.AssetID = meshAsset.FullID; + meshitem.Description = "mesh "; + meshitem.Name = name; + meshitem.AssetType = (int)AssetType.Mesh; + meshitem.InvType = (int)InventoryType.Mesh; + meshitem.Folder = UUID.Zero; // send to default + + // If we set PermissionMask.All then when we rez the item the next permissions will replace the current + // (owner) permissions. This becomes a problem if next permissions are changed. + meshitem.CurrentPermissions + = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); + + meshitem.BasePermissions = (uint)PermissionMask.All; + meshitem.EveryOnePermissions = 0; + meshitem.NextPermissions = (uint)PermissionMask.All; + meshitem.CreationDate = Util.UnixTimeSinceEpoch(); + + m_Scene.AddInventoryItem(client, meshitem); + meshitem = null; + } } int skipedMeshs = 0; @@ -1540,12 +1591,14 @@ namespace OpenSim.Region.ClientStack.Linden private int m_nreqmeshs; private int m_nreqinstances; private bool m_IsAtestUpload; + private bool m_avatarSkeleton; + private bool m_avatarCollider; 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) + bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider) { m_assetName = assetName; m_assetDes = description; @@ -1564,6 +1617,8 @@ namespace OpenSim.Region.ClientStack.Linden m_nreqmeshs = nreqmeshs; m_nreqinstances = nreqinstances; m_IsAtestUpload = IsAtestUpload; + m_avatarSkeleton = avatarSkeleton; + m_avatarCollider = avatarCollider; m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; @@ -1608,7 +1663,8 @@ namespace OpenSim.Region.ClientStack.Linden if (handlerUpLoad != null) { 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); + m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, + m_avatarSkeleton, m_avatarCollider, ref m_error); } if (m_IsAtestUpload) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 4a3fae6..db6f9fd 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -96,12 +96,18 @@ namespace OpenSim.Region.ClientStack.Linden // basicCost input region assets upload cost // totalcost returns model total upload fee // meshcostdata returns detailed costs for viewer - public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, - LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) + // 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 bool avatarSkeleton, out bool useAvatarCollider, + out string error, ref string warning) { totalcost = 0; error = string.Empty; - + + avatarSkeleton = false; + useAvatarCollider = false; + if (resources == null || resources.instance_list == null || resources.instance_list.Array.Count == 0) @@ -145,6 +151,10 @@ namespace OpenSim.Region.ClientStack.Linden float meshsfee = 0; int numberMeshs = 0; bool haveMeshs = false; + + bool curskeleton; + bool curAvatarPhys; + List meshsCosts = new List(); if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) @@ -156,10 +166,20 @@ namespace OpenSim.Region.ClientStack.Linden ameshCostParam curCost = new ameshCostParam(); byte[] data = (byte[])resources.mesh_list.Array[i]; - if (!MeshCost(data, curCost, out error)) + if (!MeshCost(data, curCost,out curskeleton, out curAvatarPhys, out error)) { return false; } + + if (curskeleton) + { + if (avatarSkeleton) + { + error = "model can only contain a avatar skeleton"; + return false; + } + avatarSkeleton = true; + } meshsCosts.Add(curCost); meshsfee += curCost.costFee; } @@ -273,7 +293,7 @@ namespace OpenSim.Region.ClientStack.Linden } // single mesh asset cost - private bool MeshCost(byte[] data, ameshCostParam cost, out string error) + private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error) { cost.highLODSize = 0; cost.medLODSize = 0; @@ -284,6 +304,9 @@ namespace OpenSim.Region.ClientStack.Linden error = string.Empty; + skeleton = false; + avatarPhys = false; + if (data == null || data.Length == 0) { error = "Missing model information."; @@ -330,6 +353,17 @@ namespace OpenSim.Region.ClientStack.Linden int submesh_offset = -1; + if (map.ContainsKey("skeleton")) + { + tmpmap = (OSDMap)map["skeleton"]; + if (tmpmap.ContainsKey("offset") && tmpmap.ContainsKey("size")) + { + int sksize = tmpmap["size"].AsInteger(); + if(sksize > 0) + skeleton = true; + } + } + if (map.ContainsKey("physics_convex")) { tmpmap = (OSDMap)map["physics_convex"]; -- cgit v1.1 From dab2e778d6a9d11cce48161d045598a56e7de952 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 10:22:57 +0100 Subject: bug fix --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 3a070c3..133a629 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -830,7 +830,8 @@ namespace OpenSim.Region.ClientStack.Linden List textures = new List(); - if (doTextInv) +// if (doTextInv) + if (doTextInv || avatarSkeleton) m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); if(client == null) // don't put textures in inventory if there is no client @@ -903,7 +904,7 @@ namespace OpenSim.Region.ClientStack.Linden // test code - if (avatarSkeleton) + if (avatarSkeleton && client != null) { string name = assetName; if (name.Length > 25) -- cgit v1.1 From cc71dd9a278ffe79668336db11fb768ce881fd18 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 11:12:43 +0100 Subject: dont let test mesh go to meshes inventory folder that is not displayed by viewers --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 133a629..344df2b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -920,7 +920,9 @@ namespace OpenSim.Region.ClientStack.Linden meshitem.Name = name; meshitem.AssetType = (int)AssetType.Mesh; meshitem.InvType = (int)InventoryType.Mesh; - meshitem.Folder = UUID.Zero; // send to default + // meshitem.Folder = UUID.Zero; // send to default + + meshitem.Folder = parentFolder; // dont let it go to folder Meshes that viewers dont show // If we set PermissionMask.All then when we rez the item the next permissions will replace the current // (owner) permissions. This becomes a problem if next permissions are changed. -- cgit v1.1 From c3e88b7b3810aace6e2260526d8f74df88d2cead Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 22:41:59 +0100 Subject: changed skeleton, do parse the mesh on upload to check skeleton. Sooner or later this parsing needs to validate the model cost also. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 44 +++++++++++----------- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 8 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 344df2b..ab8f0c9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -58,7 +58,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, bool avatarSkeleton, bool avatarCollider, ref string error); + bool IsAtestUpload, ref string error); public delegate UUID UpdateItem(UUID itemID, byte[] data); @@ -531,8 +531,6 @@ namespace OpenSim.Region.ClientStack.Linden int nreqmeshs= 0; int nreqinstances = 0; bool IsAtestUpload = false; - bool avatarSkeleton = false; - bool avatarCollider = false; string assetName = llsdRequest.name; @@ -584,7 +582,7 @@ namespace OpenSim.Region.ClientStack.Linden if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, - meshcostdata,out avatarSkeleton, out avatarCollider, out error, ref warning)) + meshcostdata, out error, ref warning)) { LLSDAssetUploadError resperror = new LLSDAssetUploadError(); resperror.message = error; @@ -667,7 +665,7 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, - texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, avatarSkeleton, avatarCollider); + texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); m_HostCapsObj.HttpListener.AddStreamHandler( new BinaryStreamHandler( @@ -714,7 +712,7 @@ namespace OpenSim.Region.ClientStack.Linden UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType, int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, - bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider, ref string error) + bool IsAtestUpload, ref string error) { lock (m_ModelCost) @@ -800,7 +798,7 @@ namespace OpenSim.Region.ClientStack.Linden OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); // compare and get updated information - +/* does nothing still we do need something to avoid special viewer to upload something diferent from the cost estimation bool mismatchError = true; while (mismatchError) @@ -816,7 +814,7 @@ namespace OpenSim.Region.ClientStack.Linden return; } - +*/ OSDArray instance_list = (OSDArray)request["instance_list"]; OSDArray mesh_list = (OSDArray)request["mesh_list"]; OSDArray texture_list = (OSDArray)request["texture_list"]; @@ -831,7 +829,6 @@ namespace OpenSim.Region.ClientStack.Linden // if (doTextInv) - if (doTextInv || avatarSkeleton) m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); if(client == null) // don't put textures in inventory if there is no client @@ -879,10 +876,17 @@ namespace OpenSim.Region.ClientStack.Linden // create and store meshs assets List meshAssets = new List(); + List meshAvatarSkeletons = new List(); + List meshAvatarColliders = new List(); + + bool curAvSkeleton; + bool curAvCollider; for (int i = 0; i < mesh_list.Count; i++) { -/* - // do we really need this heavy thing? + curAvSkeleton = false; + curAvCollider = false; + + // we do need to parse the mesh now OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]); if (osd is OSDMap) { @@ -891,9 +895,10 @@ namespace OpenSim.Region.ClientStack.Linden { OSDMap skeleton = (OSDMap)mosd["skeleton"]; int sksize = skeleton["size"].AsInteger(); + if (sksize > 0) + curAvSkeleton = true; } } -*/ AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); meshAsset.Data = mesh_list[i].AsBinary(); @@ -901,10 +906,11 @@ namespace OpenSim.Region.ClientStack.Linden meshAsset.Local = true; m_assetService.Store(meshAsset); meshAssets.Add(meshAsset.FullID); - + meshAvatarSkeletons.Add(curAvSkeleton); + meshAvatarColliders.Add(curAvCollider); // test code - if (avatarSkeleton && client != null) + if (curAvSkeleton && client != null) { string name = assetName; if (name.Length > 25) @@ -1594,14 +1600,12 @@ namespace OpenSim.Region.ClientStack.Linden private int m_nreqmeshs; private int m_nreqinstances; private bool m_IsAtestUpload; - private bool m_avatarSkeleton; - private bool m_avatarCollider; - + 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,bool avatarSkeleton, bool avatarCollider) + bool IsAtestUpload) { m_assetName = assetName; m_assetDes = description; @@ -1620,8 +1624,6 @@ namespace OpenSim.Region.ClientStack.Linden m_nreqmeshs = nreqmeshs; m_nreqinstances = nreqinstances; m_IsAtestUpload = IsAtestUpload; - m_avatarSkeleton = avatarSkeleton; - m_avatarCollider = avatarCollider; m_timeoutTimer.Elapsed += TimedOut; m_timeoutTimer.Interval = 120000; @@ -1667,7 +1669,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, - m_avatarSkeleton, m_avatarCollider, ref m_error); + ref m_error); } if (m_IsAtestUpload) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index db6f9fd..546bcd9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -99,15 +99,13 @@ 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 bool avatarSkeleton, out bool useAvatarCollider, - out string error, ref string warning) + LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) { totalcost = 0; error = string.Empty; - avatarSkeleton = false; - useAvatarCollider = false; - + bool avatarSkeleton = false; + if (resources == null || resources.instance_list == null || resources.instance_list.Array.Count == 0) -- cgit v1.1 From 39cfd823032ec83096cf3755566901f73a993fdc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 22:53:47 +0100 Subject: add simulator features AvatarSkeleton and AnimationSet report --- OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index e4d8a20..7c22a7c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -131,8 +131,11 @@ namespace OpenSim.Region.ClientStack.Linden m_features["MeshRezEnabled"] = true; m_features["MeshUploadEnabled"] = true; m_features["MeshXferEnabled"] = true; + m_features["AvatarSkeleton"] = true; + m_features["AnimationSet"] = true; + m_features["PhysicsMaterialsEnabled"] = true; - + OSDMap typesMap = new OSDMap(); typesMap["convex"] = true; typesMap["none"] = true; -- cgit v1.1 From 9a3df6445e82453964e0604b91ad08499406a2e2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 12 Oct 2014 12:52:12 +0100 Subject: move AnimationSet and AvatarSkeleton to OpenSimExtras --- .../ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 7c22a7c..bedec80 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -131,8 +131,6 @@ namespace OpenSim.Region.ClientStack.Linden m_features["MeshRezEnabled"] = true; m_features["MeshUploadEnabled"] = true; m_features["MeshXferEnabled"] = true; - m_features["AvatarSkeleton"] = true; - m_features["AnimationSet"] = true; m_features["PhysicsMaterialsEnabled"] = true; @@ -143,15 +141,19 @@ namespace OpenSim.Region.ClientStack.Linden m_features["PhysicsShapeTypes"] = typesMap; // Extra information for viewers that want to use it - // TODO: Take these out of here into their respective modules, like map-server-url + OSDMap extrasMap = new OSDMap(); + + extrasMap["AvatarSkeleton"] = true; + extrasMap["AnimationSet"] = true; + + // TODO: Take these out of here into their respective modules, like map-server-url if (m_SearchURL != string.Empty) extrasMap["search-server-url"] = m_SearchURL; if (m_ExportSupported) extrasMap["ExportSupported"] = true; - if (extrasMap.Count > 0) - m_features["OpenSimExtras"] = extrasMap; + m_features["OpenSimExtras"] = extrasMap; } } -- cgit v1.1 From 8c41271b3312f2a02608ffc41b220f7fb018d6ad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 13 Oct 2014 13:17:48 +0100 Subject: *TEST* send udp sync. Stop uncontroled and hidden use of IO threads. Testing this may require several people. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- .../Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 99e7aba..ac4a877 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1305,7 +1305,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketsSentCount++; // Put the UDP payload on the wire - AsyncBeginSend(buffer); + //AsyncBeginSend(buffer); + SyncSend(buffer); // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 881e768..1d76c14 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -375,12 +375,28 @@ namespace OpenMetaverse // Synchronous mode waits until the packet callback completes // before starting the receive to fetch another packet - if (!m_asyncPacketHandling) +// if (!m_asyncPacketHandling) AsyncBeginReceive(); } } } + public void SyncSend(UDPPacketBuffer buf) + { + try + { + m_udpSocket.SendTo( + buf.Data, + 0, + buf.DataLength, + SocketFlags.None, + buf.RemoteEndPoint + ); + } + catch (SocketException) { } + catch (ObjectDisposedException) { } + } + public void AsyncBeginSend(UDPPacketBuffer buf) { // if (IsRunningOutbound) -- cgit v1.1 From 33ec07332069de24b0442c7d1795580bd0669449 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 13 Oct 2014 22:46:58 +0100 Subject: revert to async send, since past experience showed sync didn't work when on mono --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ac4a877..8cc009d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1305,8 +1305,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketsSentCount++; // Put the UDP payload on the wire - //AsyncBeginSend(buffer); - SyncSend(buffer); + AsyncBeginSend(buffer); + //SyncSend(buffer); // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; -- cgit v1.1 From 12ebc92e55efbe08616506d7f543c3c9ed88de43 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 13 Oct 2014 23:52:19 +0200 Subject: Revert "*TEST* send udp sync. Stop uncontroled and hidden use of IO threads." This reverts commit 8c41271b3312f2a02608ffc41b220f7fb018d6ad. Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 - .../Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 18 +----------------- 2 files changed, 1 insertion(+), 18 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 8cc009d..99e7aba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1306,7 +1306,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Put the UDP payload on the wire AsyncBeginSend(buffer); - //SyncSend(buffer); // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 1d76c14..881e768 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -375,28 +375,12 @@ namespace OpenMetaverse // Synchronous mode waits until the packet callback completes // before starting the receive to fetch another packet -// if (!m_asyncPacketHandling) + if (!m_asyncPacketHandling) AsyncBeginReceive(); } } } - public void SyncSend(UDPPacketBuffer buf) - { - try - { - m_udpSocket.SendTo( - buf.Data, - 0, - buf.DataLength, - SocketFlags.None, - buf.RemoteEndPoint - ); - } - catch (SocketException) { } - catch (ObjectDisposedException) { } - } - public void AsyncBeginSend(UDPPacketBuffer buf) { // if (IsRunningOutbound) -- cgit v1.1 From 4571e5bc3e284c916d1ae4dd6429b80a8028b8e0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 24 Oct 2014 18:10:28 +0100 Subject: try to make SOG crossings full async. Simplify some borders checking.... --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6385aed..6f42990 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3865,7 +3865,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart part = (SceneObjectPart)update.Entity; - if (part.ParentGroup.IsDeleted) + if (part.ParentGroup.IsDeleted || part.ParentGroup.inTransit) continue; if (part.ParentGroup.IsAttachment) -- cgit v1.1 From 54ab9e7d4dd04042cb36b292c3896d20f3df8060 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 30 Oct 2014 21:57:20 +0000 Subject: set udp SocketOptionName.ReuseAddress to false, to not allow two regions to bind to same port, as seems to be possible at least with mono 3.2.8, same as patch just pushed to core by justin. This is not necessary on windows, possible a bug on some mono versions. --- OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 881e768..a09195c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -152,6 +152,8 @@ namespace OpenMetaverse SocketType.Dgram, ProtocolType.Udp); + m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); + try { // This udp socket flag is not supported under mono, -- cgit v1.1 From ba8e1efb434e9584972c56b9706752bb82a80057 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 31 Oct 2014 23:34:43 +0000 Subject: sadly revert to resend terseUpdates enqueuing them back into entityupdates queue. Viewers fail to handle correctly out of order updates with ugly visible effects. Make sure these packets don't include acks so they aren't lost. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 49 ++++++++++++++++++++-- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 2 files changed, 47 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6f42990..da30a04 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3824,6 +3824,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } + + /// + /// Requeue an EntityUpdate when it was not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdate(EntityUpdate update) + { + // If the update exists in priority queue, it will be updated. + // If it does not exist then it will be added with the current (rather than its original) priority + uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); + + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Enqueue(priority, update); + } + + /// + /// Requeue a list of EntityUpdates when they were not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) + { + // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); + + // Remove the update packet from the list of packets waiting for acknowledgement + // because we are requeuing the list of updates. They will be resent in new packets + // with the most recent state and priority. + m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); + + // Count this as a resent packet since we are going to requeue all of the updates contained in it + Interlocked.Increment(ref m_udpClient.PacketsResent); + + // We're not going to worry about interlock yet since its not currently critical that this total count + // is 100% correct + m_udpServer.PacketsResentCount++; + + foreach (EntityUpdate update in updates) + ResendPrimUpdate(update); + } + private void ProcessEntityUpdates(int maxUpdates) { OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -4044,7 +4087,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Unknown, true); + OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); } if (objectUpdateBlocks.IsValueCreated) @@ -4090,8 +4133,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - - OutPacket(packet, ThrottleOutPacketType.Task, true); + + OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); } #endregion Packet Sending diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 99e7aba..f66534d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1245,7 +1245,7 @@ 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) + if (!isZerocoded && !isResend && outgoingPacket.UnackedMethod == null) { // Keep appending ACKs until there is no room left in the buffer or there are // no more ACKs to append -- cgit v1.1 From 5cca6e7d16ee4dbfd23a0adcb50221e3e3051259 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Nov 2014 00:01:11 +0000 Subject: don't send updates for deleted agents --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index da30a04..4b15e9f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3832,8 +3832,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The original update time is used for the merged update. /// private void ResendPrimUpdate(EntityUpdate update) - { - // If the update exists in priority queue, it will be updated. + { + // If the update exists in priority queue, it will be updated. // If it does not exist then it will be added with the current (rather than its original) priority uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); @@ -3975,7 +3975,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP else if (update.Entity is ScenePresence) { ScenePresence presence = (ScenePresence)update.Entity; - + if (presence.IsDeleted) + continue; // If ParentUUID is not UUID.Zero and ParentID is 0, this // avatar is in the process of crossing regions while // sat on an object. In this state, we don't want any -- cgit v1.1 From ead78764abfe3d91f79b55ec200bd0d5e8ca2151 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Nov 2014 19:03:25 +0000 Subject: allow drawdistance to change between 32 and MaxDrawDistance, configurable value default to 256, so should have no effect. Next steps needed: reduce client udp Throttles with distance, update childreen connections with significat movement and view range changes, Make disconnect be delayed in time, make disconnects be receiving region action not sender on region changes. Allow distance less than 256 to only connect to visible regions, even none. Make this be relative to camera and not agent position or region centers as it is now. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4b15e9f..b9646c7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5765,8 +5765,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold - || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed + // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold + || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed ; //if (movementSignificant) //{ -- cgit v1.1 From caddabb5c4f62767305a589e9d818ae3457a8030 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Nov 2014 22:25:16 +0000 Subject: scale ChildAgentThrottles with distance (internal to child server and not root as was done before ) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++++- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b9646c7..f2f7cf9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12344,7 +12344,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SetChildAgentThrottle(byte[] throttles) { - m_udpClient.SetThrottles(throttles); + SetChildAgentThrottle(throttles, 1.0f); + } + + public void SetChildAgentThrottle(byte[] throttles,float factor) + { + m_udpClient.SetThrottles(throttles, factor); GenericCall2 handler = OnUpdateThrottles; if (handler != null) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 33375ff..0ae7617 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -340,6 +340,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SetThrottles(byte[] throttleData) { + SetThrottles(throttleData, 1.0f); + } + + public void SetThrottles(byte[] throttleData, float factor) + { byte[] adjData; int pos = 0; @@ -359,13 +364,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // 0.125f converts from bits to bytes - int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + float scale = 0.125f * factor; + int resend = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int land = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int wind = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int cloud = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int task = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged -- cgit v1.1 From 785a2cc729a9935a6a68a33ce2b7df107f40e918 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2014 04:48:36 +0100 Subject: Remove JustinCCs UDP patch - it is harmful to Avination's grid management --- OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index a09195c..0030dee 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -152,7 +152,9 @@ namespace OpenMetaverse SocketType.Dgram, ProtocolType.Udp); - m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); + // OpenSim may need this but in AVN, this messes up automated + // sim restarts badly + //m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); try { @@ -416,4 +418,4 @@ namespace OpenMetaverse catch (ObjectDisposedException) { } } } -} \ No newline at end of file +} -- cgit v1.1 From 64deb6ae6fdf586bcd2e940d3cbf3ee54367dc83 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2014 19:49:58 +0100 Subject: Second part of invisible base avatar option --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f2f7cf9..b7a4b93 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5142,7 +5142,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP acceleration = Vector3.Zero; if (sendTexture) - textureEntry = presence.Appearance.Texture.GetBytes(); + { + if (presence.Invisible) + textureEntry = AvatarAppearance.Invisible.GetBytes(); + else + textureEntry = presence.Appearance.Texture.GetBytes(); + } else textureEntry = null; } -- cgit v1.1 From bec456c2a529ca0b9ca7fd59e8110e5d5b27c126 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 11 Nov 2014 07:09:30 +0100 Subject: Remove the Invisible stuff and add more baked caching. Refactor selection of textures to save to Bakes module. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b7a4b93..849fec3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5143,10 +5143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (sendTexture) { - if (presence.Invisible) - textureEntry = AvatarAppearance.Invisible.GetBytes(); - else - textureEntry = presence.Appearance.Texture.GetBytes(); + textureEntry = presence.Appearance.Texture.GetBytes(); } else textureEntry = null; -- cgit v1.1 From 08c72a8dc1e54114559521a6c2952905ecf6f105 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 28 Mar 2015 07:50:04 -0700 Subject: varregion: remove use of Constants.RegionSize is various places. More use of the Util routines for conversion of region handles into addresses. --- .../ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index ca6c3ca..51535a6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -59,6 +59,7 @@ namespace OpenSim.Region.ClientStack.Linden public class EventQueueGetModule : IEventQueue, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static string LogHeader = "[EVENT QUEUE GET MODULE]"; /// /// Debug level. @@ -479,7 +480,7 @@ namespace OpenSim.Region.ClientStack.Linden public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) { m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>", - "[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY); + LogHeader, handle, avatarID, regionSizeX, regionSizeY); OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); Enqueue(item, avatarID); @@ -489,7 +490,7 @@ namespace OpenSim.Region.ClientStack.Linden ulong regionHandle, int regionSizeX, int regionSizeY) { m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>", - "[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY); + LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY); Enqueue(item, avatarID); } @@ -500,7 +501,7 @@ namespace OpenSim.Region.ClientStack.Linden UUID avatarID, int regionSizeX, int regionSizeY) { m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>", - "[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY); + LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY); @@ -512,7 +513,7 @@ namespace OpenSim.Region.ClientStack.Linden string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) { m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>", - "[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY); + LogHeader, handle, avatarID, regionSizeX, regionSizeY); OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint, capsURL, avatarID, sessionID, regionSizeX, regionSizeY); -- cgit v1.1 From c5a7bf6601dfde518a008d45b4e4a8dc8de698bf Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 28 Mar 2015 08:30:52 -0700 Subject: varregion: add varregion and TerrainData use in LLClientView. Add sending multiple parcel patches and sending patches by avatar view distance. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 273 +++++++++++++-------- 1 file changed, 164 insertions(+), 109 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 849fec3..4c0fba5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -312,6 +312,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static string LogHeader = "[LLCLIENTVIEW]"; protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients /// @@ -690,12 +691,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// true if the handler was added. This is currently always the case. public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync) { + return AddLocalPacketHandler(packetType, handler, doAsync, false); + } + + /// + /// Add a handler for the given packet type. + /// + /// + /// + /// + /// If true, when the packet is received handle it on a different thread. Whether this is given direct to + /// a threadpool thread or placed in a queue depends on the inEngine parameter. + /// + /// + /// If async is false then this parameter is ignored. + /// If async is true and inEngine is false, then the packet is sent directly to a + /// threadpool thread. + /// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine. + /// This may result in slower handling but reduces the risk of overloading the simulator when there are many + /// simultaneous async requests. + /// + /// true if the handler was added. This is currently always the case. + public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync, bool inEngine) + { bool result = false; lock (m_packetHandlers) { if (!m_packetHandlers.ContainsKey(packetType)) { - m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = doAsync }); + m_packetHandlers.Add( + packetType, new PacketProcessor() { method = handler, Async = doAsync }); result = true; } } @@ -1174,11 +1199,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Send the region heightmap to the client + /// This method is only called when not doing intellegent terrain patch sending and + /// is only called when the scene presence is initially created and sends all of the + /// region's patches to the client. /// /// heightmap public virtual void SendLayerData(float[] map) { - Util.FireAndForget(DoSendLayerData, map); + Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData()); // Send it sync, and async. It's not that much data // and it improves user experience just so much! @@ -1191,15 +1219,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private void DoSendLayerData(object o) { - float[] map = LLHeightFieldMoronize((float[])o); + TerrainData map = (TerrainData)o; try { + // Send LayerData in typerwriter pattern for (int y = 0; y < 16; y++) { - for (int x = 0; x < 16; x+=4) + for (int x = 0; x < 16; x++) { - SendLayerPacket(x, y, map); + SendLayerData(x, y, map); } } } @@ -1209,77 +1238,95 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - /// - /// Sends a set of four patches (x, x+1, ..., x+3) to the client - /// - /// heightmap - /// X coordinate for patches 0..12 - /// Y coordinate for patches 0..15 - private void SendLayerPacket(int x, int y, float[] map) + // Legacy form of invocation that passes around a bare data array. + // Just ignore what was passed and use the real terrain info that is part of the scene. + // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, + // there is a special form for specifying multiple terrain patches to send. + // The form is to pass 'px' as negative the number of patches to send and to + // pass the float array as pairs of patch X and Y coordinates. So, passing 'px' + // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches + // and the patches to send are <3,5> and <8,4>. + public void SendLayerData(int px, int py, float[] map) { - int[] patches = new int[4]; - patches[0] = x + 0 + y * 16; - patches[1] = x + 1 + y * 16; - patches[2] = x + 2 + y * 16; - patches[3] = x + 3 + y * 16; + if (px >= 0) + { + SendLayerData(px, py, m_scene.Heightmap.GetTerrainData()); + } + else + { + int numPatches = -px; + int[] xPatches = new int[numPatches]; + int[] yPatches = new int[numPatches]; + for (int pp = 0; pp < numPatches; pp++) + { + xPatches[pp] = (int)map[pp * 2]; + yPatches[pp] = (int)map[pp * 2 + 1]; + } - float[] heightmap = (map.Length == 65536) ? - map : - LLHeightFieldMoronize(map); + // DebugSendingPatches("SendLayerData", xPatches, yPatches); - try - { - Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); - OutPacket(layerpack, ThrottleOutPacketType.Land); + SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData()); } - catch + } + + private void DebugSendingPatches(string pWho, int[] pX, int[] pY) + { + if (m_log.IsDebugEnabled) { - for (int px = x ; px < x + 4 ; px++) - SendLayerData(px, y, map); + int numPatches = pX.Length; + string Xs = ""; + string Ys = ""; + for (int pp = 0; pp < numPatches; pp++) + { + Xs += String.Format("{0}", (int)pX[pp]) + ","; + Ys += String.Format("{0}", (int)pY[pp]) + ","; + } + m_log.DebugFormat("{0} {1}: numPatches={2}, X={3}, Y={4}", LogHeader, pWho, numPatches, Xs, Ys); } } /// - /// Sends a specified patch to a client + /// Sends a terrain packet for the point specified. + /// This is a legacy call that has refarbed the terrain into a flat map of floats. + /// We just use the terrain from the region we know about. /// /// Patch coordinate (x) 0..15 /// Patch coordinate (y) 0..15 /// heightmap - public void SendLayerData(int px, int py, float[] map) + public void SendLayerData(int px, int py, TerrainData terrData) + { + int[] xPatches = new[] { px }; + int[] yPatches = new[] { py }; + SendLayerData(xPatches, yPatches, terrData); + } + + private void SendLayerData(int[] px, int[] py, TerrainData terrData) { try { - int[] patches = new int[] { py * 16 + px }; - float[] heightmap = (map.Length == 65536) ? - map : - LLHeightFieldMoronize(map); - - LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); - - // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. - // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. - // We also make them unreliable because it's extremely likely that multiple packets will be sent for a terrain patch area - // invalidating previous packets for that area. - - // It's possible for an editing user to flood themselves with edited packets but the majority of use cases are such that only a - // tiny percentage of users will be editing the terrain. Other, non-editing users will see the edits much slower. - - // One last note on this topic, by the time users are going to be editing the terrain, it's extremely likely that the sim will - // have rezzed already and therefore this is not likely going to cause any additional issues with lost packets, objects or terrain - // patches. + /* test code using the terrain compressor in libOpenMetaverse + int[] patchInd = new int[1]; + patchInd[0] = px + (py * Constants.TerrainPatchSize); + LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(terrData.GetFloatsSerialized(), patchInd); + */ + // Many, many patches could have been passed to us. Since the patches will be compressed + // into variable sized blocks, we cannot pre-compute how many will fit into one + // packet. While some fancy packing algorithm is possible, 4 seems to always fit. + int PatchesAssumedToFit = 4; + for (int pcnt = 0; pcnt < px.Length; pcnt += PatchesAssumedToFit) + { + int remaining = Math.Min(px.Length - pcnt, PatchesAssumedToFit); + int[] xPatches = new int[remaining]; + int[] yPatches = new int[remaining]; + for (int ii = 0; ii < remaining; ii++) + { + xPatches[ii] = px[pcnt + ii]; + yPatches[ii] = py[pcnt + ii]; + } + LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, xPatches, yPatches); + // DebugSendingPatches("SendLayerDataInternal", xPatches, yPatches); - // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we only have one cache miss. - if (m_justEditedTerrain) - { - layerpack.Header.Reliable = false; - OutPacket(layerpack, - ThrottleOutPacketType.Unknown ); - } - else - { - layerpack.Header.Reliable = true; - OutPacket(layerpack, - ThrottleOutPacketType.Task); + SendTheLayerPacket(layerpack); } } catch (Exception e) @@ -1288,36 +1335,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - /// - /// Munges heightfield into the LLUDP backed in restricted heightfield. - /// - /// float array in the base; Constants.RegionSize - /// float array in the base 256 - internal float[] LLHeightFieldMoronize(float[] map) + // When a user edits the terrain, so much data is sent, the data queues up fast and presents a + // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we + // start skipping the queues until they're done editing the terrain. We also make them + // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch + // area invalidating previous packets for that area. + + // It's possible for an editing user to flood themselves with edited packets but the majority + // of use cases are such that only a tiny percentage of users will be editing the terrain. + // Other, non-editing users will see the edits much slower. + + // One last note on this topic, by the time users are going to be editing the terrain, it's + // extremely likely that the sim will have rezzed already and therefore this is not likely going + // to cause any additional issues with lost packets, objects or terrain patches. + + // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we + // only have one cache miss. + private void SendTheLayerPacket(LayerDataPacket layerpack) { - if (map.Length == 65536) - return map; + if (m_justEditedTerrain) + { + layerpack.Header.Reliable = false; + OutPacket(layerpack, ThrottleOutPacketType.Unknown ); + } else { - float[] returnmap = new float[65536]; - - if (map.Length < 65535) - { - // rebase the vector stride to 256 - for (int i = 0; i < Constants.RegionSize; i++) - Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, (int)Constants.RegionSize); - } - else - { - for (int i = 0; i < 256; i++) - Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, 256); - } - - //Array.Copy(map,0,returnmap,0,(map.Length < 65536)? map.Length : 65536); - - return returnmap; + layerpack.Header.Reliable = true; + OutPacket(layerpack, ThrottleOutPacketType.Land); } - } /// @@ -1346,21 +1391,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Vector2[] windSpeeds = (Vector2[])o; TerrainPatch[] patches = new TerrainPatch[2]; - patches[0] = new TerrainPatch(); - patches[0].Data = new float[16 * 16]; - patches[1] = new TerrainPatch(); - patches[1].Data = new float[16 * 16]; + patches[0] = new TerrainPatch { Data = new float[16 * 16] }; + patches[1] = new TerrainPatch { Data = new float[16 * 16] }; - for (int y = 0; y < 16; y++) + for (int x = 0; x < 16 * 16; x++) { - for (int x = 0; x < 16; x++) - { - patches[0].Data[y * 16 + x] = windSpeeds[y * 16 + x].X; - patches[1].Data[y * 16 + x] = windSpeeds[y * 16 + x].Y; - } + patches[0].Data[x] = windSpeeds[x].X; + patches[1].Data[x] = windSpeeds[x].Y; } - LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Wind); + byte layerType = (byte)TerrainPatch.LayerType.Wind; + if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) + layerType = (byte)TerrainPatch.LayerType.WindExtended; + + // LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, (TerrainPatch.LayerType)layerType); + LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, + (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); layerpack.Header.Zerocoded = true; OutPacket(layerpack, ThrottleOutPacketType.Wind); } @@ -1384,7 +1430,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Cloud); + byte layerType = (byte)TerrainPatch.LayerType.Cloud; + if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) + layerType = (byte)TerrainPatch.LayerType.CloudExtended; + + // LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, (TerrainPatch.LayerType)layerType); + LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, + (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); layerpack.Header.Zerocoded = true; OutPacket(layerpack, ThrottleOutPacketType.Cloud); } @@ -1489,10 +1541,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP mapReply.Data[i].Access = mapBlocks2[i].Access; mapReply.Data[i].Agents = mapBlocks2[i].Agents; - // TODO: hookup varregion sim size here mapReply.Size[i] = new MapBlockReplyPacket.SizeBlock(); - mapReply.Size[i].SizeX = 256; - mapReply.Size[i].SizeY = 256; + mapReply.Size[i].SizeX = mapBlocks2[i].SizeX; + mapReply.Size[i].SizeY = mapBlocks2[i].SizeY; } OutPacket(mapReply, ThrottleOutPacketType.Land); } @@ -1657,15 +1708,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(List localIDs) { -// foreach (uint id in localIDs) -// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); - - // remove pending entities - lock (m_entityProps.SyncRoot) - m_entityProps.Remove(localIDs); - lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Remove(localIDs); - KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; @@ -9087,6 +9129,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest; if (handlerTeleportLocationRequest != null) { + // Adjust teleport location to base of a larger region if requested to teleport to a sub-region + uint locX, locY; + Util.RegionHandleToWorldLoc(tpLocReq.Info.RegionHandle, out locX, out locY); + if ((locX >= m_scene.RegionInfo.WorldLocX) + && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) + && (locY >= m_scene.RegionInfo.WorldLocY) + && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) + { + tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; + tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; + tpLocReq.Info.Position.Y += locY - m_scene.RegionInfo.WorldLocY; + } + handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); } -- cgit v1.1 From 7aa171e49f991718ffac9a4749982f130ff7c285 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 12 Jun 2015 03:16:09 +0200 Subject: Maybe reduce incidence of ghost avatars --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index f66534d..b5f9da8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1757,6 +1757,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AuthenticateResponse sessionInfo; if (IsClientAuthorized(uccp, out sessionInfo)) { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + // Begin the process of adding the client to the simulator client = AddClient( @@ -1766,6 +1768,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); + // This will be true if the client is new, e.g. not + // an existing child agent, and there is no circuit data + if (client != null && aCircuit == null) + { + m_scene.CloseAgent(client.AgentId, true); + return; + } + // Now we know we can handle more data Thread.Sleep(200); @@ -1802,7 +1812,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); 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) -- cgit v1.1 From 1fb2f0296fdaff56745daa1c1e8096cd8e25462b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 15 Aug 2015 02:46:41 +0200 Subject: Track selected objects per client --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 849fec3..7b6889a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -474,6 +474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_disableFacelights = value; } } + public List SelectedObjects {get; private set;} public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } @@ -494,6 +495,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // DebugPacketLevel = 1; CloseSyncLock = new Object(); + SelectedObjects = new List(); RegisterInterface(this); RegisterInterface(this); @@ -7347,6 +7349,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < incomingselect.ObjectData.Length; i++) { + if (!SelectedObjects.Contains(incomingselect.ObjectData[i].ObjectLocalID)) + SelectedObjects.Add(incomingselect.ObjectData[i].ObjectLocalID); handlerObjectSelect = OnObjectSelect; if (handlerObjectSelect != null) { @@ -7373,6 +7377,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) { + if (!SelectedObjects.Contains(incomingdeselect.ObjectData[i].ObjectLocalID)) + SelectedObjects.Add(incomingdeselect.ObjectData[i].ObjectLocalID); handlerObjectDeselect = OnObjectDeselect; if (handlerObjectDeselect != null) { -- cgit v1.1 From 05d72f77ff38585817dead9b4a812ff97a001dce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 18 Aug 2015 21:32:03 +0100 Subject: do keepalive on mesh and texture GET. Dont use reusecontext any where. setting of keepalive is wrong, it should follow the requested one ( or always as http1.1) only deny if needed (errors). KeepAlive may increase stress on number of avaiable file descritors. --- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 4 ++-- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index a381a1b..4c15ad8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -264,7 +264,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = false; + response["keepalive"] = true; response["reusecontext"] = false; return response; @@ -285,7 +285,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = false; + response["keepalive"] = true; response["reusecontext"] = false; lock (responses) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index e053054..656f177 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -283,7 +283,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = false; + response["keepalive"] = true; response["reusecontext"] = false; return response; @@ -303,7 +303,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 503; response["str_response_string"] = "Throttled"; response["content_type"] = "text/plain"; - response["keepalive"] = false; + response["keepalive"] = true; response["reusecontext"] = false; lock (responses) @@ -320,7 +320,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = false; + response["keepalive"] = true; response["reusecontext"] = false; lock (responses) -- cgit v1.1 From fd82a0a0b79b9c0a817b887e7577e1094135dcd6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Aug 2015 00:26:43 +0100 Subject: add a Retry-After response header to the 503 sent when we are 2 busy to do the request. just 503 could mean server down (?) --- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 656f177..54e8d76 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -300,11 +300,16 @@ namespace OpenSim.Region.ClientStack.Linden { response = new Hashtable(); + response["int_response_code"] = 503; response["str_response_string"] = "Throttled"; response["content_type"] = "text/plain"; response["keepalive"] = true; response["reusecontext"] = false; + + Hashtable headers = new Hashtable(); + headers["Retry-After"] = 30; + response["headers"] = headers; lock (responses) responses[requestID] = new aPollResponse() {bytes = 0, response = response}; -- cgit v1.1 From 0af2fafddf36009ffe470da106dc6d0ceb3ced10 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Aug 2015 11:04:28 +0100 Subject: add missing regionExtent setup and Scene physicsscene configuration ( not exactly as core) --- OpenSim/Region/ClientStack/RegionApplicationBase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 287c278..982646e 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.ClientStack /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. /// /// - protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); + protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent); protected abstract ClientStackManager CreateClientStackManager(); protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); @@ -135,13 +135,13 @@ namespace OpenSim.Region.ClientStack /// /// protected PhysicsScene GetPhysicsScene( - string engine, string meshEngine, IConfigSource config, string osSceneIdentifier) + string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent) { PhysicsPluginManager physicsPluginManager; physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - - return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); + + return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent); } } } -- cgit v1.1 From 9a0040d67c5af84defc6f40733bd0dd6a09450d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Aug 2015 20:38:49 +0100 Subject: put back entities remove from updates on SendKillObject. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 226f2a1..36c3780 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1212,7 +1212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send it sync, and async. It's not that much data // and it improves user experience just so much! - DoSendLayerData(map); +// DoSendLayerData(map); } /// @@ -1710,6 +1710,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(List localIDs) { + // think we do need this + // foreach (uint id in localIDs) + // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); + + // remove pending entities + lock (m_entityProps.SyncRoot) + m_entityProps.Remove(localIDs); + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Remove(localIDs); + KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; -- cgit v1.1 From e3d82ad706db04d295a549543380b71b00848f7f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Aug 2015 04:08:30 +0100 Subject: delay terrain sending if land queue is 2 busy --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 11 ++++++++++- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 36c3780..46836b1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1199,6 +1199,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(GATRP, ThrottleOutPacketType.Task); } + + public virtual bool CanSendLayerData() + { + int n = m_udpClient.GetCatBytesInSendQueue(ThrottleOutPacketType.Land); + if ( n > 100000) + return false; + return true; + } + /// /// Send the region heightmap to the client /// This method is only called when not doing intellegent terrain patch sending and @@ -9151,7 +9160,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((locX >= m_scene.RegionInfo.WorldLocX) && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) && (locY >= m_scene.RegionInfo.WorldLocY) - && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) + && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY))) { tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 0ae7617..4b541e6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -474,6 +474,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP return data; } + + public int GetCatBytesInSendQueue(ThrottleOutPacketType cat) + { + ; + int icat = (int)cat; + if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT) + { + TokenBucket bucket = m_throttleCategories[icat]; + return m_packetOutboxes[icat].Count; + } + else + return 0; + } + public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) { -- cgit v1.1 From 018d855f2840988163519ca941a373c77997c689 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 24 Aug 2015 07:38:33 +0100 Subject: turn off KeepAlive --- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 4 ++-- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 4c15ad8..a381a1b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -264,7 +264,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = true; + response["keepalive"] = false; response["reusecontext"] = false; return response; @@ -285,7 +285,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = true; + response["keepalive"] = false; response["reusecontext"] = false; lock (responses) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 54e8d76..99ccd4b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -283,7 +283,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = true; + response["keepalive"] = false; response["reusecontext"] = false; return response; @@ -304,7 +304,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 503; response["str_response_string"] = "Throttled"; response["content_type"] = "text/plain"; - response["keepalive"] = true; + response["keepalive"] = false; response["reusecontext"] = false; Hashtable headers = new Hashtable(); @@ -325,7 +325,7 @@ namespace OpenSim.Region.ClientStack.Linden response["int_response_code"] = 500; response["str_response_string"] = "Script timeout"; response["content_type"] = "text/plain"; - response["keepalive"] = true; + response["keepalive"] = false; response["reusecontext"] = false; lock (responses) -- cgit v1.1 From e2cfc732939a1ccd686a310ef49995c24afe9e3c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Aug 2015 15:20:18 +0100 Subject: NEVER EVER SEND TERRAIN PATCHS AS UNRELIABLE!!!!!!!!!!!!!!!!!!!!!!!!!! this costed me hours :P --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 39 ++++++++-------------- 1 file changed, 13 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 46836b1..6c81035 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1315,6 +1315,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP { try { + if (px.Length != py.Length || + terrData.SizeX != (int)Scene.RegionInfo.RegionSizeX || + terrData.SizeY != (int)Scene.RegionInfo.RegionSizeY) + { + if (px.Length != py.Length) + m_log.Debug("px py"); + if (terrData.SizeX != Scene.RegionInfo.RegionSizeX) + m_log.Debug("sx"); + if (terrData.SizeY != Scene.RegionInfo.RegionSizeY) + m_log.Debug("sx"); + } + /* test code using the terrain compressor in libOpenMetaverse int[] patchInd = new int[1]; patchInd[0] = px + (py * Constants.TerrainPatchSize); @@ -1346,34 +1358,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - // When a user edits the terrain, so much data is sent, the data queues up fast and presents a - // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we - // start skipping the queues until they're done editing the terrain. We also make them - // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch - // area invalidating previous packets for that area. - - // It's possible for an editing user to flood themselves with edited packets but the majority - // of use cases are such that only a tiny percentage of users will be editing the terrain. - // Other, non-editing users will see the edits much slower. - - // One last note on this topic, by the time users are going to be editing the terrain, it's - // extremely likely that the sim will have rezzed already and therefore this is not likely going - // to cause any additional issues with lost packets, objects or terrain patches. - - // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we - // only have one cache miss. - private void SendTheLayerPacket(LayerDataPacket layerpack) + private void SendTheLayerPacket(LayerDataPacket layerpack) { - if (m_justEditedTerrain) - { - layerpack.Header.Reliable = false; - OutPacket(layerpack, ThrottleOutPacketType.Unknown ); - } - else - { - layerpack.Header.Reliable = true; OutPacket(layerpack, ThrottleOutPacketType.Land); - } } /// -- cgit v1.1 From c7ddb790a7b97115874f74a055e1d0c192eb8ef2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 27 Aug 2015 04:45:16 +0100 Subject: change osd encoding of region size --- .../Linden/Caps/EventQueue/EventQueueHelper.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 3fb7de2..50e22f5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -77,8 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); - llsdSimInfo.Add("RegionSizeX", new OSDInteger(regionSizeX)); - llsdSimInfo.Add("RegionSizeY", new OSDInteger(regionSizeY)); + llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); + llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); OSDArray arr = new OSDArray(1); arr.Add(llsdSimInfo); @@ -138,8 +138,8 @@ namespace OpenSim.Region.ClientStack.Linden regionDataMap.Add("SeedCapability", OSD.FromString(capsURL)); regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); - regionDataMap.Add("RegionSizeX", new OSDInteger(regionSizeX)); - regionDataMap.Add("RegionSizeY", new OSDInteger(regionSizeY)); + regionDataMap.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); + regionDataMap.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); OSDArray regionDataArr = new OSDArray(1); regionDataArr.Add(regionDataMap); @@ -173,8 +173,8 @@ namespace OpenSim.Region.ClientStack.Linden info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); // info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation info.Add("TeleportFlags", OSD.FromUInteger(flags)); - info.Add("RegionSizeX", new OSDInteger(regionSizeX)); - info.Add("RegionSizeY", new OSDInteger(regionSizeY)); + info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); + info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); OSDArray infoArr = new OSDArray(); infoArr.Add(info); @@ -211,8 +211,8 @@ namespace OpenSim.Region.ClientStack.Linden {"sim-ip-and-port", new OSDString(simIpAndPort)}, {"seed-capability", new OSDString(seedcap)}, {"region-handle", OSD.FromULong(regionHandle)}, - {"region-size-x", OSD.FromInteger(regionSizeX)}, - {"region-size-y", OSD.FromInteger(regionSizeY)} + {"region-size-x", OSD.FromUInteger((uint)regionSizeX)}, + {"region-size-y", OSD.FromUInteger((uint)regionSizeY)} }; return BuildEvent("EstablishAgentCommunication", body); -- cgit v1.1 From f9efa23d5e0534068dbfb4058cc318588dfbb1e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 27 Aug 2015 21:30:51 +0100 Subject: remove the rest of #justEditedTerrain, it was sending patchs non conforming to protocol, and no longer in agreement with how patchs are schedule to send --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6c81035..69f001a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -338,8 +338,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool m_VelocityInterpolate = false; private const uint MaxTransferBytesPerPacket = 600; - private volatile bool m_justEditedTerrain = false; - /// /// List used in construction of data blocks for an object update packet. This is to stop us having to /// continually recreate it. @@ -1315,18 +1313,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { try { - if (px.Length != py.Length || - terrData.SizeX != (int)Scene.RegionInfo.RegionSizeX || - terrData.SizeY != (int)Scene.RegionInfo.RegionSizeY) - { - if (px.Length != py.Length) - m_log.Debug("px py"); - if (terrData.SizeX != Scene.RegionInfo.RegionSizeX) - m_log.Debug("sx"); - if (terrData.SizeY != Scene.RegionInfo.RegionSizeY) - m_log.Debug("sx"); - } - /* test code using the terrain compressor in libOpenMetaverse int[] patchInd = new int[1]; patchInd[0] = px + (py * Constants.TerrainPatchSize); @@ -6509,7 +6495,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore, // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit. - m_justEditedTerrain = true; // Prevent terrain packet (Land layer) from being queued, make it unreliable if (OnModifyTerrain != null) { for (int i = 0; i < modify.ParcelData.Length; i++) @@ -6525,7 +6510,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - m_justEditedTerrain = false; // Queue terrain packet (Land layer) if necessary, make it reliable again } return true; -- cgit v1.1 From efc062b0ccfc0c1bbe305d7ce26b0521b53f1d74 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 28 Aug 2015 03:34:28 +0100 Subject: send land parcels overlay in cat Land not Task, or avatar freezes --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 69f001a..56069a3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4889,7 +4889,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.ParcelData.Data = data; packet.ParcelData.SequenceID = sequence_id; packet.Header.Zerocoded = true; - OutPacket(packet, ThrottleOutPacketType.Task); +// OutPacket(packet, ThrottleOutPacketType.Task); + OutPacket(packet, ThrottleOutPacketType.Land); } public void SendLandProperties( -- cgit v1.1