More plumbing of the EntityTransferContext (not yet complete)

avinationmerge
Melanie Thielker 2015-11-01 19:11:14 +01:00
parent 29798cefcc
commit 69585a4824
22 changed files with 135 additions and 88 deletions

View File

@ -184,7 +184,7 @@ namespace OpenSim.Framework
/// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
/// </summary> /// </summary>
/// <returns>map of the agent circuit data</returns> /// <returns>map of the agent circuit data</returns>
public OSDMap PackAgentCircuitData() public OSDMap PackAgentCircuitData(int wearablesCount)
{ {
OSDMap args = new OSDMap(); OSDMap args = new OSDMap();
args["agent_id"] = OSD.FromUUID(AgentID); args["agent_id"] = OSD.FromUUID(AgentID);
@ -224,7 +224,7 @@ namespace OpenSim.Framework
{ {
args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
OSDMap appmap = Appearance.Pack(); OSDMap appmap = Appearance.Pack(wearablesCount);
args["packed_appearance"] = appmap; args["packed_appearance"] = appmap;
} }

View File

@ -211,13 +211,12 @@ namespace OpenSim.Framework
m_serial = appearance.Serial; m_serial = appearance.Serial;
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; ClearWearables();
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
m_wearables[i] = new AvatarWearable();
if (copyWearables && (appearance.Wearables != null)) if (copyWearables && (appearance.Wearables != null))
{ {
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) m_wearables = new AvatarWearable[appearance.Wearables.Length];
for (int i = 0; i < appearance.Wearables.Length; i++)
SetWearable(i,appearance.Wearables[i]); SetWearable(i,appearance.Wearables[i]);
} }
@ -247,7 +246,7 @@ namespace OpenSim.Framework
public void GetAssetsFrom(AvatarAppearance app) public void GetAssetsFrom(AvatarAppearance app)
{ {
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) for (int i = 0; i < m_wearables.Length; i++)
{ {
for (int j = 0; j < m_wearables[i].Count; j++) for (int j = 0; j < m_wearables[i].Count; j++)
{ {
@ -262,8 +261,8 @@ namespace OpenSim.Framework
public void ClearWearables() public void ClearWearables()
{ {
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; m_wearables = new AvatarWearable[AvatarWearable.LEGACY_VERSION_MAX_WEARABLES];
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) for (int i = 0; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; i++)
m_wearables[i] = new AvatarWearable(); m_wearables[i] = new AvatarWearable();
} }
@ -470,11 +469,15 @@ namespace OpenSim.Framework
// DEBUG ON // DEBUG ON
// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
// DEBUG OFF // DEBUG OFF
if (wearableId >= m_wearables.Length)
{
int currentLength = m_wearables.Length;
Array.Resize(ref m_wearables, wearableId + 1);
for (int i = currentLength ; i < m_wearables.Length ; i++)
m_wearables[i] = new AvatarWearable();
}
m_wearables[wearableId].Clear(); m_wearables[wearableId].Clear();
int count = wearable.Count; for (int i = 0; i < wearable.Count; i++)
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < count; i++)
m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID);
} }
@ -714,7 +717,7 @@ namespace OpenSim.Framework
/// <summary> /// <summary>
/// Create an OSDMap from the appearance data /// Create an OSDMap from the appearance data
/// </summary> /// </summary>
public OSDMap Pack() public OSDMap Pack(int wearablesCount)
{ {
OSDMap data = new OSDMap(); OSDMap data = new OSDMap();
@ -722,9 +725,22 @@ namespace OpenSim.Framework
data["height"] = OSD.FromReal(m_avatarHeight); data["height"] = OSD.FromReal(m_avatarHeight);
// Wearables // Wearables
OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); //
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) // This will send as many or as few wearables as we have, unless a count
wears.Add(m_wearables[i].Pack()); // is given. Used for legacy (pre 0.4) versions.
int count = wearablesCount;
if (wearablesCount == -1)
count = m_wearables.Length;
OSDArray wears = new OSDArray(count);
for (int i = 0; i < count; i++)
{
AvatarWearable dummyWearable = new AvatarWearable();
if (i < m_wearables.Length)
wears.Add(m_wearables[i].Pack());
else
wears.Add(dummyWearable.Pack());
}
data["wearables"] = wears; data["wearables"] = wears;
// Avatar Textures // Avatar Textures
@ -782,8 +798,8 @@ namespace OpenSim.Framework
OSDArray wears = (OSDArray)(data["wearables"]); OSDArray wears = (OSDArray)(data["wearables"]);
int count = wears.Count; int count = wears.Count;
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES; m_wearables = new AvatarWearable[count];
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);

