From c3d16955a714c9a652eb5339103ecf6fcd6c299a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 9 Dec 2011 23:07:53 +0000 Subject: [PATCH] Get rid of IScene.PresenceChildStatus() which always had to execute a lookup in favour of IClientAPI.ISceneAgent.IsChildAgent instead. --- OpenSim/Framework/IScene.cs | 13 ------------- OpenSim/Framework/ISceneAgent.cs | 7 +++++++ .../ClientStack/Linden/UDP/LLClientView.cs | 16 ++++------------ OpenSim/Region/Framework/Scenes/Scene.cs | 14 -------------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 5 ----- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 ++------------- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 6 +++--- 7 files changed, 16 insertions(+), 60 deletions(-) diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index e0e023d76c..b2604f4a39 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -89,19 +89,6 @@ namespace OpenSim.Framework string GetSimulatorVersion(); - /// - /// Is the agent denoted by the given agentID a child presence in this scene? - /// - /// - /// Used by ClientView when a 'kick everyone' or 'estate message' occurs - /// - /// AvatarID to lookup - /// true if the presence is a child agent, false if the presence is a root exception - /// - /// Thrown if the agent does not exist. - /// - bool PresenceChildStatus(UUID agentId); - bool TryGetScenePresence(UUID agentID, out object scenePresence); /// diff --git a/OpenSim/Framework/ISceneAgent.cs b/OpenSim/Framework/ISceneAgent.cs index 69e91edfa7..824172d58a 100644 --- a/OpenSim/Framework/ISceneAgent.cs +++ b/OpenSim/Framework/ISceneAgent.cs @@ -47,6 +47,13 @@ namespace OpenSim.Framework /// PresenceType PresenceType { get; } + /// + /// If true, then the agent has no avatar in the scene. + /// The agent exists to relay data from a region that neighbours the current position of the user's avatar. + /// Occasionally data is relayed, such as which a user clicks an item in a neighbouring region. + /// + bool IsChildAgent { get; } + /// /// Avatar appearance data. /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6d720a033b..093454cc64 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -525,7 +525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void Kick(string message) { - if (!ChildAgentStatus()) + if (!SceneAgent.IsChildAgent) { KickUserPacket kupack = (KickUserPacket)PacketPool.Instance.GetPacket(PacketType.KickUser); kupack.UserInfo.AgentID = AgentId; @@ -2443,7 +2443,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message) { - if (!ChildAgentStatus()) + if (!SceneAgent.IsChildAgent) SendInstantMessage(new GridInstantMessage(null, FromAvatarID, FromAvatarName, AgentId, 1, Message, false, new Vector3())); //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch()); @@ -5049,14 +5049,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return 0; } - /// - /// This is a utility method used by single states to not duplicate kicks and blue card of death messages. - /// - public bool ChildAgentStatus() - { - return m_scene.PresenceChildStatus(AgentId); - } - #endregion /// @@ -11617,7 +11609,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (logPacket) m_log.DebugFormat( "[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}", - Name, ChildAgentStatus() ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type); + Name, SceneAgent.IsChildAgent ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type); } m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method); @@ -11674,7 +11666,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (logPacket) m_log.DebugFormat( "[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}", - Name, ChildAgentStatus() ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type); + Name, SceneAgent.IsChildAgent ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type); } if (!ProcessPacketMethod(packet)) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4613b81e03..78ea183374 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4193,20 +4193,6 @@ namespace OpenSim.Region.Framework.Scenes return m_sceneGraph.GetScenePresence(localID); } - public override bool PresenceChildStatus(UUID avatarID) - { - ScenePresence cp = GetScenePresence(avatarID); - - // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing - // This needs to be fixed properly by cleaning up the logout code. - //if (cp != null) - // return cp.IsChildAgent; - - //return false; - - return cp.IsChildAgent; - } - /// /// Performs action on all ROOT (not child) scene presences. /// This is just a shortcut function since frequently actions only appy to root SPs diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 302ca65ed8..232ed155ae 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -211,11 +211,6 @@ namespace OpenSim.Region.Framework.Scenes } #region admin stuff - - public virtual bool PresenceChildStatus(UUID avatarID) - { - return false; - } public abstract void OtherRegionUp(GridRegion otherRegion); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 89a399609e..4cd3543901 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -589,19 +589,7 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// If this is true, agent doesn't have a representation in this scene. - /// this is an agent 'looking into' this scene from a nearby scene(region) - /// - /// if False, this agent has a representation in this scene - /// - private bool m_isChildAgent = true; - - public bool IsChildAgent - { - get { return m_isChildAgent; } - set { m_isChildAgent = value; } - } + public bool IsChildAgent { get; set; } public uint ParentID { @@ -730,6 +718,7 @@ namespace OpenSim.Region.Framework.Scenes { AttachmentsSyncLock = new Object(); + IsChildAgent = true; m_sendCourseLocationsMethod = SendCoarseLocationsDefault; m_sceneViewer = new SceneViewer(this); m_animator = new ScenePresenceAnimator(this); diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 8f8124e6f6..c754019b1e 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden { if (client is LLClientView) { - bool isChild = scene.PresenceChildStatus(client.AgentId); + bool isChild = client.SceneAgent.IsChildAgent; if (isChild && !showChildren) return; @@ -308,7 +308,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden { if (client is IStatsCollector) { - bool isChild = scene.PresenceChildStatus(client.AgentId); + bool isChild = client.SceneAgent.IsChildAgent; if (isChild && !showChildren) return; @@ -404,7 +404,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden firstClient = false; } - bool isChild = scene.PresenceChildStatus(client.AgentId); + bool isChild = client.SceneAgent.IsChildAgent; if (isChild && !showChildren) return;