diff options
author | Justin Clark-Casey (justincc) | 2011-12-08 19:25:24 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-08 19:25:24 +0000 |
commit | 0e265889dd909d23b45175ec0e6f2d52725c008c (patch) | |
tree | 3f9d117d0f7a6a2303d0c562137abf198d072f96 | |
parent | minor: remove some mono compiler warnings (diff) | |
download | opensim-SC_OLD-0e265889dd909d23b45175ec0e6f2d52725c008c.zip opensim-SC_OLD-0e265889dd909d23b45175ec0e6f2d52725c008c.tar.gz opensim-SC_OLD-0e265889dd909d23b45175ec0e6f2d52725c008c.tar.bz2 opensim-SC_OLD-0e265889dd909d23b45175ec0e6f2d52725c008c.tar.xz |
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
-rw-r--r-- | OpenSim/Framework/IScene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 |
4 files changed, 10 insertions, 19 deletions
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 6919c48..e0e023d 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs | |||
@@ -74,9 +74,7 @@ namespace OpenSim.Framework | |||
74 | /// <param name="client"></param> | 74 | /// <param name="client"></param> |
75 | /// <param name="type">The type of agent to add.</param> | 75 | /// <param name="type">The type of agent to add.</param> |
76 | /// <returns> | 76 | /// <returns> |
77 | /// The scene agent if the new client was added. | 77 | /// The scene agent if the new client was added or if an agent that already existed.</returns> |
78 | /// Null if the required scene agent already existed or no scene agent was added because the required client circuit doesn't exist. | ||
79 | /// </returns> | ||
80 | ISceneAgent AddNewClient(IClientAPI client, PresenceType type); | 78 | ISceneAgent AddNewClient(IClientAPI client, PresenceType type); |
81 | 79 | ||
82 | /// <summary> | 80 | /// <summary> |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 7db5f6b..4ab8fd0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -897,12 +897,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
897 | IClientAPI client = AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); | 897 | IClientAPI client = AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); |
898 | 898 | ||
899 | // Send ack straight away to let the viewer know that the connection is active. | 899 | // Send ack straight away to let the viewer know that the connection is active. |
900 | // The client will be null if it already exists (e.g. if on a region crossing the client sends a use | ||
901 | // circuit code to the existing child agent. This is not particularly obvious. | ||
900 | SendAckImmediate(remoteEndPoint, packet.Header.Sequence); | 902 | SendAckImmediate(remoteEndPoint, packet.Header.Sequence); |
901 | 903 | ||
902 | // FIXME: Nasty - this is the only way we currently know if Scene.AddNewClient() failed to find a | 904 | // We only want to send initial data to new clients, not ones which are being converted from child to root. |
903 | // circuit and bombed out early. That check might be pointless since authorization is established | 905 | if (client != null) |
904 | // up here. | ||
905 | if (client != null && client.SceneAgent != null) | ||
906 | client.SceneAgent.SendInitialDataToMe(); | 906 | client.SceneAgent.SendInitialDataToMe(); |
907 | 907 | ||
908 | // m_log.DebugFormat( | 908 | // m_log.DebugFormat( |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d47536a..11505cc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2486,21 +2486,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2486 | 2486 | ||
2487 | #region Add/Remove Avatar Methods | 2487 | #region Add/Remove Avatar Methods |
2488 | 2488 | ||
2489 | /// <summary> | ||
2490 | /// Add a new client and create a child scene presence for it. | ||
2491 | /// </summary> | ||
2492 | /// <param name="client"></param> | ||
2493 | /// <param name="type">The type of agent to add.</param> | ||
2494 | public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) | 2489 | public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) |
2495 | { | 2490 | { |
2491 | // Validation occurs in LLUDPServer | ||
2496 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2492 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2497 | bool vialogin = false; | ||
2498 | |||
2499 | if (aCircuit == null) // no good, didn't pass NewUserConnection successfully | ||
2500 | return null; | ||
2501 | 2493 | ||
2502 | vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || | 2494 | bool vialogin |
2503 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2495 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2496 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | ||
2504 | 2497 | ||
2505 | CheckHeartbeat(); | 2498 | CheckHeartbeat(); |
2506 | 2499 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6463ab1..8824921 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2548,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2548 | } | 2548 | } |
2549 | 2549 | ||
2550 | // This agent just became root. We are going to tell everyone about it. The process of | 2550 | // This agent just became root. We are going to tell everyone about it. The process of |
2551 | // getting other avatars information was initiated in the constructor... don't do it | 2551 | // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it |
2552 | // again here... this comes after the cached appearance check because the avatars | 2552 | // again here... this comes after the cached appearance check because the avatars |
2553 | // appearance goes into the avatar update packet | 2553 | // appearance goes into the avatar update packet |
2554 | SendAvatarDataToAllAgents(); | 2554 | SendAvatarDataToAllAgents(); |