On teleport to a region that already has a child agent established (e.g. a neighbour) don't resend all the initial avatar and object data again.

This is unnecessary since it has been received (and data continues to be received) in the existing child connection.
bullet-2.82
Justin Clark-Casey (justincc) 2014-08-15 21:34:58 +01:00
parent 626536b8cc
commit 91e1aaa5d4
7 changed files with 50 additions and 39 deletions

View File

@ -1296,7 +1296,7 @@ namespace OpenSim.Groups
presence.Grouptitle = Title; presence.Grouptitle = Title;
if (! presence.IsChildAgent) if (! presence.IsChildAgent)
presence.SendAvatarDataToAllAgents(); presence.SendAvatarDataToAllClients();
} }
} }
} }

View File

@ -71,7 +71,7 @@ namespace OpenSim.Framework
/// <remarks> /// <remarks>
/// This includes scene object data and the appearance data of other avatars. /// This includes scene object data and the appearance data of other avatars.
/// </remarks> /// </remarks>
void SendInitialDataToMe(); void SendInitialDataToClient();
/// <summary> /// <summary>
/// Direction in which the scene presence is looking. /// Direction in which the scene presence is looking.

View File

@ -1741,7 +1741,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bool tp = (aCircuit.teleportFlags > 0); bool tp = (aCircuit.teleportFlags > 0);
// Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
if (!tp) if (!tp)
client.SceneAgent.SendInitialDataToMe(); client.SceneAgent.SendInitialDataToClient();
} }
} }
else else

View File

