From 23be1cf1cd0722d48e7e15d2e2bb4e85eef1016e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Sep 2012 09:40:28 +0100 Subject: remove fireandforget call to EnableChildAgents at end on CompleteMovement, since this is already on own thread and its at the end of it. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 433efc7..a8aa551 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1315,13 +1315,15 @@ namespace OpenSim.Region.Framework.Scenes // Create child agents in neighbouring regions if (openChildAgents && !IsChildAgent) { + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) - Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); }); + m_agentTransfer.EnableChildAgents(this); IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + } // m_log.DebugFormat( -- cgit v1.1 From c83dd021f300a4272c8a869d20087dac29992c6d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Sep 2012 11:37:51 +0100 Subject: stop sending duplicated parcelProprieties at login --- .../CoreModules/World/Land/LandManagementModule.cs | 57 +++++++++++++++------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 8bc81ae..aae6603 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -401,30 +401,51 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendLandUpdate(ScenePresence avatar, bool force) { + + /* stop sendind same data twice + ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), + (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); + + if (over != null) + { + + if (force) + { + if (!avatar.IsChildAgent) + { + over.SendLandUpdateToClient(avatar.ControllingClient); + m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, + m_scene.RegionInfo.RegionID); + } + } + + if (avatar.currentParcelUUID != over.LandData.GlobalID) + { + if (!avatar.IsChildAgent) + { + over.SendLandUpdateToClient(avatar.ControllingClient); + avatar.currentParcelUUID = over.LandData.GlobalID; + m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, + m_scene.RegionInfo.RegionID); + } + } + */ + if (avatar.IsChildAgent) + return; + ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), - (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); + (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); if (over != null) { - if (force) + bool NotsameID = (avatar.currentParcelUUID != over.LandData.GlobalID); + if (force || NotsameID) { - if (!avatar.IsChildAgent) - { - over.SendLandUpdateToClient(avatar.ControllingClient); - m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, - m_scene.RegionInfo.RegionID); - } - } - - if (avatar.currentParcelUUID != over.LandData.GlobalID) - { - if (!avatar.IsChildAgent) - { - over.SendLandUpdateToClient(avatar.ControllingClient); + over.SendLandUpdateToClient(avatar.ControllingClient); + if (NotsameID) avatar.currentParcelUUID = over.LandData.GlobalID; - m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, - m_scene.RegionInfo.RegionID); - } + m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, + m_scene.RegionInfo.RegionID); } } } -- cgit v1.1 From 71d2d327d075824d9a9d3e4cd22c8a460301b837 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Sep 2012 12:50:38 +0100 Subject: One more redundante ParcelProprieties on login --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0237021..0dae946 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2890,9 +2890,11 @@ namespace OpenSim.Region.Framework.Scenes { EventManager.TriggerOnClientLogin(client); // Send initial parcel data +/* this is done on TriggerOnNewClient by landmanegement respective event handler Vector3 pos = sp.AbsolutePosition; ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); land.SendLandUpdateToClient(client); +*/ } return sp; -- 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(-) 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