From 69585a4824a7814bbe543d624de6c3627e0b927b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 1 Nov 2015 19:11:14 +0100 Subject: More plumbing of the EntityTransferContext (not yet complete) --- OpenSim/Framework/AgentCircuitData.cs | 4 +- OpenSim/Framework/AvatarAppearance.cs | 50 ++++++++++++++-------- OpenSim/Framework/AvatarWearable.cs | 7 +-- OpenSim/Framework/ChildAgentDataUpdate.cs | 28 +++++++----- OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 2 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++-- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 15 +++++-- .../EntityTransfer/EntityTransferModule.cs | 25 +++++------ .../EntityTransfer/HGEntityTransferModule.cs | 10 ++--- .../Simulation/LocalSimulationConnector.cs | 4 +- .../Simulation/RemoteSimulationConnector.cs | 12 +++--- .../Scenes/Tests/ScenePresenceAgentTests.cs | 6 ++- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 13 ++++-- .../Hypergrid/UserAgentServiceConnector.cs | 3 +- .../SimianGrid/SimianAvatarServiceConnector.cs | 2 +- .../Simulation/SimulationServiceConnector.cs | 17 ++++---- .../Services/HypergridService/GatekeeperService.cs | 2 +- .../Services/HypergridService/UserAgentService.cs | 4 +- OpenSim/Services/Interfaces/IAvatarService.cs | 3 +- OpenSim/Services/Interfaces/ISimulationService.cs | 4 +- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 +- 22 files changed, 135 insertions(+), 88 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 0d053e4..f4b35a6 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -184,7 +184,7 @@ namespace OpenSim.Framework /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json /// /// map of the agent circuit data - public OSDMap PackAgentCircuitData() + public OSDMap PackAgentCircuitData(int wearablesCount) { OSDMap args = new OSDMap(); args["agent_id"] = OSD.FromUUID(AgentID); @@ -224,7 +224,7 @@ namespace OpenSim.Framework { args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); - OSDMap appmap = Appearance.Pack(); + OSDMap appmap = Appearance.Pack(wearablesCount); args["packed_appearance"] = appmap; } diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 72c6bfc..50746a0 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -211,13 +211,12 @@ namespace OpenSim.Framework m_serial = appearance.Serial; - m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; - for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) - m_wearables[i] = new AvatarWearable(); + ClearWearables(); 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]); } @@ -247,7 +246,7 @@ namespace OpenSim.Framework 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++) { @@ -262,8 +261,8 @@ namespace OpenSim.Framework public void ClearWearables() { - m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; - for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) + m_wearables = new AvatarWearable[AvatarWearable.LEGACY_VERSION_MAX_WEARABLES]; + for (int i = 0; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; i++) m_wearables[i] = new AvatarWearable(); } @@ -470,11 +469,15 @@ namespace OpenSim.Framework // DEBUG ON // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // 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(); - int count = wearable.Count; - if (count > AvatarWearable.MAX_WEARABLES) - count = AvatarWearable.MAX_WEARABLES; - for (int i = 0; i < count; i++) + for (int i = 0; i < wearable.Count; i++) m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); } @@ -714,7 +717,7 @@ namespace OpenSim.Framework /// /// Create an OSDMap from the appearance data /// - public OSDMap Pack() + public OSDMap Pack(int wearablesCount) { OSDMap data = new OSDMap(); @@ -722,9 +725,22 @@ namespace OpenSim.Framework data["height"] = OSD.FromReal(m_avatarHeight); // Wearables - OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); - for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) - wears.Add(m_wearables[i].Pack()); + // + // This will send as many or as few wearables as we have, unless a count + // 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; // Avatar Textures @@ -782,8 +798,8 @@ namespace OpenSim.Framework OSDArray wears = (OSDArray)(data["wearables"]); 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++) m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index e662d5f..80ed77f 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -68,7 +68,7 @@ namespace OpenSim.Framework public static readonly int ALPHA = 13; 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 int MAX_WEARABLES = 16; @@ -225,8 +225,9 @@ namespace OpenSim.Framework { get { - AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; - for (int i = 0; i < MAX_WEARABLES; i++) + // We use the legacy count here because this is just a fallback anyway + AvatarWearable[] defaultWearables = new AvatarWearable[LEGACY_VERSION_MAX_WEARABLES]; + for (int i = 0; i < LEGACY_VERSION_MAX_WEARABLES; i++) { defaultWearables[i] = new AvatarWearable(); } diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index a714d86..2fce155 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -61,7 +61,7 @@ namespace OpenSim.Framework { UUID AgentID { get; set; } - OSDMap Pack(); + OSDMap Pack(Object parms = null); void Unpack(OSDMap map, IScene scene); } @@ -96,7 +96,7 @@ namespace OpenSim.Framework public Dictionary ChildrenCapSeeds = null; - public OSDMap Pack() + public OSDMap Pack(Object parms = null) { OSDMap args = new OSDMap(); args["message_type"] = OSD.FromString("AgentPosition"); @@ -391,8 +391,18 @@ namespace OpenSim.Framework public Dictionary MovementAnimationOverRides = new Dictionary(); - 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"); OSDMap args = new OSDMap(); @@ -493,7 +503,7 @@ namespace OpenSim.Framework } if (Appearance != null) - args["packed_appearance"] = Appearance.Pack(); + args["packed_appearance"] = Appearance.Pack(wearablesCount); //if ((AgentTextures != null) && (AgentTextures.Length > 0)) //{ @@ -800,11 +810,7 @@ namespace OpenSim.Framework { OSDArray wears = (OSDArray)(args["wearables"]); - int count = wears.Count; - if (count > AvatarWearable.MAX_WEARABLES) - count = AvatarWearable.MAX_WEARABLES; - - for (int i = 0; i < count / 2; i++) + for (int i = 0; i < wears.Count / 2; i++) { AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); Appearance.SetWearable(i, awear); @@ -897,9 +903,9 @@ namespace OpenSim.Framework 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) diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs index 95e9439..a2a2eea 100644 --- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs @@ -312,7 +312,7 @@ namespace OpenSim.Framework.Tests Agent1Data.startpos = StartPos; OSDMap map2; - OSDMap map = Agent1Data.PackAgentCircuitData(); + OSDMap map = Agent1Data.PackAgentCircuitData(-1); try { string str = OSDParser.SerializeJsonString(map); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 51c59e9..e20ab50 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12233,10 +12233,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; - int maxWearablesLoop = cachedtex.WearableData.Length; - if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) - maxWearablesLoop = AvatarWearable.MAX_WEARABLES; - 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 @@ -12250,6 +12246,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP cacheItems = p.Appearance.WearableCacheItems; } + int maxWearablesLoop = cachedtex.WearableData.Length; + if (maxWearablesLoop > cacheItems.Length) + maxWearablesLoop = cacheItems.Length; + if (cacheItems != null) { for (int i = 0; i < maxWearablesLoop; i++) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 0d3b39e..cdcd6b9 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -853,7 +853,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 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++) { @@ -1258,8 +1258,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) { - if (wear.Type < AvatarWearable.MAX_WEARABLES) - avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero); + // If the wearable type is larger than the current array, expand it + 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); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 4d70c54..ed93f05 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -849,7 +849,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Let's create an agent there if one doesn't exist yet. // NOTE: logout will always be false for a non-HG teleport. 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++; @@ -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 // 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(). - if (!UpdateAgent(reg, finalDestination, agent, sp)) + if (!UpdateAgent(reg, finalDestination, agent, sp, ctx)) { 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. // NOTE: logout will always be false for a non-HG teleport. 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++; @@ -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 // via CompleteMovementIntoRegion, so we can let go. // 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) { @@ -1280,13 +1280,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 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); source.RawServerURI = m_GatekeeperURI; 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) sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); @@ -1294,9 +1294,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 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) @@ -1679,7 +1679,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 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_entityTransferStateMachine.ResetFromTransit(agent.UUID); @@ -1695,7 +1695,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 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(); try @@ -1718,7 +1718,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Beyond this point, extra cleanup is needed beyond removing transit state 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 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); @@ -2360,7 +2360,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 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) { diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index dcc4746..1783e0a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -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); 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) @@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance"); // 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++) { @@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer bool found = false; foreach (AvatarAppearance a in ExportedAppearance) - if (a.Wearables[i] != null) + if (i < a.Wearables.Length && a.Wearables[i] != null) { found = true; break; @@ -356,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer found = false; 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; break; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 6cb15f6..3755650 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation * 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) { @@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; } - public bool UpdateAgent(GridRegion destination, AgentData cAgentData) + public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx) { if (destination == null) return false; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index cf19edd..0ebdbce 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -160,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation * 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) { @@ -170,27 +170,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation } // 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; // else do the remote thing 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; } - public bool UpdateAgent(GridRegion destination, AgentData cAgentData) + public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx) { if (destination == null) return false; // Try local first 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) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 96d112d..568cd34 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -44,6 +44,7 @@ using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Tests.Common; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using OpenSim.Services.Interfaces; 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 // 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. - 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.GetAgentCircuits().Count, Is.EqualTo(1)); @@ -287,4 +289,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Assert.That(childPresence.IsChildAgent, Is.True); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fae0bda..e945b30 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (appearanceModule != null) { appearanceModule.SaveBakedTextures(sp.UUID); - OSDMap appearancePacked = sp.Appearance.Pack(); + OSDMap appearancePacked = sp.Appearance.Pack(-1); TaskInventoryItem item = SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0e6710d..f6a7e19 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -461,6 +461,7 @@ namespace OpenSim.Server.Handlers.Simulation // This is the meaning of POST agent //m_regionClient.AdjustUserInformation(aCircuit); //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); resp["reason"] = OSD.FromString(reason); @@ -539,12 +540,15 @@ namespace OpenSim.Server.Handlers.Simulation AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { 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) { Util.FireAndForget(x => { 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); }); @@ -553,7 +557,7 @@ namespace OpenSim.Server.Handlers.Simulation 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); return ret; } @@ -739,7 +743,10 @@ namespace OpenSim.Server.Handlers.Simulation // subclasses can override this 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); } } diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 8abd046..1dcc82a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -138,7 +138,8 @@ namespace OpenSim.Services.Connectors.Hypergrid Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); 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); } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index a397740..d355eab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -152,7 +152,7 @@ namespace OpenSim.Services.Connectors.SimianGrid // public bool SetAppearance(UUID userID, AvatarAppearance appearance) { - OSDMap map = appearance.Pack(); + OSDMap map = appearance.Pack(-1); if (map == null) { m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID); diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 3bf03cf..bb47e6b 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -98,13 +98,13 @@ namespace OpenSim.Services.Connectors.Simulation 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; - 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); reason = String.Empty; @@ -121,7 +121,7 @@ namespace OpenSim.Services.Connectors.Simulation try { - OSDMap args = aCircuit.PackAgentCircuitData(); + OSDMap args = aCircuit.PackAgentCircuitData(-1); PackData(args, source, aCircuit, destination, flags); OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); @@ -172,9 +172,9 @@ namespace OpenSim.Services.Connectors.Simulation /// /// Send complete data about an agent in this region to a neighbor /// - 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 _failedSims = new ExpiringCache(); @@ -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 // blacklist sim for 2 minutes @@ -250,7 +251,7 @@ namespace OpenSim.Services.Connectors.Simulation /// /// This is the worker function to send AgentData to a neighbor region /// - 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); diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 8e10125..9643a8b 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -459,7 +459,7 @@ namespace OpenSim.Services.HypergridService true, aCircuit.startpos, new List(), ctx, out reason)) 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) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index c65122a..317d006 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -281,7 +281,9 @@ namespace OpenSim.Services.HypergridService } 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) diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index bd66dad..99b71b9 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs @@ -150,7 +150,8 @@ namespace OpenSim.Services.Interfaces // Wearables 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++) { diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 3f6b009..4496a9f 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs @@ -74,7 +74,7 @@ namespace OpenSim.Services.Interfaces /// /// /// Reason message in the event of a failure. - 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); /// /// Full child agent update. @@ -82,7 +82,7 @@ namespace OpenSim.Services.Interfaces /// /// /// - bool UpdateAgent(GridRegion destination, AgentData data); + bool UpdateAgent(GridRegion destination, AgentData data, EntityTransferContext ctx); /// /// Short child agent update, mostly for position. diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 619a527..6681f1a 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -999,7 +999,7 @@ namespace OpenSim.Services.LLLoginService region, aCircuit.AgentID, null, true, aCircuit.startpos, new List(), ctx, out reason)) 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) -- cgit v1.1