View File

@ -68,7 +68,7 @@ namespace OpenSim.Framework
public static readonly int ALPHA = 13; public static readonly int ALPHA = 13;
public static readonly int TATTOO = 14; public static readonly int TATTOO = 14;
public static readonly int MAX_WEARABLES = 15; public static readonly int LEGACY_VERSION_MAX_WEARABLES = 15;
// public static readonly int PHYSICS = 15; // public static readonly int PHYSICS = 15;
// public static int MAX_WEARABLES = 16; // public static int MAX_WEARABLES = 16;
@ -225,8 +225,9 @@ namespace OpenSim.Framework
{ {
get get
{ {
AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; // We use the legacy count here because this is just a fallback anyway
for (int i = 0; i < MAX_WEARABLES; i++) AvatarWearable[] defaultWearables = new AvatarWearable[LEGACY_VERSION_MAX_WEARABLES];
for (int i = 0; i < LEGACY_VERSION_MAX_WEARABLES; i++)
{ {
defaultWearables[i] = new AvatarWearable(); defaultWearables[i] = new AvatarWearable();
} }

View File

@ -61,7 +61,7 @@ namespace OpenSim.Framework
{ {
UUID AgentID { get; set; } UUID AgentID { get; set; }
OSDMap Pack(); OSDMap Pack(Object parms = null);
void Unpack(OSDMap map, IScene scene); void Unpack(OSDMap map, IScene scene);
} }
@ -96,7 +96,7 @@ namespace OpenSim.Framework
public Dictionary<ulong, string> ChildrenCapSeeds = null; public Dictionary<ulong, string> ChildrenCapSeeds = null;
public OSDMap Pack() public OSDMap Pack(Object parms = null)
{ {
OSDMap args = new OSDMap(); OSDMap args = new OSDMap();
args["message_type"] = OSD.FromString("AgentPosition"); args["message_type"] = OSD.FromString("AgentPosition");
@ -391,8 +391,18 @@ namespace OpenSim.Framework
public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>(); public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
public virtual OSDMap Pack() public virtual OSDMap Pack(Object parms = null)
{ {
int wearablesCount = -1;
if (parms != null)
{
Hashtable p = (Hashtable)parms;
if (p.ContainsKey("wearablesCount"))
wearablesCount = (int)p["wearablesCount"];
}
// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
OSDMap args = new OSDMap(); OSDMap args = new OSDMap();
@ -493,7 +503,7 @@ namespace OpenSim.Framework
} }
if (Appearance != null) if (Appearance != null)
args["packed_appearance"] = Appearance.Pack(); args["packed_appearance"] = Appearance.Pack(wearablesCount);
//if ((AgentTextures != null) && (AgentTextures.Length > 0)) //if ((AgentTextures != null) && (AgentTextures.Length > 0))
//{ //{
@ -800,11 +810,7 @@ namespace OpenSim.Framework
{ {
OSDArray wears = (OSDArray)(args["wearables"]); OSDArray wears = (OSDArray)(args["wearables"]);
int count = wears.Count; for (int i = 0; i < wears.Count / 2; i++)
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < count / 2; i++)
{ {
AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
Appearance.SetWearable(i, awear); Appearance.SetWearable(i, awear);
@ -897,9 +903,9 @@ namespace OpenSim.Framework
public class CompleteAgentData : AgentData public class CompleteAgentData : AgentData
{ {
public override OSDMap Pack() public override OSDMap Pack(object parms = null)
{ {
return base.Pack(); return base.Pack(parms);
} }
public override void Unpack(OSDMap map, IScene scene) public override void Unpack(OSDMap map, IScene scene)

View File

@ -312,7 +312,7 @@ namespace OpenSim.Framework.Tests
Agent1Data.startpos = StartPos; Agent1Data.startpos = StartPos;
OSDMap map2; OSDMap map2;
OSDMap map = Agent1Data.PackAgentCircuitData(); OSDMap map = Agent1Data.PackAgentCircuitData(-1);
try try
{ {
string str = OSDParser.SerializeJsonString(map); string str = OSDParser.SerializeJsonString(map);

View File

@ -12233,10 +12233,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
cachedresp.WearableData = cachedresp.WearableData =
new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
int maxWearablesLoop = cachedtex.WearableData.Length;
if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
int cacheHits = 0; int cacheHits = 0;
// We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
@ -12250,6 +12246,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
cacheItems = p.Appearance.WearableCacheItems; cacheItems = p.Appearance.WearableCacheItems;
} }
int maxWearablesLoop = cachedtex.WearableData.Length;
if (maxWearablesLoop > cacheItems.Length)
maxWearablesLoop = cacheItems.Length;
if (cacheItems != null) if (cacheItems != null)
{ {
for (int i = 0; i < maxWearablesLoop; i++) for (int i = 0; i < maxWearablesLoop; i++)

View File

@ -853,7 +853,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (invService.GetRootFolder(userID) != null) if (invService.GetRootFolder(userID) != null)
{ {
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) for (int i = 0; i < appearance.Wearables.Length; i++)
{ {
for (int j = 0; j < appearance.Wearables[i].Count; j++) for (int j = 0; j < appearance.Wearables[i].Count; j++)
{ {
@ -1258,8 +1258,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{ {
if (wear.Type < AvatarWearable.MAX_WEARABLES) // If the wearable type is larger than the current array, expand it
avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero); if (avatAppearance.Wearables.Length <= wear.Type)
{
int currentLength = avatAppearance.Wearables.Length;
AvatarWearable[] wears = avatAppearance.Wearables;
Array.Resize(ref wears, wear.Type + 1);
for (int i = currentLength ; i <= wear.Type ; i++)
wears[i] = new AvatarWearable();
avatAppearance.Wearables = wears;
}
avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero);
} }
avatAppearance.GetAssetsFrom(sp.Appearance); avatAppearance.GetAssetsFrom(sp.Appearance);

View File

@ -849,7 +849,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Let's create an agent there if one doesn't exist yet. // Let's create an agent there if one doesn't exist yet.
// NOTE: logout will always be false for a non-HG teleport. // NOTE: logout will always be false for a non-HG teleport.
bool logout = false; bool logout = false;
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout))
{ {
m_interRegionTeleportFailures.Value++; m_interRegionTeleportFailures.Value++;
@ -948,7 +948,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// destination region but the viewer cannot establish the connection (e.g. due to network issues between // destination region but the viewer cannot establish the connection (e.g. due to network issues between
// the viewer and the destination). In this case, UpdateAgent timesout after 10 seconds, although then // the viewer and the destination). In this case, UpdateAgent timesout after 10 seconds, although then
// there's a further 10 second wait whilst we attempt to tell the destination to delete the agent in Fail(). // there's a further 10 second wait whilst we attempt to tell the destination to delete the agent in Fail().
if (!UpdateAgent(reg, finalDestination, agent, sp)) if (!UpdateAgent(reg, finalDestination, agent, sp, ctx))
{ {
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{ {
@ -1084,7 +1084,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Let's create an agent there if one doesn't exist yet. // Let's create an agent there if one doesn't exist yet.
// NOTE: logout will always be false for a non-HG teleport. // NOTE: logout will always be false for a non-HG teleport.
bool logout = false; bool logout = false;
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout))
{ {
m_interRegionTeleportFailures.Value++; m_interRegionTeleportFailures.Value++;
@ -1158,7 +1158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Send the Update. If this returns true, we know the client has contacted the destination // Send the Update. If this returns true, we know the client has contacted the destination
// via CompleteMovementIntoRegion, so we can let go. // via CompleteMovementIntoRegion, so we can let go.
// If it returns false, something went wrong, and we need to abort. // If it returns false, something went wrong, and we need to abort.
if (!UpdateAgent(reg, finalDestination, agent, sp)) if (!UpdateAgent(reg, finalDestination, agent, sp, ctx))
{ {
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{ {
@ -1280,13 +1280,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
} }
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout)
{ {
GridRegion source = new GridRegion(Scene.RegionInfo); GridRegion source = new GridRegion(Scene.RegionInfo);
source.RawServerURI = m_GatekeeperURI; source.RawServerURI = m_GatekeeperURI;
logout = false; logout = false;
bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, out reason); bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, ctx, out reason);
if (success) if (success)
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
@ -1294,9 +1294,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return success; return success;
} }
protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent, ScenePresence sp) protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent, ScenePresence sp, EntityTransferContext ctx)
{ {
return Scene.SimulationService.UpdateAgent(finalDestination, agent); return Scene.SimulationService.UpdateAgent(finalDestination, agent, ctx);
} }
protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
@ -1679,7 +1679,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_entityTransferStateMachine.ResetFromTransit(agent.UUID); m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
} }
if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying)) if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying, ctx))
{ {
m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader);
m_entityTransferStateMachine.ResetFromTransit(agent.UUID); m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
@ -1695,7 +1695,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return agent; return agent;
} }
public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx)
{ {
int ts = Util.EnvironmentTickCount(); int ts = Util.EnvironmentTickCount();
try try
@ -1718,7 +1718,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Beyond this point, extra cleanup is needed beyond removing transit state // Beyond this point, extra cleanup is needed beyond removing transit state
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring);
if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx))
{ {
// region doesn't take it // region doesn't take it
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
@ -2360,7 +2360,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string reason = String.Empty; string reason = String.Empty;
bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, out reason); EntityTransferContext ctx = new EntityTransferContext();
bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, ctx, out reason);
if (regionAccepted) if (regionAccepted)
{ {

View File

@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
} }
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout)
{ {
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
reason = string.Empty; reason = string.Empty;
@ -308,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
} }
return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout); return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout);
} }
public void TriggerTeleportHome(UUID id, IClientAPI client) public void TriggerTeleportHome(UUID id, IClientAPI client)
@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance"); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance");
// Check wearables // Check wearables
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) for (int i = 0; i < sp.Appearance.Wearables.Length ; i++)
{ {
for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++) for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++)
{ {
@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
bool found = false; bool found = false;
foreach (AvatarAppearance a in ExportedAppearance) foreach (AvatarAppearance a in ExportedAppearance)
if (a.Wearables[i] != null) if (i < a.Wearables.Length && a.Wearables[i] != null)
{ {
found = true; found = true;
break; break;
@ -356,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
found = false; found = false;
foreach (AvatarAppearance a in ExportedAppearance) foreach (AvatarAppearance a in ExportedAppearance)
if (sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID) if (i < a.Wearables.Length && sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID)
{ {
found = true; found = true;
break; break;

View File

@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
* Agent-related communications * Agent-related communications
*/ */
public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason)
{ {
if (destination == null) if (destination == null)
{ {
@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false; return false;
} }
public bool UpdateAgent(GridRegion destination, AgentData cAgentData) public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx)
{ {
if (destination == null) if (destination == null)
return false; return false;

View File

@ -160,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
* Agent-related communications * Agent-related communications
*/ */
public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason)
{ {
if (destination == null) if (destination == null)
{ {
@ -170,27 +170,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
} }
// Try local first // Try local first
if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, out reason)) if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason))
return true; return true;
// else do the remote thing // else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionID)) if (!m_localBackend.IsLocalRegion(destination.RegionID))
{ {
return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason);
} }
return false; return false;
} }
public bool UpdateAgent(GridRegion destination, AgentData cAgentData) public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx)
{ {
if (destination == null) if (destination == null)
return false; return false;
// Try local first // Try local first
if (m_localBackend.IsLocalRegion(destination.RegionID)) if (m_localBackend.IsLocalRegion(destination.RegionID))
return m_localBackend.UpdateAgent(destination, cAgentData); return m_localBackend.UpdateAgent(destination, cAgentData, ctx);
return m_remoteConnector.UpdateAgent(destination, cAgentData); return m_remoteConnector.UpdateAgent(destination, cAgentData, ctx);
} }
public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)

View File

@ -44,6 +44,7 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {
@ -226,7 +227,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// *** This is the first stage, when a neighbouring region is told that a viewer is about to try and // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and
// establish a child scene presence. We pass in the circuit code that the client has to connect with *** // establish a child scene presence. We pass in the circuit code that the client has to connect with ***
// XXX: ViaLogin may not be correct here. // XXX: ViaLogin may not be correct here.
scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, out reason); EntityTransferContext ctx = new EntityTransferContext();
scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, ctx, out reason);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
@ -287,4 +289,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Assert.That(childPresence.IsChildAgent, Is.True); // Assert.That(childPresence.IsChildAgent, Is.True);
} }
} }
} }

