refactor: Rename Scene.AddNewClient() to AddNewAgent() to make it obvious in the code that this is symmetric with CloseAgent()

varregion
Justin Clark-Casey (justincc) 2013-09-27 22:27:39 +01:00
parent b16bc7b01c
commit 2cd95fac73
12 changed files with 23 additions and 22 deletions

View File

@ -86,14 +86,14 @@ namespace OpenSim.Framework
event restart OnRestart; event restart OnRestart;
/// <summary> /// <summary>
/// Add a new agent. All agents except initial login clients will starts off as a child agent /// Add a new agent with an attached client. All agents except initial login clients will starts off as a child agent
/// - the later agent crossing will promote it to a root agent. /// - the later agent crossing will promote it to a root agent.
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="type">The type of agent to add.</param> /// <param name="type">The type of agent to add.</param>
/// <returns> /// <returns>
/// The scene agent if the new client was added or if an agent that already existed.</returns> /// The scene agent if the new client was added or if an agent that already existed.</returns>
ISceneAgent AddNewClient(IClientAPI client, PresenceType type); ISceneAgent AddNewAgent(IClientAPI client, PresenceType type);
/// <summary> /// <summary>
/// Tell a single agent to disconnect from the region. /// Tell a single agent to disconnect from the region.

View File

@ -750,7 +750,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual void Start() public virtual void Start()
{ {
m_scene.AddNewClient(this, PresenceType.User); m_scene.AddNewAgent(this, PresenceType.User);
RefreshGroupMembership(); RefreshGroupMembership();
} }

View File

@ -1718,7 +1718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else if (client.SceneAgent == null) else if (client.SceneAgent == null)
{ {
// This check exists to catch a condition where the new client has been added to the client // 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 // eager, then the new ScenePresence may not have registered a listener for this messsage
// before we try to process it. // before we try to process it.
// XXX: A better long term fix may be to add the SceneAgent before the client is added to // XXX: A better long term fix may be to add the SceneAgent before the client is added to

View File

@ -52,7 +52,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
public override void Update(int frames) {} public override void Update(int frames) {}
public override void LoadWorldMap() {} public override void LoadWorldMap() {}
public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type)
{ {
client.OnObjectName += RecordObjectNameCall; 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 CloseAgent(UUID agentID, bool force) { return true; }
public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; } public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; }
public override void OtherRegionUp(GridRegion otherRegion) { } public override void OtherRegionUp(GridRegion otherRegion) { }

View File

@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Triggered when a new presence is added to the scene /// Triggered when a new presence is added to the scene
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/> which is used by both
/// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see> /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
/// </remarks> /// </remarks>
public event OnNewPresenceDelegate OnNewPresence; public event OnNewPresenceDelegate OnNewPresence;
@ -155,7 +155,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Triggered when a presence is removed from the scene /// Triggered when a presence is removed from the scene
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/> which is used by both
/// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see> /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
/// ///
/// Triggered under per-agent lock. So if you want to perform any long-running operations, please /// 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 <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/> /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/>
/// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/> /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/>
/// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/> /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/>
/// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/>
/// </remarks> /// </remarks>
public event MoneyTransferEvent OnMoneyTransfer; public event MoneyTransferEvent OnMoneyTransfer;

View File

@ -2802,7 +2802,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods
public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type)
{ {
ScenePresence sp; ScenePresence sp;
bool vialogin; bool vialogin;
@ -2810,7 +2810,7 @@ namespace OpenSim.Region.Framework.Scenes
// Validation occurs in LLUDPServer // 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. // each other. In practice, this does not currently occur in the code.
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 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 // and a simultaneous one that removes it (as can happen if the client is closed at a particular point
// whilst connecting). // 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 // 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 // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all
// AddNewClient() operations (though not other ops). // 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 // 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 // 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. // connected.
if (sp == null) if (sp == null)
{ {
@ -4306,7 +4306,7 @@ namespace OpenSim.Region.Framework.Scenes
// We have to wait until the viewer contacts this region // We have to wait until the viewer contacts this region
// after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol) // 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 // 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); ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID);
if (sp != null) if (sp != null)

View File

@ -216,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Add/Remove Agent/Avatar #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); public abstract bool CloseAgent(UUID agentID, bool force);

View File

@ -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 // *** 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 *** // circuit code given to the scene in stage 1 ***
TestClient client = new TestClient(acd, scene); 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.GetAgentCircuitData(agentId), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
@ -279,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// string reason; // string reason;
// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); // scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
// testclient = new TestClient(agent, scene); // testclient = new TestClient(agent, scene);
// scene.AddNewClient(testclient); // scene.AddNewAgent(testclient);
// //
// ScenePresence presence = scene.GetScenePresence(agent1); // ScenePresence presence = scene.GetScenePresence(agent1);
// //

View File

@ -903,7 +903,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public void Start() public void Start()
{ {
m_scene.AddNewClient(this, PresenceType.User); m_scene.AddNewAgent(this, PresenceType.User);
// Mimicking LLClientView which gets always set appearance from client. // Mimicking LLClientView which gets always set appearance from client.
AvatarAppearance appearance; AvatarAppearance appearance;

View File

@ -175,7 +175,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode,
acd); acd);
scene.AddNewClient(npcAvatar, PresenceType.Npc); scene.AddNewAgent(npcAvatar, PresenceType.Npc);
ScenePresence sp; ScenePresence sp;
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))

View File

@ -84,7 +84,7 @@ namespace OpenSim.Tests.Common
TestClient neighbourTc = new TestClient(newAgent, neighbourScene); TestClient neighbourTc = new TestClient(newAgent, neighbourScene);
neighbourTcs.Add(neighbourTc); neighbourTcs.Add(neighbourTc);
neighbourScene.AddNewClient(neighbourTc, PresenceType.User); neighbourScene.AddNewAgent(neighbourTc, PresenceType.User);
}; };
} }
@ -119,7 +119,7 @@ namespace OpenSim.Tests.Common
TestClient destinationClient = new TestClient(newAgent, destinationScene); TestClient destinationClient = new TestClient(newAgent, destinationScene);
destinationClients.Add(destinationClient); destinationClients.Add(destinationClient);
destinationScene.AddNewClient(destinationClient, PresenceType.User); destinationScene.AddNewAgent(destinationClient, PresenceType.User);
ThreadPool.UnsafeQueueUserWorkItem(o => destinationClient.CompleteMovement(), null); ThreadPool.UnsafeQueueUserWorkItem(o => destinationClient.CompleteMovement(), null);
}; };

View File

@ -548,7 +548,7 @@ namespace OpenSim.Tests.Common
Console.WriteLine("NewUserConnection failed: " + reason); Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene // Stage 2: add the new client as a child agent to the scene
scene.AddNewClient(client, PresenceType.User); scene.AddNewAgent(client, PresenceType.User);
return scene.GetScenePresence(client.AgentId); return scene.GetScenePresence(client.AgentId);
} }