aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-12-08 18:34:23 +0000
committerJustin Clark-Casey (justincc)2011-12-08 18:34:23 +0000
commitf61e54892f2284b6f89bacf3069467c05b2eea11 (patch)
tree87cb0933707a8e02f920910c7669273232021470 /OpenSim/Region/Framework
parentSimplify Scene.AddNewClient() (diff)
downloadopensim-SC_OLD-f61e54892f2284b6f89bacf3069467c05b2eea11.zip
opensim-SC_OLD-f61e54892f2284b6f89bacf3069467c05b2eea11.tar.gz
opensim-SC_OLD-f61e54892f2284b6f89bacf3069467c05b2eea11.tar.bz2
opensim-SC_OLD-f61e54892f2284b6f89bacf3069467c05b2eea11.tar.xz
On a new client circuit, send the initial reply ack to let the client know it's live before sending other data.
This means that avatar/appearance data of other avatars and scene objects for a client will be sent after the ack rather than possibly before. This may stop some avatars appearing grey on login. This introduces a new OpenSim.Framework.ISceneAgent to accompany the existing OpenSim.Framework.ISceneObject and ISceneEntity This allows IClientAPI to handle this as it can't reference OpenSim.Region.Framework.Interfaces
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScenePresence.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs39
4 files changed, 30 insertions, 48 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index ff39283..5e43843 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -38,28 +38,8 @@ namespace OpenSim.Region.Framework.Interfaces
38 /// <remarks> 38 /// <remarks>
39 /// Interface is a work in progress. Please feel free to add other required properties and methods. 39 /// Interface is a work in progress. Please feel free to add other required properties and methods.
40 /// </remarks> 40 /// </remarks>
41 public interface IScenePresence : ISceneEntity 41 public interface IScenePresence : ISceneAgent
42 { 42 {
43 /// <value>
44 /// The client controlling this presence
45 /// </value>
46 IClientAPI ControllingClient { get; }
47
48 /// <summary>
49 /// What type of presence is this? User, NPC, etc.
50 /// </summary>
51 PresenceType PresenceType { get; }
52
53 /// <summary>
54 /// Avatar appearance data.
55 /// </summary>
56 /// <remarks>
57 // Because appearance setting is in a module, we actually need
58 // to give it access to our appearance directly, otherwise we
59 // get a synchronization issue.
60 /// </remarks>
61 AvatarAppearance Appearance { get; set; }
62
63 /// <summary> 43 /// <summary>
64 /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments. 44 /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
65 /// </summary> 45 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 21c4a87..d47536a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2491,13 +2491,13 @@ namespace OpenSim.Region.Framework.Scenes
2491 /// </summary> 2491 /// </summary>
2492 /// <param name="client"></param> 2492 /// <param name="client"></param>
2493 /// <param name="type">The type of agent to add.</param> 2493 /// <param name="type">The type of agent to add.</param>
2494 public override void AddNewClient(IClientAPI client, PresenceType type) 2494 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)
2495 { 2495 {
2496 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2496 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2497 bool vialogin = false; 2497 bool vialogin = false;
2498 2498
2499 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully 2499 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
2500 return; 2500 return null;
2501 2501
2502 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || 2502 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
2503 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2503 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
@@ -2552,16 +2552,7 @@ namespace OpenSim.Region.Framework.Scenes
2552 if (vialogin) 2552 if (vialogin)
2553 EventManager.TriggerOnClientLogin(client); 2553 EventManager.TriggerOnClientLogin(client);
2554 2554
2555 // Send all scene object to the new client 2555 return sp;
2556 Util.FireAndForget(delegate
2557 {
2558 EntityBase[] entities = Entities.GetEntities();
2559 foreach(EntityBase e in entities)
2560 {
2561 if (e != null && e is SceneObjectGroup)
2562 ((SceneObjectGroup)e).SendFullUpdateToClient(client);
2563 }
2564 });
2565 } 2556 }
2566 2557
2567 /// <summary> 2558 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index a633c72..da15491 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes
175 175
176 #region Add/Remove Agent/Avatar 176 #region Add/Remove Agent/Avatar
177 177
178 public abstract void AddNewClient(IClientAPI client, PresenceType type); 178 public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type);
179 public abstract void RemoveClient(UUID agentID, bool closeChildAgents); 179 public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
180 180
181 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 181 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5b9438b..8e55996 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -782,15 +782,6 @@ namespace OpenSim.Region.Framework.Scenes
782 782
783 AdjustKnownSeeds(); 783 AdjustKnownSeeds();
784 784
785 // we created a new ScenePresence (a new child agent) in a fresh region.
786 // Request info about all the (root) agents in this region
787 // Note: This won't send data *to* other clients in that region (children don't send)
788
789// MIC: This gets called again in CompleteMovement
790 // SendInitialFullUpdateToAllClients();
791 SendOtherAgentsAvatarDataToMe();
792 SendOtherAgentsAppearanceToMe();
793
794 RegisterToEvents(); 785 RegisterToEvents();
795 SetDirectionVectors(); 786 SetDirectionVectors();
796 787
@@ -1191,9 +1182,9 @@ namespace OpenSim.Region.Framework.Scenes
1191 { 1182 {
1192// DateTime startTime = DateTime.Now; 1183// DateTime startTime = DateTime.Now;
1193 1184
1194 m_log.DebugFormat( 1185// m_log.DebugFormat(
1195 "[SCENE PRESENCE]: Completing movement of {0} into region {1}", 1186// "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
1196 client.Name, Scene.RegionInfo.RegionName); 1187// client.Name, Scene.RegionInfo.RegionName);
1197 1188
1198 Vector3 look = Velocity; 1189 Vector3 look = Velocity;
1199 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1190 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -1225,7 +1216,7 @@ namespace OpenSim.Region.Framework.Scenes
1225 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1216 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1226 1217
1227 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1218 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1228 SendInitialData(); 1219 ValidateAndSendAppearanceAndAgentData();
1229 1220
1230 // Create child agents in neighbouring regions 1221 // Create child agents in neighbouring regions
1231 if (openChildAgents && !IsChildAgent) 1222 if (openChildAgents && !IsChildAgent)
@@ -2512,11 +2503,31 @@ namespace OpenSim.Region.Framework.Scenes
2512 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 2503 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
2513 } 2504 }
2514 2505
2506 public void SendInitialDataToMe()
2507 {
2508 // we created a new ScenePresence (a new child agent) in a fresh region.
2509 // Request info about all the (root) agents in this region
2510 // Note: This won't send data *to* other clients in that region (children don't send)
2511 SendOtherAgentsAvatarDataToMe();
2512 SendOtherAgentsAppearanceToMe();
2513
2514 // Send all scene object to the new client
2515 Util.FireAndForget(delegate
2516 {
2517 EntityBase[] entities = Scene.Entities.GetEntities();
2518 foreach(EntityBase e in entities)
2519 {
2520 if (e != null && e is SceneObjectGroup)
2521 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
2522 }
2523 });
2524 }
2525
2515 /// <summary> 2526 /// <summary>
2516 /// Do everything required once a client completes its movement into a region and becomes 2527 /// Do everything required once a client completes its movement into a region and becomes
2517 /// a root agent. 2528 /// a root agent.
2518 /// </summary> 2529 /// </summary>
2519 private void SendInitialData() 2530 private void ValidateAndSendAppearanceAndAgentData()
2520 { 2531 {
2521 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); 2532 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID);
2522 // Moved this into CompleteMovement to ensure that Appearance is initialized before 2533 // Moved this into CompleteMovement to ensure that Appearance is initialized before