From 3ba63dde6ef773602a6c8ffa11d034a59a73f057 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Jun 2017 12:17:39 +0100 Subject: udp is not tcp. If mono versions have bronke udp sento, better update, also having 300 threads because object select is not funny --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1091078..f13b259 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6036,8 +6036,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams); AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate); AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects); - AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect); - AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect); + AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect, true, true); + AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect, true, true); AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition); AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); -- cgit v1.1 From fd8836e49393415524abedc00de3c8cacf9f529a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Jun 2017 14:09:34 +0100 Subject: dont let time go back --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 38 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f13b259..1118bb6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -8030,19 +8030,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } + Dictionary objImageSeqs = null; + double lastobjImageSeqsMS = 0.0; + private bool HandleObjectImage(IClientAPI sender, Packet Pack) { ObjectImagePacket imagePack = (ObjectImagePacket)Pack; - UpdatePrimTexture handlerUpdatePrimTexture = null; + UpdatePrimTexture handlerUpdatePrimTexture = OnUpdatePrimTexture; + if (handlerUpdatePrimTexture == null) + return true; + + double now = Util.GetTimeStampMS(); + if(objImageSeqs == null) + objImageSeqs = new Dictionary(16); + else + { + if ( now - lastobjImageSeqsMS > 30000.0) + objImageSeqs.Clear(); + } + + lastobjImageSeqsMS = now; + uint seq = Pack.Header.Sequence; + uint id; + uint lastseq; + + ObjectImagePacket.ObjectDataBlock o; for (int i = 0; i < imagePack.ObjectData.Length; i++) { - handlerUpdatePrimTexture = OnUpdatePrimTexture; - if (handlerUpdatePrimTexture != null) - { - handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, - imagePack.ObjectData[i].TextureEntry, this); - } + o = imagePack.ObjectData[i]; + id = o.ObjectLocalID; + if(objImageSeqs.TryGetValue(id, out lastseq)) + { + if(seq <= lastseq) + continue; + } + objImageSeqs[id] = seq; + handlerUpdatePrimTexture(id, o.TextureEntry, this); } return true; } -- cgit v1.1 From f33a871d614d9bf3e08b584080f53dc84dde9ec7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Jun 2017 14:15:28 +0100 Subject: hope gc does remove a little dic and contents --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1118bb6..d22f75e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -8042,12 +8042,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; double now = Util.GetTimeStampMS(); - if(objImageSeqs == null) - objImageSeqs = new Dictionary(16); - else + if(objImageSeqs == null || ( now - lastobjImageSeqsMS > 30000.0)) { - if ( now - lastobjImageSeqsMS > 30000.0) - objImageSeqs.Clear(); + objImageSeqs = null; // yeah i know superstition... + objImageSeqs = new Dictionary(16); } lastobjImageSeqsMS = now; -- cgit v1.1 From ad43cc6784b5422c5b7125a4f9356a3fa7fe2aee Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Jun 2017 19:04:18 +0100 Subject: change llclient async udp packets processing. Removed the shared Jobengine that made only one thread do some packets for all users, and removed the FireAndForget, so each user could issue a unlimited number of threads. Added a new JobEngine per client, so each gets at most one thread,and that thread can be released if iddle (for 5 seconds ) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d22f75e..54359eb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -325,6 +325,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public LLImageManager ImageManager { get; private set; } + public JobEngine m_asyncPacketProcess; private readonly LLUDPServer m_udpServer; private readonly LLUDPClient m_udpClient; private readonly UUID m_sessionId; @@ -378,7 +379,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected Scene m_scene; protected string m_firstName; protected string m_lastName; - protected Thread m_clientThread; protected Vector3 m_startpos; protected UUID m_activeGroupID; protected string m_activeGroupName = String.Empty; @@ -529,7 +529,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_prioritizer = new Prioritizer(m_scene); RegisterLocalPacketHandlers(); - + string name = string.Format("AsyncInUDP-{0}",m_agentId.ToString()); + m_asyncPacketProcess = new JobEngine(name, name, 10000); IsActive = true; } @@ -592,6 +593,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (OnConnectionClosed != null) OnConnectionClosed(this); + m_asyncPacketProcess.Stop(); // Flush all of the packets out of the UDP server for this client if (m_udpServer != null) @@ -778,12 +780,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP cinfo.AsyncRequests[packet.Type.ToString()]++; object obj = new AsyncPacketProcess(this, pprocessor.method, packet); - +/* if (pprocessor.InEngine) m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); else Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString()); - +*/ + m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); result = true; } else @@ -841,6 +844,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void Start() { + m_asyncPacketProcess.Start(); m_scene.AddNewAgent(this, PresenceType.User); // RefreshGroupMembership(); -- cgit v1.1