@ -251,7 +251,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
private void SendAppearance(ScenePresence sp) private void SendAppearance(ScenePresence sp)
{ {
// Send the appearance to everyone in the scene // Send the appearance to everyone in the scene
sp.SendAppearanceToAllOtherAgents(); sp.SendAppearanceToAllOtherClients();
// Send animations back to the avatar as well // Send animations back to the avatar as well
sp.Animator.SendAnimPack(); sp.Animator.SendAnimPack();

View File

@ -1786,8 +1786,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_entityTransferStateMachine.ResetFromTransit(agent.UUID); m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
// now we have a child agent in this region. Request all interesting data about other (root) agents // now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendOtherAgentsAvatarDataToMe(); agent.SendOtherAgentsAvatarDataToClient();
agent.SendOtherAgentsAppearanceToMe(); agent.SendOtherAgentsAppearanceToClient();
// Backwards compatibility. Best effort // Backwards compatibility. Best effort
if (version == "Unknown" || version == string.Empty) if (version == "Unknown" || version == string.Empty)

View File

@ -286,6 +286,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Set if initial data about the scene (avatars, objects) has been sent to the ControllingClient.
/// </summary>
public bool SentInitialDataToClient { get; private set; }
/// <summary> /// <summary>
/// Copy of the script states while the agent is in transit. This state may /// Copy of the script states while the agent is in transit. This state may
/// need to be placed back in case of transfer fail. /// need to be placed back in case of transfer fail.
@ -1256,7 +1261,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
SendAvatarDataToAllAgents(); SendAvatarDataToAllClients();
// send the animations of the other presences to me // send the animations of the other presences to me
m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
@ -1296,7 +1301,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name); m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name);
UseFakeGroupTitle = true; UseFakeGroupTitle = true;
SendAvatarDataToAllAgents(false); SendAvatarDataToAllClients(false);
Util.FireAndForget(o => Util.FireAndForget(o =>
{ {
@ -1307,7 +1312,7 @@ namespace OpenSim.Region.Framework.Scenes
Thread.Sleep(5000); Thread.Sleep(5000);
UseFakeGroupTitle = false; UseFakeGroupTitle = false;
SendAvatarDataToAllAgents(false); SendAvatarDataToAllClients(false);
}); });
} }
@ -1742,9 +1747,9 @@ namespace OpenSim.Region.Framework.Scenes
// Tell the client that we're totally ready // Tell the client that we're totally ready
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
// Remember in HandleUseCircuitCode, we delayed this to here // Child agents send initial data up in LLUDPServer.HandleUseCircuitCode()
if (m_teleportFlags > 0) if (!SentInitialDataToClient)
SendInitialDataToMe(); SendInitialDataToClient();
// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); // m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
@ -2652,7 +2657,7 @@ namespace OpenSim.Region.Framework.Scenes
if (satOnObject) if (satOnObject)
{ {
SendAvatarDataToAllAgents(); SendAvatarDataToAllClients();
m_requestedSitTargetID = 0; m_requestedSitTargetID = 0;
part.RemoveSittingAvatar(this); part.RemoveSittingAvatar(this);
@ -2947,7 +2952,7 @@ namespace OpenSim.Region.Framework.Scenes
Animator.TrySetMovementAnimation("SIT_GROUND"); Animator.TrySetMovementAnimation("SIT_GROUND");
else else
Animator.TrySetMovementAnimation("SIT"); Animator.TrySetMovementAnimation("SIT");
SendAvatarDataToAllAgents(); SendAvatarDataToAllClients();
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
} }
@ -3062,7 +3067,7 @@ namespace OpenSim.Region.Framework.Scenes
sitAnimation = part.SitAnimation; sitAnimation = part.SitAnimation;
} }
Animator.TrySetMovementAnimation(sitAnimation); Animator.TrySetMovementAnimation(sitAnimation);
SendAvatarDataToAllAgents(); SendAvatarDataToAllClients();
TriggerScenePresenceUpdated(); TriggerScenePresenceUpdated();
} }
} }
@ -3185,7 +3190,7 @@ namespace OpenSim.Region.Framework.Scenes
// grab the latest PhysicsActor velocity, whereas m_velocity is often // grab the latest PhysicsActor velocity, whereas m_velocity is often
// storing a requested force instead of an actual traveling velocity // storing a requested force instead of an actual traveling velocity
if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn)
SendAvatarDataToAllAgents(); SendAvatarDataToAllClients();
// Allow any updates for sitting avatars to that llSetPrimitiveLinkParams() can work for very // Allow any updates for sitting avatars to that llSetPrimitiveLinkParams() can work for very
// small increments (e.g. sit position adjusters). An alternative may be to eliminate the tolerance // small increments (e.g. sit position adjusters). An alternative may be to eliminate the tolerance
@ -3339,16 +3344,22 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
} }
public void SendInitialDataToMe() public void SendInitialDataToClient()
{ {
SentInitialDataToClient = true;
// Send all scene object to the new client // Send all scene object to the new client
Util.RunThreadNoTimeout(delegate Util.RunThreadNoTimeout(delegate
{ {
m_log.DebugFormat(
"[SCENE PRESENCE]: Sending initial data to {0} agent {1} in {2}, tp flags {3}",
IsChildAgent ? "child" : "root", Name, Scene.Name, m_teleportFlags);
// we created a new ScenePresence (a new child agent) in a fresh region. // we created a new ScenePresence (a new child agent) in a fresh region.
// Request info about all the (root) agents in this region // Request info about all the (root) agents in this region
// Note: This won't send data *to* other clients in that region (children don't send) // Note: This won't send data *to* other clients in that region (children don't send)
SendOtherAgentsAvatarDataToMe(); SendOtherAgentsAvatarDataToClient();
SendOtherAgentsAppearanceToMe(); SendOtherAgentsAppearanceToClient();
EntityBase[] entities = Scene.Entities.GetEntities(); EntityBase[] entities = Scene.Entities.GetEntities();
foreach (EntityBase e in entities) foreach (EntityBase e in entities)
@ -3357,7 +3368,7 @@ namespace OpenSim.Region.Framework.Scenes
((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
} }
}, "SendInitialDataToMe", null); }, "SendInitialDataToClient", null);
} }
/// <summary> /// <summary>
@ -3390,10 +3401,10 @@ namespace OpenSim.Region.Framework.Scenes
// getting other avatars information was initiated elsewhere immediately after the child circuit connected... 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(); SendAvatarDataToAllClients();
// This invocation always shows up in the viewer logs as an error. Is it needed? // This invocation always shows up in the viewer logs as an error. Is it needed?
SendAppearanceToAgent(this); SendAppearanceToClient(this);
// If we are using the the cached appearance then send it out to everyone // If we are using the the cached appearance then send it out to everyone
if (cachedappearance) if (cachedappearance)
@ -3403,20 +3414,20 @@ namespace OpenSim.Region.Framework.Scenes
// If the avatars baked textures are all in the cache, then we have a // If the avatars baked textures are all in the cache, then we have a
// complete appearance... send it out, if not, then we'll send it when // complete appearance... send it out, if not, then we'll send it when
// the avatar finishes updating its appearance // the avatar finishes updating its appearance
SendAppearanceToAllOtherAgents(); SendAppearanceToAllOtherClients();
} }
} }
public void SendAvatarDataToAllAgents() public void SendAvatarDataToAllClients()
{ {
SendAvatarDataToAllAgents(true); SendAvatarDataToAllClients(true);
} }
/// <summary> /// <summary>
/// Send this agent's avatar data to all other root and child agents in the scene /// Send this agent's avatar data to all other root and child agents in the scene
/// This agent must be root. This avatar will receive its own update. /// This agent must be root. This avatar will receive its own update.
/// </summary> /// </summary>
public void SendAvatarDataToAllAgents(bool full) public void SendAvatarDataToAllClients(bool full)
{ {
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID); //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID);
// only send update from root agents to other clients; children are only "listening posts" // only send update from root agents to other clients; children are only "listening posts"
@ -3435,7 +3446,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{ {
if (full) if (full)
SendAvatarDataToAgent(scenePresence); SendAvatarDataToClient(scenePresence);
else else
scenePresence.ControllingClient.SendAvatarDataImmediate(this); scenePresence.ControllingClient.SendAvatarDataImmediate(this);
count++; count++;
@ -3448,7 +3459,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Send avatar data for all other root agents to this agent, this agent /// Send avatar data for all other root agents to this agent, this agent
/// can be either a child or root /// can be either a child or root
/// </summary> /// </summary>
public void SendOtherAgentsAvatarDataToMe() public void SendOtherAgentsAvatarDataToClient()
{ {
int count = 0; int count = 0;
m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
@ -3457,7 +3468,7 @@ namespace OpenSim.Region.Framework.Scenes
if (scenePresence.UUID == UUID) if (scenePresence.UUID == UUID)
return; return;
scenePresence.SendAvatarDataToAgent(this); scenePresence.SendAvatarDataToClient(this);
count++; count++;
}); });
@ -3468,9 +3479,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Send avatar data to an agent. /// Send avatar data to an agent.
/// </summary> /// </summary>
/// <param name="avatar"></param> /// <param name="avatar"></param>
public void SendAvatarDataToAgent(ScenePresence avatar) public void SendAvatarDataToClient(ScenePresence avatar)
{ {
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToClient from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAvatarDataImmediate(this); avatar.ControllingClient.SendAvatarDataImmediate(this);
Animator.SendAnimPackToClient(avatar.ControllingClient); Animator.SendAnimPackToClient(avatar.ControllingClient);
@ -3480,9 +3491,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Send this agent's appearance to all other root and child agents in the scene /// Send this agent's appearance to all other root and child agents in the scene
/// This agent must be root. /// This agent must be root.
/// </summary> /// </summary>
public void SendAppearanceToAllOtherAgents() public void SendAppearanceToAllOtherClients()
{ {
// m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherClients: {0} {1}", Name, UUID);
// only send update from root agents to other clients; children are only "listening posts" // only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent) if (IsChildAgent)
@ -3501,7 +3512,7 @@ namespace OpenSim.Region.Framework.Scenes
if (scenePresence.UUID == UUID) if (scenePresence.UUID == UUID)
return; return;
SendAppearanceToAgent(scenePresence); SendAppearanceToClient(scenePresence);
count++; count++;
}); });
@ -3512,9 +3523,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Send appearance from all other root agents to this agent. this agent /// Send appearance from all other root agents to this agent. this agent
/// can be either root or child /// can be either root or child
/// </summary> /// </summary>
public void SendOtherAgentsAppearanceToMe() public void SendOtherAgentsAppearanceToClient()
{ {
// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} {1}", Name, UUID); // m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToClient {0} {1}", Name, UUID);
int count = 0; int count = 0;
m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
@ -3523,7 +3534,7 @@ namespace OpenSim.Region.Framework.Scenes
if (scenePresence.UUID == UUID) if (scenePresence.UUID == UUID)
return; return;
scenePresence.SendAppearanceToAgent(this); scenePresence.SendAppearanceToClient(this);
count++; count++;
}); });
@ -3534,7 +3545,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Send appearance data to an agent. /// Send appearance data to an agent.
/// </summary> /// </summary>
/// <param name="avatar"></param> /// <param name="avatar"></param>
public void SendAppearanceToAgent(ScenePresence avatar) public void SendAppearanceToClient(ScenePresence avatar)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);

View File

@ -1381,7 +1381,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
presence.Grouptitle = Title; presence.Grouptitle = Title;
if (! presence.IsChildAgent) if (! presence.IsChildAgent)
presence.SendAvatarDataToAllAgents(); presence.SendAvatarDataToAllClients();
} }
} }
} }