change child agents creation/notification. As before this assumes that
sending regions close out of view connections.avinationmerge
parent
f9588730cf
commit
b7708b9d1f
|
@ -1875,9 +1875,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
//m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count);
|
//m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count);
|
||||||
|
|
||||||
sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath);
|
sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath);
|
||||||
//foreach (ulong h in agent.ChildrenCapSeeds.Keys)
|
|
||||||
// m_log.DebugFormat("[XXX] --> {0}", h);
|
|
||||||
//m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle);
|
|
||||||
agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath);
|
agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath);
|
||||||
|
|
||||||
if (sp.Scene.CapsModule != null)
|
if (sp.Scene.CapsModule != null)
|
||||||
|
@ -1920,6 +1917,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
/// <param name="sp"></param>
|
/// <param name="sp"></param>
|
||||||
public void EnableChildAgents(ScenePresence sp)
|
public void EnableChildAgents(ScenePresence sp)
|
||||||
{
|
{
|
||||||
|
// assumes that out of view range regions are disconnected by the previus region
|
||||||
|
|
||||||
List<GridRegion> neighbours = new List<GridRegion>();
|
List<GridRegion> neighbours = new List<GridRegion>();
|
||||||
RegionInfo m_regionInfo = sp.Scene.RegionInfo;
|
RegionInfo m_regionInfo = sp.Scene.RegionInfo;
|
||||||
|
|
||||||
|
@ -1952,8 +1951,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||||
|
|
||||||
List<ulong> newneighbours = new List<ulong>();
|
|
||||||
List<AgentCircuitData> cagents = new List<AgentCircuitData>();
|
List<AgentCircuitData> cagents = new List<AgentCircuitData>();
|
||||||
|
List<GridRegion> newneighbours = new List<GridRegion>();
|
||||||
|
|
||||||
ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle;
|
ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle;
|
||||||
|
|
||||||
|
@ -1961,9 +1960,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
ulong handler = neighbour.RegionHandle;
|
ulong handler = neighbour.RegionHandle;
|
||||||
|
|
||||||
|
if (previousRegionNeighbourHandles.Contains(handler))
|
||||||
|
{
|
||||||
|
// agent already knows this region
|
||||||
|
previousRegionNeighbourHandles.Remove(handler);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (handler == currentRegionHandler)
|
if (handler == currentRegionHandler)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// a new region to add
|
||||||
AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
|
AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
|
||||||
agent.BaseFolder = UUID.Zero;
|
agent.BaseFolder = UUID.Zero;
|
||||||
agent.InventoryFolder = UUID.Zero;
|
agent.InventoryFolder = UUID.Zero;
|
||||||
|
@ -1982,86 +1989,71 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
agent.Id0 = currentAgentCircuit.Id0;
|
agent.Id0 = currentAgentCircuit.Id0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previousRegionNeighbourHandles.Contains(handler))
|
newneighbours.Add(neighbour);
|
||||||
{
|
agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||||
previousRegionNeighbourHandles.Remove(handler);
|
seeds.Add(handler, agent.CapsPath);
|
||||||
agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, handler);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newneighbours.Add(handler);
|
|
||||||
agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
|
||||||
sp.AddNeighbourRegion(handler, agent.CapsPath);
|
|
||||||
seeds.Add(handler, agent.CapsPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
cagents.Add(agent);
|
cagents.Add(agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//sp.DropOldNeighbours(previousRegionNeighbourHandles);
|
if (previousRegionNeighbourHandles.Contains(currentRegionHandler))
|
||||||
foreach (ulong handle in previousRegionNeighbourHandles)
|
previousRegionNeighbourHandles.Remove(currentRegionHandler);
|
||||||
{
|
|
||||||
sp.RemoveNeighbourRegion(handle);
|
// previousRegionNeighbourHandles now contains regions to forget
|
||||||
Scene.CapsModule.DropChildSeed(sp.UUID, handle);
|
foreach (uint handler in previousRegionNeighbourHandles)
|
||||||
}
|
seeds.Remove(handler);
|
||||||
|
|
||||||
/// Update all child agent with everyone's seeds
|
/// Update all child agent with everyone's seeds
|
||||||
foreach (AgentCircuitData a in cagents)
|
foreach (AgentCircuitData a in cagents)
|
||||||
{
|
|
||||||
a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
|
a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
|
||||||
}
|
|
||||||
|
|
||||||
if (sp.Scene.CapsModule != null)
|
if (sp.Scene.CapsModule != null)
|
||||||
{
|
|
||||||
sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds);
|
sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds);
|
||||||
}
|
|
||||||
|
|
||||||
sp.KnownRegions = seeds;
|
sp.KnownRegions = seeds;
|
||||||
//avatar.Scene.DumpChildrenSeeds(avatar.UUID);
|
|
||||||
//avatar.DumpKnownRegions();
|
if (newneighbours.Count > 0)
|
||||||
|
|
||||||
Util.FireAndForget(delegate
|
|
||||||
{
|
{
|
||||||
Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
|
Util.FireAndForget(delegate
|
||||||
int count = 0;
|
|
||||||
bool newagent;
|
|
||||||
|
|
||||||
foreach (GridRegion neighbour in neighbours)
|
|
||||||
{
|
{
|
||||||
try
|
Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
|
||||||
{
|
int count = 0;
|
||||||
newagent = newneighbours.Contains(neighbour.RegionHandle);
|
|
||||||
InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newagent);
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (ArgumentOutOfRangeException)
|
foreach (GridRegion neighbour in newneighbours)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
try
|
||||||
"[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
|
{
|
||||||
neighbour.ExternalHostName,
|
InformClientOfNeighbourAsync(sp, cagents[count], neighbour,
|
||||||
neighbour.RegionHandle,
|
neighbour.ExternalEndPoint, true);
|
||||||
neighbour.RegionLocX,
|
count++;
|
||||||
neighbour.RegionLocY);
|
}
|
||||||
}
|
catch (ArgumentOutOfRangeException)
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
m_log.ErrorFormat(
|
||||||
m_log.ErrorFormat(
|
"[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
|
||||||
"[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}",
|
neighbour.ExternalHostName,
|
||||||
neighbour.ExternalHostName,
|
neighbour.RegionHandle,
|
||||||
neighbour.RegionHandle,
|
|
||||||
neighbour.RegionLocX,
|
neighbour.RegionLocX,
|
||||||
neighbour.RegionLocY,
|
neighbour.RegionLocY);
|
||||||
e);
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}",
|
||||||
|
neighbour.ExternalHostName,
|
||||||
|
neighbour.RegionHandle,
|
||||||
|
neighbour.RegionLocX,
|
||||||
|
neighbour.RegionLocY,
|
||||||
|
e);
|
||||||
|
|
||||||
// FIXME: Okay, even though we've failed, we're still going to throw the exception on,
|
// FIXME: Okay, even though we've failed, we're still going to throw the exception on,
|
||||||
// since I don't know what will happen if we just let the client continue
|
// since I don't know what will happen if we just let the client continue
|
||||||
|
|
||||||
// XXX: Well, decided to swallow the exception instead for now. Let us see how that goes.
|
// XXX: Well, decided to swallow the exception instead for now. Let us see how that goes.
|
||||||
// throw e;
|
// throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
count++;
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
|
Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
|
||||||
|
@ -2095,56 +2087,59 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg,
|
private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg,
|
||||||
IPEndPoint endPoint, bool newAgent)
|
IPEndPoint endPoint, bool newAgent)
|
||||||
{
|
{
|
||||||
Scene scene = sp.Scene;
|
|
||||||
if (!newAgent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
if (newAgent)
|
||||||
"[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
|
|
||||||
sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
|
|
||||||
|
|
||||||
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
|
|
||||||
|
|
||||||
string reason = String.Empty;
|
|
||||||
|
|
||||||
bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
|
|
||||||
|
|
||||||
if (regionAccepted && newAgent)
|
|
||||||
{
|
{
|
||||||
// give time for createAgent to finish, since it is async and does grid services access
|
Scene scene = sp.Scene;
|
||||||
Thread.Sleep(500);
|
|
||||||
|
|
||||||
if (m_eqModule != null)
|
m_log.DebugFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
|
||||||
|
sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
|
||||||
|
|
||||||
|
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
|
||||||
|
|
||||||
|
string reason = String.Empty;
|
||||||
|
|
||||||
|
bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
|
||||||
|
|
||||||
|
if (regionAccepted)
|
||||||
{
|
{
|
||||||
#region IP Translation for NAT
|
// give time for createAgent to finish, since it is async and does grid services access
|
||||||
IClientIPEndpoint ipepClient;
|
Thread.Sleep(500);
|
||||||
if (sp.ClientView.TryGet(out ipepClient))
|
|
||||||
|
if (m_eqModule != null)
|
||||||
{
|
{
|
||||||
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
#region IP Translation for NAT
|
||||||
|
IClientIPEndpoint ipepClient;
|
||||||
|
if (sp.ClientView.TryGet(out ipepClient))
|
||||||
|
{
|
||||||
|
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
|
||||||
|
"and EstablishAgentCommunication with seed cap {8}", LogHeader,
|
||||||
|
scene.RegionInfo.RegionName, sp.Name,
|
||||||
|
reg.RegionName, reg.RegionLocX, reg.RegionLocY, reg.RegionSizeX, reg.RegionSizeY, capsPath);
|
||||||
|
|
||||||
|
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID, reg.RegionSizeX, reg.RegionSizeY);
|
||||||
|
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, reg.RegionHandle, reg.RegionSizeX, reg.RegionSizeY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sp.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, endPoint);
|
||||||
|
// TODO: make Event Queue disablable!
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Completed inform {0} {1} about neighbour {2}", sp.Name, sp.UUID, endPoint);
|
||||||
"and EstablishAgentCommunication with seed cap {8}", LogHeader,
|
|
||||||
scene.RegionInfo.RegionName, sp.Name,
|
|
||||||
reg.RegionName, reg.RegionLocX, reg.RegionLocY, reg.RegionSizeX, reg.RegionSizeY , capsPath);
|
|
||||||
|
|
||||||
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID, reg.RegionSizeX, reg.RegionSizeY);
|
|
||||||
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, reg.RegionHandle, reg.RegionSizeX, reg.RegionSizeY);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sp.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, endPoint);
|
|
||||||
// TODO: make Event Queue disablable!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Completed inform {0} {1} about neighbour {2}", sp.Name, sp.UUID, endPoint);
|
if (!regionAccepted)
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Region {0} did not accept {1} {2}: {3}",
|
||||||
|
reg.RegionName, sp.Name, sp.UUID, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!regionAccepted)
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[ENTITY TRANSFER MODULE]: Region {0} did not accept {1} {2}: {3}",
|
|
||||||
reg.RegionName, sp.Name, sp.UUID, reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2203,6 +2198,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
|
int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
|
||||||
int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
|
int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
|
||||||
|
|
||||||
|
if (startX < 0) startX = 0;
|
||||||
|
if (startY < 0) startY = 0;
|
||||||
|
|
||||||
List<GridRegion> neighbours =
|
List<GridRegion> neighbours =
|
||||||
avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
|
avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
|
||||||
|
|
||||||
|
@ -2227,7 +2225,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return neighbours;
|
return neighbours;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* not in use
|
||||||
private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours)
|
private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours)
|
||||||
{
|
{
|
||||||
return currentNeighbours.FindAll(delegate(ulong handle) { return !previousNeighbours.Contains(handle); });
|
return currentNeighbours.FindAll(delegate(ulong handle) { return !previousNeighbours.Contains(handle); });
|
||||||
|
@ -2238,20 +2236,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// return currentNeighbours.FindAll(delegate(ulong handle) { return previousNeighbours.Contains(handle); });
|
// return currentNeighbours.FindAll(delegate(ulong handle) { return previousNeighbours.Contains(handle); });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private List<ulong> OldNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours)
|
// private List<ulong> OldNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours)
|
||||||
{
|
// {
|
||||||
return previousNeighbours.FindAll(delegate(ulong handle) { return !currentNeighbours.Contains(handle); });
|
// return previousNeighbours.FindAll(delegate(ulong handle) { return !currentNeighbours.Contains(handle); });
|
||||||
}
|
// }
|
||||||
|
|
||||||
private List<ulong> NeighbourHandles(List<GridRegion> neighbours)
|
// private List<ulong> NeighbourHandles(List<GridRegion> neighbours)
|
||||||
{
|
// {
|
||||||
List<ulong> handles = new List<ulong>();
|
// List<ulong> handles = new List<ulong>();
|
||||||
foreach (GridRegion reg in neighbours)
|
// foreach (GridRegion reg in neighbours)
|
||||||
{
|
// {
|
||||||
handles.Add(reg.RegionHandle);
|
// handles.Add(reg.RegionHandle);
|
||||||
}
|
// }
|
||||||
return handles;
|
// return handles;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// private void Dump(string msg, List<ulong> handles)
|
// private void Dump(string msg, List<ulong> handles)
|
||||||
// {
|
// {
|
||||||
|
@ -2265,7 +2263,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// m_log.InfoFormat("({0}, {1})", x, y);
|
// m_log.InfoFormat("({0}, {1})", x, y);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Agent Arrived
|
#region Agent Arrived
|
||||||
|
|
|
@ -4080,15 +4080,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
|
"[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
|
||||||
acd.AgentID, RegionInfo.RegionName);
|
acd.AgentID, RegionInfo.RegionName);
|
||||||
|
|
||||||
sp.AdjustKnownSeeds();
|
|
||||||
|
|
||||||
if (CapsModule != null)
|
if (CapsModule != null)
|
||||||
{
|
{
|
||||||
CapsModule.SetAgentCapsSeeds(acd);
|
CapsModule.SetAgentCapsSeeds(acd);
|
||||||
CapsModule.CreateCaps(acd.AgentID, acd.circuitcode);
|
CapsModule.CreateCaps(acd.AgentID, acd.circuitcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sp.AdjustKnownSeeds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue