From 2cd95fac736cc99b1a2ad661e4a03810225ffaca Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 Sep 2013 22:27:39 +0100 Subject: refactor: Rename Scene.AddNewClient() to AddNewAgent() to make it obvious in the code that this is symmetric with CloseAgent() --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs | 3 ++- OpenSim/Region/Framework/Scenes/EventManager.cs | 6 +++--- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++------ OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- .../Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 4 ++-- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 2 +- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- 9 files changed, 18 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3609ec1..6b58fb7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -750,7 +750,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void Start() { - m_scene.AddNewClient(this, PresenceType.User); + m_scene.AddNewAgent(this, PresenceType.User); RefreshGroupMembership(); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 5296a6d..8d957dc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1718,7 +1718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP else if (client.SceneAgent == null) { // This check exists to catch a condition where the new client has been added to the client - // manager but the SceneAgent has not yet been set in Scene.AddNewClient(). If we are too + // manager but the SceneAgent has not yet been set in Scene.AddNewAgent(). If we are too // eager, then the new ScenePresence may not have registered a listener for this messsage // before we try to process it. // XXX: A better long term fix may be to add the SceneAgent before the client is added to diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs index 28b5eb7..e2178e5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests public override void Update(int frames) {} public override void LoadWorldMap() {} - public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) + public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type) { client.OnObjectName += RecordObjectNameCall; @@ -61,6 +61,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests } public override bool CloseAgent(UUID agentID, bool force) { return true; } + public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; } public override void OtherRegionUp(GridRegion otherRegion) { } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 39d7512..37b5776 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered when a new presence is added to the scene /// /// - /// Triggered in which is used by both + /// Triggered in which is used by both /// users and NPCs /// public event OnNewPresenceDelegate OnNewPresence; @@ -155,7 +155,7 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered when a presence is removed from the scene /// /// - /// Triggered in which is used by both + /// Triggered in which is used by both /// users and NPCs /// /// Triggered under per-agent lock. So if you want to perform any long-running operations, please @@ -1102,7 +1102,7 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered in /// via /// via - /// via + /// via /// public event MoneyTransferEvent OnMoneyTransfer; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 82abfe9..7772f94 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2802,7 +2802,7 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Avatar Methods - public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) + public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type) { ScenePresence sp; bool vialogin; @@ -2810,7 +2810,7 @@ namespace OpenSim.Region.Framework.Scenes // Validation occurs in LLUDPServer // - // XXX: A race condition exists here where two simultaneous calls to AddNewClient can interfere with + // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with // each other. In practice, this does not currently occur in the code. AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); @@ -2818,9 +2818,9 @@ namespace OpenSim.Region.Framework.Scenes // and a simultaneous one that removes it (as can happen if the client is closed at a particular point // whilst connecting). // - // It would be easier to lock across all NewUserConnection(), AddNewClient() and + // It would be easier to lock across all NewUserConnection(), AddNewAgent() and // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service - // response in some module listening to AddNewClient()) from holding up unrelated agent calls. + // response in some module listening to AddNewAgent()) from holding up unrelated agent calls. // // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all // AddNewClient() operations (though not other ops). @@ -2837,7 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause - // other problems, and possible the code calling AddNewClient() should ensure that no client is already + // other problems, and possibly the code calling AddNewAgent() should ensure that no client is already // connected. if (sp == null) { @@ -4306,7 +4306,7 @@ namespace OpenSim.Region.Framework.Scenes // We have to wait until the viewer contacts this region // after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol) // or TeleportFinish (for the v2 teleport protocol). This triggers the viewer to send - // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. + // a UseCircuitCode packet which in turn calls AddNewAgent which finally creates the ScenePresence. ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID); if (sp != null) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 4b37983..4f04706 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -216,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Agent/Avatar - public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type); + public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type); public abstract bool CloseAgent(UUID agentID, bool force); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index e25bcb7..d1aeaee 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // *** This is the second stage, where the client established a child agent/scene presence using the // circuit code given to the scene in stage 1 *** TestClient client = new TestClient(acd, scene); - scene.AddNewClient(client, PresenceType.User); + scene.AddNewAgent(client, PresenceType.User); Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); @@ -279,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // string reason; // scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); // testclient = new TestClient(agent, scene); -// scene.AddNewClient(testclient); +// scene.AddNewAgent(testclient); // // ScenePresence presence = scene.GetScenePresence(agent1); // diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 23a435d..a4fc4ae 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -903,7 +903,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public void Start() { - m_scene.AddNewClient(this, PresenceType.User); + m_scene.AddNewAgent(this, PresenceType.User); // Mimicking LLClientView which gets always set appearance from client. AvatarAppearance appearance; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 740f75a..fffe1ab 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -175,7 +175,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); - scene.AddNewClient(npcAvatar, PresenceType.Npc); + scene.AddNewAgent(npcAvatar, PresenceType.Npc); ScenePresence sp; if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) -- cgit v1.1