View File

@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (appearanceModule != null) if (appearanceModule != null)
{ {
appearanceModule.SaveBakedTextures(sp.UUID); appearanceModule.SaveBakedTextures(sp.UUID);
OSDMap appearancePacked = sp.Appearance.Pack(); OSDMap appearancePacked = sp.Appearance.Pack(-1);
TaskInventoryItem item TaskInventoryItem item
= SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); = SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true);

View File

@ -461,6 +461,7 @@ namespace OpenSim.Server.Handlers.Simulation
// This is the meaning of POST agent // This is the meaning of POST agent
//m_regionClient.AdjustUserInformation(aCircuit); //m_regionClient.AdjustUserInformation(aCircuit);
//bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason);
resp["reason"] = OSD.FromString(reason); resp["reason"] = OSD.FromString(reason);
@ -539,12 +540,15 @@ namespace OpenSim.Server.Handlers.Simulation
AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
{ {
reason = String.Empty; reason = String.Empty;
// The data and protocols are already defined so this is just a dummy to satisfy the interface
// TODO: make this end-to-end
EntityTransferContext ctx = new EntityTransferContext();
if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0)
{ {
Util.FireAndForget(x => Util.FireAndForget(x =>
{ {
string r; string r;
m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out r); m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out r);
m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r); m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r);
}); });
@ -553,7 +557,7 @@ namespace OpenSim.Server.Handlers.Simulation
else else
{ {
bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason);
m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason);
return ret; return ret;
} }
@ -739,7 +743,10 @@ namespace OpenSim.Server.Handlers.Simulation
// subclasses can override this // subclasses can override this
protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) protected virtual bool UpdateAgent(GridRegion destination, AgentData agent)
{ {
return m_SimulationService.UpdateAgent(destination, agent); // The data and protocols are already defined so this is just a dummy to satisfy the interface
// TODO: make this end-to-end
EntityTransferContext ctx = new EntityTransferContext();
return m_SimulationService.UpdateAgent(destination, agent, ctx);
} }
} }

