From 5f18f2ce6a4308fe30de8b7816058bd5d4b962ca Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 1 Nov 2015 19:37:14 +0100
Subject: More EntityTransferContext plumbing
---
OpenSim/Framework/AgentCircuitData.cs | 4 +--
OpenSim/Framework/AvatarAppearance.cs | 6 ++---
OpenSim/Framework/ChildAgentDataUpdate.cs | 30 ++++++++--------------
OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 3 ++-
OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 5 ++--
.../Shared/Api/Implementation/OSSL_Api.cs | 3 ++-
.../Server/Handlers/Simulation/AgentHandlers.cs | 8 +++---
.../SimianGrid/SimianAvatarServiceConnector.cs | 3 ++-
.../Simulation/SimulationServiceConnector.cs | 6 ++---
OpenSim/Services/Interfaces/ISimulationService.cs | 14 ----------
10 files changed, 32 insertions(+), 50 deletions(-)
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index f4b35a6..4529944 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(int wearablesCount)
+ public OSDMap PackAgentCircuitData(EntityTransferContext ctx)
{
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(wearablesCount);
+ OSDMap appmap = Appearance.Pack(ctx);
args["packed_appearance"] = appmap;
}
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 50746a0..5258760 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -717,7 +717,7 @@ namespace OpenSim.Framework
///
/// Create an OSDMap from the appearance data
///
- public OSDMap Pack(int wearablesCount)
+ public OSDMap Pack(EntityTransferContext ctx)
{
OSDMap data = new OSDMap();
@@ -728,8 +728,8 @@ namespace OpenSim.Framework
//
// 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)
+ int count = ctx.WearablesCount;
+ if (ctx.WearablesCount == -1)
count = m_wearables.Length;
OSDArray wears = new OSDArray(count);
for (int i = 0; i < count; i++)
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 2fce155..72c2c34 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -61,8 +61,8 @@ namespace OpenSim.Framework
{
UUID AgentID { get; set; }
- OSDMap Pack(Object parms = null);
- void Unpack(OSDMap map, IScene scene);
+ OSDMap Pack(EntityTransferContext ctx);
+ void Unpack(OSDMap map, IScene scene, EntityTransferContext ctx);
}
///
@@ -96,7 +96,7 @@ namespace OpenSim.Framework
public Dictionary ChildrenCapSeeds = null;
- public OSDMap Pack(Object parms = null)
+ public OSDMap Pack(EntityTransferContext ctx)
{
OSDMap args = new OSDMap();
args["message_type"] = OSD.FromString("AgentPosition");
@@ -136,7 +136,7 @@ namespace OpenSim.Framework
return args;
}
- public void Unpack(OSDMap args, IScene scene)
+ public void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
{
if (args.ContainsKey("region_handle"))
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
@@ -391,18 +391,10 @@ namespace OpenSim.Framework
public Dictionary MovementAnimationOverRides = new Dictionary();
- public virtual OSDMap Pack(Object parms = null)
+ public virtual OSDMap Pack(EntityTransferContext ctx)
{
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();
@@ -503,7 +495,7 @@ namespace OpenSim.Framework
}
if (Appearance != null)
- args["packed_appearance"] = Appearance.Pack(wearablesCount);
+ args["packed_appearance"] = Appearance.Pack(ctx);
//if ((AgentTextures != null) && (AgentTextures.Length > 0))
//{
@@ -594,7 +586,7 @@ namespace OpenSim.Framework
/// Avoiding reflection makes it painful to write, but that's the price!
///
///
- public virtual void Unpack(OSDMap args, IScene scene)
+ public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
{
//m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
@@ -903,14 +895,14 @@ namespace OpenSim.Framework
public class CompleteAgentData : AgentData
{
- public override OSDMap Pack(object parms = null)
+ public override OSDMap Pack(EntityTransferContext ctx)
{
- return base.Pack(parms);
+ return base.Pack(ctx);
}
- public override void Unpack(OSDMap map, IScene scene)
+ public override void Unpack(OSDMap map, IScene scene, EntityTransferContext ctx)
{
- base.Unpack(map, scene);
+ base.Unpack(map, scene, ctx);
}
}
}
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
index a2a2eea..e8ae728 100644
--- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
@@ -311,8 +311,9 @@ namespace OpenSim.Framework.Tests
Agent1Data.SessionID = SessionId;
Agent1Data.startpos = StartPos;
+ EntityTransferContext ctx = new EntityTransferContext();
OSDMap map2;
- OSDMap map = Agent1Data.PackAgentCircuitData(-1);
+ OSDMap map = Agent1Data.PackAgentCircuitData(ctx);
try
{
string str = OSDParser.SerializeJsonString(map);
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index 08f2af5..d8072c7 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -116,7 +116,8 @@ namespace OpenSim.Framework.Tests
position2 = new AgentPosition();
Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition");
- position2.Unpack(position1.Pack(), null);
+ EntityTransferContext ctx = new EntityTransferContext();
+ position2.Unpack(position1.Pack(ctx), null, ctx);
Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed");
Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed");
@@ -305,4 +306,4 @@ namespace OpenSim.Framework.Tests
}
}
-}
\ 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 e945b30..29f5a83 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3114,7 +3114,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (appearanceModule != null)
{
appearanceModule.SaveBakedTextures(sp.UUID);
- OSDMap appearancePacked = sp.Appearance.Pack(-1);
+ EntityTransferContext ctx = new EntityTransferContext();
+ OSDMap appearancePacked = sp.Appearance.Pack(ctx);
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 f6a7e19..7ab7dea 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -262,7 +262,6 @@ namespace OpenSim.Server.Handlers.Simulation
resp["version"] = OSD.FromString(legacyVersion);
resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion);
resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion);
- resp["variable_wearables_count_supported"] = OSD.FromBoolean(true);
OSDArray featuresWanted = new OSDArray();
foreach (UUID feature in features)
@@ -661,6 +660,9 @@ namespace OpenSim.Server.Handlers.Simulation
protected void DoAgentPut(Hashtable request, Hashtable responsedata)
{
+ // TODO: Encode the ENtityTransferContext
+ EntityTransferContext ctx = new EntityTransferContext();
+
OSDMap args = Utils.GetOSDMap((string)request["body"]);
if (args == null)
{
@@ -703,7 +705,7 @@ namespace OpenSim.Server.Handlers.Simulation
AgentData agent = new AgentData();
try
{
- agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
+ agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID), ctx);
}
catch (Exception ex)
{
@@ -722,7 +724,7 @@ namespace OpenSim.Server.Handlers.Simulation
AgentPosition agent = new AgentPosition();
try
{
- agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
+ agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID), ctx);
}
catch (Exception ex)
{
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index d355eab..a52dd6c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -152,7 +152,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
//
public bool SetAppearance(UUID userID, AvatarAppearance appearance)
{
- OSDMap map = appearance.Pack(-1);
+ EntityTransferContext ctx = new EntityTransferContext();
+ OSDMap map = appearance.Pack(ctx);
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 bb47e6b..0ebd37e 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Services.Connectors.Simulation
try
{
- OSDMap args = aCircuit.PackAgentCircuitData(-1);
+ OSDMap args = aCircuit.PackAgentCircuitData(ctx);
PackData(args, source, aCircuit, destination, flags);
OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
@@ -260,7 +260,7 @@ namespace OpenSim.Services.Connectors.Simulation
try
{
- OSDMap args = cAgentData.Pack();
+ OSDMap args = cAgentData.Pack(ctx);
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
@@ -347,8 +347,6 @@ namespace OpenSim.Services.Connectors.Simulation
ctx.OutboundVersion = float.Parse(parts[1]);
}
}
- if (data.ContainsKey("variable_wearables_count_supported"))
- ctx.VariableWearablesSupported = true;
m_log.DebugFormat(
"[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3}/{4}",
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 4496a9f..d89f6ff 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -34,20 +34,6 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Services.Interfaces
{
- public class EntityTransferContext
- {
- public EntityTransferContext()
- {
- InboundVersion = VersionInfo.SimulationServiceVersionAcceptedMax;
- OutboundVersion = VersionInfo.SimulationServiceVersionSupportedMax;
- VariableWearablesSupported = false;
- }
-
- public float InboundVersion { get; set; }
- public float OutboundVersion { get; set; }
- public bool VariableWearablesSupported { get; set; }
- }
-
public interface ISimulationService
{
///
--
cgit v1.1