From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../Simulation/SimulationServiceConnector.cs | 71 +++++++++++++--------- 1 file changed, 41 insertions(+), 30 deletions(-) (limited to 'OpenSim/Services/Connectors/Simulation') diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index cea870b..a4ca2d3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -50,7 +50,7 @@ namespace OpenSim.Services.Connectors.Simulation // we use this dictionary to track the pending updateagent requests, maps URI --> position update private Dictionary m_updateAgentQueue = new Dictionary(); - + //private GridRegion m_Region; public SimulationServiceConnector() @@ -98,29 +98,32 @@ 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; myipaddress = String.Empty; if (destination == null) { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); + reason = "Destination not found"; + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Create agent destination is null"); return false; } + m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); + string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - + try { - OSDMap args = aCircuit.PackAgentCircuitData(); + OSDMap args = aCircuit.PackAgentCircuitData(ctx); + args["context"] = ctx.Pack(); PackData(args, source, aCircuit, destination, flags); OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); @@ -134,7 +137,7 @@ namespace OpenSim.Services.Connectors.Simulation myipaddress = data["your_ip"].AsString(); return success; } - + // Try the old version, uncompressed result = WebUtil.PostToService(uri, args, 30000, false); @@ -152,10 +155,10 @@ namespace OpenSim.Services.Connectors.Simulation return success; } } - + m_log.WarnFormat( - "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {2}", - aCircuit.firstname, aCircuit.lastname, destination.RegionName); + "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {2}", + aCircuit.firstname, aCircuit.lastname, destination.RegionName); reason = result["Message"] != null ? result["Message"].AsString() : "error"; return false; } @@ -171,9 +174,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(); @@ -199,8 +202,8 @@ namespace OpenSim.Services.Connectors.Simulation { if (m_updateAgentQueue.ContainsKey(uri)) { - // Another thread is already handling - // updates for this simulator, just update + // Another thread is already handling + // updates for this simulator, just update // the position and return, overwrites are // not a problem since we only care about the // last update anyway @@ -234,7 +237,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 @@ -249,7 +253,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); @@ -258,12 +262,13 @@ 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()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); + args["context"] = ctx.Pack(); OSDMap result = WebUtil.PutToServiceCompressed(uri, args, timeout); if (result["Success"].AsBoolean()) @@ -284,20 +289,19 @@ namespace OpenSim.Services.Connectors.Simulation public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List featuresAvailable, EntityTransferContext ctx, out string reason) { + Culture.SetCurrentCulture(); + reason = "Failed to contact destination"; // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); - IPEndPoint ext = destination.ExternalEndPoint; - if (ext == null) return false; - // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; OSDMap request = new OSDMap(); request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); request.Add("position", OSD.FromString(position.ToString())); - // To those who still understad this field, we're telling them + // To those who still understad this field, we're telling them // the lowest version just to be safe request.Add("my_version", OSD.FromString(String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersionSupportedMin))); // New simulation service negotiation @@ -306,6 +310,8 @@ namespace OpenSim.Services.Connectors.Simulation request.Add("simulation_service_accepted_min", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMin)); request.Add("simulation_service_accepted_max", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMax)); + request.Add("context", ctx.Pack()); + OSDArray features = new OSDArray(); foreach (UUID feature in featuresAvailable) features.Add(OSD.FromString(feature.ToString())); @@ -325,7 +331,7 @@ namespace OpenSim.Services.Connectors.Simulation // FIXME: If there is a _Result map then it's the success key here that indicates the true success // or failure, not the sibling result node. - success = data["success"]; + success = data["success"].AsBoolean(); reason = data["reason"].AsString(); // We will need to plumb this and start sing the outbound version as well @@ -345,8 +351,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}", @@ -367,7 +371,7 @@ namespace OpenSim.Services.Connectors.Simulation m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); return true; } - + reason = result["Message"]; } else @@ -379,7 +383,6 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - featuresAvailable.Clear(); if (result.ContainsKey("features")) @@ -390,13 +393,21 @@ namespace OpenSim.Services.Connectors.Simulation featuresAvailable.Add(new UUID(o.AsString())); } + // Version stuff + if (ctx.OutboundVersion < 0.5) + ctx.WearablesCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; + else if (ctx.OutboundVersion < 0.6) + ctx.WearablesCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES + 1; + else + ctx.WearablesCount = -1; // send all (just in case..) + return success; } catch (Exception e) { m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcesss failed with exception; {0}",e.ToString()); } - + return false; } @@ -414,7 +425,7 @@ namespace OpenSim.Services.Connectors.Simulation { m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] ReleaseAgent failed with exception; {0}",e.ToString()); } - + return true; } -- cgit v1.1