View File

@ -138,7 +138,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI);
uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome; uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome;
return CreateAgent(source, home, aCircuit, flags, out reason); EntityTransferContext ctx = new EntityTransferContext();
return CreateAgent(source, home, aCircuit, flags, ctx, out reason);
} }

View File

@ -152,7 +152,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
// <param name=""></param> // <param name=""></param>
public bool SetAppearance(UUID userID, AvatarAppearance appearance) public bool SetAppearance(UUID userID, AvatarAppearance appearance)
{ {
OSDMap map = appearance.Pack(); OSDMap map = appearance.Pack(-1);
if (map == null) if (map == null)
{ {
m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID); m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID);

View File

@ -98,13 +98,13 @@ namespace OpenSim.Services.Connectors.Simulation
args["teleport_flags"] = OSD.FromString(flags.ToString()); args["teleport_flags"] = OSD.FromString(flags.ToString());
} }
public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string reason)
{ {
string tmp = String.Empty; string tmp = String.Empty;
return CreateAgent(source, destination, aCircuit, flags, out tmp, out reason); return CreateAgent(source, destination, aCircuit, flags, ctx, out tmp, out reason);
} }
public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string myipaddress, out string reason)
{ {
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
reason = String.Empty; reason = String.Empty;
@ -121,7 +121,7 @@ namespace OpenSim.Services.Connectors.Simulation
try try
{ {
OSDMap args = aCircuit.PackAgentCircuitData(); OSDMap args = aCircuit.PackAgentCircuitData(-1);
PackData(args, source, aCircuit, destination, flags); PackData(args, source, aCircuit, destination, flags);
OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
@ -172,9 +172,9 @@ namespace OpenSim.Services.Connectors.Simulation
/// <summary> /// <summary>
/// Send complete data about an agent in this region to a neighbor /// Send complete data about an agent in this region to a neighbor
/// </summary> /// </summary>
public bool UpdateAgent(GridRegion destination, AgentData data) public bool UpdateAgent(GridRegion destination, AgentData data, EntityTransferContext ctx)
{ {
return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds return UpdateAgent(destination, (IAgentData)data, ctx, 200000); // yes, 200 seconds
} }
private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>(); private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>();
@ -235,7 +235,8 @@ namespace OpenSim.Services.Connectors.Simulation
} }
} }
success = UpdateAgent(destination, (IAgentData)pos, 10000); EntityTransferContext ctx = new EntityTransferContext(); // Dummy, not needed for position
success = UpdateAgent(destination, (IAgentData)pos, ctx, 10000);
} }
// we get here iff success == false // we get here iff success == false
// blacklist sim for 2 minutes // blacklist sim for 2 minutes
@ -250,7 +251,7 @@ namespace OpenSim.Services.Connectors.Simulation
/// <summary> /// <summary>
/// This is the worker function to send AgentData to a neighbor region /// This is the worker function to send AgentData to a neighbor region
/// </summary> /// </summary>
private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout) private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, EntityTransferContext ctx, int timeout)
{ {
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI); // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI);

View File

@ -459,7 +459,7 @@ namespace OpenSim.Services.HypergridService
true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
return false; return false;
return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason);
} }
protected bool Authenticate(AgentCircuitData aCircuit) protected bool Authenticate(AgentCircuitData aCircuit)

