From e5bebe3a3215bac1d5d54602ded7859860470aa0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 May 2017 08:20:58 +0100 Subject: webrequests serialiazation per endpoint its now ServicePointManager job --- OpenSim/Framework/Servers/ServerBase.cs | 48 +--------------------------- OpenSim/Framework/WebUtil.cs | 55 +-------------------------------- 2 files changed, 2 insertions(+), 101 deletions(-) diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index f627ae6..3bb2313 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -275,18 +275,6 @@ namespace OpenSim.Framework.Servers (string module, string[] args) => Notice(GetThreadsReport())); m_console.Commands.AddCommand ( - "Debug", false, "debug comms set", - "debug comms set serialosdreq true|false", - "Set comms parameters. For debug purposes.", - HandleDebugCommsSet); - - m_console.Commands.AddCommand ( - "Debug", false, "debug comms status", - "debug comms status", - "Show current debug comms parameters.", - HandleDebugCommsStatus); - - m_console.Commands.AddCommand ( "Debug", false, "debug threadpool set", "debug threadpool set worker|iocp min|max ", "Set threadpool parameters. For debug purposes.", @@ -343,47 +331,13 @@ namespace OpenSim.Framework.Servers public void RegisterCommonComponents(IConfigSource configSource) { - IConfig networkConfig = configSource.Configs["Network"]; - - if (networkConfig != null) - { - WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false); - } +// IConfig networkConfig = configSource.Configs["Network"]; m_serverStatsCollector = new ServerStatsCollector(); m_serverStatsCollector.Initialise(configSource); m_serverStatsCollector.Start(); } - private void HandleDebugCommsStatus(string module, string[] args) - { - Notice("serialosdreq is {0}", WebUtil.SerializeOSDRequestsPerEndpoint); - } - - private void HandleDebugCommsSet(string module, string[] args) - { - if (args.Length != 5) - { - Notice("Usage: debug comms set serialosdreq true|false"); - return; - } - - if (args[3] != "serialosdreq") - { - Notice("Usage: debug comms set serialosdreq true|false"); - return; - } - - bool setSerializeOsdRequests; - - if (!ConsoleUtil.TryParseConsoleBool(m_console, args[4], out setSerializeOsdRequests)) - return; - - WebUtil.SerializeOSDRequestsPerEndpoint = setSerializeOsdRequests; - - Notice("serialosdreq is now {0}", setSerializeOsdRequests); - } - private void HandleShowThreadpoolCallsActive(string module, string[] args) { List> calls = Util.GetFireAndForgetCallsInProgress().ToList(); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 12f58fe..7b085d0 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -72,11 +72,6 @@ namespace OpenSim.Framework public static int RequestNumber { get; set; } /// - /// Control where OSD requests should be serialized per endpoint. - /// - public static bool SerializeOSDRequestsPerEndpoint { get; set; } - - /// /// this is the header field used to communicate the local request id /// used for performance and debugging /// @@ -98,31 +93,6 @@ namespace OpenSim.Framework /// public const int MaxRequestDiagLength = 200; - /// - /// Dictionary of end points - /// - private static Dictionary m_endpointSerializer = new Dictionary(); - - private static object EndPointLock(string url) - { - System.Uri uri = new System.Uri(url); - string endpoint = string.Format("{0}:{1}",uri.Host,uri.Port); - - lock (m_endpointSerializer) - { - object eplock = null; - - if (! m_endpointSerializer.TryGetValue(endpoint,out eplock)) - { - eplock = new object(); - m_endpointSerializer.Add(endpoint,eplock); - // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint); - } - - return eplock; - } - } - #region JSONRequest /// @@ -154,21 +124,6 @@ namespace OpenSim.Framework return ServiceOSDRequest(url, null, "GET", timeout, false, false); } - public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) - { - if (SerializeOSDRequestsPerEndpoint) - { - lock (EndPointLock(url)) - { - return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); - } - } - else - { - return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); - } - } - public static void LogOutgoingDetail(Stream outputStream) { LogOutgoingDetail("", outputStream); @@ -222,7 +177,7 @@ namespace OpenSim.Framework LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input); } - private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) + public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) { int reqnum = RequestNumber++; @@ -422,14 +377,6 @@ namespace OpenSim.Framework public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) { - lock (EndPointLock(url)) - { - return ServiceFormRequestWorker(url,data,timeout); - } - } - - private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) - { int reqnum = RequestNumber++; string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; -- cgit v1.1