Assume childreen don't need to know caps seeds

avinationmerge
UbitUmarov 2014-10-20 09:14:27 +01:00
parent f44c29effb
commit afa9b4a002
3 changed files with 84 additions and 33 deletions

View File

@ -355,6 +355,7 @@ namespace OpenSim.Framework
public UUID ActiveGroupID;
public AgentGroupData[] Groups;
public Dictionary<ulong, string> ChildrenCapSeeds = null;
public Animation[] Anims;
public Animation DefaultAnim = null;
public Animation AnimState = null;
@ -440,6 +441,19 @@ namespace OpenSim.Framework
args["groups"] = groups;
}
if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
{
OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
{
OSDMap pair = new OSDMap();
pair["handle"] = OSD.FromString(kvp.Key.ToString());
pair["seed"] = OSD.FromString(kvp.Value);
childrenSeeds.Add(pair);
}
args["children_seeds"] = childrenSeeds;
}
if ((Anims != null) && (Anims.Length > 0))
{
OSDArray anims = new OSDArray(Anims.Length);
@ -663,6 +677,29 @@ namespace OpenSim.Framework
}
}
if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
(args["children_seeds"].Type == OSDType.Array))
{
OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
ChildrenCapSeeds = new Dictionary<ulong, string>();
foreach (OSD o in childrenSeeds)
{
if (o.Type == OSDType.Map)
{
ulong handle = 0;
string seed = "";
OSDMap pair = (OSDMap)o;
if (pair["handle"] != null)
if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
continue;
if (pair["seed"] != null)
seed = pair["seed"].AsString();
if (!ChildrenCapSeeds.ContainsKey(handle))
ChildrenCapSeeds.Add(handle, seed);
}
}
}
if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
{
OSDArray anims = (OSDArray)(args["animations"]);

View File

@ -1655,13 +1655,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
int ts = Util.EnvironmentTickCount();
try
{
AgentData cAgent = new AgentData();
agent.CopyTo(cAgent);
// agent.Appearance.WearableCacheItems = null;
cAgent.Position = pos;
cAgent.ChildrenCapSeeds = agent.KnownRegions;
if (isFlying)
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
@ -1707,8 +1709,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
bool isFlying, string version)
{
agent.ControllingClient.RequestClientInfo();
string agentcaps;
if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
{
@ -1719,8 +1719,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// No turning back
agent.IsChildAgent = true;
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
@ -1732,7 +1730,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_eqModule != null)
{
m_eqModule.CrossRegion(
neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */,
neighbourRegion.RegionHandle, pos, vel2 /* agent.Velocity */,
neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId,
neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
@ -1740,7 +1738,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else
{
m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader);
agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos + agent.Velocity, agent.Velocity, neighbourRegion.ExternalEndPoint,
agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath);
}
@ -1866,13 +1864,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
seeds.Add(regionhandler, agent.CapsPath);
agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
agent.ChildrenCapSeeds = null;
if (sp.Scene.CapsModule != null)
{
sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds);
}
sp.KnownRegions = seeds;
if (currentAgentCircuit != null)
@ -1884,7 +1882,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.Mac = currentAgentCircuit.Mac;
agent.Id0 = currentAgentCircuit.Id0;
}
/*
AgentPosition agentpos = null;
if (oldregions.Count > 0)
@ -1901,7 +1899,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentpos.Throttles = sp.ControllingClient.GetThrottlesPacked(1);
agentpos.ChildrenCapSeeds = seeds;
}
*/
IPEndPoint external = region.ExternalEndPoint;
if (external != null)
{
@ -1910,7 +1908,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
InformClientOfNeighbourCompleted,
d);
}
/*
if(oldregions.Count >0)
{
uint neighbourx;
@ -1924,6 +1922,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Scene.SimulationService.UpdateAgent(neighbour, agentpos);
}
}
*/
}
#endregion
@ -1943,7 +1942,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// assumes that out of view range regions are disconnected by the previus region
List<GridRegion> neighbours = new List<GridRegion>();
RegionInfo m_regionInfo = sp.Scene.RegionInfo;
Scene spScene = sp.Scene;
RegionInfo m_regionInfo = spScene.RegionInfo;
if (m_regionInfo != null)
{
@ -1954,13 +1954,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?");
}
ulong currentRegionHandler = m_regionInfo.RegionHandle;
LinkedList<ulong> previousRegionNeighbourHandles;
Dictionary<ulong, string> seeds;
ICapabilitiesModule capsModule = spScene.CapsModule;
if (sp.Scene.CapsModule != null)
if (capsModule != null)
{
seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID));
seeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(sp.UUID));
previousRegionNeighbourHandles = new LinkedList<ulong>(seeds.Keys);
}
else
@ -1969,16 +1971,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
previousRegionNeighbourHandles = new LinkedList<ulong>();
}
if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle))
seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath);
IClientAPI spClient = sp.ControllingClient;
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
if (!seeds.ContainsKey(currentRegionHandler))
seeds.Add(currentRegionHandler, spClient.RequestClientInfo().CapsPath);
AgentCircuitData currentAgentCircuit =
spScene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
List<AgentCircuitData> cagents = new List<AgentCircuitData>();
List<ulong> newneighbours = new List<ulong>();
ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle;
foreach (GridRegion neighbour in neighbours)
{
ulong handler = neighbour.RegionHandle;
@ -1994,7 +1997,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
continue;
// a new region to add
AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
AgentCircuitData agent = spClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero;
agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour);
@ -2015,6 +2018,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
newneighbours.Add(handler);
agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
seeds.Add(handler, agent.CapsPath);
agent.ChildrenCapSeeds = null;
cagents.Add(agent);
}
@ -2026,25 +2031,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
seeds.Remove(handler);
/// Update all child agent with everyone's seeds
foreach (AgentCircuitData a in cagents)
a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
// foreach (AgentCircuitData a in cagents)
// a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
if (sp.Scene.CapsModule != null)
sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds);
if (capsModule != null)
capsModule.SetChildrenSeed(sp.UUID, seeds);
sp.KnownRegions = seeds;
AgentPosition agentpos = new AgentPosition();
agentpos.AgentID = new UUID(sp.UUID.Guid);
agentpos.SessionID = sp.ControllingClient.SessionId;
agentpos.SessionID = spClient.SessionId;
agentpos.Size = sp.Appearance.AvatarSize;
agentpos.Center = sp.CameraPosition;
agentpos.Far = sp.DrawDistance;
agentpos.Position = sp.AbsolutePosition;
agentpos.Velocity = sp.Velocity;
agentpos.RegionHandle = currentRegionHandler;
agentpos.Throttles = sp.ControllingClient.GetThrottlesPacked(1);
agentpos.ChildrenCapSeeds = seeds;
agentpos.Throttles = spClient.GetThrottlesPacked(1);
// agentpos.ChildrenCapSeeds = seeds;
if (neighbours.Count - previousRegionNeighbourHandles.Count > 0)
{
@ -2066,7 +2071,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
else if(!previousRegionNeighbourHandles.Contains(handler))
{
sp.Scene.SimulationService.UpdateAgent(neighbour, agentpos);
spScene.SimulationService.UpdateAgent(neighbour, agentpos);
}
}
catch (ArgumentOutOfRangeException)

View File

@ -4262,6 +4262,15 @@ namespace OpenSim.Region.Framework.Scenes
// DrawDistance = cAgent.Far;
DrawDistance = Scene.DefaultDrawDistance;
if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0)
{
if (Scene.CapsModule != null)
{
Scene.CapsModule.SetChildrenSeed(UUID, cAgent.ChildrenCapSeeds);
}
KnownRegions = cAgent.ChildrenCapSeeds;
}
if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgent.Throttles);