Bug fix in new child agents management. Thanks DigiDaz for helping identify this issue.

We need to update all child agents whenever the root agent crosses regions. The update
now includes child agents in common neighbours. This is so that those get updated with the
seeds of the new child agents that are spawned from the receiving region.
This also fixes some timing issues. We need to close child agents from the originating region
before we update child agents in the receiving region.
0.6.1-post-fixes
diva 2008-12-15 16:23:34 +00:00
parent 43142afab1
commit 4b71b88114
4 changed files with 174 additions and 116 deletions

View File

@ -169,6 +169,17 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
// once we reach here... // once we reach here...
//avatar.Scene.RemoveCapsHandler(avatar.UUID); //avatar.Scene.RemoveCapsHandler(avatar.UUID);
// Let's close some agents
if (isHyperLink) // close them all except this one
{
List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles);
regions.Remove(avatar.Scene.RegionInfo.RegionHandle);
SendCloseChildAgentConnections(avatar.UUID, regions);
}
else // close just a few
avatar.CloseChildAgents(newRegionX, newRegionY);
string capsPath = String.Empty;
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero; agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero;
@ -178,36 +189,37 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
{ {
// brand new agent // brand new agent
agent.CapsPath = Util.GetRandomCapsPath(); agent.CapsPath = Util.GetRandomCapsPath();
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent))
{
avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
return;
}
// TODO Should construct this behind a method
capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/";
if (eq != null)
{
OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint);
eq.Enqueue(Item, avatar.UUID);
Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath);
eq.Enqueue(Item, avatar.UUID);
}
else
{
avatar.ControllingClient.InformClientOfNeighbour(realHandle, reg.ExternalEndPoint);
// TODO: make Event Queue disablable!
}
} }
else else
{ {
// child agent already there // child agent already there
agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
} capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/";
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent))
{
avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
return;
}
// TODO Should construct this behind a method
string capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/";
if (eq != null)
{
OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint);
eq.Enqueue(Item, avatar.UUID);
Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath);
eq.Enqueue(Item, avatar.UUID);
}
else
{
avatar.ControllingClient.InformClientOfNeighbour(realHandle, reg.ExternalEndPoint);
// TODO: make Event Queue disablable!
} }
m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
@ -258,28 +270,24 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
} }
// Let's close some children agents
if (isHyperLink) // close them all
SendCloseChildAgentConnections(avatar.UUID, avatar.KnownChildRegionHandles);
else // close just a few
avatar.CloseChildAgents(newRegionX, newRegionY);
//avatar.Close(); //avatar.Close();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
/// ///
/// Hypergrid mod: extra check for isHyperLink /// Hypergrid mod: extra check for isHyperLink
/// ///
//if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
//{ {
// CloseConnection(avatar.UUID); CloseConnection(avatar.UUID);
//} }
// if (teleport success) // seems to be always success here // if (teleport success) // seems to be always success here
// the user may change their profile information in other region, // the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it // so the userinfo in UserProfileCache is not reliable any more, delete it
if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) if (avatar.Scene.NeedSceneCacheClear(avatar.UUID))
{
m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID);
m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID); m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID);
}
} }
else else
{ {

View File

@ -2657,7 +2657,7 @@ namespace OpenSim.Region.Environment.Scenes
GetAvatarAppearance(client, out appearance); GetAvatarAppearance(client, out appearance);
ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
return avatar; return avatar;
} }
@ -2871,9 +2871,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="agent"></param> /// <param name="agent"></param>
public void NewUserConnection(AgentCircuitData agent) public void NewUserConnection(AgentCircuitData agent)
{ {
m_log.DebugFormat("[CONNECTION DEBUGGING] Adding NewUserConnection for {0} in {1} with CC of {2}", agent.AgentID,
RegionInfo.RegionName, agent.circuitcode);
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
{ {
m_log.WarnFormat( m_log.WarnFormat(
@ -2883,9 +2880,19 @@ namespace OpenSim.Region.Environment.Scenes
/// Diva: Horrible stuff! /// Diva: Horrible stuff!
capsPaths[agent.AgentID] = agent.CapsPath; capsPaths[agent.AgentID] = agent.CapsPath;
//m_log.DebugFormat("------------>child seeds in {0}: {1}", RegionInfo.RegionName, ((agent.ChildrenCapSeeds == null) ? "null" : agent.ChildrenCapSeeds.Count.ToString()));
childrenSeeds[agent.AgentID] = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds); childrenSeeds[agent.AgentID] = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID);
if (sp != null)
{
m_log.DebugFormat("[CONNECTION DEBUGGING]: Updated agent {0} in {1}", agent.AgentID, RegionInfo.RegionName);
sp.AdjustKnownSeeds();
return;
}
m_log.DebugFormat("[CONNECTION DEBUGGING]: Adding NewUserConnection for {0} in {1} with CC of {2}", agent.AgentID,
RegionInfo.RegionName, agent.circuitcode);
AddCapsHandler(agent.AgentID); AddCapsHandler(agent.AgentID);
if (!agent.child) if (!agent.child)

View File

@ -255,7 +255,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Inform Client of Neighbours #region Inform Client of Neighbours
private delegate void InformClientOfNeighbourDelegate( private delegate void InformClientOfNeighbourDelegate(
ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, IPEndPoint endPoint); ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, IPEndPoint endPoint, bool newAgent);
private void InformClientOfNeighbourCompleted(IAsyncResult iar) private void InformClientOfNeighbourCompleted(IAsyncResult iar)
{ {
@ -274,8 +274,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="endPoint"></param> /// <param name="endPoint"></param>
private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg,
IPEndPoint endPoint) IPEndPoint endPoint, bool newAgent)
{ {
// Let's wait just a little to give time to originating regions to catch up with closing child agents
// after a cross here
Thread.Sleep(200);
uint x, y; uint x, y;
Utils.LongToUInts(reg.RegionHandle, out x, out y); Utils.LongToUInts(reg.RegionHandle, out x, out y);
x = x / Constants.RegionSize; x = x / Constants.RegionSize;
@ -287,7 +291,7 @@ namespace OpenSim.Region.Environment.Scenes
bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a);
if (regionAccepted) if (regionAccepted && newAgent)
{ {
IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null) if (eq != null)
@ -362,6 +366,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Collect as many seeds as possible /// Collect as many seeds as possible
Dictionary<ulong, string> seeds = new Dictionary<ulong, string>(avatar.Scene.GetChildrenSeeds(avatar.UUID)); Dictionary<ulong, string> seeds = new Dictionary<ulong, string>(avatar.Scene.GetChildrenSeeds(avatar.UUID));
//Console.WriteLine(" !!! No. of seeds: " + seeds.Count);
if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle)) if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle))
seeds.Add(avatar.Scene.RegionInfo.RegionHandle, avatar.ControllingClient.RequestClientInfo().CapsPath); seeds.Add(avatar.Scene.RegionInfo.RegionHandle, avatar.ControllingClient.RequestClientInfo().CapsPath);
@ -369,22 +374,26 @@ namespace OpenSim.Region.Environment.Scenes
List<AgentCircuitData> cagents = new List<AgentCircuitData>(); List<AgentCircuitData> cagents = new List<AgentCircuitData>();
foreach (SimpleRegionInfo neighbour in neighbours) foreach (SimpleRegionInfo neighbour in neighbours)
{ {
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle)
agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero;
agent.startpos = new Vector3(128, 128, 70);
agent.child = true;
if (newRegions.Contains(neighbour.RegionHandle))
{ {
agent.CapsPath = Util.GetRandomCapsPath();
avatar.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath);
seeds.Add(neighbour.RegionHandle, agent.CapsPath);
}
else
agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, neighbour.RegionHandle);
cagents.Add(agent); AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero;
agent.startpos = new Vector3(128, 128, 70);
agent.child = true;
if (newRegions.Contains(neighbour.RegionHandle))
{
agent.CapsPath = Util.GetRandomCapsPath();
avatar.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath);
seeds.Add(neighbour.RegionHandle, agent.CapsPath);
}
else
agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, neighbour.RegionHandle);
cagents.Add(agent);
}
} }
/// Update all child agent with everyone's seeds /// Update all child agent with everyone's seeds
@ -398,16 +407,22 @@ namespace OpenSim.Region.Environment.Scenes
//avatar.Scene.DumpChildrenSeeds(avatar.UUID); //avatar.Scene.DumpChildrenSeeds(avatar.UUID);
//avatar.DumpKnownRegions(); //avatar.DumpKnownRegions();
bool newAgent = false;
int count = 0; int count = 0;
foreach (SimpleRegionInfo neighbour in neighbours) foreach (SimpleRegionInfo neighbour in neighbours)
{ {
// Don't do it if there's already an agent in that region // Don't do it if there's already an agent in that region
if (newRegions.Contains(neighbour.RegionHandle)) if (newRegions.Contains(neighbour.RegionHandle))
newAgent = true;
else
newAgent = false;
if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle)
{ {
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
try try
{ {
d.BeginInvoke(avatar, cagents[count], neighbour, neighbour.ExternalEndPoint, d.BeginInvoke(avatar, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
InformClientOfNeighbourCompleted, InformClientOfNeighbourCompleted,
d); d);
} }
@ -429,11 +444,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
else
m_log.Debug("[SCM]: Skipping common neighbor " + neighbour.RegionLocX + ", " + neighbour.RegionLocY);
count++; count++;
} }
} }
@ -450,7 +461,7 @@ namespace OpenSim.Region.Environment.Scenes
agent.child = true; agent.child = true;
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
d.BeginInvoke(avatar, agent, region, region.ExternalEndPoint, d.BeginInvoke(avatar, agent, region, region.ExternalEndPoint, true,
InformClientOfNeighbourCompleted, InformClientOfNeighbourCompleted,
d); d);
} }
@ -748,6 +759,10 @@ namespace OpenSim.Region.Environment.Scenes
// once we reach here... // once we reach here...
//avatar.Scene.RemoveCapsHandler(avatar.UUID); //avatar.Scene.RemoveCapsHandler(avatar.UUID);
// Let's close some agents
avatar.CloseChildAgents(newRegionX, newRegionY);
string capsPath = String.Empty;
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero; agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero;
@ -757,36 +772,37 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// brand new agent // brand new agent
agent.CapsPath = Util.GetRandomCapsPath(); agent.CapsPath = Util.GetRandomCapsPath();
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent))
{
avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
return;
}
// TODO Should construct this behind a method
capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/";
if (eq != null)
{
OSD Item = EventQueueHelper.EnableSimulator(reg.RegionHandle, reg.ExternalEndPoint);
eq.Enqueue(Item, avatar.UUID);
Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath);
eq.Enqueue(Item, avatar.UUID);
}
else
{
avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, reg.ExternalEndPoint);
}
} }
else else
{ {
// child agent already there
agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/";
} }
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent))
{
avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
return;
}
// TODO Should construct this behind a method
string capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/";
if (eq != null)
{
OSD Item = EventQueueHelper.EnableSimulator(reg.RegionHandle, reg.ExternalEndPoint);
eq.Enqueue(Item, avatar.UUID);
Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath);
eq.Enqueue(Item, avatar.UUID);
}
else
{
avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, reg.ExternalEndPoint);
}
if (!m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, if (!m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
position, false)) position, false))
@ -826,24 +842,25 @@ namespace OpenSim.Region.Environment.Scenes
} }
// Let's close some children agents
avatar.CloseChildAgents(newRegionX, newRegionY);
// Close this ScenePresence too
//avatar.Close();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
//if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
//{ {
// CloseConnection(avatar.UUID); CloseConnection(avatar.UUID);
//} }
// if (teleport success) // seems to be always success here // if (teleport success) // seems to be always success here
// the user may change their profile information in other region, // the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it // so the userinfo in UserProfileCache is not reliable any more, delete it
if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) if (avatar.Scene.NeedSceneCacheClear(avatar.UUID))
{
m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID);
m_log.InfoFormat("User {0} is going to another region, profile cache removed", avatar.UUID); m_log.InfoFormat("User {0} is going to another region, profile cache removed", avatar.UUID);
}
// Close this ScenePresence too
//avatar.Close();
} }
else else
{ {

View File

@ -505,6 +505,28 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void AdjustKnownSeeds()
{
Dictionary<ulong, string> seeds = Scene.GetChildrenSeeds(UUID);
List<ulong> old = new List<ulong>();
foreach (ulong handle in seeds.Keys)
{
uint x, y;
Utils.LongToUInts(handle, out x, out y);
x = x / Constants.RegionSize;
y = y / Constants.RegionSize;
if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY))
{
old.Add(handle);
}
}
DropOldNeighbours(old);
Scene.SetChildrenSeed(UUID, seeds);
KnownRegions = seeds;
//Console.WriteLine(" ++++++++++AFTER+++++++++++++ ");
//DumpKnownRegions();
}
public void DumpKnownRegions() public void DumpKnownRegions()
{ {
Console.WriteLine("================ KnownRegions {0} ================", Scene.RegionInfo.RegionName); Console.WriteLine("================ KnownRegions {0} ================", Scene.RegionInfo.RegionName);
@ -545,6 +567,7 @@ namespace OpenSim.Region.Environment.Scenes
m_grouptitle = gm.GetGroupTitle(m_uuid); m_grouptitle = gm.GetGroupTitle(m_uuid);
AbsolutePosition = m_controllingClient.StartPos; AbsolutePosition = m_controllingClient.StartPos;
AdjustKnownSeeds();
TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here... TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here...
@ -935,7 +958,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_knownChildRegions.ContainsKey(regionHandle)) if (m_knownChildRegions.ContainsKey(regionHandle))
{ {
m_knownChildRegions.Remove(regionHandle); m_knownChildRegions.Remove(regionHandle);
//Console.WriteLine(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); //Console.WriteLine(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count);
} }
} }
} }
@ -1949,9 +1972,6 @@ namespace OpenSim.Region.Environment.Scenes
CheckForBorderCrossing(); CheckForBorderCrossing();
CheckForSignificantMovement(); // sends update to the modules. CheckForSignificantMovement(); // sends update to the modules.
} }
//if ((x++ % 30) == 0)
// Console.WriteLine(" >> In {0} known regions: {0}, seeds:{1}", Scene.RegionInfo.RegionName, KnownRegions.Count, Scene.GetChildrenSeeds(UUID));
} }
#endregion #endregion
@ -2412,6 +2432,9 @@ namespace OpenSim.Region.Environment.Scenes
m_physicsActor.Flying); m_physicsActor.Flying);
if (crossingSuccessful) if (crossingSuccessful)
{ {
// Next, let's close the child agent connections that are too far away.
CloseChildAgents(neighbourx, neighboury);
AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
//Console.WriteLine("BEFORE CROSS"); //Console.WriteLine("BEFORE CROSS");
@ -2446,15 +2469,15 @@ namespace OpenSim.Region.Environment.Scenes
CrossAttachmentsIntoNewRegion(neighbourHandle, true); CrossAttachmentsIntoNewRegion(neighbourHandle, true);
// m_scene.SendKillObject(m_localId); // m_scene.SendKillObject(m_localId);
// Next, let's close the child agent connections that are too far away.
CloseChildAgents(neighbourx, neighboury);
m_scene.NotifyMyCoarseLocationChange(); m_scene.NotifyMyCoarseLocationChange();
// the user may change their profile information in other region, // the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it // so the userinfo in UserProfileCache is not reliable any more, delete it
if (m_scene.NeedSceneCacheClear(UUID)) if (m_scene.NeedSceneCacheClear(UUID))
{
m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID); m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID);
m_log.InfoFormat("[AVATAR]: User {0} is going to another region, profile cache removed", UUID); m_log.InfoFormat("[AVATAR]: User {0} is going to another region, profile cache removed", UUID);
}
} }
else else
{ {
@ -2487,16 +2510,20 @@ namespace OpenSim.Region.Environment.Scenes
{ {
foreach (ulong handle in m_knownChildRegions.Keys) foreach (ulong handle in m_knownChildRegions.Keys)
{ {
uint x, y; // Don't close the agent on this region yet
Utils.LongToUInts(handle, out x, out y); if (handle != Scene.RegionInfo.RegionHandle)
x = x / Constants.RegionSize;
y = y / Constants.RegionSize;
//Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
//Console.WriteLine("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
if (Util.IsOutsideView(x, newRegionX, y, newRegionY))
{ {
byebyeRegions.Add(handle); uint x, y;
Utils.LongToUInts(handle, out x, out y);
x = x / Constants.RegionSize;
y = y / Constants.RegionSize;
//Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
//Console.WriteLine("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
if (Util.IsOutsideView(x, newRegionX, y, newRegionY))
{
byebyeRegions.Add(handle);
}
} }
} }
} }
@ -2510,7 +2537,6 @@ namespace OpenSim.Region.Environment.Scenes
RemoveNeighbourRegion(handle); RemoveNeighbourRegion(handle);
} }
} }
#endregion #endregion