From 8cc547c2776f957abd0fa09c33c02bf42de70340 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 2 May 2011 09:04:34 -0700 Subject: Turns out that it's a bad idea to let Agent position updates linger for a long time on certain versions of mono. It's better to abort them if they take too long. So timeout is now an argument. Currently: 20secs for CreateAgent, 100secs for UpdateAgent (fat), 10 secs for UpdateAgent (Position); all of these divided by 4, for ReadWrite, as Mic had before. --- OpenSim/Framework/WebUtil.cs | 18 +++++++++--------- .../Simulation/SimulationServiceConnector.cs | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index ac0828b..4734fc1 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -140,19 +140,19 @@ namespace OpenSim.Framework /// PUT JSON-encoded data to a web service that returns LLSD or /// JSON data /// - public static OSDMap PutToService(string url, OSDMap data) + public static OSDMap PutToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url,data,"PUT",30000); + return ServiceOSDRequest(url,data, "PUT", timeout); } - - public static OSDMap PostToService(string url, OSDMap data) + + public static OSDMap PostToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url,data,"POST",30000); + return ServiceOSDRequest(url, data, "POST", timeout); } - - public static OSDMap GetFromService(string url) + + public static OSDMap GetFromService(string url, int timeout) { - return ServiceOSDRequest(url,null,"GET",30000); + return ServiceOSDRequest(url, null, "GET", timeout); } public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) @@ -171,7 +171,7 @@ namespace OpenSim.Framework request.Timeout = timeout; request.KeepAlive = false; request.MaximumAutomaticRedirections = 10; - request.ReadWriteTimeout = timeout * 8; + request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); // If there is some input, write it into the request diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 5cb8269..0f2ced1 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -102,7 +102,7 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); args["teleport_flags"] = OSD.FromString(flags.ToString()); - OSDMap result = WebUtil.PostToService(uri,args); + OSDMap result = WebUtil.PostToService(uri, args, 20000); if (result["Success"].AsBoolean()) return true; @@ -126,7 +126,7 @@ namespace OpenSim.Services.Connectors.Simulation /// public bool UpdateAgent(GridRegion destination, AgentData data) { - return UpdateAgent(destination, (IAgentData)data); + return UpdateAgent(destination, (IAgentData)data, 100000); // yes, 100 seconds } /// @@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors.Simulation } } - UpdateAgent(destination,(IAgentData)pos); + UpdateAgent(destination, (IAgentData)pos, 10000); } // unreachable @@ -191,7 +191,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) + private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout) { // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent start"); @@ -207,7 +207,7 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); - OSDMap result = WebUtil.PutToService(uri,args); + OSDMap result = WebUtil.PutToService(uri, args, timeout); return result["Success"].AsBoolean(); } catch (Exception e) @@ -233,7 +233,7 @@ namespace OpenSim.Services.Connectors.Simulation try { - OSDMap result = WebUtil.GetFromService(uri); + OSDMap result = WebUtil.GetFromService(uri, 10000); if (result["Success"].AsBoolean()) { // OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString()); @@ -392,7 +392,7 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); - WebUtil.PostToService(uri, args); + WebUtil.PostToService(uri, args, 40000); } catch (Exception e) { -- cgit v1.1