Remove unnecessary AgentCircuitData null check from Scene.AddNewClient().

The only caller is the LLUDP stack and this has to validate the UDP circuit itself, so we know that it exists.
This allows us to eliminate another null check elsewhere and simplifies the method contract
iar_mods
Justin Clark-Casey (justincc) 2011-12-08 19:25:24 +00:00
parent 55de189752
commit 0e265889dd
4 changed files with 10 additions and 19 deletions

View File

@ -74,9 +74,7 @@ namespace OpenSim.Framework
/// <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. /// The scene agent if the new client was added or if an agent that already existed.</returns>
/// Null if the required scene agent already existed or no scene agent was added because the required client circuit doesn't exist.
/// </returns>
ISceneAgent AddNewClient(IClientAPI client, PresenceType type); ISceneAgent AddNewClient(IClientAPI client, PresenceType type);
/// <summary> /// <summary>

View File

@ -897,12 +897,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IClientAPI client = AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); IClientAPI client = AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint);
// Send ack straight away to let the viewer know that the connection is active. // Send ack straight away to let the viewer know that the connection is active.
// The client will be null if it already exists (e.g. if on a region crossing the client sends a use
// circuit code to the existing child agent. This is not particularly obvious.
SendAckImmediate(remoteEndPoint, packet.Header.Sequence); SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
// FIXME: Nasty - this is the only way we currently know if Scene.AddNewClient() failed to find a // We only want to send initial data to new clients, not ones which are being converted from child to root.
// circuit and bombed out early. That check might be pointless since authorization is established if (client != null)
// up here.
if (client != null && client.SceneAgent != null)
client.SceneAgent.SendInitialDataToMe(); client.SceneAgent.SendInitialDataToMe();
// m_log.DebugFormat( // m_log.DebugFormat(

View File

@ -2486,21 +2486,14 @@ namespace OpenSim.Region.Framework.Scenes
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods
/// <summary>
/// Add a new client and create a child scene presence for it.
/// </summary>
/// <param name="client"></param>
/// <param name="type">The type of agent to add.</param>
public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)
{ {
// Validation occurs in LLUDPServer
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
bool vialogin = false;
if (aCircuit == null) // no good, didn't pass NewUserConnection successfully bool vialogin
return null; = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0
|| (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
CheckHeartbeat(); CheckHeartbeat();

View File

@ -2548,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
// This agent just became root. We are going to tell everyone about it. The process of // This agent just became root. We are going to tell everyone about it. The process of
// getting other avatars information was initiated in the constructor... don't do it // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it
// again here... this comes after the cached appearance check because the avatars // again here... this comes after the cached appearance check because the avatars
// appearance goes into the avatar update packet // appearance goes into the avatar update packet
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();