View File

@ -281,7 +281,9 @@ namespace OpenSim.Services.HypergridService
} }
else else
{ {
success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason); //TODO: Should there not be a call to QueryAccess here?
EntityTransferContext ctx = new EntityTransferContext();
success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, ctx, out myExternalIP, out reason);
} }
if (!success) if (!success)

View File

@ -150,7 +150,8 @@ namespace OpenSim.Services.Interfaces
// Wearables // Wearables
Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++) // TODO: With COF, is this even needed?
for (int i = 0 ; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES ; i++)
{ {
for (int j = 0 ; j < appearance.Wearables[i].Count ; j++) for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
{ {

View File

@ -74,7 +74,7 @@ namespace OpenSim.Services.Interfaces
/// <param name="aCircuit"></param> /// <param name="aCircuit"></param>
/// <param name="flags"></param> /// <param name="flags"></param>
/// <param name="reason">Reason message in the event of a failure.</param> /// <param name="reason">Reason message in the event of a failure.</param>
bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string reason);
/// <summary> /// <summary>
/// Full child agent update. /// Full child agent update.
@ -82,7 +82,7 @@ namespace OpenSim.Services.Interfaces
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="data"></param> /// <param name="data"></param>
/// <returns></returns> /// <returns></returns>
bool UpdateAgent(GridRegion destination, AgentData data); bool UpdateAgent(GridRegion destination, AgentData data, EntityTransferContext ctx);
/// <summary> /// <summary>
/// Short child agent update, mostly for position. /// Short child agent update, mostly for position.

View File

@ -999,7 +999,7 @@ namespace OpenSim.Services.LLLoginService
region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
return false; return false;
return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, ctx, out reason);
} }
private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason)