From ef4122213c440c55d32c097c08e52170f4b4346a Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 6 Aug 2012 15:35:40 +0100 Subject: enables configurable minimum sizes for physical & non-physical prims --- OpenSim/Framework/RegionInfo.cs | 42 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 2080a16..8131089 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -120,7 +120,9 @@ namespace OpenSim.Framework public UUID lastMapUUID = UUID.Zero; public string lastMapRefresh = "0"; + private float m_nonphysPrimMin = 0; private int m_nonphysPrimMax = 0; + private float m_physPrimMin = 0; private int m_physPrimMax = 0; private bool m_clampPrimSize = false; private int m_objectCapacity = 0; @@ -285,11 +287,21 @@ namespace OpenSim.Framework set { m_windlight = value; } } + public float NonphysPrimMin + { + get { return m_nonphysPrimMin; } + } + public int NonphysPrimMax { get { return m_nonphysPrimMax; } } + public float PhysPrimMin + { + get { return m_physPrimMin; } + } + public int PhysPrimMax { get { return m_physPrimMax; } @@ -623,16 +635,28 @@ namespace OpenSim.Framework m_regionType = config.GetString("RegionType", String.Empty); allKeys.Remove("RegionType"); - // Prim stuff - // + #region Prim stuff + + m_nonphysPrimMin = config.GetFloat("NonphysicalPrimMin", 0); + allKeys.Remove("NonphysicalPrimMin"); + m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0); allKeys.Remove("NonphysicalPrimMax"); + + m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0); + allKeys.Remove("PhysicalPrimMin"); + m_physPrimMax = config.GetInt("PhysicalPrimMax", 0); allKeys.Remove("PhysicalPrimMax"); + m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); allKeys.Remove("ClampPrimSize"); + m_objectCapacity = config.GetInt("MaxPrims", 15000); allKeys.Remove("MaxPrims"); + + #endregion + m_agentCapacity = config.GetInt("MaxAgents", 100); allKeys.Remove("MaxAgents"); @@ -668,10 +692,18 @@ namespace OpenSim.Framework config.Set("ExternalHostName", m_externalHostName); + if (m_nonphysPrimMin != 0) + config.Set("NonphysicalPrimMax", m_nonphysPrimMin); + if (m_nonphysPrimMax != 0) config.Set("NonphysicalPrimMax", m_nonphysPrimMax); + + if (m_physPrimMin != 0) + config.Set("PhysicalPrimMax", m_physPrimMin); + if (m_physPrimMax != 0) config.Set("PhysicalPrimMax", m_physPrimMax); + config.Set("ClampPrimSize", m_clampPrimSize.ToString()); if (m_objectCapacity != 0) @@ -754,9 +786,15 @@ namespace OpenSim.Framework configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); + configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, + "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true); + configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); + configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, + "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true); + configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for physical prims", m_physPrimMax.ToString(), true); -- cgit v1.1 From e9ea911563362c4766d34cd948a2915beac06124 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 17 Aug 2012 16:53:36 +0100 Subject: adding a clip method to handle Vector3 objects to enable a minor amount of refactoring --- OpenSim/Framework/Util.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 8cc29ee..38cb3a6 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -850,6 +850,12 @@ namespace OpenSim.Framework return Math.Min(Math.Max(x, min), max); } + public static Vector3 Clip(Vector3 vec, float min, float max) + { + return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max), + Clip(vec.Z, min, max)); + } + /// /// Convert an UUID to a raw uuid string. Right now this is a string without hyphens. /// -- cgit v1.1 From e4e5237086bd34a6649b687d3499a6795317f043 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 18 Aug 2012 00:46:34 +0100 Subject: When reporting a thread timeout, create a copy of the info rather than passing the original ThreadWatchdogInfo structure. This is to avoid the possibility of misleading reporting if a watchdog update outraces an alarm. Should address any remaining issues from http://opensimulator.org/mantis/view.php?id=6012 --- OpenSim/Framework/Monitoring/Watchdog.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 02f11fa..7964f28 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -89,6 +89,17 @@ namespace OpenSim.Framework.Monitoring FirstTick = Environment.TickCount & Int32.MaxValue; LastTick = FirstTick; } + + public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi) + { + Thread = previousTwi.Thread; + FirstTick = previousTwi.FirstTick; + LastTick = previousTwi.LastTick; + Timeout = previousTwi.Timeout; + IsTimedOut = previousTwi.IsTimedOut; + AlarmIfTimeout = previousTwi.AlarmIfTimeout; + AlarmMethod = previousTwi.AlarmMethod; + } } /// @@ -335,7 +346,9 @@ namespace OpenSim.Framework.Monitoring if (callbackInfos == null) callbackInfos = new List(); - callbackInfos.Add(threadInfo); + // Send a copy of the watchdog info to prevent race conditions where the watchdog + // thread updates the monitoring info after an alarm has been sent out. + callbackInfos.Add(new ThreadWatchdogInfo(threadInfo)); } } } -- cgit v1.1 From bcbd450fe441e94d6c0f547055b4e95f75a5b0d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 20 Aug 2012 20:24:54 +0100 Subject: Add --force flag to "kick user" console command to allow bypassing of recent race condition checks. This is to allow a second attempt to remove an avatar even if "show connections" shows them as already inactive (i.e. close has already been attempted once). You should only attempt --force if a normal kick fails. This is partly for diagnostics as we have seen some connections occasionally remain on lbsa plaza even if they are registered as inactive. This is not a permanent solution and may not work anyway - the ultimate solution is to stop this problem from happening in the first place. --- OpenSim/Framework/IClientAPI.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index d5952c4..8a63bff 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1033,7 +1033,21 @@ namespace OpenSim.Framework void InPacket(object NewPack); void ProcessInPacket(Packet NewPack); + + /// + /// Close this client + /// void Close(); + + /// + /// Close this client + /// + /// + /// If true, attempts the close without checking active status. You do not want to try this except as a last + /// ditch attempt where Active == false but the ScenePresence still exists. + /// + void Close(bool force); + void Kick(string message); /// -- cgit v1.1 From 970727e57e2fd478685b5853c855d3b471d5325d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 20 Aug 2012 20:55:58 +0100 Subject: Tighten up OpenSim.Framework.Cache locking to avoid race conditions. This is to resolve a reported issue in http://opensimulator.org/mantis/view.php?id=6232 Here, the land management module is using OpenSim.Framework.Cache (the only code to currently do so apart from the non-default CoreAssetCache). --- OpenSim/Framework/Cache.cs | 83 +++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 30 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs index 79e20fc..31cab4a 100644 --- a/OpenSim/Framework/Cache.cs +++ b/OpenSim/Framework/Cache.cs @@ -199,7 +199,14 @@ namespace OpenSim.Framework // public class Cache { + /// + /// Must only be accessed under lock. + /// private List m_Index = new List(); + + /// + /// Must only be accessed under m_Index lock. + /// private Dictionary m_Lookup = new Dictionary(); @@ -320,19 +327,19 @@ namespace OpenSim.Framework { if (m_Lookup.ContainsKey(index)) item = m_Lookup[index]; - } - if (item == null) - { + if (item == null) + { + Expire(true); + return null; + } + + item.hits++; + item.lastUsed = DateTime.Now; + Expire(true); - return null; } - item.hits++; - item.lastUsed = DateTime.Now; - - Expire(true); - return item; } @@ -385,7 +392,10 @@ namespace OpenSim.Framework // public Object Find(Predicate d) { - CacheItemBase item = m_Index.Find(d); + CacheItemBase item; + + lock (m_Index) + item = m_Index.Find(d); if (item == null) return null; @@ -419,12 +429,12 @@ namespace OpenSim.Framework public virtual void Store(string index, Object data, Type container, Object[] parameters) { - Expire(false); - CacheItemBase item; lock (m_Index) { + Expire(false); + if (m_Index.Contains(new CacheItemBase(index))) { if ((m_Flags & CacheFlags.AllowUpdate) != 0) @@ -450,9 +460,17 @@ namespace OpenSim.Framework m_Index.Add(item); m_Lookup[index] = item; } + item.Store(data); } + /// + /// Expire items as appropriate. + /// + /// + /// Callers must lock m_Index. + /// + /// protected virtual void Expire(bool getting) { if (getting && (m_Strategy == CacheStrategy.Aggressive)) @@ -475,12 +493,10 @@ namespace OpenSim.Framework switch (m_Strategy) { - case CacheStrategy.Aggressive: - if (Count < Size) - return; + case CacheStrategy.Aggressive: + if (Count < Size) + return; - lock (m_Index) - { m_Index.Sort(new SortLRU()); m_Index.Reverse(); @@ -490,7 +506,7 @@ namespace OpenSim.Framework ExpireDelegate doExpire = OnExpire; - if (doExpire != null) + if (doExpire != null) { List candidates = m_Index.GetRange(target, Count - target); @@ -513,27 +529,34 @@ namespace OpenSim.Framework foreach (CacheItemBase item in m_Index) m_Lookup[item.uuid] = item; } - } - break; - default: - break; + + break; + + default: + break; } } public void Invalidate(string uuid) { - if (!m_Lookup.ContainsKey(uuid)) - return; + lock (m_Index) + { + if (!m_Lookup.ContainsKey(uuid)) + return; - CacheItemBase item = m_Lookup[uuid]; - m_Lookup.Remove(uuid); - m_Index.Remove(item); + CacheItemBase item = m_Lookup[uuid]; + m_Lookup.Remove(uuid); + m_Index.Remove(item); + } } public void Clear() { - m_Index.Clear(); - m_Lookup.Clear(); + lock (m_Index) + { + m_Index.Clear(); + m_Lookup.Clear(); + } } } -} +} \ No newline at end of file -- cgit v1.1 From 7ea832d47c827ad9ef8eb0ce24702fbee585b1ee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 29 Aug 2012 02:01:43 +0100 Subject: Fix regression introduced in a0d178b2 (Sat Aug 25 02:00:17 2012) where folders with asset type of 'Folder' and 'Unknown' were accidentally treated as system folders. This prevented more than one additional ordinary folder from being created in the base "My Inventory" user folder. Added regression test for this case. Switched tests to use XInventoryService with mostly implemented TestXInventoryDataPlugin rather than InventoryService Disabled TestLoadIarV0_1SameNameCreator() since this has not been working for a very long time (ever since XInventoryService) started being used since it doesnt' preserve creator data in the same way as InventoryService did and so effectively lost the OSPAs. However, nobody noticed/complained about this issue and OSPAs have been superseded by HG like creator information via the --home save oar/iar switch. --- OpenSim/Framework/InventoryFolderBase.cs | 18 ++++++------------ .../Framework/Serialization/External/OspResolver.cs | 14 +++++++++++--- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index a12183c..b3457a6 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs @@ -73,33 +73,27 @@ namespace OpenSim.Framework { } - public InventoryFolderBase(UUID id) + public InventoryFolderBase(UUID id) : this() { ID = id; } - public InventoryFolderBase(UUID id, UUID owner) + public InventoryFolderBase(UUID id, UUID owner) : this(id) { - ID = id; Owner = owner; } - public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) + public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner) { - ID = id; Name = name; - Owner = owner; ParentID = parent; } - public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) + public InventoryFolderBase( + UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent) { - ID = id; - Name = name; - Owner = owner; Type = type; - ParentID = parent; Version = version; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs index d31d27c..fa7160f 100644 --- a/OpenSim/Framework/Serialization/External/OspResolver.cs +++ b/OpenSim/Framework/Serialization/External/OspResolver.cs @@ -65,9 +65,14 @@ namespace OpenSim.Framework.Serialization UserAccount account = userService.GetUserAccount(UUID.Zero, userId); if (account != null) + { return MakeOspa(account.FirstName, account.LastName); + } // else +// { // m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId); +// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId); +// } return null; } @@ -79,10 +84,13 @@ namespace OpenSim.Framework.Serialization /// public static string MakeOspa(string firstName, string lastName) { -// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName); + string ospa + = OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; + +// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); +// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); - return - OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; + return ospa; } /// -- cgit v1.1 From 15d5f3d09d140a0850d968fd3b738afc0b1f3985 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 4 Sep 2012 00:11:14 +0100 Subject: Bump master code up to 0.7.5 now that 0.7.4 is out. --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 5f01788..c9d9770 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.7.4"; + private const string VERSION_NUMBER = "0.7.5"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From 874bde366aa3f834957f757aa56a7634becb4415 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 10:54:45 +0100 Subject: 4096 is used in various places as the maximum height of a region, refactoring to be a constant --- OpenSim/Framework/Constants.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 1b1aaf2..a2eb5ee 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -31,6 +31,7 @@ namespace OpenSim.Framework public class Constants { public const uint RegionSize = 256; + public const uint RegionHeight = 4096; public const byte TerrainPatchSize = 16; public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; -- cgit v1.1 From 783ee949ea9b9bfe309e542a74bb0712f3b65d00 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 8 Sep 2012 13:48:07 +0100 Subject: implementing per-region configuration of limits on the number of prims one can have in a linkset Applied with changes - patch was based on a repo different from core Signed-off-by: Melanie --- OpenSim/Framework/RegionInfo.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 8131089..ded2df2 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -126,6 +126,7 @@ namespace OpenSim.Framework private int m_physPrimMax = 0; private bool m_clampPrimSize = false; private int m_objectCapacity = 0; + private int m_linksetCapacity = 0; private int m_agentCapacity = 0; private string m_regionType = String.Empty; private RegionLightShareData m_windlight = new RegionLightShareData(); @@ -317,6 +318,11 @@ namespace OpenSim.Framework get { return m_objectCapacity; } } + public int LinksetCapacity + { + get { return m_linksetCapacity; } + } + public int AgentCapacity { get { return m_agentCapacity; } @@ -654,6 +660,9 @@ namespace OpenSim.Framework m_objectCapacity = config.GetInt("MaxPrims", 15000); allKeys.Remove("MaxPrims"); + + m_linksetCapacity = config.GetInt("LinksetPrims", 0); + allKeys.Remove("LinksetPrims"); #endregion @@ -709,6 +718,9 @@ namespace OpenSim.Framework if (m_objectCapacity != 0) config.Set("MaxPrims", m_objectCapacity); + if (m_linksetCapacity != 0) + config.Set("LinksetPrims", m_linksetCapacity); + if (m_agentCapacity != 0) config.Set("MaxAgents", m_agentCapacity); @@ -804,6 +816,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", m_objectCapacity.ToString(), true); + configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, + "Max prims an object will hold", m_linksetCapacity.ToString(), true); + configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max avatars this sim will hold", m_agentCapacity.ToString(), true); @@ -922,6 +937,9 @@ namespace OpenSim.Framework case "object_capacity": m_objectCapacity = (int)configuration_result; break; + case "linkset_capacity": + m_linksetCapacity = (int)configuration_result; + break; case "agent_capacity": m_agentCapacity = (int)configuration_result; break; @@ -1052,4 +1070,4 @@ namespace OpenSim.Framework return kvp; } } -} \ No newline at end of file +} -- cgit v1.1 From 25111e703f54d84c7c51e32db1f94332ea3ffd00 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 11 Sep 2012 21:48:02 +0100 Subject: Add levels 4 and 5 to "debug http" console command that will log a sample of incoming request data and the entire incoming data respectively. See "help debug http" for more details. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 68 ++++++++++++++++++---- OpenSim/Framework/Servers/MainServer.cs | 2 + OpenSim/Framework/Util.cs | 32 ++++++++++ 3 files changed, 90 insertions(+), 12 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index f57ea76..c81e283 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -449,9 +449,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (TryGetStreamHandler(handlerKey, out requestHandler)) { if (DebugLevel >= 3) - m_log.DebugFormat( - "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", - request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); + LogIncomingToStreamHandler(request, requestHandler); response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. @@ -563,9 +561,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (DoWeHaveALLSDHandler(request.RawUrl)) { if (DebugLevel >= 3) - m_log.DebugFormat( - "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery); + LogIncomingToContentTypeHandler(request); buffer = HandleLLSDRequests(request, response); } @@ -573,18 +569,14 @@ namespace OpenSim.Framework.Servers.HttpServer else if (DoWeHaveAHTTPHandler(request.RawUrl)) { if (DebugLevel >= 3) - m_log.DebugFormat( - "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery); + LogIncomingToContentTypeHandler(request); buffer = HandleHTTPRequest(request, response); } else { if (DebugLevel >= 3) - m_log.DebugFormat( - "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", - request.HttpMethod, request.Url.PathAndQuery); + LogIncomingToXmlRpcHandler(request); // generic login request. buffer = HandleXmlRpcRequests(request, response); @@ -654,6 +646,58 @@ namespace OpenSim.Framework.Servers.HttpServer } } + private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) + { + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", + request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); + + if (DebugLevel >= 4) + LogIncomingInDetail(request); + } + + private void LogIncomingToContentTypeHandler(OSHttpRequest request) + { + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); + + if (DebugLevel >= 4) + LogIncomingInDetail(request); + } + + private void LogIncomingToXmlRpcHandler(OSHttpRequest request) + { + m_log.DebugFormat( + "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", + request.HttpMethod, request.Url.PathAndQuery); + + if (DebugLevel >= 4) + LogIncomingInDetail(request); + } + + private void LogIncomingInDetail(OSHttpRequest request) + { + using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8)) + { + string output; + + if (DebugLevel == 4) + { + const int sampleLength = 80; + char[] sampleChars = new char[sampleLength]; + reader.Read(sampleChars, 0, sampleLength); + output = string.Format("[BASE HTTP SERVER]: {0}...", sampleChars); + } + else + { + output = string.Format("[BASE HTTP SERVER]: {0}", reader.ReadToEnd()); + } + + m_log.Debug(output); + } + } + private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler) { string bestMatch = null; diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 8dc0e3a..1ac0953 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -111,6 +111,8 @@ namespace OpenSim.Framework.Servers + "If level >= 1, then short warnings are logged when receiving bad input data.\n" + "If level >= 2, then long warnings are logged when receiving bad input data.\n" + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" + + "If level >= 4, then a sample from the beginning of the incoming data is logged.\n" + + "If level >= 5, then the entire incoming data is logged.\n" + "If no level is specified then the current level is returned.", HandleDebugHttpCommand); } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 38cb3a6..1b9777f 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1007,6 +1007,38 @@ namespace OpenSim.Framework } } + /// + /// Copy data from one stream to another, leaving the read position of both streams at the beginning. + /// + /// + /// Input stream. Must be seekable. + /// + /// + /// Thrown if the input stream is not seekable. + /// + public static Stream Copy(Stream inputStream) + { + if (!inputStream.CanSeek) + throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek"); + + const int readSize = 256; + byte[] buffer = new byte[readSize]; + MemoryStream ms = new MemoryStream(); + + int count = inputStream.Read(buffer, 0, readSize); + + while (count > 0) + { + ms.Write(buffer, 0, count); + count = inputStream.Read(buffer, 0, readSize); + } + + ms.Position = 0; + inputStream.Position = 0; + + return ms; + } + public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) { return SendXmlRpcCommand(url, methodName, args); -- cgit v1.1 From d53a53d4c599e77f039149128526ac67570b30fb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 12 Sep 2012 00:10:48 +0100 Subject: Make "show http-handlers" command available for ROBUST instances as well as the simulator executable. --- OpenSim/Framework/Servers/MainServer.cs | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 1ac0953..b367b12 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Net; +using System.Text; using log4net; using OpenSim.Framework; using OpenSim.Framework.Console; @@ -105,6 +106,11 @@ namespace OpenSim.Framework.Servers public static void RegisterHttpConsoleCommands(ICommandConsole console) { console.Commands.AddCommand( + "Comms", false, "show http-handlers", + "show http-handlers", + "Show all registered http handlers", HandleShowHttpHandlersCommand); + + console.Commands.AddCommand( "Debug", false, "debug http", "debug http []", "Turn on inbound non-poll http request debugging.", "If level <= 0, then no extra logging is done.\n" @@ -142,6 +148,51 @@ namespace OpenSim.Framework.Servers } } + private static void HandleShowHttpHandlersCommand(string module, string[] args) + { + if (args.Length != 2) + { + MainConsole.Instance.Output("Usage: show http-handlers"); + return; + } + + StringBuilder handlers = new StringBuilder(); + + lock (m_Servers) + { + foreach (BaseHttpServer httpServer in m_Servers.Values) + { + handlers.AppendFormat( + "Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port); + + handlers.AppendFormat("* XMLRPC:\n"); + foreach (String s in httpServer.GetXmlRpcHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* HTTP:\n"); + List poll = httpServer.GetPollServiceHandlerKeys(); + foreach (String s in httpServer.GetHTTPHandlerKeys()) + handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); + + handlers.AppendFormat("* Agent:\n"); + foreach (String s in httpServer.GetAgentHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* LLSD:\n"); + foreach (String s in httpServer.GetLLSDHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count); + foreach (String s in httpServer.GetStreamHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.Append("\n"); + } + } + + MainConsole.Instance.Output(handlers.ToString()); + } + /// /// Register an already started HTTP server to the collection of known servers. /// -- cgit v1.1 From c17965eec41e0c37f43cc3d4a7c12e52280db59d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 8 Sep 2012 12:53:30 +0100 Subject: mathematically & hypothetically speaking we want to avoid negative values being written --- OpenSim/Framework/RegionInfo.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ded2df2..928e798 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -701,27 +701,27 @@ namespace OpenSim.Framework config.Set("ExternalHostName", m_externalHostName); - if (m_nonphysPrimMin != 0) + if (m_nonphysPrimMin > 0) config.Set("NonphysicalPrimMax", m_nonphysPrimMin); - if (m_nonphysPrimMax != 0) + if (m_nonphysPrimMax > 0) config.Set("NonphysicalPrimMax", m_nonphysPrimMax); - if (m_physPrimMin != 0) + if (m_physPrimMin > 0) config.Set("PhysicalPrimMax", m_physPrimMin); - if (m_physPrimMax != 0) + if (m_physPrimMax > 0) config.Set("PhysicalPrimMax", m_physPrimMax); config.Set("ClampPrimSize", m_clampPrimSize.ToString()); - if (m_objectCapacity != 0) + if (m_objectCapacity > 0) config.Set("MaxPrims", m_objectCapacity); - if (m_linksetCapacity != 0) + if (m_linksetCapacity > 0) config.Set("LinksetPrims", m_linksetCapacity); - if (m_agentCapacity != 0) + if (m_agentCapacity > 0) config.Set("MaxAgents", m_agentCapacity); if (ScopeID != UUID.Zero) -- cgit v1.1 From 7df7b86ec5e6186fc86dd075792f56001cac66f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 12 Sep 2012 23:01:07 +0100 Subject: Fix bug in logging sample input at debug http level 4. Also converts newlines to "\n" text. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index c81e283..43a19fa 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -687,7 +687,7 @@ namespace OpenSim.Framework.Servers.HttpServer const int sampleLength = 80; char[] sampleChars = new char[sampleLength]; reader.Read(sampleChars, 0, sampleLength); - output = string.Format("[BASE HTTP SERVER]: {0}...", sampleChars); + output = string.Format("[BASE HTTP SERVER]: {0}...", new string(sampleChars).Replace("\n", @"\n")); } else { -- cgit v1.1 From cdc3781f42869586aa4bba482359f8cda21cb912 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 12 Sep 2012 23:02:25 +0100 Subject: Fix usage statement on "debug http" console command since max level is now 5 rather than 3 --- OpenSim/Framework/Servers/MainServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index b367b12..7402c73 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -144,7 +144,7 @@ namespace OpenSim.Framework.Servers } else { - MainConsole.Instance.Output("Usage: debug http 0..3"); + MainConsole.Instance.Output("Usage: debug http 0..5"); } } -- cgit v1.1 From ce468215d576cc301a261d85bee9baa68a246ce6 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 24 Jul 2012 19:48:08 +0300 Subject: Support multi-region OAR files Merged ArchiveWriteRequestPreparation.cs and ArchiveWriteRequestExecution.cs. This simplifies the code, and it's faster to write each scene to the archive as it's found rather than all at once at the end. --- OpenSim/Framework/Serialization/ArchiveConstants.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 2c5e001..48f1c4f 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -53,6 +53,11 @@ namespace OpenSim.Framework.Serialization public const string INVENTORY_PATH = "inventory/"; /// + /// Path for regions in a multi-region archive + /// + public const string REGIONS_PATH = "regions/"; + + /// /// Path for the prims file /// public const string OBJECTS_PATH = "objects/"; -- cgit v1.1 From d29fc5305222abcc081daa7aa4b0b017d04bbae1 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 18 Sep 2012 09:47:15 -0400 Subject: Fix some inconsistencies in configurartion: NonPhys prims Fix inconsistencies between configuration parameter names and their description names. Changing the configuration parameters for non physical prim size min-max from Nonphys* to NonPhys*. Please update your OpenSim.ini and Regions.ini to reflect these changes. --- OpenSim/Framework/RegionInfo.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 928e798..016f2a6 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -643,11 +643,11 @@ namespace OpenSim.Framework #region Prim stuff - m_nonphysPrimMin = config.GetFloat("NonphysicalPrimMin", 0); - allKeys.Remove("NonphysicalPrimMin"); + m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); + allKeys.Remove("NonPhysicalPrimMin"); - m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0); - allKeys.Remove("NonphysicalPrimMax"); + m_nonphysPrimMax = config.GetInt("NonPhysicalPrimMax", 0); + allKeys.Remove("NonPhysicalPrimMax"); m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0); allKeys.Remove("PhysicalPrimMin"); -- cgit v1.1 From 387a1bb283c0c55178421f2c28b0d28a24dac7a1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 20 Sep 2012 22:36:47 +0100 Subject: Add ability to turn on/off logging of outgoing HTTP requests flowing through WebUtil. This is for debugging purposes. This is controlled via the "debug http" command which can already log incoming requests. This now gains a mandatory parameter of in, out or all to control what is logged. Log messages are also shortened and labelled and HTTP IN or HTTP OUT to be consistent with existing UDP PACKET IN and PACKET OUT messages. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 10 +-- OpenSim/Framework/Servers/MainServer.cs | 87 ++++++++++++++++------ OpenSim/Framework/WebUtil.cs | 41 ++++++++-- 3 files changed, 103 insertions(+), 35 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 43a19fa..f93b3dd 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -529,7 +529,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (DebugLevel >= 3) m_log.DebugFormat( - "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleHTTPRequest(request, response); @@ -541,7 +541,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (DebugLevel >= 3) m_log.DebugFormat( - "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleLLSDRequests(request, response); @@ -649,7 +649,7 @@ namespace OpenSim.Framework.Servers.HttpServer private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) { m_log.DebugFormat( - "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", + "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3}", request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); if (DebugLevel >= 4) @@ -659,7 +659,7 @@ namespace OpenSim.Framework.Servers.HttpServer private void LogIncomingToContentTypeHandler(OSHttpRequest request) { m_log.DebugFormat( - "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", request.ContentType, request.HttpMethod, request.Url.PathAndQuery); if (DebugLevel >= 4) @@ -669,7 +669,7 @@ namespace OpenSim.Framework.Servers.HttpServer private void LogIncomingToXmlRpcHandler(OSHttpRequest request) { m_log.DebugFormat( - "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", + "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1}", request.HttpMethod, request.Url.PathAndQuery); if (DebugLevel >= 4) diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 7402c73..b7a133e 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -48,9 +48,11 @@ namespace OpenSim.Framework.Servers /// Control the printing of certain debug messages. /// /// - /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data. - /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data. - /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged. + /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data. + /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data. + /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged. + /// If DebugLevel >= 4 then the start of the body of incoming non-poll HTTP requests will be logged. + /// If DebugLevel >= 5 then the entire body of incoming non-poll HTTP requests will be logged. /// public static int DebugLevel { @@ -102,7 +104,6 @@ namespace OpenSim.Framework.Servers get { return new Dictionary(m_Servers); } } - public static void RegisterHttpConsoleCommands(ICommandConsole console) { console.Commands.AddCommand( @@ -111,15 +112,18 @@ namespace OpenSim.Framework.Servers "Show all registered http handlers", HandleShowHttpHandlersCommand); console.Commands.AddCommand( - "Debug", false, "debug http", "debug http []", - "Turn on inbound non-poll http request debugging.", - "If level <= 0, then no extra logging is done.\n" - + "If level >= 1, then short warnings are logged when receiving bad input data.\n" - + "If level >= 2, then long warnings are logged when receiving bad input data.\n" - + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" - + "If level >= 4, then a sample from the beginning of the incoming data is logged.\n" - + "If level >= 5, then the entire incoming data is logged.\n" - + "If no level is specified then the current level is returned.", + "Debug", false, "debug http", "debug http []", + "Turn on http request logging.", + "If in or all and\n" + + " level <= 0, then no extra logging is done.\n" + + " level >= 1, then short warnings are logged when receiving bad input data.\n" + + " level >= 2, then long warnings are logged when receiving bad input data.\n" + + " level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" + + " level >= 4, then a sample from the beginning of the incoming data is logged.\n" + + " level >= 5, then the entire incoming data is logged.\n" + + " no level is specified then the current level is returned.\n\n" + + "If out or all and\n" + + " level >= 3. then short notices about all outgoing requests going through WebUtil are logged.\n", HandleDebugHttpCommand); } @@ -127,24 +131,63 @@ namespace OpenSim.Framework.Servers /// Turn on some debugging values for OpenSim. /// /// - private static void HandleDebugHttpCommand(string module, string[] args) + private static void HandleDebugHttpCommand(string module, string[] cmdparams) { - if (args.Length == 3) + if (cmdparams.Length < 3) { + MainConsole.Instance.Output("Usage: debug http 0..5"); + return; + } + + bool inReqs = false; + bool outReqs = false; + bool allReqs = false; + + string subCommand = cmdparams[2]; + + if (subCommand == "in") + inReqs = true; + else if (subCommand == "out") + outReqs = true; + else + allReqs = true; + + if (cmdparams.Length >= 4) + { + string rawNewDebug = cmdparams[3]; int newDebug; - if (int.TryParse(args[2], out newDebug)) + + if (!int.TryParse(rawNewDebug, out newDebug)) + { + MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug); + return; + } + + if (newDebug < 0 || newDebug > 5) + { + MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..5", newDebug); + return; + } + + if (allReqs || inReqs) { MainServer.DebugLevel = newDebug; - MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug); + MainConsole.Instance.OutputFormat("In debug level set to {0}", newDebug); + } + + if (allReqs || outReqs) + { + WebUtil.DebugLevel = newDebug; + MainConsole.Instance.OutputFormat("Out debug level set to {0}", newDebug); } - } - else if (args.Length == 2) - { - MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel); } else { - MainConsole.Instance.Output("Usage: debug http 0..5"); + if (allReqs || inReqs) + MainConsole.Instance.OutputFormat("Current in debug level is {0}", MainServer.DebugLevel); + + if (allReqs || outReqs) + MainConsole.Instance.OutputFormat("Current out debug level is {0}", WebUtil.DebugLevel); } } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 2aa4af5..7c4e852 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -54,6 +54,14 @@ namespace OpenSim.Framework MethodBase.GetCurrentMethod().DeclaringType); /// + /// Control the printing of certain debug messages. + /// + /// + /// If DebugLevel >= 3 then short notices about outgoing HTTP requests are logged. + /// + public static int DebugLevel { get; set; } + + /// /// Request number for diagnostic purposes. /// public static int RequestNumber = 0; @@ -146,7 +154,11 @@ namespace OpenSim.Framework private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) { int reqnum = RequestNumber++; - // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); + + if (DebugLevel >= 3) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})", + reqnum, method, url, timeout, compressed); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); @@ -317,7 +329,11 @@ namespace OpenSim.Framework { int reqnum = RequestNumber++; string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; - // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); + + if (DebugLevel >= 3) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})", + reqnum, method, url, timeout); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); @@ -643,7 +659,6 @@ namespace OpenSim.Framework /// public static string[] GetPreferredImageTypes(string accept) { - if (accept == null || accept == string.Empty) return new string[0]; @@ -695,13 +710,15 @@ namespace OpenSim.Framework string requestUrl, TRequest obj, Action action) { int reqnum = WebUtil.RequestNumber++; - // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); + + if (WebUtil.DebugLevel >= 3) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}", + reqnum, verb, requestUrl); int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; - // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); - Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); @@ -882,7 +899,11 @@ namespace OpenSim.Framework public static string MakeRequest(string verb, string requestUrl, string obj) { int reqnum = WebUtil.RequestNumber++; - // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); + + if (WebUtil.DebugLevel >= 3) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}", + reqnum, verb, requestUrl); int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; @@ -998,7 +1019,11 @@ namespace OpenSim.Framework public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj) { int reqnum = WebUtil.RequestNumber++; - // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); + + if (WebUtil.DebugLevel >= 3) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}", + reqnum, verb, requestUrl); int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; -- cgit v1.1 From a5b3989e5db0a3b22e44b84412227a8e487bcef2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 20 Sep 2012 23:18:19 +0100 Subject: Insert a new log level 4 for HTTP IN and HTTP OUT that will log how long the request took. This is only printed if debug http level >= 4 and the request didn't take more than the time considered 'long', in which case the existing log message is printed. This displaces the previous log levels 4 and 5 which are now 5 and 6 respectively. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 47 ++++++++++++++------- OpenSim/Framework/Servers/MainServer.cs | 48 ++++++++++++++-------- OpenSim/Framework/WebUtil.cs | 24 +++++++++++ 3 files changed, 87 insertions(+), 32 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index f93b3dd..4e04dd8 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -54,6 +54,12 @@ namespace OpenSim.Framework.Servers.HttpServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); + /// + /// Gets or sets the debug level. + /// + /// + /// See MainServer.DebugLevel. + /// public int DebugLevel { get; set; } private volatile int NotSocketErrors = 0; @@ -529,8 +535,8 @@ namespace OpenSim.Framework.Servers.HttpServer if (DebugLevel >= 3) m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery); + "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); buffer = HandleHTTPRequest(request, response); break; @@ -541,8 +547,8 @@ namespace OpenSim.Framework.Servers.HttpServer if (DebugLevel >= 3) m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery); + "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); buffer = HandleLLSDRequests(request, response); break; @@ -640,7 +646,18 @@ namespace OpenSim.Framework.Servers.HttpServer uriString, requestHandler != null ? requestHandler.Name : "", requestHandler != null ? requestHandler.Description : "", - request.RemoteIPEndPoint.ToString(), + request.RemoteIPEndPoint, + tickdiff); + } + else if (DebugLevel >= 4) + { + m_log.DebugFormat( + "[BASE HTTP SERVER]: HTTP IN {0} {1} {2} {3} from {4} took {5}ms", + requestMethod, + uriString, + requestHandler != null ? requestHandler.Name : "", + requestHandler != null ? requestHandler.Description : "", + request.RemoteIPEndPoint, tickdiff); } } @@ -649,30 +666,30 @@ namespace OpenSim.Framework.Servers.HttpServer private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) { m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3}", - request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); + "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3} from {4}", + request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description, request.RemoteIPEndPoint); - if (DebugLevel >= 4) + if (DebugLevel >= 5) LogIncomingInDetail(request); } private void LogIncomingToContentTypeHandler(OSHttpRequest request) { m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery); + "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); - if (DebugLevel >= 4) + if (DebugLevel >= 5) LogIncomingInDetail(request); } private void LogIncomingToXmlRpcHandler(OSHttpRequest request) { m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1}", - request.HttpMethod, request.Url.PathAndQuery); + "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1} from {2}", + request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); - if (DebugLevel >= 4) + if (DebugLevel >= 5) LogIncomingInDetail(request); } @@ -682,7 +699,7 @@ namespace OpenSim.Framework.Servers.HttpServer { string output; - if (DebugLevel == 4) + if (DebugLevel == 5) { const int sampleLength = 80; char[] sampleChars = new char[sampleLength]; diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index b7a133e..72f9cce 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -51,8 +51,9 @@ namespace OpenSim.Framework.Servers /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data. /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data. /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged. - /// If DebugLevel >= 4 then the start of the body of incoming non-poll HTTP requests will be logged. - /// If DebugLevel >= 5 then the entire body of incoming non-poll HTTP requests will be logged. + /// If DebugLevel >= 4 then the time taken to fulfill the request is logged. + /// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged. + /// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged. /// public static int DebugLevel { @@ -115,15 +116,17 @@ namespace OpenSim.Framework.Servers "Debug", false, "debug http", "debug http []", "Turn on http request logging.", "If in or all and\n" - + " level <= 0, then no extra logging is done.\n" - + " level >= 1, then short warnings are logged when receiving bad input data.\n" - + " level >= 2, then long warnings are logged when receiving bad input data.\n" - + " level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" - + " level >= 4, then a sample from the beginning of the incoming data is logged.\n" - + " level >= 5, then the entire incoming data is logged.\n" + + " level <= 0 then no extra logging is done.\n" + + " level >= 1 then short warnings are logged when receiving bad input data.\n" + + " level >= 2 then long warnings are logged when receiving bad input data.\n" + + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n" + + " level >= 4 then the time taken to fulfill the request is logged.\n" + + " level >= 5 then a sample from the beginning of the incoming data is logged.\n" + + " level >= 6 then the entire incoming data is logged.\n" + " no level is specified then the current level is returned.\n\n" + "If out or all and\n" - + " level >= 3. then short notices about all outgoing requests going through WebUtil are logged.\n", + + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n" + + " level >= 4 then the time taken to fulfill the request is logged.\n", HandleDebugHttpCommand); } @@ -135,7 +138,7 @@ namespace OpenSim.Framework.Servers { if (cmdparams.Length < 3) { - MainConsole.Instance.Output("Usage: debug http 0..5"); + MainConsole.Instance.Output("Usage: debug http 0..6"); return; } @@ -145,12 +148,23 @@ namespace OpenSim.Framework.Servers string subCommand = cmdparams[2]; - if (subCommand == "in") + if (subCommand.ToLower() == "in") + { inReqs = true; - else if (subCommand == "out") + } + else if (subCommand.ToLower() == "out") + { outReqs = true; - else + } + else if (subCommand.ToLower() == "all") + { allReqs = true; + } + else + { + MainConsole.Instance.Output("You must specify in, out or all"); + return; + } if (cmdparams.Length >= 4) { @@ -172,22 +186,22 @@ namespace OpenSim.Framework.Servers if (allReqs || inReqs) { MainServer.DebugLevel = newDebug; - MainConsole.Instance.OutputFormat("In debug level set to {0}", newDebug); + MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug); } if (allReqs || outReqs) { WebUtil.DebugLevel = newDebug; - MainConsole.Instance.OutputFormat("Out debug level set to {0}", newDebug); + MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug); } } else { if (allReqs || inReqs) - MainConsole.Instance.OutputFormat("Current in debug level is {0}", MainServer.DebugLevel); + MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel); if (allReqs || outReqs) - MainConsole.Instance.OutputFormat("Current out debug level is {0}", WebUtil.DebugLevel); + MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel); } } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 7c4e852..64d61f1 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -250,6 +250,10 @@ namespace OpenSim.Framework strBuffer != null ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) : ""); + else if (DebugLevel >= 4) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", + reqnum, tickdiff, tickdata); } m_log.DebugFormat( @@ -405,6 +409,10 @@ namespace OpenSim.Framework queryString != null ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString : ""); + else if (DebugLevel >= 4) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", + reqnum, tickdiff, tickdata); } m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); @@ -879,6 +887,12 @@ namespace OpenSim.Framework tickdata, originalRequest); } + else if (WebUtil.DebugLevel >= 4) + { + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", + reqnum, tickdiff, tickdata); + } } } @@ -995,6 +1009,10 @@ namespace OpenSim.Framework tickdiff, tickdata, obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); + else if (WebUtil.DebugLevel >= 4) + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", + reqnum, tickdiff, tickdata); return respstring; } @@ -1144,6 +1162,12 @@ namespace OpenSim.Framework tickdata, originalRequest); } + else if (WebUtil.DebugLevel >= 4) + { + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", + reqnum, tickdiff, tickdata); + } return deserial; } -- cgit v1.1 From e29d563557bbe3a5a8f3aaf883ca92770a586e10 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 21 Sep 2012 00:09:17 +0100 Subject: Add request number counting to incoming HTTP requests in the same way that this was already being done for outgoing HTTP requests. This allows us to associate debug logging messages with the right request. It also allows us to put a request number on 'long request' logging even if other debug logging is not enabled, which gives us some idea of whether every request is suffering this problem or only some. This is a separate internal number not associated with any incoming number in the opensim-request-id header, this will be clarified when logging of this incoming request number is re-enabled. This commit also adds port number to HTTP IN logging to allow us to distinguish between different request numbers on different ports. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 59 +++++++++++++++------- OpenSim/Framework/WebUtil.cs | 2 +- 2 files changed, 42 insertions(+), 19 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 4e04dd8..05c2d53 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -62,6 +62,15 @@ namespace OpenSim.Framework.Servers.HttpServer /// public int DebugLevel { get; set; } + /// + /// Request number for diagnostic purposes. + /// + /// + /// This is an internal number. In some debug situations an external number may also be supplied in the + /// opensim-request-id header but we are not currently logging this. + /// + public int RequestNumber { get; private set; } + private volatile int NotSocketErrors = 0; public volatile bool HTTPDRunning = false; @@ -302,6 +311,8 @@ namespace OpenSim.Framework.Servers.HttpServer private void OnRequest(object source, RequestEventArgs args) { + RequestNumber++; + try { IHttpClientContext context = (IHttpClientContext)source; @@ -411,7 +422,6 @@ namespace OpenSim.Framework.Servers.HttpServer string requestMethod = request.HttpMethod; string uriString = request.RawUrl; -// string reqnum = "unknown"; int requestStartTick = Environment.TickCount; // Will be adjusted later on. @@ -535,8 +545,8 @@ namespace OpenSim.Framework.Servers.HttpServer if (DebugLevel >= 3) m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); + "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", + RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); buffer = HandleHTTPRequest(request, response); break; @@ -547,8 +557,8 @@ namespace OpenSim.Framework.Servers.HttpServer if (DebugLevel >= 3) m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); + "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", + RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); buffer = HandleLLSDRequests(request, response); break; @@ -641,7 +651,8 @@ namespace OpenSim.Framework.Servers.HttpServer if (tickdiff > 3000) { m_log.InfoFormat( - "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", + "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", + RequestNumber, requestMethod, uriString, requestHandler != null ? requestHandler.Name : "", @@ -652,12 +663,9 @@ namespace OpenSim.Framework.Servers.HttpServer else if (DebugLevel >= 4) { m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} {1} {2} {3} from {4} took {5}ms", - requestMethod, - uriString, - requestHandler != null ? requestHandler.Name : "", - requestHandler != null ? requestHandler.Description : "", - request.RemoteIPEndPoint, + "[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms", + RequestNumber, + Port, tickdiff); } } @@ -666,8 +674,14 @@ namespace OpenSim.Framework.Servers.HttpServer private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) { m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3} from {4}", - request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description, request.RemoteIPEndPoint); + "[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}", + RequestNumber, + Port, + request.HttpMethod, + request.Url.PathAndQuery, + requestHandler.Name, + requestHandler.Description, + request.RemoteIPEndPoint); if (DebugLevel >= 5) LogIncomingInDetail(request); @@ -676,8 +690,13 @@ namespace OpenSim.Framework.Servers.HttpServer private void LogIncomingToContentTypeHandler(OSHttpRequest request) { m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", - request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); + "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", + RequestNumber, + Port, + request.ContentType, + request.HttpMethod, + request.Url.PathAndQuery, + request.RemoteIPEndPoint); if (DebugLevel >= 5) LogIncomingInDetail(request); @@ -686,8 +705,12 @@ namespace OpenSim.Framework.Servers.HttpServer private void LogIncomingToXmlRpcHandler(OSHttpRequest request) { m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1} from {2}", - request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); + "[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}", + RequestNumber, + Port, + request.HttpMethod, + request.Url.PathAndQuery, + request.RemoteIPEndPoint); if (DebugLevel >= 5) LogIncomingInDetail(request); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 64d61f1..e095402 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -64,7 +64,7 @@ namespace OpenSim.Framework /// /// Request number for diagnostic purposes. /// - public static int RequestNumber = 0; + public static int RequestNumber { get; internal set; } /// /// this is the header field used to communicate the local request id -- cgit v1.1 From 1b0abf8f0cd417e2a37cffc96379274ad98183f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 21 Sep 2012 00:29:13 +0100 Subject: Comment out the long unused afaik HTTP agent handlers. As far as I know, this was only used by the IBM Rest modules, much of which has been commented out for a very long time now. Other similar code uses HTTP or stream handlers instead. So commenting this out to reduce code complexity and the need to make this facility consistent with the others where it may not be used anyway. If this facility is actually being used then please notify me or uncomment it if you are core. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 146 ++++++++++----------- .../Servers/HttpServer/Interfaces/IHttpServer.cs | 22 ++-- OpenSim/Framework/Servers/MainServer.cs | 6 +- 3 files changed, 87 insertions(+), 87 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 05c2d53..8c29ad4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -82,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer protected Dictionary m_llsdHandlers = new Dictionary(); protected Dictionary m_streamHandlers = new Dictionary(); protected Dictionary m_HTTPHandlers = new Dictionary(); - protected Dictionary m_agentHandlers = new Dictionary(); +// protected Dictionary m_agentHandlers = new Dictionary(); protected Dictionary m_pollHandlers = new Dictionary(); @@ -260,29 +260,29 @@ namespace OpenSim.Framework.Servers.HttpServer return new List(m_pollHandlers.Keys); } - // Note that the agent string is provided simply to differentiate - // the handlers - it is NOT required to be an actual agent header - // value. - public bool AddAgentHandler(string agent, IHttpAgentHandler handler) - { - lock (m_agentHandlers) - { - if (!m_agentHandlers.ContainsKey(agent)) - { - m_agentHandlers.Add(agent, handler); - return true; - } - } - - //must already have a handler for that path so return false - return false; - } - - public List GetAgentHandlerKeys() - { - lock (m_agentHandlers) - return new List(m_agentHandlers.Keys); - } +// // Note that the agent string is provided simply to differentiate +// // the handlers - it is NOT required to be an actual agent header +// // value. +// public bool AddAgentHandler(string agent, IHttpAgentHandler handler) +// { +// lock (m_agentHandlers) +// { +// if (!m_agentHandlers.ContainsKey(agent)) +// { +// m_agentHandlers.Add(agent, handler); +// return true; +// } +// } +// +// //must already have a handler for that path so return false +// return false; +// } +// +// public List GetAgentHandlerKeys() +// { +// lock (m_agentHandlers) +// return new List(m_agentHandlers.Keys); +// } public bool AddLLSDHandler(string path, LLSDMethod handler) { @@ -438,22 +438,22 @@ namespace OpenSim.Framework.Servers.HttpServer Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); - // This is the REST agent interface. We require an agent to properly identify - // itself. If the REST handler recognizes the prefix it will attempt to - // satisfy the request. If it is not recognizable, and no damage has occurred - // the request can be passed through to the other handlers. This is a low - // probability event; if a request is matched it is normally expected to be - // handled - IHttpAgentHandler agentHandler; - - if (TryGetAgentHandler(request, response, out agentHandler)) - { - if (HandleAgentRequest(agentHandler, request, response)) - { - requestEndTick = Environment.TickCount; - return; - } - } +// // This is the REST agent interface. We require an agent to properly identify +// // itself. If the REST handler recognizes the prefix it will attempt to +// // satisfy the request. If it is not recognizable, and no damage has occurred +// // the request can be passed through to the other handlers. This is a low +// // probability event; if a request is matched it is normally expected to be +// // handled +// IHttpAgentHandler agentHandler; +// +// if (TryGetAgentHandler(request, response, out agentHandler)) +// { +// if (HandleAgentRequest(agentHandler, request, response)) +// { +// requestEndTick = Environment.TickCount; +// return; +// } +// } //response.KeepAlive = true; response.SendChunked = false; @@ -830,24 +830,24 @@ namespace OpenSim.Framework.Servers.HttpServer } } - private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) - { - agentHandler = null; - - lock (m_agentHandlers) - { - foreach (IHttpAgentHandler handler in m_agentHandlers.Values) - { - if (handler.Match(request, response)) - { - agentHandler = handler; - return true; - } - } - } - - return false; - } +// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) +// { +// agentHandler = null; +// +// lock (m_agentHandlers) +// { +// foreach (IHttpAgentHandler handler in m_agentHandlers.Values) +// { +// if (handler.Match(request, response)) +// { +// agentHandler = handler; +// return true; +// } +// } +// } +// +// return false; +// } /// /// Try all the registered xmlrpc handlers when an xmlrpc request is received. @@ -1772,21 +1772,21 @@ namespace OpenSim.Framework.Servers.HttpServer m_pollHandlers.Remove(path); } - public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) - { - lock (m_agentHandlers) - { - IHttpAgentHandler foundHandler; - - if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) - { - m_agentHandlers.Remove(agent); - return true; - } - } - - return false; - } +// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) +// { +// lock (m_agentHandlers) +// { +// IHttpAgentHandler foundHandler; +// +// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) +// { +// m_agentHandlers.Remove(agent); +// return true; +// } +// } +// +// return false; +// } public void RemoveXmlRPCHandler(string method) { diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs index db58f6f..0bd3aae 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs @@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer uint Port { get; } bool UseSSL { get; } - // Note that the agent string is provided simply to differentiate - // the handlers - it is NOT required to be an actual agent header - // value. - bool AddAgentHandler(string agent, IHttpAgentHandler handler); +// // Note that the agent string is provided simply to differentiate +// // the handlers - it is NOT required to be an actual agent header +// // value. +// bool AddAgentHandler(string agent, IHttpAgentHandler handler); /// /// Add a handler for an HTTP request. @@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); - /// - /// Remove the agent if it is registered. - /// - /// - /// - /// - bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); +// /// +// /// Remove the agent if it is registered. +// /// +// /// +// /// +// /// +// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); /// /// Remove an HTTP handler diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 72f9cce..4b61b18 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -231,9 +231,9 @@ namespace OpenSim.Framework.Servers foreach (String s in httpServer.GetHTTPHandlerKeys()) handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); - handlers.AppendFormat("* Agent:\n"); - foreach (String s in httpServer.GetAgentHandlerKeys()) - handlers.AppendFormat("\t{0}\n", s); +// handlers.AppendFormat("* Agent:\n"); +// foreach (String s in httpServer.GetAgentHandlerKeys()) +// handlers.AppendFormat("\t{0}\n", s); handlers.AppendFormat("* LLSD:\n"); foreach (String s in httpServer.GetLLSDHandlerKeys()) -- cgit v1.1 From 80f486c7782e195d8cf3eb11adaca66f6e648af1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 21 Sep 2012 01:59:28 +0100 Subject: minor: Make slow outgoing request log messages consistent with other log messages --- OpenSim/Framework/WebUtil.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index e095402..1d9e2ce 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -241,7 +241,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, method, url, @@ -257,7 +257,7 @@ namespace OpenSim.Framework } m_log.DebugFormat( - "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); + "[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage); return ErrorResponseMap(errorMessage); } @@ -400,7 +400,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + "[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, method, url, @@ -415,7 +415,7 @@ namespace OpenSim.Framework reqnum, tickdiff, tickdata); } - m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); + m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage); return ErrorResponseMap(errorMessage); } @@ -879,7 +879,7 @@ namespace OpenSim.Framework } m_log.InfoFormat( - "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, @@ -1002,7 +1002,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > WebUtil.LongCallTime) m_log.InfoFormat( - "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, @@ -1154,7 +1154,7 @@ namespace OpenSim.Framework } m_log.InfoFormat( - "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + "[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, -- cgit v1.1 From e379566e6e3bed0d7001f099a5ea8dfd648d76cf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 20 Sep 2012 19:50:57 -0700 Subject: Improvement over last commit: refactor the asset permissions code, so that it can be used by both the HG Asset Service and the simulator. Also renamed the config vars to something more intuitive --- OpenSim/Framework/AssetPermissions.cs | 81 +++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 OpenSim/Framework/AssetPermissions.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AssetPermissions.cs b/OpenSim/Framework/AssetPermissions.cs new file mode 100644 index 0000000..d276def --- /dev/null +++ b/OpenSim/Framework/AssetPermissions.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +using Nini.Config; +using log4net; + +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public class AssetPermissions + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private bool[] m_DisallowExport, m_DisallowImport; + private string[] m_AssetTypeNames; + + public AssetPermissions(IConfig config) + { + Type enumType = typeof(AssetType); + m_AssetTypeNames = Enum.GetNames(enumType); + for (int i = 0; i < m_AssetTypeNames.Length; i++) + m_AssetTypeNames[i] = m_AssetTypeNames[i].ToLower(); + int n = Enum.GetValues(enumType).Length; + m_DisallowExport = new bool[n]; + m_DisallowImport = new bool[n]; + + LoadPermsFromConfig(config, "DisallowExport", m_DisallowExport); + LoadPermsFromConfig(config, "DisallowImport", m_DisallowImport); + + } + + private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray) + { + string perms = assetConfig.GetString(variable, String.Empty); + string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + foreach (string s in parts) + { + int index = Array.IndexOf(m_AssetTypeNames, s.Trim().ToLower()); + if (index >= 0) + bitArray[index] = true; + else + m_log.WarnFormat("[Asset Permissions]: Invalid AssetType {0}", s); + } + + } + + public bool AllowedExport(sbyte type) + { + string assetTypeName = ((AssetType)type).ToString(); + + int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower()); + if (index >= 0 && m_DisallowExport[index]) + { + m_log.DebugFormat("[Asset Permissions]: Export denied: configuration does not allow export of AssetType {0}", assetTypeName); + return false; + } + + return true; + } + + public bool AllowedImport(sbyte type) + { + string assetTypeName = ((AssetType)type).ToString(); + + int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower()); + if (index >= 0 && m_DisallowImport[index]) + { + m_log.DebugFormat("[Asset Permissions]: Import denied: configuration does not allow import of AssetType {0}", assetTypeName); + return false; + } + + return true; + } + + + } +} -- cgit v1.1 From f931c0a86893799548d1d0f72c327c37823e4612 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 21 Sep 2012 15:04:41 -0700 Subject: Minor: may avoid crashes of sims that still don't have this configuration section. --- OpenSim/Framework/AssetPermissions.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AssetPermissions.cs b/OpenSim/Framework/AssetPermissions.cs index d276def..4a905c2 100644 --- a/OpenSim/Framework/AssetPermissions.cs +++ b/OpenSim/Framework/AssetPermissions.cs @@ -35,6 +35,9 @@ namespace OpenSim.Framework private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray) { + if (assetConfig == null) + return; + string perms = assetConfig.GetString(variable, String.Empty); string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in parts) -- cgit v1.1 From 772aedc7318209f9c0a2e69ed03b2d8aac4f39ef Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 22 Sep 2012 14:01:07 -0700 Subject: Make BaseHttpServer throws say something useful. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 8c29ad4..d139235 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -636,11 +636,11 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (IOException e) { - m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); + m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); } catch (Exception e) { - m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); + m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); SendHTML500(response); } finally -- cgit v1.1 From f4579527551f474f68f368ffdd0cd0a89d31d504 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 29 Sep 2012 02:38:21 +0100 Subject: Fix bug where debug http level 6 could not be specified. Also converts newlines at this level to '\n' to enable them to be logged. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 6 +++--- OpenSim/Framework/Servers/MainServer.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d139235..ff57422 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -727,14 +727,14 @@ namespace OpenSim.Framework.Servers.HttpServer const int sampleLength = 80; char[] sampleChars = new char[sampleLength]; reader.Read(sampleChars, 0, sampleLength); - output = string.Format("[BASE HTTP SERVER]: {0}...", new string(sampleChars).Replace("\n", @"\n")); + output = new string(sampleChars); } else { - output = string.Format("[BASE HTTP SERVER]: {0}", reader.ReadToEnd()); + output = reader.ReadToEnd(); } - m_log.Debug(output); + m_log.DebugFormat("[BASE HTTP SERVER]: {0}...", output.Replace("\n", @"\n")); } } diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 4b61b18..ae7d515 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -177,9 +177,9 @@ namespace OpenSim.Framework.Servers return; } - if (newDebug < 0 || newDebug > 5) + if (newDebug < 0 || newDebug > 6) { - MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..5", newDebug); + MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..6", newDebug); return; } -- cgit v1.1 From 531edd51d82ecd6a842a2611c99e9919634491ef Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Sep 2012 07:22:55 -0700 Subject: Added request.Proxy=null everywhere, as discussed in http://stackoverflow.com/questions/2519655/httpwebrequest-is-extremely-slow. Thanks R.Gunther (rigun@rigutech.nl) https://lists.berlios.de/pipermail/opensim-users/2012-September/010986.html --- OpenSim/Framework/Communications/RestClient.cs | 2 ++ OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | 1 + OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 1 + OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs | 1 + OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs | 1 + OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 2 ++ OpenSim/Framework/UntrustedWebRequest.cs | 1 + OpenSim/Framework/WebUtil.cs | 5 +++++ 8 files changed, 14 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 97b3b60..226e52f 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -306,6 +306,7 @@ namespace OpenSim.Framework.Communications _request.ContentType = "application/xml"; _request.Timeout = 200000; _request.Method = RequestMethod; + _request.Proxy = null; _asyncException = null; // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); @@ -365,6 +366,7 @@ namespace OpenSim.Framework.Communications _request.ContentType = "application/xml"; _request.Timeout = 900000; _request.Method = RequestMethod; + _request.Proxy = null; _asyncException = null; _request.ContentLength = src.Length; diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 3dce578..7aaf776 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs @@ -65,6 +65,7 @@ namespace OpenSim.Framework.Configuration.HTTP byte[] buf = new byte[8192]; HttpWebRequest request = (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); + request.Proxy = null; HttpWebResponse response = (HttpWebResponse) request.GetResponse(); Stream resStream = response.GetResponseStream(); diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index a2f5d9c..96d4d59 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -70,6 +70,7 @@ namespace OpenSim.Framework.RegionLoader.Web int regionCount = 0; HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); webRequest.Timeout = 30000; //30 Second Timeout + webRequest.Proxy = null; m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); try diff --git a/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs b/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs index 48ced19..61161e3 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs @@ -50,6 +50,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; MemoryStream buffer = new MemoryStream(); diff --git a/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs index 451745c..727f027 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs @@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 10000; diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 19c03a8..1612d4a 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -74,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 20000; @@ -139,6 +140,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 10000; diff --git a/OpenSim/Framework/UntrustedWebRequest.cs b/OpenSim/Framework/UntrustedWebRequest.cs index e6411cc..f2355b1 100644 --- a/OpenSim/Framework/UntrustedWebRequest.cs +++ b/OpenSim/Framework/UntrustedWebRequest.cs @@ -88,6 +88,7 @@ namespace OpenSim.Framework httpWebRequest.ReadWriteTimeout = readWriteTimeoutMS; httpWebRequest.Timeout = timeoutMS; httpWebRequest.KeepAlive = false; + httpWebRequest.Proxy = null; return httpWebRequest; } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 1d9e2ce..9eff0d2 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -171,6 +171,7 @@ namespace OpenSim.Framework request.Method = method; request.Timeout = timeout; request.KeepAlive = false; + request.Proxy = null; request.MaximumAutomaticRedirections = 10; request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); @@ -350,6 +351,7 @@ namespace OpenSim.Framework request.Method = "POST"; request.Timeout = timeout; request.KeepAlive = false; + request.Proxy = null; request.MaximumAutomaticRedirections = 10; request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); @@ -730,6 +732,7 @@ namespace OpenSim.Framework Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); + request.Proxy = null; WebResponse response = null; TResponse deserial = default(TResponse); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); @@ -924,6 +927,7 @@ namespace OpenSim.Framework WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; string respstring = String.Empty; using (MemoryStream buffer = new MemoryStream()) @@ -1051,6 +1055,7 @@ namespace OpenSim.Framework WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; MemoryStream buffer = null; if ((verb == "POST") || (verb == "PUT")) -- cgit v1.1 From 91a5c602e313b96ffaf1d50b7f0d2923a2e141ba Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Sep 2012 07:48:03 -0700 Subject: Revert "Added request.Proxy=null everywhere, as discussed in http://stackoverflow.com/questions/2519655/httpwebrequest-is-extremely-slow." But the patch is here, in case anyone wants to try it. This reverts commit 531edd51d82ecd6a842a2611c99e9919634491ef. --- OpenSim/Framework/Communications/RestClient.cs | 2 -- OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | 1 - OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 1 - OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs | 1 - OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs | 1 - OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 2 -- OpenSim/Framework/UntrustedWebRequest.cs | 1 - OpenSim/Framework/WebUtil.cs | 5 ----- 8 files changed, 14 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 226e52f..97b3b60 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -306,7 +306,6 @@ namespace OpenSim.Framework.Communications _request.ContentType = "application/xml"; _request.Timeout = 200000; _request.Method = RequestMethod; - _request.Proxy = null; _asyncException = null; // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); @@ -366,7 +365,6 @@ namespace OpenSim.Framework.Communications _request.ContentType = "application/xml"; _request.Timeout = 900000; _request.Method = RequestMethod; - _request.Proxy = null; _asyncException = null; _request.ContentLength = src.Length; diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 7aaf776..3dce578 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs @@ -65,7 +65,6 @@ namespace OpenSim.Framework.Configuration.HTTP byte[] buf = new byte[8192]; HttpWebRequest request = (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); - request.Proxy = null; HttpWebResponse response = (HttpWebResponse) request.GetResponse(); Stream resStream = response.GetResponseStream(); diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index 96d4d59..a2f5d9c 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -70,7 +70,6 @@ namespace OpenSim.Framework.RegionLoader.Web int regionCount = 0; HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); webRequest.Timeout = 30000; //30 Second Timeout - webRequest.Proxy = null; m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); try diff --git a/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs b/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs index 61161e3..48ced19 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs @@ -50,7 +50,6 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - request.Proxy = null; request.ContentType = "text/xml"; MemoryStream buffer = new MemoryStream(); diff --git a/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs index 727f027..451745c 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs @@ -57,7 +57,6 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 10000; diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 1612d4a..19c03a8 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -74,7 +74,6 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 20000; @@ -140,7 +139,6 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 10000; diff --git a/OpenSim/Framework/UntrustedWebRequest.cs b/OpenSim/Framework/UntrustedWebRequest.cs index f2355b1..e6411cc 100644 --- a/OpenSim/Framework/UntrustedWebRequest.cs +++ b/OpenSim/Framework/UntrustedWebRequest.cs @@ -88,7 +88,6 @@ namespace OpenSim.Framework httpWebRequest.ReadWriteTimeout = readWriteTimeoutMS; httpWebRequest.Timeout = timeoutMS; httpWebRequest.KeepAlive = false; - httpWebRequest.Proxy = null; return httpWebRequest; } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 9eff0d2..1d9e2ce 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -171,7 +171,6 @@ namespace OpenSim.Framework request.Method = method; request.Timeout = timeout; request.KeepAlive = false; - request.Proxy = null; request.MaximumAutomaticRedirections = 10; request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); @@ -351,7 +350,6 @@ namespace OpenSim.Framework request.Method = "POST"; request.Timeout = timeout; request.KeepAlive = false; - request.Proxy = null; request.MaximumAutomaticRedirections = 10; request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); @@ -732,7 +730,6 @@ namespace OpenSim.Framework Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); - request.Proxy = null; WebResponse response = null; TResponse deserial = default(TResponse); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); @@ -927,7 +924,6 @@ namespace OpenSim.Framework WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - request.Proxy = null; string respstring = String.Empty; using (MemoryStream buffer = new MemoryStream()) @@ -1055,7 +1051,6 @@ namespace OpenSim.Framework WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - request.Proxy = null; MemoryStream buffer = null; if ((verb == "POST") || (verb == "PUT")) -- cgit v1.1 From 060d6fe8f4eba0c1b1c0cb4f52acd2fd59725c66 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:11:23 +0200 Subject: Allow setting max connections for an endpoint --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ff57422..d5bc3c3 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -648,7 +648,7 @@ namespace OpenSim.Framework.Servers.HttpServer // Every month or so this will wrap and give bad numbers, not really a problem // since its just for reporting int tickdiff = requestEndTick - requestStartTick; - if (tickdiff > 3000) + if (tickdiff > 3000 && requestHandler.Name != "GetTexture") { m_log.InfoFormat( "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", -- cgit v1.1 From 503ce70f74bc59813fc662373aabccc0b3962b05 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:15:10 +0200 Subject: Allow setting connection limits, part 2 --- OpenSim/Framework/WebUtil.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 1d9e2ce..5c34cf4 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -717,6 +717,13 @@ namespace OpenSim.Framework public static void MakeRequest(string verb, string requestUrl, TRequest obj, Action action) { + MakeRequest(verb, requestUrl, obj, action, 0); + } + + public static void MakeRequest(string verb, + string requestUrl, TRequest obj, Action action, + int maxConnections) + { int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) @@ -730,6 +737,10 @@ namespace OpenSim.Framework Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); + HttpWebRequest ht = (HttpWebRequest)request; + if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) + ht.ServicePoint.ConnectionLimit = maxConnections; + WebResponse response = null; TResponse deserial = default(TResponse); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); @@ -1036,6 +1047,16 @@ namespace OpenSim.Framework /// the request. You'll want to make sure you deal with this as they're not uncommon public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj) { + return MakeRequest(verb, requestUrl, obj, 0); + } + + public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout) + { + return MakeRequest(verb, requestUrl, obj, pTimeout, 0); + } + + public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) + { int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) @@ -1050,6 +1071,10 @@ namespace OpenSim.Framework TResponse deserial = default(TResponse); WebRequest request = WebRequest.Create(requestUrl); + HttpWebRequest ht = (HttpWebRequest)request; + if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) + ht.ServicePoint.ConnectionLimit = maxConnections; + request.Method = verb; MemoryStream buffer = null; @@ -1172,4 +1197,4 @@ namespace OpenSim.Framework return deserial; } } -} \ No newline at end of file +} -- cgit v1.1 From e717398f6c72bdb30e59468462f3a5f589c1bb35 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Oct 2012 00:32:42 +0100 Subject: Add experimental "slow frames" stat, available in "show stats" and via the monitoring module. This increments a SlowFrames counter if a frame takes over 120% of maximum time. This commit also introduces a generic OpenSim.Framework.Monitoring.Stat which is available to any code that wants to register a statistic. This is more granualar than asking objects to create their own reports. At some point this will supersede earlier IMonitor and IAlert facilities in MonitoringModule which are only available to scene code. --- .../Framework/Monitoring/SimExtraStatsCollector.cs | 13 ++- OpenSim/Framework/Monitoring/StatsManager.cs | 114 +++++++++++++++++++++ 2 files changed, 125 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index cdd7cc7..8ac9090 100644 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs @@ -355,10 +355,19 @@ Asset service request failures: {3}" + Environment.NewLine, sb.Append(Environment.NewLine); sb.Append( string.Format( - "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}", + "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}\n\n", inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); - sb.Append(Environment.NewLine); + + foreach (KeyValuePair kvp in StatsManager.RegisteredStats) + { + Stat stat = kvp.Value; + + if (stat.Category == "scene" && stat.Verbosity == StatVerbosity.Info) + { + sb.AppendFormat("Slow frames ({0}): {1}\n", stat.Container, stat.Value); + } + } /* sb.Append(Environment.NewLine); diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index d78fa6a..02df0ac 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -25,6 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; +using System.Collections.Generic; + namespace OpenSim.Framework.Monitoring { /// @@ -32,6 +35,14 @@ namespace OpenSim.Framework.Monitoring /// public class StatsManager { + /// + /// Registered stats. + /// + /// + /// Do not add or remove from this dictionary. + /// + public static Dictionary RegisteredStats = new Dictionary(); + private static AssetStatsCollector assetStats; private static UserStatsCollector userStats; private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector(); @@ -61,5 +72,108 @@ namespace OpenSim.Framework.Monitoring return userStats; } + + public static bool RegisterStat(Stat stat) + { + lock (RegisteredStats) + { + if (RegisteredStats.ContainsKey(stat.UniqueName)) + { + // XXX: For now just return false. This is to avoid problems in regression tests where all tests + // in a class are run in the same instance of the VM. + return false; + +// throw new Exception( +// "StatsManager already contains stat with ShortName {0} in Category {1}", stat.ShortName, stat.Category); + } + + // We take a replace-on-write approach here so that we don't need to generate a new Dictionary + Dictionary newRegisteredStats = new Dictionary(RegisteredStats); + newRegisteredStats[stat.UniqueName] = stat; + RegisteredStats = newRegisteredStats; + } + + return true; + } + + public static bool DeregisterStat(Stat stat) + { + lock (RegisteredStats) + { + if (!RegisteredStats.ContainsKey(stat.UniqueName)) + return false; + + Dictionary newRegisteredStats = new Dictionary(RegisteredStats); + newRegisteredStats.Remove(stat.UniqueName); + RegisteredStats = newRegisteredStats; + + return true; + } + } + } + + /// + /// Verbosity of stat. + /// + /// + /// Info will always be displayed. + /// + public enum StatVerbosity + { + Debug, + Info + } + + /// + /// Holds individual static details + /// + public class Stat + { + /// + /// Unique stat name used for indexing. Each ShortName in a Category must be unique. + /// + public string UniqueName { get; private set; } + + /// + /// Category of this stat (e.g. cache, scene, etc). + /// + public string Category { get; private set; } + + /// + /// Containing name for this stat. + /// FIXME: In the case of a scene, this is currently the scene name (though this leaves + /// us with a to-be-resolved problem of non-unique region names). + /// + /// + /// The container. + /// + public string Container { get; private set; } + + public StatVerbosity Verbosity { get; private set; } + public string ShortName { get; private set; } + public string Name { get; private set; } + public string Description { get; private set; } + public string UnitName { get; private set; } + + public double Value { get; set; } + + public Stat( + string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description) + { + ShortName = shortName; + Name = name; + UnitName = unitName; + Category = category; + Container = container; + Verbosity = verbosity; + Description = description; + + UniqueName = GenUniqueName(Container, Category, ShortName); + } + + public static string GenUniqueName(string container, string category, string shortName) + { + return string.Format("{0}+{1}+{2}", container, category, shortName); + } } } \ No newline at end of file -- cgit v1.1 From 3d36a6d55cb0bba408f5447d4596c12564366030 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Oct 2012 01:27:40 +0100 Subject: Add generic PercentageStat. Not yet used. --- OpenSim/Framework/Monitoring/StatsManager.cs | 35 ++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 02df0ac..b5dc24f 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -153,9 +153,9 @@ namespace OpenSim.Framework.Monitoring public string ShortName { get; private set; } public string Name { get; private set; } public string Description { get; private set; } - public string UnitName { get; private set; } + public virtual string UnitName { get; private set; } - public double Value { get; set; } + public virtual double Value { get; set; } public Stat( string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description) @@ -176,4 +176,35 @@ namespace OpenSim.Framework.Monitoring return string.Format("{0}+{1}+{2}", container, category, shortName); } } + + public class PercentageStat : Stat + { + public int Antecedent { get; set; } + public int Consequent { get; set; } + + public override double Value + { + get + { + int c = Consequent; + + // Avoid any chance of a multi-threaded divide-by-zero + if (c == 0) + return 0; + + return (double)Antecedent / c; + } + + set + { + throw new Exception("Cannot set value on a PercentageStat"); + } + } + + public PercentageStat( + string shortName, string name, string category, string container, StatVerbosity verbosity, string description) + : base(shortName, name, " %", category, container, verbosity, description) + { + } + } } \ No newline at end of file -- cgit v1.1 From f0178a6a413e35a45efcb0f7f0eeffc0daed15fe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Oct 2012 01:12:56 +0100 Subject: refactor: Move OpenSim.Framework.PacketPool to OpenSim.Region.Clientstack.Linden.UDP This is to allow it to use OpenSim.Framework.Monitoring in the future. This is also a better location since the packet pool is linden udp specific --- OpenSim/Framework/PacketPool.cs | 247 ---------------------------------------- 1 file changed, 247 deletions(-) delete mode 100644 OpenSim/Framework/PacketPool.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs deleted file mode 100644 index 41d17c5..0000000 --- a/OpenSim/Framework/PacketPool.cs +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using OpenMetaverse; -using OpenMetaverse.Packets; -using log4net; - -namespace OpenSim.Framework -{ - - public sealed class PacketPool - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private static readonly PacketPool instance = new PacketPool(); - - private bool packetPoolEnabled = true; - private bool dataBlockPoolEnabled = true; - - private readonly Dictionary> pool = new Dictionary>(); - - private static Dictionary> DataBlocks = - new Dictionary>(); - - static PacketPool() - { - } - - public static PacketPool Instance - { - get { return instance; } - } - - public bool RecyclePackets - { - set { packetPoolEnabled = value; } - get { return packetPoolEnabled; } - } - - public bool RecycleDataBlocks - { - set { dataBlockPoolEnabled = value; } - get { return dataBlockPoolEnabled; } - } - - public Packet GetPacket(PacketType type) - { - Packet packet; - - if (!packetPoolEnabled) - return Packet.BuildPacket(type); - - lock (pool) - { - if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0) - { - // Creating a new packet if we cannot reuse an old package - packet = Packet.BuildPacket(type); - } - else - { - // Recycle old packages - packet = (pool[type]).Pop(); - } - } - - return packet; - } - - // private byte[] decoded_header = new byte[10]; - private static PacketType GetType(byte[] bytes) - { - byte[] decoded_header = new byte[10 + 8]; - ushort id; - PacketFrequency freq; - - if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0) - { - Helpers.ZeroDecode(bytes, 16, decoded_header); - } - else - { - Buffer.BlockCopy(bytes, 0, decoded_header, 0, 10); - } - - if (decoded_header[6] == 0xFF) - { - if (decoded_header[7] == 0xFF) - { - id = (ushort) ((decoded_header[8] << 8) + decoded_header[9]); - freq = PacketFrequency.Low; - } - else - { - id = decoded_header[7]; - freq = PacketFrequency.Medium; - } - } - else - { - id = decoded_header[6]; - freq = PacketFrequency.High; - } - - return Packet.GetType(id, freq); - } - - public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer) - { - PacketType type = GetType(bytes); - - Array.Clear(zeroBuffer, 0, zeroBuffer.Length); - - int i = 0; - Packet packet = GetPacket(type); - if (packet == null) - m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type); - else - packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); - - return packet; - } - - /// - /// Return a packet to the packet pool - /// - /// - public void ReturnPacket(Packet packet) - { - if (dataBlockPoolEnabled) - { - switch (packet.Type) - { - case PacketType.ObjectUpdate: - ObjectUpdatePacket oup = (ObjectUpdatePacket)packet; - - foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData) - ReturnDataBlock(oupod); - - oup.ObjectData = null; - break; - - case PacketType.ImprovedTerseObjectUpdate: - ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet; - - foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData) - ReturnDataBlock(itoupod); - - itoup.ObjectData = null; - break; - } - } - - if (packetPoolEnabled) - { - switch (packet.Type) - { - // List pooling packets here - case PacketType.PacketAck: - case PacketType.ObjectUpdate: - case PacketType.ImprovedTerseObjectUpdate: - lock (pool) - { - PacketType type = packet.Type; - - if (!pool.ContainsKey(type)) - { - pool[type] = new Stack(); - } - - if ((pool[type]).Count < 50) - { - (pool[type]).Push(packet); - } - } - break; - - // Other packets wont pool - default: - return; - } - } - } - - public static T GetDataBlock() where T: new() - { - lock (DataBlocks) - { - Stack s; - - if (DataBlocks.TryGetValue(typeof(T), out s)) - { - if (s.Count > 0) - return (T)s.Pop(); - } - else - { - DataBlocks[typeof(T)] = new Stack(); - } - - return new T(); - } - } - - public static void ReturnDataBlock(T block) where T: new() - { - if (block == null) - return; - - lock (DataBlocks) - { - if (!DataBlocks.ContainsKey(typeof(T))) - DataBlocks[typeof(T)] = new Stack(); - - if (DataBlocks[typeof(T)].Count < 50) - DataBlocks[typeof(T)].Push(block); - } - } - } -} -- cgit v1.1 From 130768b16a35e307389e88d902f6e3a785dfb8ee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Oct 2012 03:52:42 +0100 Subject: Add "show object pos to " command to simulator console. This allows you to display details of all objects in a given bounding box. Values parts of the co-ord can be left out as appropriate (e.g. to get all objects between the ground and z=30. See "help show object pos" for more details. --- OpenSim/Framework/Util.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 1b9777f..5c7797a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -534,6 +534,19 @@ namespace OpenSim.Framework } /// + /// Determines whether a point is inside a bounding box. + /// + /// /param> + /// + /// + /// + public static bool IsInsideBox(Vector3 v, Vector3 min, Vector3 max) + { + return v.X >= min.X & v.Y >= min.Y && v.Z >= min.Z + && v.X <= max.X && v.Y <= max.Y && v.Z <= max.Z; + } + + /// /// Are the co-ordinates of the new region visible from the old region? /// /// Old region x-coord -- cgit v1.1 From 633e1ed62cadbdc06592e19bbb1cfaa6fbae72b2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Oct 2012 03:57:35 +0100 Subject: Add missing ConsoleUtil from last commit --- OpenSim/Framework/Console/ConsoleUtil.cs | 111 +++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 OpenSim/Framework/Console/ConsoleUtil.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs new file mode 100644 index 0000000..a254be0 --- /dev/null +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -0,0 +1,111 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using log4net; +using OpenMetaverse; + +public class ConsoleUtil +{ + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public const string MinRawConsoleVectorValue = "-~"; + public const string MaxRawConsoleVectorValue = "~"; + + public const string VectorSeparator = ","; + public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray(); + + /// + /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 + /// + /// /param> + /// + /// + public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector) + { + return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector); + } + + /// + /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3 + /// + /// /param> + /// + /// + public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector) + { + return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector); + } + + /// + /// Convert a vector input from the console to an OpenMetaverse.Vector3 + /// + /// + /// A string in the form ,, where there is no space between values. + /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value + /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40) + /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue + /// Other than that, component values must be numeric. + /// + /// + /// + /// + public static bool TryParseConsoleVector( + string rawConsoleVector, Func blankComponentFunc, out Vector3 vector) + { + List components = rawConsoleVector.Split(VectorSeparatorChars).ToList(); + + if (components.Count < 1 || components.Count > 3) + return false; + + for (int i = components.Count; i < 3; i++) + components.Add(""); + + List semiDigestedComponents + = components.ConvertAll( + c => + { + if (c == "") + return blankComponentFunc.Invoke(c); + else if (c == MaxRawConsoleVectorValue) + return float.MaxValue.ToString(); + else if (c == MinRawConsoleVectorValue) + return float.MinValue.ToString(); + else + return c; + }); + + string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray()); + + m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); + + return Vector3.TryParse(semiDigestedConsoleVector, out vector); + } +} \ No newline at end of file -- cgit v1.1 From 68859af3f8c610e562351a328a78a987ab7f229d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Oct 2012 03:58:52 +0100 Subject: Add Vector3.Zero return on TryParseConsoleVector() which fails on mono 2.4.3 but not mono 2.10.9 --- OpenSim/Framework/Console/ConsoleUtil.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs index a254be0..2612a50 100644 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -83,7 +83,10 @@ public class ConsoleUtil List components = rawConsoleVector.Split(VectorSeparatorChars).ToList(); if (components.Count < 1 || components.Count > 3) + { + vector = Vector3.Zero; return false; + } for (int i = components.Count; i < 3; i++) components.Add(""); -- cgit v1.1 From 16c9c1dff7bbf299efddd44e4f9aeeb7db38fff6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Oct 2012 02:34:49 +0100 Subject: On receiving TaskInventoryAccepted with a destination folder in the binary bucket slot for RLV, notify the viewer about inventory folder updates. The viewer would not see the folder move without this, either on accept or decline. This commit also updates the TaskInventoryOffered message to better conform with the data LL uses Changes are, agentID is prim owner rather than prim id, agent name is now simply object name rather than name with owner detail, message is just folder name in single quotes, message is not timestamped. However, folder is not renamed "still #RLV/~". Long term solution is probably not to do these operations server-side. Notes will be added to http://opensimulator.org/mantis/view.php?id=6311 --- OpenSim/Framework/GridInstantMessage.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs index a6bf6e3..6ae0488 100644 --- a/OpenSim/Framework/GridInstantMessage.cs +++ b/OpenSim/Framework/GridInstantMessage.cs @@ -44,7 +44,6 @@ namespace OpenSim.Framework public Vector3 Position; public byte[] binaryBucket; - public uint ParentEstateID; public Guid RegionID; public uint timestamp; @@ -58,7 +57,7 @@ namespace OpenSim.Framework string _fromAgentName, UUID _toAgentID, byte _dialog, bool _fromGroup, string _message, UUID _imSessionID, bool _offline, Vector3 _position, - byte[] _binaryBucket) + byte[] _binaryBucket, bool addTimestamp) { fromAgentID = _fromAgentID.Guid; fromAgentName = _fromAgentName; @@ -79,7 +78,9 @@ namespace OpenSim.Framework ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID; RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid; } - timestamp = (uint)Util.UnixTimeSinceEpoch(); + + if (addTimestamp) + timestamp = (uint)Util.UnixTimeSinceEpoch(); } public GridInstantMessage(IScene scene, UUID _fromAgentID, @@ -87,7 +88,7 @@ namespace OpenSim.Framework string _message, bool _offline, Vector3 _position) : this(scene, _fromAgentID, _fromAgentName, _toAgentID, _dialog, false, _message, - _fromAgentID ^ _toAgentID, _offline, _position, new byte[0]) + _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true) { } } -- cgit v1.1 From a0d047413b2e8bac626f13ff224e4794955fa244 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Oct 2012 01:37:02 +0100 Subject: Once again, forgot to add a file. --- OpenSim/Framework/RegionFlags.cs | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 OpenSim/Framework/RegionFlags.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionFlags.cs b/OpenSim/Framework/RegionFlags.cs new file mode 100644 index 0000000..c0630c8 --- /dev/null +++ b/OpenSim/Framework/RegionFlags.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; + +namespace OpenSim.Framework +{ + /// + /// Region flags used internally by OpenSimulator to store installation specific information about regions. + /// + /// + /// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire). + /// + [Flags] + public enum RegionFlags : int + { + DefaultRegion = 1, // Used for new Rez. Random if multiple defined + FallbackRegion = 2, // Regions we redirect to when the destination is down + RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false + NoDirectLogin = 8, // Region unavailable for direct logins (by name) + Persistent = 16, // Don't remove on unregister + LockedOut = 32, // Don't allow registration + NoMove = 64, // Don't allow moving this region + Reservation = 128, // This is an inactive reservation + Authenticate = 256, // Require authentication + Hyperlink = 512 // Record represents a HG link + } +} \ No newline at end of file -- cgit v1.1 From ef3cc2e507a545bfcffc804015ee3ec5b8a260e0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Oct 2012 01:40:40 +0100 Subject: minor: Add documentation to IGridService.GetRegionFlags() --- OpenSim/Framework/RegionFlags.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionFlags.cs b/OpenSim/Framework/RegionFlags.cs index c0630c8..a3089b0 100644 --- a/OpenSim/Framework/RegionFlags.cs +++ b/OpenSim/Framework/RegionFlags.cs @@ -34,6 +34,7 @@ namespace OpenSim.Framework /// /// /// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire). + /// Returned by IGridService.GetRegionFlags() /// [Flags] public enum RegionFlags : int -- cgit v1.1 From efd9791506b00e424bb5f1846b37d79e7638bda2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Oct 2012 23:30:48 +0100 Subject: Add "delete object pos to " console command. This allows one to delete objects within a certain volume. See help on console for more details. --- OpenSim/Framework/Console/ConsoleUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs index 2612a50..a7cf0c0 100644 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -34,7 +34,7 @@ using OpenMetaverse; public class ConsoleUtil { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public const string MinRawConsoleVectorValue = "-~"; public const string MaxRawConsoleVectorValue = "~"; @@ -107,7 +107,7 @@ public class ConsoleUtil string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray()); - m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); +// m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); return Vector3.TryParse(semiDigestedConsoleVector, out vector); } -- cgit v1.1 From 1f2472d0fcd86a7ae09c01ecb3508eab001ce033 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Oct 2012 23:28:53 +0100 Subject: Extend "show stats" command to "show stats [list|all|]" This allows different categories of stats to be shown, with options to list categories or show all stats. Currently categories are scene and simulator and only a very few stats are currently registered via this mechanism. This commit also adds percentage stats for packets and blocks reused from the packet pool. --- .../Framework/Monitoring/SimExtraStatsCollector.cs | 16 +- OpenSim/Framework/Monitoring/StatsManager.cs | 193 +++++++++++++++++++-- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 32 +--- 3 files changed, 189 insertions(+), 52 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index 8ac9090..aa86202 100644 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs @@ -359,13 +359,19 @@ Asset service request failures: {3}" + Environment.NewLine, inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); - foreach (KeyValuePair kvp in StatsManager.RegisteredStats) - { - Stat stat = kvp.Value; + Dictionary> sceneStats; - if (stat.Category == "scene" && stat.Verbosity == StatVerbosity.Info) + if (StatsManager.TryGetStats("scene", out sceneStats)) + { + foreach (KeyValuePair> kvp in sceneStats) { - sb.AppendFormat("Slow frames ({0}): {1}\n", stat.Container, stat.Value); + foreach (Stat stat in kvp.Value.Values) + { + if (stat.Verbosity == StatVerbosity.Info) + { + sb.AppendFormat("{0} ({1}): {2}{3}\n", stat.Name, stat.Container, stat.Value, stat.UnitName); + } + } } } diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index b5dc24f..a67c5f8 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using OpenSim.Framework.Console; namespace OpenSim.Framework.Monitoring { @@ -35,13 +36,23 @@ namespace OpenSim.Framework.Monitoring /// public class StatsManager { + // Subcommand used to list other stats. + public const string AllSubCommand = "all"; + + // Subcommand used to list other stats. + public const string ListSubCommand = "list"; + + // All subcommands + public static HashSet SubCommands = new HashSet { AllSubCommand, ListSubCommand }; + /// - /// Registered stats. + /// Registered stats categorized by category/container/shortname /// /// - /// Do not add or remove from this dictionary. + /// Do not add or remove directly from this dictionary. /// - public static Dictionary RegisteredStats = new Dictionary(); + public static Dictionary>> RegisteredStats + = new Dictionary>>(); private static AssetStatsCollector assetStats; private static UserStatsCollector userStats; @@ -51,6 +62,76 @@ namespace OpenSim.Framework.Monitoring public static UserStatsCollector UserStats { get { return userStats; } } public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } + public static void RegisterConsoleCommands(CommandConsole console) + { + console.Commands.AddCommand( + "General", + false, + "show stats", + "show stats [list|all|]", + "Show statistical information for this server", + "If no final argument is specified then legacy statistics information is currently shown.\n" + + "If list is specified then statistic categories are shown.\n" + + "If all is specified then all registered statistics are shown.\n" + + "If a category name is specified then only statistics from that category are shown.\n" + + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS", + HandleShowStatsCommand); + } + + public static void HandleShowStatsCommand(string module, string[] cmd) + { + ICommandConsole con = MainConsole.Instance; + + if (cmd.Length > 2) + { + var categoryName = cmd[2]; + + if (categoryName == AllSubCommand) + { + foreach (var category in RegisteredStats.Values) + { + OutputCategoryStatsToConsole(con, category); + } + } + else if (categoryName == ListSubCommand) + { + con.Output("Statistic categories available are:"); + foreach (string category in RegisteredStats.Keys) + con.OutputFormat(" {0}", category); + } + else + { + Dictionary> category; + if (!RegisteredStats.TryGetValue(categoryName, out category)) + { + con.OutputFormat("No such category as {0}", categoryName); + } + else + { + OutputCategoryStatsToConsole(con, category); + } + } + } + else + { + // Legacy + con.Output(SimExtraStats.Report()); + } + } + + private static void OutputCategoryStatsToConsole( + ICommandConsole con, Dictionary> category) + { + foreach (var container in category.Values) + { + foreach (Stat stat in container.Values) + { + con.OutputFormat( + "{0}.{1}.{2} : {3}{4}", stat.Category, stat.Container, stat.ShortName, stat.Value, stat.UnitName); + } + } + } + /// /// Start collecting statistics related to assets. /// Should only be called once. @@ -73,43 +154,100 @@ namespace OpenSim.Framework.Monitoring return userStats; } + /// + /// Registers a statistic. + /// + /// + /// public static bool RegisterStat(Stat stat) { + Dictionary> category = null, newCategory; + Dictionary container = null, newContainer; + lock (RegisteredStats) { - if (RegisteredStats.ContainsKey(stat.UniqueName)) - { - // XXX: For now just return false. This is to avoid problems in regression tests where all tests - // in a class are run in the same instance of the VM. + // Stat name is not unique across category/container/shortname key. + // XXX: For now just return false. This is to avoid problems in regression tests where all tests + // in a class are run in the same instance of the VM. + if (TryGetStat(stat, out category, out container)) return false; -// throw new Exception( -// "StatsManager already contains stat with ShortName {0} in Category {1}", stat.ShortName, stat.Category); - } + // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. + // This means that we don't need to lock or copy them on iteration, which will be a much more + // common operation after startup. + if (container != null) + newContainer = new Dictionary(container); + else + newContainer = new Dictionary(); + + if (category != null) + newCategory = new Dictionary>(category); + else + newCategory = new Dictionary>(); - // We take a replace-on-write approach here so that we don't need to generate a new Dictionary - Dictionary newRegisteredStats = new Dictionary(RegisteredStats); - newRegisteredStats[stat.UniqueName] = stat; - RegisteredStats = newRegisteredStats; + newContainer[stat.ShortName] = stat; + newCategory[stat.Container] = newContainer; + RegisteredStats[stat.Category] = newCategory; } return true; } + /// + /// Deregister a statistic + /// > + /// + /// > category = null, newCategory; + Dictionary container = null, newContainer; + lock (RegisteredStats) { - if (!RegisteredStats.ContainsKey(stat.UniqueName)) + if (!TryGetStat(stat, out category, out container)) return false; - Dictionary newRegisteredStats = new Dictionary(RegisteredStats); - newRegisteredStats.Remove(stat.UniqueName); - RegisteredStats = newRegisteredStats; + newContainer = new Dictionary(container); + newContainer.Remove(stat.UniqueName); + + newCategory = new Dictionary>(category); + newCategory.Remove(stat.Container); + + newCategory[stat.Container] = newContainer; + RegisteredStats[stat.Category] = newCategory; return true; } } + + public static bool TryGetStats(string category, out Dictionary> stats) + { + return RegisteredStats.TryGetValue(category, out stats); + } + + public static bool TryGetStat( + Stat stat, + out Dictionary> category, + out Dictionary container) + { + category = null; + container = null; + + lock (RegisteredStats) + { + if (RegisteredStats.TryGetValue(stat.Category, out category)) + { + if (category.TryGetValue(stat.Container, out container)) + { + if (container.ContainsKey(stat.ShortName)) + return true; + } + } + } + + return false; + } } /// @@ -157,9 +295,26 @@ namespace OpenSim.Framework.Monitoring public virtual double Value { get; set; } + /// + /// Constructor + /// + /// Short name for the stat. Must not contain spaces. e.g. "LongFrames" + /// Human readable name for the stat. e.g. "Long frames" + /// + /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value. + /// e.g. " frames" + /// + /// Category under which this stat should appear, e.g. "scene". Do not capitalize. + /// Entity to which this stat relates. e.g. scene name if this is a per scene stat. + /// Verbosity of stat. Controls whether it will appear in short stat display or only full display. + /// Description of stat public Stat( string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description) { + if (StatsManager.SubCommands.Contains(category)) + throw new Exception( + string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category)); + ShortName = shortName; Name = name; UnitName = unitName; @@ -203,7 +358,7 @@ namespace OpenSim.Framework.Monitoring public PercentageStat( string shortName, string name, string category, string container, StatVerbosity verbosity, string description) - : base(shortName, name, " %", category, container, verbosity, description) + : base(shortName, name, "%", category, container, verbosity, description) { } } diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 7a5c16d..aac9c45 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -96,11 +96,6 @@ namespace OpenSim.Framework.Servers get { return m_httpServer; } } - /// - /// Holds the non-viewer statistics collection object for this service/server - /// - protected IStatsCollector m_stats; - public BaseOpenSimServer() { m_startuptime = DateTime.Now; @@ -177,10 +172,6 @@ namespace OpenSim.Framework.Servers "show info", "Show general information about the server", HandleShow); - m_console.Commands.AddCommand("General", false, "show stats", - "show stats", - "Show statistics", HandleShow); - m_console.Commands.AddCommand("General", false, "show threads", "show threads", "Show thread status", HandleShow); @@ -226,12 +217,7 @@ namespace OpenSim.Framework.Servers { StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); sb.Append(GetUptimeReport()); - - if (m_stats != null) - { - sb.Append(m_stats.Report()); - } - + sb.Append(StatsManager.SimExtraStats.Report()); sb.Append(Environment.NewLine); sb.Append(GetThreadsReport()); @@ -382,10 +368,6 @@ namespace OpenSim.Framework.Servers { Notice("set log level [level] - change the console logging level only. For example, off or debug."); Notice("show info - show server information (e.g. startup path)."); - - if (m_stats != null) - Notice("show stats - show statistical information for this server"); - Notice("show threads - list tracked threads"); Notice("show uptime - show server startup time and uptime."); Notice("show version - show server version."); @@ -409,11 +391,6 @@ namespace OpenSim.Framework.Servers ShowInfo(); break; - case "stats": - if (m_stats != null) - Notice(m_stats.Report()); - break; - case "threads": Notice(GetThreadsReport()); break; @@ -604,8 +581,7 @@ namespace OpenSim.Framework.Servers public string osSecret { // Secret uuid for the simulator - get { return m_osSecret; } - + get { return m_osSecret; } } public string StatReport(IOSHttpRequest httpRequest) @@ -613,11 +589,11 @@ namespace OpenSim.Framework.Servers // If we catch a request for "callback", wrap the response in the value for jsonp if (httpRequest.Query.ContainsKey("callback")) { - return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; + return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; } else { - return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); + return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); } } -- cgit v1.1 From 2e9ef015f7b73a3942011a36a9f94ce59d848dc0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Oct 2012 23:58:37 +0100 Subject: Fix packetpool for ImprovedTerseObjectUpdate packets. These were neither being returned or in many places reused. Getting packets from a pool rather than deallocating and reallocating reduces memory churn which in turn reduces garbage collection time and frequency. --- OpenSim/Framework/Monitoring/StatsManager.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index a67c5f8..d365190 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -126,8 +126,7 @@ namespace OpenSim.Framework.Monitoring { foreach (Stat stat in container.Values) { - con.OutputFormat( - "{0}.{1}.{2} : {3}{4}", stat.Category, stat.Container, stat.ShortName, stat.Value, stat.UnitName); + con.Output(stat.ToConsoleString()); } } } @@ -330,6 +329,12 @@ namespace OpenSim.Framework.Monitoring { return string.Format("{0}+{1}+{2}", container, category, shortName); } + + public virtual string ToConsoleString() + { + return string.Format( + "{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName); + } } public class PercentageStat : Stat @@ -358,8 +363,13 @@ namespace OpenSim.Framework.Monitoring public PercentageStat( string shortName, string name, string category, string container, StatVerbosity verbosity, string description) - : base(shortName, name, "%", category, container, verbosity, description) + : base(shortName, name, "%", category, container, verbosity, description) {} + + public override string ToConsoleString() { + return string.Format( + "{0}.{1}.{2} : {3:0.###}{4} ({5}/{6})", + Category, Container, ShortName, Value, UnitName, Antecedent, Consequent); } } } \ No newline at end of file -- cgit v1.1 From 387ce8ef35e7084895524507d6bba987b8c4a5d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Oct 2012 00:10:51 +0100 Subject: Fix build break by moving OpenSim.Framework.Console back below HttpServer in the build order. Luckily, it turns out Framework.Monitoring doesn't need to reference Console directly. --- OpenSim/Framework/Monitoring/StatsManager.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index d365190..d7aff03 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using OpenSim.Framework.Console; namespace OpenSim.Framework.Monitoring { @@ -62,7 +61,7 @@ namespace OpenSim.Framework.Monitoring public static UserStatsCollector UserStats { get { return userStats; } } public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } - public static void RegisterConsoleCommands(CommandConsole console) + public static void RegisterConsoleCommands(ICommandConsole console) { console.Commands.AddCommand( "General", -- cgit v1.1 From 59a17ad676326d5affc2e221ef9c02166a85c6fd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Oct 2012 00:26:15 +0100 Subject: Fix percentage stats to multiply by 100. Adjust container name for packetpool stats. --- OpenSim/Framework/Monitoring/StatsManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index d7aff03..31989e5 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -351,7 +351,7 @@ namespace OpenSim.Framework.Monitoring if (c == 0) return 0; - return (double)Antecedent / c; + return (double)Antecedent / c * 100; } set @@ -367,7 +367,7 @@ namespace OpenSim.Framework.Monitoring public override string ToConsoleString() { return string.Format( - "{0}.{1}.{2} : {3:0.###}{4} ({5}/{6})", + "{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})", Category, Container, ShortName, Value, UnitName, Antecedent, Consequent); } } -- cgit v1.1 From ab7b7c5d3df03decbcaa3b8bf7683f1268f2be92 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Oct 2012 02:59:28 +0100 Subject: Get Watchdog to log thread removal --- OpenSim/Framework/Monitoring/Watchdog.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 7964f28..a20326d 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -231,7 +231,25 @@ namespace OpenSim.Framework.Monitoring private static bool RemoveThread(int threadID) { lock (m_threads) - return m_threads.Remove(threadID); + { + ThreadWatchdogInfo twi; + if (m_threads.TryGetValue(threadID, out twi)) + { + m_log.DebugFormat( + "[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); + + m_threads.Remove(threadID); + + return true; + } + else + { + m_log.WarnFormat( + "[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID); + + return false; + } + } } public static bool AbortThread(int threadID) -- cgit v1.1 From 950192539761a6fff2c27734e3090cd8aee2df1b Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 12 Oct 2012 19:23:35 +0100 Subject: Fix a merge issue --- OpenSim/Framework/EstateSettings.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 9020761..e03750b 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -419,11 +419,11 @@ namespace OpenSim.Framework public void SetFromFlags(ulong regionFlags) { - ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport); - BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell); - AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark); - AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges); - AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome); + ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport); + BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell); + AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark); + AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges); + AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome); } public bool GroupAccess(UUID groupID) -- cgit v1.1 From fc861c7904840b2b0b9de0621e9b5d976c8071b1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Oct 2012 23:35:05 +0100 Subject: Add optional pool for the UDPPacketBuffer objects that handle all incoming UDP data. Even when an avatar is standing still, it's sending in a constant stream of AgentUpdate packets that the client creates new UDPPacketBuffer objects to handle. This option pools those objects. This reduces memory churn. Currently off by default. Works but the scope can be expanded. --- OpenSim/Framework/Pool.cs | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 OpenSim/Framework/Pool.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs new file mode 100644 index 0000000..1ca06c3 --- /dev/null +++ b/OpenSim/Framework/Pool.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; + +namespace OpenSim.Framework +{ + /// + /// Naive pool implementation. + /// + /// + /// Currently assumes that objects are in a useable state when returned. + /// + public class Pool + { + private Stack m_pool; + + private int m_maxPoolSize; + + private Func m_createFunction; + + public Pool(Func createFunction, int maxSize) + { + m_maxPoolSize = maxSize; + m_createFunction = createFunction; + m_pool = new Stack(m_maxPoolSize); + } + + public T GetObject() + { + lock (m_pool) + { + if (m_pool.Count > 0) + return m_pool.Pop(); + else + return m_createFunction(); + } + } + + public void ReturnObject(T obj) + { + lock (m_pool) + { + if (m_pool.Count >= m_maxPoolSize) + return; + else + m_pool.Push(obj); + } + } + } +} \ No newline at end of file -- cgit v1.1 From 4e5b2346a5700b14687a33175ba54a93960a9d33 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Oct 2012 23:44:52 +0100 Subject: Add LastMemoryChurn stat using existing data so we can more quickly tell how memory churn changes rather than waiting for the average to move. --- OpenSim/Framework/Monitoring/BaseStatsCollector.cs | 6 +++++- OpenSim/Framework/Monitoring/MemoryWatchdog.cs | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs index 57a63ef..2903b6e 100644 --- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs @@ -49,7 +49,11 @@ namespace OpenSim.Framework.Monitoring Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); sb.AppendFormat( - "OpenSim object memory churn : {0} MB/s\n", + "OpenSim last object memory churn : {0} MB/s\n", + Math.Round((MemoryWatchdog.LastMemoryChurn * 1000) / 1024.0 / 1024, 3)); + + sb.AppendFormat( + "OpenSim average object memory churn : {0} MB/s\n", Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3)); sb.AppendFormat( diff --git a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs index a23cf1f..c6010cd 100644 --- a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs +++ b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs @@ -60,7 +60,7 @@ namespace OpenSim.Framework.Monitoring private static bool m_enabled; /// - /// Average memory churn in bytes per millisecond. + /// Last memory churn in bytes per millisecond. /// public static double AverageMemoryChurn { @@ -68,6 +68,14 @@ namespace OpenSim.Framework.Monitoring } /// + /// Average memory churn in bytes per millisecond. + /// + public static double LastMemoryChurn + { + get { if (m_samples.Count > 0) return m_samples.Last(); else return 0; } + } + + /// /// Maximum number of statistical samples. /// /// -- cgit v1.1 From 1de80cdafebe6a604d03df60e3bb7920a9bee852 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Oct 2012 00:04:23 +0100 Subject: minor: move recent OnAgentUpdate/OnPreAgentUpdate event doc up into IClientAPI from LLClientView --- OpenSim/Framework/IClientAPI.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8a63bff..9856978 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -805,8 +805,23 @@ namespace OpenSim.Framework event Action OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; event Action OnCompleteMovementToRegion; + + /// + /// Called when an AgentUpdate message is received and before OnAgentUpdate. + /// + /// + /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates. + /// event UpdateAgent OnPreAgentUpdate; + + /// + /// Called when an AgentUpdate message is received and after OnPreAgentUpdate. + /// + /// + /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates. + /// event UpdateAgent OnAgentUpdate; + event AgentRequestSit OnAgentRequestSit; event AgentSit OnAgentSit; event AvatarPickerRequest OnAvatarPickerRequest; -- cgit v1.1 From 991151250d070cb3e16d609b0f13e9de751687f1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Oct 2012 00:39:43 +0100 Subject: If we're avoiding printing a long request warning for a GetTexture CAP call, check we received a request handler first since this is not guaranteed. Resolves harmless logged exception when content type and generic xml rpc requests take more than 3 seconds. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d5bc3c3..b018e57 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -648,7 +648,7 @@ namespace OpenSim.Framework.Servers.HttpServer // Every month or so this will wrap and give bad numbers, not really a problem // since its just for reporting int tickdiff = requestEndTick - requestStartTick; - if (tickdiff > 3000 && requestHandler.Name != "GetTexture") + if (tickdiff > 3000 && requestHandler != null && requestHandler.Name != "GetTexture") { m_log.InfoFormat( "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", -- cgit v1.1 From d7fa4cacb3227cb432a13d4f27076e408e8c114f Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Fri, 19 Oct 2012 21:02:54 +0200 Subject: Fix: invinite loading for Viewer3 : parcelinfo request of traffic-value (implementation of dwell-value in LandData + eventhandler, return always 0); source-formatting of LandData Signed-off-by: BlueWall --- OpenSim/Framework/LandData.cs | 385 ++++++++++++++++++++++++++++-------------- 1 file changed, 260 insertions(+), 125 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index bf2ecf2..fc02f33 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -49,8 +49,8 @@ namespace OpenSim.Framework // use only one serializer to give the runtime a chance to // optimize it (it won't do that if you use a new instance // every time) - private static XmlSerializer serializer = new XmlSerializer(typeof (LandData)); - + private static XmlSerializer serializer = new XmlSerializer(typeof(LandData)); + private Vector3 _AABBMax = new Vector3(); private Vector3 _AABBMin = new Vector3(); private int _area = 0; @@ -65,11 +65,11 @@ namespace OpenSim.Framework private byte[] _bitmap = new byte[512]; private string _description = String.Empty; - private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | - (uint) ParcelFlags.AllowAPrimitiveEntry | - (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | - (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | - (uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat; + private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark | + (uint)ParcelFlags.AllowAPrimitiveEntry | + (uint)ParcelFlags.AllowDeedToGroup | (uint)ParcelFlags.AllowTerraform | + (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts | + (uint)ParcelFlags.SoundLocal | (uint)ParcelFlags.AllowVoiceChat; private byte _landingType = 0; private string _name = "Your Parcel"; @@ -97,16 +97,36 @@ namespace OpenSim.Framework private bool _mediaLoop = false; private bool _obscureMusic = false; private bool _obscureMedia = false; + private float _dwell = 0; + + /// + /// Traffic count of parcel + /// + [XmlIgnore] + public float Dwell + { + get + { + return _dwell; + } + set + { + _dwell = value; + } + } /// /// Whether to obscure parcel media URL /// [XmlIgnore] - public bool ObscureMedia { - get { + public bool ObscureMedia + { + get + { return _obscureMedia; } - set { + set + { _obscureMedia = value; } } @@ -115,11 +135,14 @@ namespace OpenSim.Framework /// Whether to obscure parcel music URL /// [XmlIgnore] - public bool ObscureMusic { - get { + public bool ObscureMusic + { + get + { return _obscureMusic; } - set { + set + { _obscureMusic = value; } } @@ -128,11 +151,14 @@ namespace OpenSim.Framework /// Whether to loop parcel media /// [XmlIgnore] - public bool MediaLoop { - get { + public bool MediaLoop + { + get + { return _mediaLoop; } - set { + set + { _mediaLoop = value; } } @@ -141,11 +167,14 @@ namespace OpenSim.Framework /// Height of parcel media render /// [XmlIgnore] - public int MediaHeight { - get { + public int MediaHeight + { + get + { return _mediaHeight; } - set { + set + { _mediaHeight = value; } } @@ -154,11 +183,14 @@ namespace OpenSim.Framework /// Width of parcel media render /// [XmlIgnore] - public int MediaWidth { - get { + public int MediaWidth + { + get + { return _mediaWidth; } - set { + set + { _mediaWidth = value; } } @@ -167,11 +199,14 @@ namespace OpenSim.Framework /// Upper corner of the AABB for the parcel /// [XmlIgnore] - public Vector3 AABBMax { - get { + public Vector3 AABBMax + { + get + { return _AABBMax; } - set { + set + { _AABBMax = value; } } @@ -179,11 +214,14 @@ namespace OpenSim.Framework /// Lower corner of the AABB for the parcel /// [XmlIgnore] - public Vector3 AABBMin { - get { + public Vector3 AABBMin + { + get + { return _AABBMin; } - set { + set + { _AABBMin = value; } } @@ -191,11 +229,14 @@ namespace OpenSim.Framework /// /// Area in meters^2 the parcel contains /// - public int Area { - get { + public int Area + { + get + { return _area; } - set { + set + { _area = value; } } @@ -203,11 +244,14 @@ namespace OpenSim.Framework /// /// ID of auction (3rd Party Integration) when parcel is being auctioned /// - public uint AuctionID { - get { + public uint AuctionID + { + get + { return _auctionID; } - set { + set + { _auctionID = value; } } @@ -215,11 +259,14 @@ namespace OpenSim.Framework /// /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it. /// - public UUID AuthBuyerID { - get { + public UUID AuthBuyerID + { + get + { return _authBuyerID; } - set { + set + { _authBuyerID = value; } } @@ -227,11 +274,14 @@ namespace OpenSim.Framework /// /// Category of parcel. Used for classifying the parcel in classified listings /// - public ParcelCategory Category { - get { + public ParcelCategory Category + { + get + { return _category; } - set { + set + { _category = value; } } @@ -239,11 +289,14 @@ namespace OpenSim.Framework /// /// Date that the current owner purchased or claimed the parcel /// - public int ClaimDate { - get { + public int ClaimDate + { + get + { return _claimDate; } - set { + set + { _claimDate = value; } } @@ -251,11 +304,14 @@ namespace OpenSim.Framework /// /// The last price that the parcel was sold at /// - public int ClaimPrice { - get { + public int ClaimPrice + { + get + { return _claimPrice; } - set { + set + { _claimPrice = value; } } @@ -263,11 +319,14 @@ namespace OpenSim.Framework /// /// Global ID for the parcel. (3rd Party Integration) /// - public UUID GlobalID { - get { + public UUID GlobalID + { + get + { return _globalID; } - set { + set + { _globalID = value; } } @@ -275,11 +334,14 @@ namespace OpenSim.Framework /// /// Unique ID of the Group that owns /// - public UUID GroupID { - get { + public UUID GroupID + { + get + { return _groupID; } - set { + set + { _groupID = value; } } @@ -287,11 +349,14 @@ namespace OpenSim.Framework /// /// Returns true if the Land Parcel is owned by a group /// - public bool IsGroupOwned { - get { + public bool IsGroupOwned + { + get + { return _isGroupOwned; } - set { + set + { _isGroupOwned = value; } } @@ -299,11 +364,14 @@ namespace OpenSim.Framework /// /// jp2 data for the image representative of the parcel in the parcel dialog /// - public byte[] Bitmap { - get { + public byte[] Bitmap + { + get + { return _bitmap; } - set { + set + { _bitmap = value; } } @@ -311,11 +379,14 @@ namespace OpenSim.Framework /// /// Parcel Description /// - public string Description { - get { + public string Description + { + get + { return _description; } - set { + set + { _description = value; } } @@ -323,11 +394,14 @@ namespace OpenSim.Framework /// /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags /// - public uint Flags { - get { + public uint Flags + { + get + { return _flags; } - set { + set + { _flags = value; } } @@ -336,11 +410,14 @@ namespace OpenSim.Framework /// Determines if people are able to teleport where they please on the parcel or if they /// get constrainted to a specific point on teleport within the parcel /// - public byte LandingType { - get { + public byte LandingType + { + get + { return _landingType; } - set { + set + { _landingType = value; } } @@ -348,11 +425,14 @@ namespace OpenSim.Framework /// /// Parcel Name /// - public string Name { - get { + public string Name + { + get + { return _name; } - set { + set + { _name = value; } } @@ -360,11 +440,14 @@ namespace OpenSim.Framework /// /// Status of Parcel, Leased, Abandoned, For Sale /// - public ParcelStatus Status { - get { + public ParcelStatus Status + { + get + { return _status; } - set { + set + { _status = value; } } @@ -372,11 +455,14 @@ namespace OpenSim.Framework /// /// Internal ID of the parcel. Sometimes the client will try to use this value /// - public int LocalID { - get { + public int LocalID + { + get + { return _localID; } - set { + set + { _localID = value; } } @@ -384,11 +470,14 @@ namespace OpenSim.Framework /// /// Determines if we scale the media based on the surface it's on /// - public byte MediaAutoScale { - get { + public byte MediaAutoScale + { + get + { return _mediaAutoScale; } - set { + set + { _mediaAutoScale = value; } } @@ -396,11 +485,14 @@ namespace OpenSim.Framework /// /// Texture Guid to replace with the output of the media stream /// - public UUID MediaID { - get { + public UUID MediaID + { + get + { return _mediaID; } - set { + set + { _mediaID = value; } } @@ -408,11 +500,14 @@ namespace OpenSim.Framework /// /// URL to the media file to display /// - public string MediaURL { - get { + public string MediaURL + { + get + { return _mediaURL; } - set { + set + { _mediaURL = value; } } @@ -432,11 +527,14 @@ namespace OpenSim.Framework /// /// URL to the shoutcast music stream to play on the parcel /// - public string MusicURL { - get { + public string MusicURL + { + get + { return _musicURL; } - set { + set + { _musicURL = value; } } @@ -445,11 +543,14 @@ namespace OpenSim.Framework /// Owner Avatar or Group of the parcel. Naturally, all land masses must be /// owned by someone /// - public UUID OwnerID { - get { + public UUID OwnerID + { + get + { return _ownerID; } - set { + set + { _ownerID = value; } } @@ -457,11 +558,14 @@ namespace OpenSim.Framework /// /// List of access data for the parcel. User data, some bitflags, and a time /// - public List ParcelAccessList { - get { + public List ParcelAccessList + { + get + { return _parcelAccessList; } - set { + set + { _parcelAccessList = value; } } @@ -469,11 +573,14 @@ namespace OpenSim.Framework /// /// How long in hours a Pass to the parcel is given /// - public float PassHours { - get { + public float PassHours + { + get + { return _passHours; } - set { + set + { _passHours = value; } } @@ -481,11 +588,14 @@ namespace OpenSim.Framework /// /// Price to purchase a Pass to a restricted parcel /// - public int PassPrice { - get { + public int PassPrice + { + get + { return _passPrice; } - set { + set + { _passPrice = value; } } @@ -493,11 +603,14 @@ namespace OpenSim.Framework /// /// When the parcel is being sold, this is the price to purchase the parcel /// - public int SalePrice { - get { + public int SalePrice + { + get + { return _salePrice; } - set { + set + { _salePrice = value; } } @@ -506,11 +619,14 @@ namespace OpenSim.Framework /// Number of meters^2 in the Simulator /// [XmlIgnore] - public int SimwideArea { - get { + public int SimwideArea + { + get + { return _simwideArea; } - set { + set + { _simwideArea = value; } } @@ -519,11 +635,14 @@ namespace OpenSim.Framework /// Number of SceneObjectPart in the Simulator /// [XmlIgnore] - public int SimwidePrims { - get { + public int SimwidePrims + { + get + { return _simwidePrims; } - set { + set + { _simwidePrims = value; } } @@ -531,11 +650,14 @@ namespace OpenSim.Framework /// /// ID of the snapshot used in the client parcel dialog of the parcel /// - public UUID SnapshotID { - get { + public UUID SnapshotID + { + get + { return _snapshotID; } - set { + set + { _snapshotID = value; } } @@ -544,11 +666,14 @@ namespace OpenSim.Framework /// When teleporting is restricted to a certain point, this is the location /// that the user will be redirected to /// - public Vector3 UserLocation { - get { + public Vector3 UserLocation + { + get + { return _userLocation; } - set { + set + { _userLocation = value; } } @@ -557,11 +682,14 @@ namespace OpenSim.Framework /// When teleporting is restricted to a certain point, this is the rotation /// that the user will be positioned /// - public Vector3 UserLookAt { - get { + public Vector3 UserLookAt + { + get + { return _userLookAt; } - set { + set + { _userLookAt = value; } } @@ -570,11 +698,14 @@ namespace OpenSim.Framework /// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// the parcel and isn't set to the same 'group' as the parcel. /// - public int OtherCleanTime { - get { + public int OtherCleanTime + { + get + { return _otherCleanTime; } - set { + set + { _otherCleanTime = value; } } @@ -582,11 +713,14 @@ namespace OpenSim.Framework /// /// parcel media description /// - public string MediaDescription { - get { + public string MediaDescription + { + get + { return _mediaDescription; } - set { + set + { _mediaDescription = value; } } @@ -622,7 +756,7 @@ namespace OpenSim.Framework landData._mediaURL = _mediaURL; landData._musicURL = _musicURL; landData._ownerID = _ownerID; - landData._bitmap = (byte[]) _bitmap.Clone(); + landData._bitmap = (byte[])_bitmap.Clone(); landData._description = _description; landData._flags = _flags; landData._name = _name; @@ -643,6 +777,7 @@ namespace OpenSim.Framework landData._obscureMedia = _obscureMedia; landData._simwideArea = _simwideArea; landData._simwidePrims = _simwidePrims; + landData._dwell = _dwell; landData._parcelAccessList.Clear(); foreach (LandAccessEntry entry in _parcelAccessList) -- cgit v1.1 From 542d0753769f939d914b5bd0a8fc5c2e03f9f2f8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 23 Oct 2012 00:39:59 +0100 Subject: minor: Use LogIncomingToContentTypeHandler() method for incoming HTTP data where this wasn't already used. This allows log level 5 (log sample or large part of incoming post data) to operate and removes copy/paste. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index b018e57..5d731f4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -542,11 +542,8 @@ namespace OpenSim.Framework.Servers.HttpServer { case null: case "text/html": - if (DebugLevel >= 3) - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", - RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); + LogIncomingToContentTypeHandler(request); buffer = HandleHTTPRequest(request, response); break; @@ -554,11 +551,8 @@ namespace OpenSim.Framework.Servers.HttpServer case "application/llsd+xml": case "application/xml+llsd": case "application/llsd+json": - if (DebugLevel >= 3) - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", - RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); + LogIncomingToContentTypeHandler(request); buffer = HandleLLSDRequests(request, response); break; -- cgit v1.1 From 2206132ab992469f200048aa25a724d48290b9f3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 23 Oct 2012 00:44:47 +0100 Subject: minor: Get content type handler logger to log "unset" for the content type instead of blank if no content type was set. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 5d731f4..410a76a 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -687,7 +687,7 @@ namespace OpenSim.Framework.Servers.HttpServer "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", RequestNumber, Port, - request.ContentType, + (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); -- cgit v1.1 From 4578ff74fec7500902f58fbdee6ce5a6b39601fb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 23 Oct 2012 01:50:05 +0100 Subject: Add object count stats for new IncomingPacket and UDPPacketBuffer pools if they are enabled. Add count stats for existing LLUDP pool. This introduces a pull stat type in addition to the push stat type. A pull stat takes a method on construction which knows how to update the stat on request. In this way, special interfaces for pull stat collection are not necessary. --- OpenSim/Framework/Monitoring/StatsManager.cs | 75 +++++++++++++++++++++++++--- OpenSim/Framework/Pool.cs | 15 ++++++ 2 files changed, 84 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 31989e5..116b2c0 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -249,6 +249,19 @@ namespace OpenSim.Framework.Monitoring } /// + /// Stat type. + /// + /// + /// A push stat is one which is continually updated and so it's value can simply by read. + /// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated. + /// + public enum StatType + { + Push, + Pull + } + + /// /// Verbosity of stat. /// /// @@ -285,29 +298,65 @@ namespace OpenSim.Framework.Monitoring /// public string Container { get; private set; } + public StatType StatType { get; private set; } + + /// + /// Action used to update this stat when the value is requested if it's a pull type. + /// + public Action PullAction { get; private set; } + public StatVerbosity Verbosity { get; private set; } public string ShortName { get; private set; } public string Name { get; private set; } public string Description { get; private set; } public virtual string UnitName { get; private set; } - public virtual double Value { get; set; } + public virtual double Value + { + get + { + // Asking for an update here means that the updater cannot access this value without infinite recursion. + // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being + // called by the pull action and just return the value. + if (StatType == StatType.Pull) + PullAction(this); + + return m_value; + } + + set + { + m_value = value; + } + } + + private double m_value; /// /// Constructor /// /// Short name for the stat. Must not contain spaces. e.g. "LongFrames" /// Human readable name for the stat. e.g. "Long frames" + /// Description of stat /// /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value. /// e.g. " frames" /// /// Category under which this stat should appear, e.g. "scene". Do not capitalize. /// Entity to which this stat relates. e.g. scene name if this is a per scene stat. + /// Push or pull + /// Pull stats need an action to update the stat on request. Push stats should set null here. /// Verbosity of stat. Controls whether it will appear in short stat display or only full display. - /// Description of stat public Stat( - string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description) + string shortName, + string name, + string description, + string unitName, + string category, + string container, + StatType type, + Action pullAction, + StatVerbosity verbosity) { if (StatsManager.SubCommands.Contains(category)) throw new Exception( @@ -315,11 +364,18 @@ namespace OpenSim.Framework.Monitoring ShortName = shortName; Name = name; + Description = description; UnitName = unitName; Category = category; Container = container; + StatType = type; + + if (StatType == StatType.Push && pullAction != null) + throw new Exception("A push stat cannot have a pull action"); + else + PullAction = pullAction; + Verbosity = verbosity; - Description = description; UniqueName = GenUniqueName(Container, Category, ShortName); } @@ -361,8 +417,15 @@ namespace OpenSim.Framework.Monitoring } public PercentageStat( - string shortName, string name, string category, string container, StatVerbosity verbosity, string description) - : base(shortName, name, "%", category, container, verbosity, description) {} + string shortName, + string name, + string description, + string category, + string container, + StatType type, + Action pullAction, + StatVerbosity verbosity) + : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {} public override string ToConsoleString() { diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs index 1ca06c3..5484f5c 100644 --- a/OpenSim/Framework/Pool.cs +++ b/OpenSim/Framework/Pool.cs @@ -38,8 +38,23 @@ namespace OpenSim.Framework /// public class Pool { + /// + /// Number of objects in the pool. + /// + public int Count + { + get + { + lock (m_pool) + return m_pool.Count; + } + } + private Stack m_pool; + /// + /// Maximum pool size. Beyond this, any returned objects are not pooled. + /// private int m_maxPoolSize; private Func m_createFunction; -- cgit v1.1 From 319ebaca06db3d4a38beff74725d321b7c836157 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 23 Oct 2012 02:44:15 +0100 Subject: Make it possible to turn the base UDP object packet pools on and off whilst running via the "debug lludp pool " console command. For debug purposes. This does not currently apply to the higher LLUDP packetpool. --- OpenSim/Framework/Monitoring/StatsManager.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 116b2c0..4844336 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -207,7 +207,7 @@ namespace OpenSim.Framework.Monitoring return false; newContainer = new Dictionary(container); - newContainer.Remove(stat.UniqueName); + newContainer.Remove(stat.ShortName); newCategory = new Dictionary>(category); newCategory.Remove(stat.Container); @@ -279,11 +279,6 @@ namespace OpenSim.Framework.Monitoring public class Stat { /// - /// Unique stat name used for indexing. Each ShortName in a Category must be unique. - /// - public string UniqueName { get; private set; } - - /// /// Category of this stat (e.g. cache, scene, etc). /// public string Category { get; private set; } @@ -376,13 +371,6 @@ namespace OpenSim.Framework.Monitoring PullAction = pullAction; Verbosity = verbosity; - - UniqueName = GenUniqueName(Container, Category, ShortName); - } - - public static string GenUniqueName(string container, string category, string shortName) - { - return string.Format("{0}+{1}+{2}", container, category, shortName); } public virtual string ToConsoleString() -- cgit v1.1 From 938fa96b9f5377ef330171232262b4d8aaca0918 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 24 Oct 2012 01:33:21 +0100 Subject: minor: Move co-ordinate related help to object commands to common ConsoleUtil.CoordHelp --- OpenSim/Framework/Console/ConsoleUtil.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs index a7cf0c0..027753d 100644 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -36,6 +36,23 @@ public class ConsoleUtil { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section + /// rather than in each help summary. + /// + public const string CoordHelp += @"Each component of the coord is comma separated. There must be no spaces between the commas. +If you don't care about the z component you can simply omit it. +If you don't care about the x or y components then you can leave them blank (though a comma is still required) +If you want to specify the maxmimum value of a component then you can use ~ instead of a number +If you want to specify the minimum value of a component then you can use -~ instead of a number +e.g. +delete object pos 20,20,20 to 40,40,40 +delete object pos 20,20 to 40,40 +delete object pos ,20,20 to ,40,40 +delete object pos ,,30 to ,,~ +delete object pos ,,-~ to ,,30"; + public const string MinRawConsoleVectorValue = "-~"; public const string MaxRawConsoleVectorValue = "~"; -- cgit v1.1 From 73db057fa1dbda7d6dff7de770cef8670b234f84 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 24 Oct 2012 02:05:28 +0100 Subject: Add "dump object uuid" console command. This allows any object in the scene to be serialized and dumped to XML for debug purposes. --- OpenSim/Framework/Console/ConsoleUtil.cs | 206 +++++++++++++++++-------------- 1 file changed, 115 insertions(+), 91 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs index 027753d..5c25ccb 100644 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -32,100 +32,124 @@ using System.Reflection; using log4net; using OpenMetaverse; -public class ConsoleUtil +namespace OpenSim.Framework.Console { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section - /// rather than in each help summary. - /// - public const string CoordHelp -= @"Each component of the coord is comma separated. There must be no spaces between the commas. -If you don't care about the z component you can simply omit it. -If you don't care about the x or y components then you can leave them blank (though a comma is still required) -If you want to specify the maxmimum value of a component then you can use ~ instead of a number -If you want to specify the minimum value of a component then you can use -~ instead of a number -e.g. -delete object pos 20,20,20 to 40,40,40 -delete object pos 20,20 to 40,40 -delete object pos ,20,20 to ,40,40 -delete object pos ,,30 to ,,~ -delete object pos ,,-~ to ,,30"; - - public const string MinRawConsoleVectorValue = "-~"; - public const string MaxRawConsoleVectorValue = "~"; - - public const string VectorSeparator = ","; - public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray(); - - /// - /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 - /// - /// /param> - /// - /// - public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector) + public class ConsoleUtil { - return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector); - } - - /// - /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3 - /// - /// /param> - /// - /// - public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector) - { - return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector); - } - - /// - /// Convert a vector input from the console to an OpenMetaverse.Vector3 - /// - /// - /// A string in the form ,, where there is no space between values. - /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value - /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40) - /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue - /// Other than that, component values must be numeric. - /// - /// - /// - /// - public static bool TryParseConsoleVector( - string rawConsoleVector, Func blankComponentFunc, out Vector3 vector) - { - List components = rawConsoleVector.Split(VectorSeparatorChars).ToList(); - - if (components.Count < 1 || components.Count > 3) + // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section + /// rather than in each help summary. + /// + public const string CoordHelp + = @"Each component of the coord is comma separated. There must be no spaces between the commas. + If you don't care about the z component you can simply omit it. + If you don't care about the x or y components then you can leave them blank (though a comma is still required) + If you want to specify the maxmimum value of a component then you can use ~ instead of a number + If you want to specify the minimum value of a component then you can use -~ instead of a number + e.g. + delete object pos 20,20,20 to 40,40,40 + delete object pos 20,20 to 40,40 + delete object pos ,20,20 to ,40,40 + delete object pos ,,30 to ,,~ + delete object pos ,,-~ to ,,30"; + + public const string MinRawConsoleVectorValue = "-~"; + public const string MaxRawConsoleVectorValue = "~"; + + public const string VectorSeparator = ","; + public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray(); + + /// + /// Try to parse a console UUID from the console. + /// + /// + /// Will complain to the console if parsing fails. + /// + /// + /// + /// + /// + public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid) { - vector = Vector3.Zero; - return false; + if (!UUID.TryParse(rawUuid, out uuid)) + { + console.OutputFormat("{0} is not a valid uuid", rawUuid); + return false; + } + + return true; + } + + /// + /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 + /// + /// /param> + /// + /// + public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector) + { + return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector); + } + + /// + /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3 + /// + /// /param> + /// + /// + public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector) + { + return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector); + } + + /// + /// Convert a vector input from the console to an OpenMetaverse.Vector3 + /// + /// + /// A string in the form ,, where there is no space between values. + /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value + /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40) + /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue + /// Other than that, component values must be numeric. + /// + /// + /// + /// + public static bool TryParseConsoleVector( + string rawConsoleVector, Func blankComponentFunc, out Vector3 vector) + { + List components = rawConsoleVector.Split(VectorSeparatorChars).ToList(); + + if (components.Count < 1 || components.Count > 3) + { + vector = Vector3.Zero; + return false; + } + + for (int i = components.Count; i < 3; i++) + components.Add(""); + + List semiDigestedComponents + = components.ConvertAll( + c => + { + if (c == "") + return blankComponentFunc.Invoke(c); + else if (c == MaxRawConsoleVectorValue) + return float.MaxValue.ToString(); + else if (c == MinRawConsoleVectorValue) + return float.MinValue.ToString(); + else + return c; + }); + + string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray()); + + // m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); + + return Vector3.TryParse(semiDigestedConsoleVector, out vector); } - - for (int i = components.Count; i < 3; i++) - components.Add(""); - - List semiDigestedComponents - = components.ConvertAll( - c => - { - if (c == "") - return blankComponentFunc.Invoke(c); - else if (c == MaxRawConsoleVectorValue) - return float.MaxValue.ToString(); - else if (c == MinRawConsoleVectorValue) - return float.MinValue.ToString(); - else - return c; - }); - - string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray()); - -// m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); - - return Vector3.TryParse(semiDigestedConsoleVector, out vector); } } \ No newline at end of file -- cgit v1.1 From f76dceb90b5a76a7b6a5243c9032996c007c0cf5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 24 Oct 2012 03:08:58 +0100 Subject: Get "save oar" and "save iar" to tell you in a more friendly manner if the filename to save already exists, rather than exception throwing. Also changes ConsoleUtil.CheckFileExists to CheckFileDoesNotExist() since this is more meaningful in the context, even though it does result in double negatives. --- OpenSim/Framework/Console/ConsoleUtil.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs index 5c25ccb..3ebfdf8 100644 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; using log4net; @@ -60,6 +61,24 @@ namespace OpenSim.Framework.Console public const string VectorSeparator = ","; public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray(); + + /// + /// Check if the given file path exists. + /// + /// If not, warning is printed to the given console. + /// true if the file does not exist, false otherwise. + /// + /// + public static bool CheckFileDoesNotExist(ICommandConsole console, string path) + { + if (File.Exists(path)) + { + console.OutputFormat("File {0} already exists. Please move or remove it.", path); + return false; + } + + return true; + } /// /// Try to parse a console UUID from the console. -- cgit v1.1 From 81aeecc90723658187668baa49bd168b7b333afb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 24 Oct 2012 04:10:22 +0100 Subject: Allow "show object", "show part", "dump object" and "delete object" to accept a local ID as well as a UUID. This means that the sub-commands are now id rather than uuid, e.g. show object id --- OpenSim/Framework/Console/ConsoleUtil.cs | 58 ++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs index 3ebfdf8..16a63e0 100644 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ b/OpenSim/Framework/Console/ConsoleUtil.cs @@ -38,6 +38,8 @@ namespace OpenSim.Framework.Console public class ConsoleUtil { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public const int LocalIdNotFound = 0; /// /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section @@ -87,19 +89,71 @@ namespace OpenSim.Framework.Console /// Will complain to the console if parsing fails. /// /// - /// + /// If null then no complaint is printed. /// /// public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid) { if (!UUID.TryParse(rawUuid, out uuid)) { - console.OutputFormat("{0} is not a valid uuid", rawUuid); + if (console != null) + console.OutputFormat("{0} is not a valid uuid", rawUuid); + return false; } return true; } + + public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId) + { + if (!uint.TryParse(rawLocalId, out localId)) + { + if (console != null) + console.OutputFormat("{0} is not a valid local id", localId); + + return false; + } + + if (localId == 0) + { + if (console != null) + console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId); + + return false; + } + + return true; + } + + /// + /// Tries to parse the input as either a UUID or a local ID. + /// + /// true if parsing succeeded, false otherwise. + /// + /// + /// + /// + /// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded. + /// + public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId) + { + if (TryParseConsoleUuid(null, rawId, out uuid)) + { + localId = LocalIdNotFound; + return true; + } + + if (TryParseConsoleLocalId(null, rawId, out localId)) + { + return true; + } + + if (console != null) + console.OutputFormat("{0} is not a valid UUID or local id", rawId); + + return false; + } /// /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 -- cgit v1.1 From 5d4ac5a90fea758e18c8a9e97b06e799186b5a14 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 00:59:27 +0100 Subject: Add TestOsNpcLoadAppearance() --- OpenSim/Framework/AvatarAppearance.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 4f598b0..95e9667 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -330,6 +330,9 @@ namespace OpenSim.Framework SetVisualParams(visualParams); } + /// + /// Set avatar height by a calculation based on their visual parameters. + /// public virtual void SetHeight() { // Start with shortest possible female avatar height -- cgit v1.1 From c13a99dc5cc82efac5497dab27dcb6b0d9865cea Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 03:26:12 +0100 Subject: Fix script error messages not showing up in viewer 3 and associated viewers. Viewer 3 will discard such a message if the chat message owner does not match the avatar. We were filling the ownerID with the primID, so this never matched, hence viewer 3 did not see any script error messages. This commit fills the ownerID in with the prim ownerID so the script owner will receive script error messages. This does not affect viewer 1 and associated viewers which continue to process script errors as normal. --- OpenSim/Framework/Client/IClientChat.cs | 7 ++++--- OpenSim/Framework/IClientAPI.cs | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Client/IClientChat.cs b/OpenSim/Framework/Client/IClientChat.cs index 078ea9b..86b1faa 100644 --- a/OpenSim/Framework/Client/IClientChat.cs +++ b/OpenSim/Framework/Client/IClientChat.cs @@ -33,7 +33,8 @@ namespace OpenSim.Framework.Client { event ChatMessage OnChatFromClient; - void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, - byte audible); + void SendChatMessage( + string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, + byte audible); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 9856978..87433cc 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1099,8 +1099,20 @@ namespace OpenSim.Framework void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); - void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, - byte audible); + /// + /// Send chat to the viewer. + /// + /// + /// + /// + /// + /// + /// + /// + /// + void SendChatMessage( + string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, + byte audible); void SendInstantMessage(GridInstantMessage im); -- cgit v1.1 From c97890ca69df91e6590ac7dd234a3e86cf7fbaf1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 29 Oct 2012 22:53:06 +0000 Subject: Add "force gc" region console command which manually invokes garbage collection. For debugging purposes. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index aac9c45..5b2d7dc 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -192,8 +192,19 @@ namespace OpenSim.Framework.Servers "threads show", "Show thread status. Synonym for \"show threads\"", (string module, string[] args) => Notice(GetThreadsReport())); + + m_console.Commands.AddCommand("General", false, "force gc", + "force gc", + "Manually invoke runtime garbage collection. For debugging purposes", + HandleForceGc); } } + + private void HandleForceGc(string module, string[] args) + { + MainConsole.Instance.Output("Manually invoking runtime garbage collection"); + GC.Collect(); + } /// /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing -- cgit v1.1 From 56965dd9599597bf5c51ab795f278db8291514c2 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 13:00:16 +0100 Subject: fixing poorly-formatted xml doc string for Util.IsInsideBox --- OpenSim/Framework/Util.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 5c7797a..c369dbc 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -536,7 +536,7 @@ namespace OpenSim.Framework /// /// Determines whether a point is inside a bounding box. /// - /// /param> + /// /// /// /// -- cgit v1.1 From 9e05067a4f029983a749c348259112a8a18432d1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Oct 2012 21:45:39 +0100 Subject: Add AnimState to CADU --- OpenSim/Framework/ChildAgentDataUpdate.cs | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 6d048f4..dfe60aa 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -306,6 +306,8 @@ namespace OpenSim.Framework public AgentGroupData[] Groups; public Animation[] Anims; + public Animation DefaultAnim = null; + public Animation AnimState = null; public UUID GranterID; @@ -390,6 +392,16 @@ namespace OpenSim.Framework args["animations"] = anims; } + if (DefaultAnim != null) + { + args["default_animation"] = DefaultAnim.PackUpdateMessage(); + } + + if (AnimState != null) + { + args["animation_state"] = AnimState.PackUpdateMessage(); + } + if (Appearance != null) args["packed_appearance"] = Appearance.Pack(); @@ -583,6 +595,30 @@ namespace OpenSim.Framework } } + if (args["default_animation"] != null) + { + try + { + DefaultAnim = new Animation((OSDMap)args["default_animation"]); + } + catch + { + DefaultAnim = null; + } + } + + if (args["animation_state"] != null) + { + try + { + AnimState = new Animation((OSDMap)args["animation_state"]); + } + catch + { + AnimState = null; + } + } + //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) //{ // OSDArray textures = (OSDArray)(args["agent_textures"]); -- cgit v1.1 From 6235d16c3148bb6f9f881b0dc286deccfdf9148a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 31 Oct 2012 00:31:18 +0000 Subject: Make "show object part" command correctly display script status. Uses new IEntityInventory.TryGetScriptInstanceRunning() Makes it clearer that TaskInventoryItem.ScriptRunning cannot be used as it is temporary and not updated. --- OpenSim/Framework/TaskInventoryDictionary.cs | 4 +++- OpenSim/Framework/TaskInventoryItem.cs | 19 ++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 421bd5d..8af2c41 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -35,10 +35,12 @@ using OpenMetaverse; namespace OpenSim.Framework { /// - /// A dictionary for task inventory. + /// A dictionary containing task inventory items. Indexed by item UUID. /// + /// /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before /// iterating over it. + /// public class TaskInventoryDictionary : Dictionary, ICloneable, IXmlSerializable { diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 3b40381..a06f8e7 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -73,9 +73,6 @@ namespace OpenSim.Framework private bool _ownerChanged = false; - // This used ONLY during copy. It can't be relied on at other times! - private bool _scriptRunning = true; - public UUID AssetID { get { return _assetID; @@ -353,14 +350,13 @@ namespace OpenSim.Framework } } - public bool ScriptRunning { - get { - return _scriptRunning; - } - set { - _scriptRunning = value; - } - } + /// + /// This used ONLY during copy. It can't be relied on at other times! + /// + /// + /// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now. + /// + public bool ScriptRunning { get; set; } // See ICloneable @@ -388,6 +384,7 @@ namespace OpenSim.Framework public TaskInventoryItem() { + ScriptRunning = true; CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; } } -- cgit v1.1 From cda127e30f0049cda21137363e4d759fd7fd4959 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 9 Nov 2012 23:55:30 -0500 Subject: * Prep work switching the GetMeshModule over to a poll service. * This still has the image throttler in it.. as is... so it's not suitable for live yet.... The throttler keeps track of the task throttle but doesn't balance the UDP throttle yet. --- OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index d0a37d0..c19ac32 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -53,7 +53,8 @@ namespace OpenSim.Framework.Servers.HttpServer Normal = 0, LslHttp = 1, Inventory = 2, - Texture = 3 + Texture = 3, + Mesh = 4 } public PollServiceEventArgs( -- cgit v1.1 From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001 From: teravus Date: Thu, 15 Nov 2012 10:05:16 -0500 Subject: Revert "Merge master into teravuswork", it should have been avination, not master. This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64. --- OpenSim/Framework/AssetPermissions.cs | 84 ----- OpenSim/Framework/AvatarAppearance.cs | 3 - OpenSim/Framework/Cache.cs | 83 ++--- OpenSim/Framework/Client/IClientChat.cs | 7 +- OpenSim/Framework/Console/ConsoleUtil.cs | 228 ------------ OpenSim/Framework/Constants.cs | 1 - OpenSim/Framework/EstateSettings.cs | 10 +- OpenSim/Framework/GridInstantMessage.cs | 9 +- OpenSim/Framework/IClientAPI.cs | 46 +-- OpenSim/Framework/InventoryFolderBase.cs | 18 +- OpenSim/Framework/LandData.cs | 385 +++++++-------------- OpenSim/Framework/Monitoring/BaseStatsCollector.cs | 23 +- OpenSim/Framework/Monitoring/MemoryWatchdog.cs | 10 +- .../Framework/Monitoring/SimExtraStatsCollector.cs | 19 +- OpenSim/Framework/Monitoring/StatsManager.cs | 360 ------------------- OpenSim/Framework/Monitoring/Watchdog.cs | 35 +- OpenSim/Framework/PacketPool.cs | 247 +++++++++++++ OpenSim/Framework/Pool.cs | 91 ----- OpenSim/Framework/RegionFlags.cs | 53 --- OpenSim/Framework/RegionInfo.cs | 72 +--- .../Framework/Serialization/ArchiveConstants.cs | 5 - .../Serialization/External/OspResolver.cs | 14 +- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 43 ++- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 274 ++++++--------- .../Servers/HttpServer/Interfaces/IHttpServer.cs | 22 +- OpenSim/Framework/Servers/MainServer.cs | 148 +------- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- OpenSim/Framework/TaskInventoryDictionary.cs | 4 +- OpenSim/Framework/TaskInventoryItem.cs | 19 +- OpenSim/Framework/Util.cs | 51 --- OpenSim/Framework/WebUtil.cs | 81 +---- 31 files changed, 639 insertions(+), 1808 deletions(-) delete mode 100644 OpenSim/Framework/AssetPermissions.cs delete mode 100644 OpenSim/Framework/Console/ConsoleUtil.cs create mode 100644 OpenSim/Framework/PacketPool.cs delete mode 100644 OpenSim/Framework/Pool.cs delete mode 100644 OpenSim/Framework/RegionFlags.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AssetPermissions.cs b/OpenSim/Framework/AssetPermissions.cs deleted file mode 100644 index 4a905c2..0000000 --- a/OpenSim/Framework/AssetPermissions.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -using Nini.Config; -using log4net; - -using OpenMetaverse; - -namespace OpenSim.Framework -{ - public class AssetPermissions - { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - private bool[] m_DisallowExport, m_DisallowImport; - private string[] m_AssetTypeNames; - - public AssetPermissions(IConfig config) - { - Type enumType = typeof(AssetType); - m_AssetTypeNames = Enum.GetNames(enumType); - for (int i = 0; i < m_AssetTypeNames.Length; i++) - m_AssetTypeNames[i] = m_AssetTypeNames[i].ToLower(); - int n = Enum.GetValues(enumType).Length; - m_DisallowExport = new bool[n]; - m_DisallowImport = new bool[n]; - - LoadPermsFromConfig(config, "DisallowExport", m_DisallowExport); - LoadPermsFromConfig(config, "DisallowImport", m_DisallowImport); - - } - - private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray) - { - if (assetConfig == null) - return; - - string perms = assetConfig.GetString(variable, String.Empty); - string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - foreach (string s in parts) - { - int index = Array.IndexOf(m_AssetTypeNames, s.Trim().ToLower()); - if (index >= 0) - bitArray[index] = true; - else - m_log.WarnFormat("[Asset Permissions]: Invalid AssetType {0}", s); - } - - } - - public bool AllowedExport(sbyte type) - { - string assetTypeName = ((AssetType)type).ToString(); - - int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower()); - if (index >= 0 && m_DisallowExport[index]) - { - m_log.DebugFormat("[Asset Permissions]: Export denied: configuration does not allow export of AssetType {0}", assetTypeName); - return false; - } - - return true; - } - - public bool AllowedImport(sbyte type) - { - string assetTypeName = ((AssetType)type).ToString(); - - int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower()); - if (index >= 0 && m_DisallowImport[index]) - { - m_log.DebugFormat("[Asset Permissions]: Import denied: configuration does not allow import of AssetType {0}", assetTypeName); - return false; - } - - return true; - } - - - } -} diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 1638541..c5d9641 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -358,9 +358,6 @@ namespace OpenSim.Framework SetVisualParams(visualParams); } - /// - /// Set avatar height by a calculation based on their visual parameters. - /// public virtual void SetHeight() { // Start with shortest possible female avatar height diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs index 31cab4a..79e20fc 100644 --- a/OpenSim/Framework/Cache.cs +++ b/OpenSim/Framework/Cache.cs @@ -199,14 +199,7 @@ namespace OpenSim.Framework // public class Cache { - /// - /// Must only be accessed under lock. - /// private List m_Index = new List(); - - /// - /// Must only be accessed under m_Index lock. - /// private Dictionary m_Lookup = new Dictionary(); @@ -327,19 +320,19 @@ namespace OpenSim.Framework { if (m_Lookup.ContainsKey(index)) item = m_Lookup[index]; + } - if (item == null) - { - Expire(true); - return null; - } - - item.hits++; - item.lastUsed = DateTime.Now; - + if (item == null) + { Expire(true); + return null; } + item.hits++; + item.lastUsed = DateTime.Now; + + Expire(true); + return item; } @@ -392,10 +385,7 @@ namespace OpenSim.Framework // public Object Find(Predicate d) { - CacheItemBase item; - - lock (m_Index) - item = m_Index.Find(d); + CacheItemBase item = m_Index.Find(d); if (item == null) return null; @@ -429,12 +419,12 @@ namespace OpenSim.Framework public virtual void Store(string index, Object data, Type container, Object[] parameters) { + Expire(false); + CacheItemBase item; lock (m_Index) { - Expire(false); - if (m_Index.Contains(new CacheItemBase(index))) { if ((m_Flags & CacheFlags.AllowUpdate) != 0) @@ -460,17 +450,9 @@ namespace OpenSim.Framework m_Index.Add(item); m_Lookup[index] = item; } - item.Store(data); } - /// - /// Expire items as appropriate. - /// - /// - /// Callers must lock m_Index. - /// - /// protected virtual void Expire(bool getting) { if (getting && (m_Strategy == CacheStrategy.Aggressive)) @@ -493,10 +475,12 @@ namespace OpenSim.Framework switch (m_Strategy) { - case CacheStrategy.Aggressive: - if (Count < Size) - return; + case CacheStrategy.Aggressive: + if (Count < Size) + return; + lock (m_Index) + { m_Index.Sort(new SortLRU()); m_Index.Reverse(); @@ -506,7 +490,7 @@ namespace OpenSim.Framework ExpireDelegate doExpire = OnExpire; - if (doExpire != null) + if (doExpire != null) { List candidates = m_Index.GetRange(target, Count - target); @@ -529,34 +513,27 @@ namespace OpenSim.Framework foreach (CacheItemBase item in m_Index) m_Lookup[item.uuid] = item; } - - break; - - default: - break; + } + break; + default: + break; } } public void Invalidate(string uuid) { - lock (m_Index) - { - if (!m_Lookup.ContainsKey(uuid)) - return; + if (!m_Lookup.ContainsKey(uuid)) + return; - CacheItemBase item = m_Lookup[uuid]; - m_Lookup.Remove(uuid); - m_Index.Remove(item); - } + CacheItemBase item = m_Lookup[uuid]; + m_Lookup.Remove(uuid); + m_Index.Remove(item); } public void Clear() { - lock (m_Index) - { - m_Index.Clear(); - m_Lookup.Clear(); - } + m_Index.Clear(); + m_Lookup.Clear(); } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Client/IClientChat.cs b/OpenSim/Framework/Client/IClientChat.cs index 86b1faa..078ea9b 100644 --- a/OpenSim/Framework/Client/IClientChat.cs +++ b/OpenSim/Framework/Client/IClientChat.cs @@ -33,8 +33,7 @@ namespace OpenSim.Framework.Client { event ChatMessage OnChatFromClient; - void SendChatMessage( - string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, - byte audible); + void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, + byte audible); } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs deleted file mode 100644 index 16a63e0..0000000 --- a/OpenSim/Framework/Console/ConsoleUtil.cs +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Framework.Console -{ - public class ConsoleUtil - { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public const int LocalIdNotFound = 0; - - /// - /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section - /// rather than in each help summary. - /// - public const string CoordHelp - = @"Each component of the coord is comma separated. There must be no spaces between the commas. - If you don't care about the z component you can simply omit it. - If you don't care about the x or y components then you can leave them blank (though a comma is still required) - If you want to specify the maxmimum value of a component then you can use ~ instead of a number - If you want to specify the minimum value of a component then you can use -~ instead of a number - e.g. - delete object pos 20,20,20 to 40,40,40 - delete object pos 20,20 to 40,40 - delete object pos ,20,20 to ,40,40 - delete object pos ,,30 to ,,~ - delete object pos ,,-~ to ,,30"; - - public const string MinRawConsoleVectorValue = "-~"; - public const string MaxRawConsoleVectorValue = "~"; - - public const string VectorSeparator = ","; - public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray(); - - /// - /// Check if the given file path exists. - /// - /// If not, warning is printed to the given console. - /// true if the file does not exist, false otherwise. - /// - /// - public static bool CheckFileDoesNotExist(ICommandConsole console, string path) - { - if (File.Exists(path)) - { - console.OutputFormat("File {0} already exists. Please move or remove it.", path); - return false; - } - - return true; - } - - /// - /// Try to parse a console UUID from the console. - /// - /// - /// Will complain to the console if parsing fails. - /// - /// - /// If null then no complaint is printed. - /// - /// - public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid) - { - if (!UUID.TryParse(rawUuid, out uuid)) - { - if (console != null) - console.OutputFormat("{0} is not a valid uuid", rawUuid); - - return false; - } - - return true; - } - - public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId) - { - if (!uint.TryParse(rawLocalId, out localId)) - { - if (console != null) - console.OutputFormat("{0} is not a valid local id", localId); - - return false; - } - - if (localId == 0) - { - if (console != null) - console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId); - - return false; - } - - return true; - } - - /// - /// Tries to parse the input as either a UUID or a local ID. - /// - /// true if parsing succeeded, false otherwise. - /// - /// - /// - /// - /// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded. - /// - public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId) - { - if (TryParseConsoleUuid(null, rawId, out uuid)) - { - localId = LocalIdNotFound; - return true; - } - - if (TryParseConsoleLocalId(null, rawId, out localId)) - { - return true; - } - - if (console != null) - console.OutputFormat("{0} is not a valid UUID or local id", rawId); - - return false; - } - - /// - /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 - /// - /// /param> - /// - /// - public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector) - { - return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector); - } - - /// - /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3 - /// - /// /param> - /// - /// - public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector) - { - return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector); - } - - /// - /// Convert a vector input from the console to an OpenMetaverse.Vector3 - /// - /// - /// A string in the form ,, where there is no space between values. - /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value - /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40) - /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue - /// Other than that, component values must be numeric. - /// - /// - /// - /// - public static bool TryParseConsoleVector( - string rawConsoleVector, Func blankComponentFunc, out Vector3 vector) - { - List components = rawConsoleVector.Split(VectorSeparatorChars).ToList(); - - if (components.Count < 1 || components.Count > 3) - { - vector = Vector3.Zero; - return false; - } - - for (int i = components.Count; i < 3; i++) - components.Add(""); - - List semiDigestedComponents - = components.ConvertAll( - c => - { - if (c == "") - return blankComponentFunc.Invoke(c); - else if (c == MaxRawConsoleVectorValue) - return float.MaxValue.ToString(); - else if (c == MinRawConsoleVectorValue) - return float.MinValue.ToString(); - else - return c; - }); - - string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray()); - - // m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); - - return Vector3.TryParse(semiDigestedConsoleVector, out vector); - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index a2eb5ee..1b1aaf2 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -31,7 +31,6 @@ namespace OpenSim.Framework public class Constants { public const uint RegionSize = 256; - public const uint RegionHeight = 4096; public const byte TerrainPatchSize = 16; public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index e03750b..9020761 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -419,11 +419,11 @@ namespace OpenSim.Framework public void SetFromFlags(ulong regionFlags) { - ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport); - BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell); - AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark); - AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges); - AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome); + ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport); + BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell); + AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark); + AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges); + AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome); } public bool GroupAccess(UUID groupID) diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs index 6ae0488..a6bf6e3 100644 --- a/OpenSim/Framework/GridInstantMessage.cs +++ b/OpenSim/Framework/GridInstantMessage.cs @@ -44,6 +44,7 @@ namespace OpenSim.Framework public Vector3 Position; public byte[] binaryBucket; + public uint ParentEstateID; public Guid RegionID; public uint timestamp; @@ -57,7 +58,7 @@ namespace OpenSim.Framework string _fromAgentName, UUID _toAgentID, byte _dialog, bool _fromGroup, string _message, UUID _imSessionID, bool _offline, Vector3 _position, - byte[] _binaryBucket, bool addTimestamp) + byte[] _binaryBucket) { fromAgentID = _fromAgentID.Guid; fromAgentName = _fromAgentName; @@ -78,9 +79,7 @@ namespace OpenSim.Framework ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID; RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid; } - - if (addTimestamp) - timestamp = (uint)Util.UnixTimeSinceEpoch(); + timestamp = (uint)Util.UnixTimeSinceEpoch(); } public GridInstantMessage(IScene scene, UUID _fromAgentID, @@ -88,7 +87,7 @@ namespace OpenSim.Framework string _message, bool _offline, Vector3 _position) : this(scene, _fromAgentID, _fromAgentName, _toAgentID, _dialog, false, _message, - _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true) + _fromAgentID ^ _toAgentID, _offline, _position, new byte[0]) { } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 1c6685a..e31c7f6 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -815,23 +815,8 @@ namespace OpenSim.Framework event Action OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; event Action OnCompleteMovementToRegion; - - /// - /// Called when an AgentUpdate message is received and before OnAgentUpdate. - /// - /// - /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates. - /// event UpdateAgent OnPreAgentUpdate; - - /// - /// Called when an AgentUpdate message is received and after OnPreAgentUpdate. - /// - /// - /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates. - /// event UpdateAgent OnAgentUpdate; - event AgentRequestSit OnAgentRequestSit; event AgentSit OnAgentSit; event AvatarPickerRequest OnAvatarPickerRequest; @@ -1061,21 +1046,8 @@ namespace OpenSim.Framework void InPacket(object NewPack); void ProcessInPacket(Packet NewPack); - - /// - /// Close this client - /// void Close(); - - /// - /// Close this client - /// - /// - /// If true, attempts the close without checking active status. You do not want to try this except as a last - /// ditch attempt where Active == false but the ScenePresence still exists. - /// - void Close(bool sendStop, bool force); - + void Close(bool sendStop); void Kick(string message); /// @@ -1112,20 +1084,8 @@ namespace OpenSim.Framework void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); - /// - /// Send chat to the viewer. - /// - /// - /// - /// - /// - /// - /// - /// - /// - void SendChatMessage( - string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, - byte audible); + void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, + byte audible); void SendInstantMessage(GridInstantMessage im); diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index b3457a6..a12183c 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs @@ -73,27 +73,33 @@ namespace OpenSim.Framework { } - public InventoryFolderBase(UUID id) : this() + public InventoryFolderBase(UUID id) { ID = id; } - public InventoryFolderBase(UUID id, UUID owner) : this(id) + public InventoryFolderBase(UUID id, UUID owner) { + ID = id; Owner = owner; } - public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner) + public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) { + ID = id; Name = name; + Owner = owner; ParentID = parent; } - public InventoryFolderBase( - UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent) + public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) { + ID = id; + Name = name; + Owner = owner; Type = type; + ParentID = parent; Version = version; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 4dffd3f..dcaa46d 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -49,8 +49,8 @@ namespace OpenSim.Framework // use only one serializer to give the runtime a chance to // optimize it (it won't do that if you use a new instance // every time) - private static XmlSerializer serializer = new XmlSerializer(typeof(LandData)); - + private static XmlSerializer serializer = new XmlSerializer(typeof (LandData)); + private Vector3 _AABBMax = new Vector3(); private Vector3 _AABBMin = new Vector3(); private int _area = 0; @@ -65,11 +65,11 @@ namespace OpenSim.Framework private byte[] _bitmap = new byte[512]; private string _description = String.Empty; - private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark | - (uint)ParcelFlags.AllowAPrimitiveEntry | - (uint)ParcelFlags.AllowDeedToGroup | - (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts | - (uint)ParcelFlags.AllowVoiceChat; + private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | + (uint) ParcelFlags.AllowAPrimitiveEntry | + (uint) ParcelFlags.AllowDeedToGroup | + (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | + (uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat; private byte _landingType = 0; private string _name = "Your Parcel"; @@ -97,36 +97,16 @@ namespace OpenSim.Framework private bool _mediaLoop = false; private bool _obscureMusic = false; private bool _obscureMedia = false; - private float _dwell = 0; - - /// - /// Traffic count of parcel - /// - [XmlIgnore] - public float Dwell - { - get - { - return _dwell; - } - set - { - _dwell = value; - } - } /// /// Whether to obscure parcel media URL /// [XmlIgnore] - public bool ObscureMedia - { - get - { + public bool ObscureMedia { + get { return _obscureMedia; } - set - { + set { _obscureMedia = value; } } @@ -135,14 +115,11 @@ namespace OpenSim.Framework /// Whether to obscure parcel music URL /// [XmlIgnore] - public bool ObscureMusic - { - get - { + public bool ObscureMusic { + get { return _obscureMusic; } - set - { + set { _obscureMusic = value; } } @@ -151,14 +128,11 @@ namespace OpenSim.Framework /// Whether to loop parcel media /// [XmlIgnore] - public bool MediaLoop - { - get - { + public bool MediaLoop { + get { return _mediaLoop; } - set - { + set { _mediaLoop = value; } } @@ -167,14 +141,11 @@ namespace OpenSim.Framework /// Height of parcel media render /// [XmlIgnore] - public int MediaHeight - { - get - { + public int MediaHeight { + get { return _mediaHeight; } - set - { + set { _mediaHeight = value; } } @@ -183,14 +154,11 @@ namespace OpenSim.Framework /// Width of parcel media render /// [XmlIgnore] - public int MediaWidth - { - get - { + public int MediaWidth { + get { return _mediaWidth; } - set - { + set { _mediaWidth = value; } } @@ -199,14 +167,11 @@ namespace OpenSim.Framework /// Upper corner of the AABB for the parcel /// [XmlIgnore] - public Vector3 AABBMax - { - get - { + public Vector3 AABBMax { + get { return _AABBMax; } - set - { + set { _AABBMax = value; } } @@ -214,14 +179,11 @@ namespace OpenSim.Framework /// Lower corner of the AABB for the parcel /// [XmlIgnore] - public Vector3 AABBMin - { - get - { + public Vector3 AABBMin { + get { return _AABBMin; } - set - { + set { _AABBMin = value; } } @@ -229,14 +191,11 @@ namespace OpenSim.Framework /// /// Area in meters^2 the parcel contains /// - public int Area - { - get - { + public int Area { + get { return _area; } - set - { + set { _area = value; } } @@ -244,14 +203,11 @@ namespace OpenSim.Framework /// /// ID of auction (3rd Party Integration) when parcel is being auctioned /// - public uint AuctionID - { - get - { + public uint AuctionID { + get { return _auctionID; } - set - { + set { _auctionID = value; } } @@ -259,14 +215,11 @@ namespace OpenSim.Framework /// /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it. /// - public UUID AuthBuyerID - { - get - { + public UUID AuthBuyerID { + get { return _authBuyerID; } - set - { + set { _authBuyerID = value; } } @@ -274,14 +227,11 @@ namespace OpenSim.Framework /// /// Category of parcel. Used for classifying the parcel in classified listings /// - public ParcelCategory Category - { - get - { + public ParcelCategory Category { + get { return _category; } - set - { + set { _category = value; } } @@ -289,14 +239,11 @@ namespace OpenSim.Framework /// /// Date that the current owner purchased or claimed the parcel /// - public int ClaimDate - { - get - { + public int ClaimDate { + get { return _claimDate; } - set - { + set { _claimDate = value; } } @@ -304,14 +251,11 @@ namespace OpenSim.Framework /// /// The last price that the parcel was sold at /// - public int ClaimPrice - { - get - { + public int ClaimPrice { + get { return _claimPrice; } - set - { + set { _claimPrice = value; } } @@ -319,14 +263,11 @@ namespace OpenSim.Framework /// /// Global ID for the parcel. (3rd Party Integration) /// - public UUID GlobalID - { - get - { + public UUID GlobalID { + get { return _globalID; } - set - { + set { _globalID = value; } } @@ -334,14 +275,11 @@ namespace OpenSim.Framework /// /// Unique ID of the Group that owns /// - public UUID GroupID - { - get - { + public UUID GroupID { + get { return _groupID; } - set - { + set { _groupID = value; } } @@ -349,14 +287,11 @@ namespace OpenSim.Framework /// /// Returns true if the Land Parcel is owned by a group /// - public bool IsGroupOwned - { - get - { + public bool IsGroupOwned { + get { return _isGroupOwned; } - set - { + set { _isGroupOwned = value; } } @@ -364,14 +299,11 @@ namespace OpenSim.Framework /// /// jp2 data for the image representative of the parcel in the parcel dialog /// - public byte[] Bitmap - { - get - { + public byte[] Bitmap { + get { return _bitmap; } - set - { + set { _bitmap = value; } } @@ -379,14 +311,11 @@ namespace OpenSim.Framework /// /// Parcel Description /// - public string Description - { - get - { + public string Description { + get { return _description; } - set - { + set { _description = value; } } @@ -394,14 +323,11 @@ namespace OpenSim.Framework /// /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags /// - public uint Flags - { - get - { + public uint Flags { + get { return _flags; } - set - { + set { _flags = value; } } @@ -410,14 +336,11 @@ namespace OpenSim.Framework /// Determines if people are able to teleport where they please on the parcel or if they /// get constrainted to a specific point on teleport within the parcel /// - public byte LandingType - { - get - { + public byte LandingType { + get { return _landingType; } - set - { + set { _landingType = value; } } @@ -425,14 +348,11 @@ namespace OpenSim.Framework /// /// Parcel Name /// - public string Name - { - get - { + public string Name { + get { return _name; } - set - { + set { _name = value; } } @@ -440,14 +360,11 @@ namespace OpenSim.Framework /// /// Status of Parcel, Leased, Abandoned, For Sale /// - public ParcelStatus Status - { - get - { + public ParcelStatus Status { + get { return _status; } - set - { + set { _status = value; } } @@ -455,14 +372,11 @@ namespace OpenSim.Framework /// /// Internal ID of the parcel. Sometimes the client will try to use this value /// - public int LocalID - { - get - { + public int LocalID { + get { return _localID; } - set - { + set { _localID = value; } } @@ -470,14 +384,11 @@ namespace OpenSim.Framework /// /// Determines if we scale the media based on the surface it's on /// - public byte MediaAutoScale - { - get - { + public byte MediaAutoScale { + get { return _mediaAutoScale; } - set - { + set { _mediaAutoScale = value; } } @@ -485,14 +396,11 @@ namespace OpenSim.Framework /// /// Texture Guid to replace with the output of the media stream /// - public UUID MediaID - { - get - { + public UUID MediaID { + get { return _mediaID; } - set - { + set { _mediaID = value; } } @@ -500,14 +408,11 @@ namespace OpenSim.Framework /// /// URL to the media file to display /// - public string MediaURL - { - get - { + public string MediaURL { + get { return _mediaURL; } - set - { + set { _mediaURL = value; } } @@ -527,14 +432,11 @@ namespace OpenSim.Framework /// /// URL to the shoutcast music stream to play on the parcel /// - public string MusicURL - { - get - { + public string MusicURL { + get { return _musicURL; } - set - { + set { _musicURL = value; } } @@ -543,14 +445,11 @@ namespace OpenSim.Framework /// Owner Avatar or Group of the parcel. Naturally, all land masses must be /// owned by someone /// - public UUID OwnerID - { - get - { + public UUID OwnerID { + get { return _ownerID; } - set - { + set { _ownerID = value; } } @@ -558,14 +457,11 @@ namespace OpenSim.Framework /// /// List of access data for the parcel. User data, some bitflags, and a time /// - public List ParcelAccessList - { - get - { + public List ParcelAccessList { + get { return _parcelAccessList; } - set - { + set { _parcelAccessList = value; } } @@ -573,14 +469,11 @@ namespace OpenSim.Framework /// /// How long in hours a Pass to the parcel is given /// - public float PassHours - { - get - { + public float PassHours { + get { return _passHours; } - set - { + set { _passHours = value; } } @@ -588,14 +481,11 @@ namespace OpenSim.Framework /// /// Price to purchase a Pass to a restricted parcel /// - public int PassPrice - { - get - { + public int PassPrice { + get { return _passPrice; } - set - { + set { _passPrice = value; } } @@ -603,14 +493,11 @@ namespace OpenSim.Framework /// /// When the parcel is being sold, this is the price to purchase the parcel /// - public int SalePrice - { - get - { + public int SalePrice { + get { return _salePrice; } - set - { + set { _salePrice = value; } } @@ -619,14 +506,11 @@ namespace OpenSim.Framework /// Number of meters^2 in the Simulator /// [XmlIgnore] - public int SimwideArea - { - get - { + public int SimwideArea { + get { return _simwideArea; } - set - { + set { _simwideArea = value; } } @@ -635,14 +519,11 @@ namespace OpenSim.Framework /// Number of SceneObjectPart in the Simulator /// [XmlIgnore] - public int SimwidePrims - { - get - { + public int SimwidePrims { + get { return _simwidePrims; } - set - { + set { _simwidePrims = value; } } @@ -650,14 +531,11 @@ namespace OpenSim.Framework /// /// ID of the snapshot used in the client parcel dialog of the parcel /// - public UUID SnapshotID - { - get - { + public UUID SnapshotID { + get { return _snapshotID; } - set - { + set { _snapshotID = value; } } @@ -666,14 +544,11 @@ namespace OpenSim.Framework /// When teleporting is restricted to a certain point, this is the location /// that the user will be redirected to /// - public Vector3 UserLocation - { - get - { + public Vector3 UserLocation { + get { return _userLocation; } - set - { + set { _userLocation = value; } } @@ -682,14 +557,11 @@ namespace OpenSim.Framework /// When teleporting is restricted to a certain point, this is the rotation /// that the user will be positioned /// - public Vector3 UserLookAt - { - get - { + public Vector3 UserLookAt { + get { return _userLookAt; } - set - { + set { _userLookAt = value; } } @@ -698,14 +570,11 @@ namespace OpenSim.Framework /// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// the parcel and isn't set to the same 'group' as the parcel. /// - public int OtherCleanTime - { - get - { + public int OtherCleanTime { + get { return _otherCleanTime; } - set - { + set { _otherCleanTime = value; } } @@ -713,14 +582,11 @@ namespace OpenSim.Framework /// /// parcel media description /// - public string MediaDescription - { - get - { + public string MediaDescription { + get { return _mediaDescription; } - set - { + set { _mediaDescription = value; } } @@ -756,7 +622,7 @@ namespace OpenSim.Framework landData._mediaURL = _mediaURL; landData._musicURL = _musicURL; landData._ownerID = _ownerID; - landData._bitmap = (byte[])_bitmap.Clone(); + landData._bitmap = (byte[]) _bitmap.Clone(); landData._description = _description; landData._flags = _flags; landData._name = _name; @@ -777,7 +643,6 @@ namespace OpenSim.Framework landData._obscureMedia = _obscureMedia; landData._simwideArea = _simwideArea; landData._simwidePrims = _simwidePrims; - landData._dwell = _dwell; landData._parcelAccessList.Clear(); foreach (LandAccessEntry entry in _parcelAccessList) diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs index 446e3c0..9ee0876 100644 --- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs @@ -43,32 +43,27 @@ namespace OpenSim.Framework.Monitoring StringBuilder sb = new StringBuilder(Environment.NewLine); sb.Append("MEMORY STATISTICS"); sb.Append(Environment.NewLine); - sb.AppendFormat( + sb.Append( + string.Format( "Allocated to OpenSim objects: {0} MB\n", - Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); - - sb.AppendFormat( - "OpenSim last object memory churn : {0} MB/s\n", - Math.Round((MemoryWatchdog.LastMemoryChurn * 1000) / 1024.0 / 1024, 3)); - - sb.AppendFormat( - "OpenSim average object memory churn : {0} MB/s\n", - Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3)); + Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); Process myprocess = Process.GetCurrentProcess(); if (!myprocess.HasExited) { myprocess.Refresh(); - sb.AppendFormat( + sb.Append( + string.Format( "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0), Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0), - Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0)); - sb.AppendFormat( + Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0))); + sb.Append( + string.Format( "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0), Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0), - Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0)); + Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0))); } else sb.Append("Process reported as Exited \n"); diff --git a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs index c6010cd..a23cf1f 100644 --- a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs +++ b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs @@ -60,7 +60,7 @@ namespace OpenSim.Framework.Monitoring private static bool m_enabled; /// - /// Last memory churn in bytes per millisecond. + /// Average memory churn in bytes per millisecond. /// public static double AverageMemoryChurn { @@ -68,14 +68,6 @@ namespace OpenSim.Framework.Monitoring } /// - /// Average memory churn in bytes per millisecond. - /// - public static double LastMemoryChurn - { - get { if (m_samples.Count > 0) return m_samples.Last(); else return 0; } - } - - /// /// Maximum number of statistical samples. /// /// diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index aa86202..cdd7cc7 100644 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs @@ -355,25 +355,10 @@ Asset service request failures: {3}" + Environment.NewLine, sb.Append(Environment.NewLine); sb.Append( string.Format( - "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}\n\n", + "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}", inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); - - Dictionary> sceneStats; - - if (StatsManager.TryGetStats("scene", out sceneStats)) - { - foreach (KeyValuePair> kvp in sceneStats) - { - foreach (Stat stat in kvp.Value.Values) - { - if (stat.Verbosity == StatVerbosity.Info) - { - sb.AppendFormat("{0} ({1}): {2}{3}\n", stat.Name, stat.Container, stat.Value, stat.UnitName); - } - } - } - } + sb.Append(Environment.NewLine); /* sb.Append(Environment.NewLine); diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 4844336..d78fa6a 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -25,9 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; - namespace OpenSim.Framework.Monitoring { /// @@ -35,24 +32,6 @@ namespace OpenSim.Framework.Monitoring /// public class StatsManager { - // Subcommand used to list other stats. - public const string AllSubCommand = "all"; - - // Subcommand used to list other stats. - public const string ListSubCommand = "list"; - - // All subcommands - public static HashSet SubCommands = new HashSet { AllSubCommand, ListSubCommand }; - - /// - /// Registered stats categorized by category/container/shortname - /// - /// - /// Do not add or remove directly from this dictionary. - /// - public static Dictionary>> RegisteredStats - = new Dictionary>>(); - private static AssetStatsCollector assetStats; private static UserStatsCollector userStats; private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector(); @@ -61,75 +40,6 @@ namespace OpenSim.Framework.Monitoring public static UserStatsCollector UserStats { get { return userStats; } } public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } - public static void RegisterConsoleCommands(ICommandConsole console) - { - console.Commands.AddCommand( - "General", - false, - "show stats", - "show stats [list|all|]", - "Show statistical information for this server", - "If no final argument is specified then legacy statistics information is currently shown.\n" - + "If list is specified then statistic categories are shown.\n" - + "If all is specified then all registered statistics are shown.\n" - + "If a category name is specified then only statistics from that category are shown.\n" - + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS", - HandleShowStatsCommand); - } - - public static void HandleShowStatsCommand(string module, string[] cmd) - { - ICommandConsole con = MainConsole.Instance; - - if (cmd.Length > 2) - { - var categoryName = cmd[2]; - - if (categoryName == AllSubCommand) - { - foreach (var category in RegisteredStats.Values) - { - OutputCategoryStatsToConsole(con, category); - } - } - else if (categoryName == ListSubCommand) - { - con.Output("Statistic categories available are:"); - foreach (string category in RegisteredStats.Keys) - con.OutputFormat(" {0}", category); - } - else - { - Dictionary> category; - if (!RegisteredStats.TryGetValue(categoryName, out category)) - { - con.OutputFormat("No such category as {0}", categoryName); - } - else - { - OutputCategoryStatsToConsole(con, category); - } - } - } - else - { - // Legacy - con.Output(SimExtraStats.Report()); - } - } - - private static void OutputCategoryStatsToConsole( - ICommandConsole con, Dictionary> category) - { - foreach (var container in category.Values) - { - foreach (Stat stat in container.Values) - { - con.Output(stat.ToConsoleString()); - } - } - } - /// /// Start collecting statistics related to assets. /// Should only be called once. @@ -151,275 +61,5 @@ namespace OpenSim.Framework.Monitoring return userStats; } - - /// - /// Registers a statistic. - /// - /// - /// - public static bool RegisterStat(Stat stat) - { - Dictionary> category = null, newCategory; - Dictionary container = null, newContainer; - - lock (RegisteredStats) - { - // Stat name is not unique across category/container/shortname key. - // XXX: For now just return false. This is to avoid problems in regression tests where all tests - // in a class are run in the same instance of the VM. - if (TryGetStat(stat, out category, out container)) - return false; - - // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. - // This means that we don't need to lock or copy them on iteration, which will be a much more - // common operation after startup. - if (container != null) - newContainer = new Dictionary(container); - else - newContainer = new Dictionary(); - - if (category != null) - newCategory = new Dictionary>(category); - else - newCategory = new Dictionary>(); - - newContainer[stat.ShortName] = stat; - newCategory[stat.Container] = newContainer; - RegisteredStats[stat.Category] = newCategory; - } - - return true; - } - - /// - /// Deregister a statistic - /// > - /// - /// > category = null, newCategory; - Dictionary container = null, newContainer; - - lock (RegisteredStats) - { - if (!TryGetStat(stat, out category, out container)) - return false; - - newContainer = new Dictionary(container); - newContainer.Remove(stat.ShortName); - - newCategory = new Dictionary>(category); - newCategory.Remove(stat.Container); - - newCategory[stat.Container] = newContainer; - RegisteredStats[stat.Category] = newCategory; - - return true; - } - } - - public static bool TryGetStats(string category, out Dictionary> stats) - { - return RegisteredStats.TryGetValue(category, out stats); - } - - public static bool TryGetStat( - Stat stat, - out Dictionary> category, - out Dictionary container) - { - category = null; - container = null; - - lock (RegisteredStats) - { - if (RegisteredStats.TryGetValue(stat.Category, out category)) - { - if (category.TryGetValue(stat.Container, out container)) - { - if (container.ContainsKey(stat.ShortName)) - return true; - } - } - } - - return false; - } - } - - /// - /// Stat type. - /// - /// - /// A push stat is one which is continually updated and so it's value can simply by read. - /// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated. - /// - public enum StatType - { - Push, - Pull - } - - /// - /// Verbosity of stat. - /// - /// - /// Info will always be displayed. - /// - public enum StatVerbosity - { - Debug, - Info - } - - /// - /// Holds individual static details - /// - public class Stat - { - /// - /// Category of this stat (e.g. cache, scene, etc). - /// - public string Category { get; private set; } - - /// - /// Containing name for this stat. - /// FIXME: In the case of a scene, this is currently the scene name (though this leaves - /// us with a to-be-resolved problem of non-unique region names). - /// - /// - /// The container. - /// - public string Container { get; private set; } - - public StatType StatType { get; private set; } - - /// - /// Action used to update this stat when the value is requested if it's a pull type. - /// - public Action PullAction { get; private set; } - - public StatVerbosity Verbosity { get; private set; } - public string ShortName { get; private set; } - public string Name { get; private set; } - public string Description { get; private set; } - public virtual string UnitName { get; private set; } - - public virtual double Value - { - get - { - // Asking for an update here means that the updater cannot access this value without infinite recursion. - // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being - // called by the pull action and just return the value. - if (StatType == StatType.Pull) - PullAction(this); - - return m_value; - } - - set - { - m_value = value; - } - } - - private double m_value; - - /// - /// Constructor - /// - /// Short name for the stat. Must not contain spaces. e.g. "LongFrames" - /// Human readable name for the stat. e.g. "Long frames" - /// Description of stat - /// - /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value. - /// e.g. " frames" - /// - /// Category under which this stat should appear, e.g. "scene". Do not capitalize. - /// Entity to which this stat relates. e.g. scene name if this is a per scene stat. - /// Push or pull - /// Pull stats need an action to update the stat on request. Push stats should set null here. - /// Verbosity of stat. Controls whether it will appear in short stat display or only full display. - public Stat( - string shortName, - string name, - string description, - string unitName, - string category, - string container, - StatType type, - Action pullAction, - StatVerbosity verbosity) - { - if (StatsManager.SubCommands.Contains(category)) - throw new Exception( - string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category)); - - ShortName = shortName; - Name = name; - Description = description; - UnitName = unitName; - Category = category; - Container = container; - StatType = type; - - if (StatType == StatType.Push && pullAction != null) - throw new Exception("A push stat cannot have a pull action"); - else - PullAction = pullAction; - - Verbosity = verbosity; - } - - public virtual string ToConsoleString() - { - return string.Format( - "{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName); - } - } - - public class PercentageStat : Stat - { - public int Antecedent { get; set; } - public int Consequent { get; set; } - - public override double Value - { - get - { - int c = Consequent; - - // Avoid any chance of a multi-threaded divide-by-zero - if (c == 0) - return 0; - - return (double)Antecedent / c * 100; - } - - set - { - throw new Exception("Cannot set value on a PercentageStat"); - } - } - - public PercentageStat( - string shortName, - string name, - string description, - string category, - string container, - StatType type, - Action pullAction, - StatVerbosity verbosity) - : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {} - - public override string ToConsoleString() - { - return string.Format( - "{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})", - Category, Container, ShortName, Value, UnitName, Antecedent, Consequent); - } } } \ No newline at end of file diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 28d6d5c..b709baa 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -89,17 +89,6 @@ namespace OpenSim.Framework.Monitoring FirstTick = Environment.TickCount & Int32.MaxValue; LastTick = FirstTick; } - - public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi) - { - Thread = previousTwi.Thread; - FirstTick = previousTwi.FirstTick; - LastTick = previousTwi.LastTick; - Timeout = previousTwi.Timeout; - IsTimedOut = previousTwi.IsTimedOut; - AlarmIfTimeout = previousTwi.AlarmIfTimeout; - AlarmMethod = previousTwi.AlarmMethod; - } } /// @@ -231,25 +220,7 @@ namespace OpenSim.Framework.Monitoring private static bool RemoveThread(int threadID) { lock (m_threads) - { - ThreadWatchdogInfo twi; - if (m_threads.TryGetValue(threadID, out twi)) - { - m_log.DebugFormat( - "[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); - - m_threads.Remove(threadID); - - return true; - } - else - { - m_log.WarnFormat( - "[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID); - - return false; - } - } + return m_threads.Remove(threadID); } public static bool AbortThread(int threadID) @@ -364,9 +335,7 @@ namespace OpenSim.Framework.Monitoring if (callbackInfos == null) callbackInfos = new List(); - // Send a copy of the watchdog info to prevent race conditions where the watchdog - // thread updates the monitoring info after an alarm has been sent out. - callbackInfos.Add(new ThreadWatchdogInfo(threadInfo)); + callbackInfos.Add(threadInfo); } } } diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs new file mode 100644 index 0000000..41d17c5 --- /dev/null +++ b/OpenSim/Framework/PacketPool.cs @@ -0,0 +1,247 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using OpenMetaverse; +using OpenMetaverse.Packets; +using log4net; + +namespace OpenSim.Framework +{ + + public sealed class PacketPool + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private static readonly PacketPool instance = new PacketPool(); + + private bool packetPoolEnabled = true; + private bool dataBlockPoolEnabled = true; + + private readonly Dictionary> pool = new Dictionary>(); + + private static Dictionary> DataBlocks = + new Dictionary>(); + + static PacketPool() + { + } + + public static PacketPool Instance + { + get { return instance; } + } + + public bool RecyclePackets + { + set { packetPoolEnabled = value; } + get { return packetPoolEnabled; } + } + + public bool RecycleDataBlocks + { + set { dataBlockPoolEnabled = value; } + get { return dataBlockPoolEnabled; } + } + + public Packet GetPacket(PacketType type) + { + Packet packet; + + if (!packetPoolEnabled) + return Packet.BuildPacket(type); + + lock (pool) + { + if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0) + { + // Creating a new packet if we cannot reuse an old package + packet = Packet.BuildPacket(type); + } + else + { + // Recycle old packages + packet = (pool[type]).Pop(); + } + } + + return packet; + } + + // private byte[] decoded_header = new byte[10]; + private static PacketType GetType(byte[] bytes) + { + byte[] decoded_header = new byte[10 + 8]; + ushort id; + PacketFrequency freq; + + if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0) + { + Helpers.ZeroDecode(bytes, 16, decoded_header); + } + else + { + Buffer.BlockCopy(bytes, 0, decoded_header, 0, 10); + } + + if (decoded_header[6] == 0xFF) + { + if (decoded_header[7] == 0xFF) + { + id = (ushort) ((decoded_header[8] << 8) + decoded_header[9]); + freq = PacketFrequency.Low; + } + else + { + id = decoded_header[7]; + freq = PacketFrequency.Medium; + } + } + else + { + id = decoded_header[6]; + freq = PacketFrequency.High; + } + + return Packet.GetType(id, freq); + } + + public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer) + { + PacketType type = GetType(bytes); + + Array.Clear(zeroBuffer, 0, zeroBuffer.Length); + + int i = 0; + Packet packet = GetPacket(type); + if (packet == null) + m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type); + else + packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); + + return packet; + } + + /// + /// Return a packet to the packet pool + /// + /// + public void ReturnPacket(Packet packet) + { + if (dataBlockPoolEnabled) + { + switch (packet.Type) + { + case PacketType.ObjectUpdate: + ObjectUpdatePacket oup = (ObjectUpdatePacket)packet; + + foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData) + ReturnDataBlock(oupod); + + oup.ObjectData = null; + break; + + case PacketType.ImprovedTerseObjectUpdate: + ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet; + + foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData) + ReturnDataBlock(itoupod); + + itoup.ObjectData = null; + break; + } + } + + if (packetPoolEnabled) + { + switch (packet.Type) + { + // List pooling packets here + case PacketType.PacketAck: + case PacketType.ObjectUpdate: + case PacketType.ImprovedTerseObjectUpdate: + lock (pool) + { + PacketType type = packet.Type; + + if (!pool.ContainsKey(type)) + { + pool[type] = new Stack(); + } + + if ((pool[type]).Count < 50) + { + (pool[type]).Push(packet); + } + } + break; + + // Other packets wont pool + default: + return; + } + } + } + + public static T GetDataBlock() where T: new() + { + lock (DataBlocks) + { + Stack s; + + if (DataBlocks.TryGetValue(typeof(T), out s)) + { + if (s.Count > 0) + return (T)s.Pop(); + } + else + { + DataBlocks[typeof(T)] = new Stack(); + } + + return new T(); + } + } + + public static void ReturnDataBlock(T block) where T: new() + { + if (block == null) + return; + + lock (DataBlocks) + { + if (!DataBlocks.ContainsKey(typeof(T))) + DataBlocks[typeof(T)] = new Stack(); + + if (DataBlocks[typeof(T)].Count < 50) + DataBlocks[typeof(T)].Push(block); + } + } + } +} diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs deleted file mode 100644 index 5484f5c..0000000 --- a/OpenSim/Framework/Pool.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; - -namespace OpenSim.Framework -{ - /// - /// Naive pool implementation. - /// - /// - /// Currently assumes that objects are in a useable state when returned. - /// - public class Pool - { - /// - /// Number of objects in the pool. - /// - public int Count - { - get - { - lock (m_pool) - return m_pool.Count; - } - } - - private Stack m_pool; - - /// - /// Maximum pool size. Beyond this, any returned objects are not pooled. - /// - private int m_maxPoolSize; - - private Func m_createFunction; - - public Pool(Func createFunction, int maxSize) - { - m_maxPoolSize = maxSize; - m_createFunction = createFunction; - m_pool = new Stack(m_maxPoolSize); - } - - public T GetObject() - { - lock (m_pool) - { - if (m_pool.Count > 0) - return m_pool.Pop(); - else - return m_createFunction(); - } - } - - public void ReturnObject(T obj) - { - lock (m_pool) - { - if (m_pool.Count >= m_maxPoolSize) - return; - else - m_pool.Push(obj); - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/RegionFlags.cs b/OpenSim/Framework/RegionFlags.cs deleted file mode 100644 index a3089b0..0000000 --- a/OpenSim/Framework/RegionFlags.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Framework -{ - /// - /// Region flags used internally by OpenSimulator to store installation specific information about regions. - /// - /// - /// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire). - /// Returned by IGridService.GetRegionFlags() - /// - [Flags] - public enum RegionFlags : int - { - DefaultRegion = 1, // Used for new Rez. Random if multiple defined - FallbackRegion = 2, // Regions we redirect to when the destination is down - RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false - NoDirectLogin = 8, // Region unavailable for direct logins (by name) - Persistent = 16, // Don't remove on unregister - LockedOut = 32, // Don't allow registration - NoMove = 64, // Don't allow moving this region - Reservation = 128, // This is an inactive reservation - Authenticate = 256, // Require authentication - Hyperlink = 512 // Record represents a HG link - } -} \ No newline at end of file diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index e7bed6a..4bde7be 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -122,13 +122,10 @@ namespace OpenSim.Framework public UUID lastMapUUID = UUID.Zero; public string lastMapRefresh = "0"; - private float m_nonphysPrimMin = 0; private int m_nonphysPrimMax = 0; - private float m_physPrimMin = 0; private int m_physPrimMax = 0; private bool m_clampPrimSize = false; private int m_objectCapacity = 0; - private int m_linksetCapacity = 0; private int m_agentCapacity = 0; private string m_regionType = String.Empty; private RegionLightShareData m_windlight = new RegionLightShareData(); @@ -290,21 +287,11 @@ namespace OpenSim.Framework set { m_windlight = value; } } - public float NonphysPrimMin - { - get { return m_nonphysPrimMin; } - } - public int NonphysPrimMax { get { return m_nonphysPrimMax; } } - public float PhysPrimMin - { - get { return m_physPrimMin; } - } - public int PhysPrimMax { get { return m_physPrimMax; } @@ -320,11 +307,6 @@ namespace OpenSim.Framework get { return m_objectCapacity; } } - public int LinksetCapacity - { - get { return m_linksetCapacity; } - } - public int AgentCapacity { get { return m_agentCapacity; } @@ -643,31 +625,16 @@ namespace OpenSim.Framework m_regionType = config.GetString("RegionType", String.Empty); allKeys.Remove("RegionType"); - #region Prim stuff - - m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); - allKeys.Remove("NonPhysicalPrimMin"); - - m_nonphysPrimMax = config.GetInt("NonPhysicalPrimMax", 0); - allKeys.Remove("NonPhysicalPrimMax"); - - m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0); - allKeys.Remove("PhysicalPrimMin"); - + // Prim stuff + // + m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0); + allKeys.Remove("NonphysicalPrimMax"); m_physPrimMax = config.GetInt("PhysicalPrimMax", 0); allKeys.Remove("PhysicalPrimMax"); - m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); allKeys.Remove("ClampPrimSize"); - m_objectCapacity = config.GetInt("MaxPrims", 15000); allKeys.Remove("MaxPrims"); - - m_linksetCapacity = config.GetInt("LinksetPrims", 0); - allKeys.Remove("LinksetPrims"); - - #endregion - m_agentCapacity = config.GetInt("MaxAgents", 100); allKeys.Remove("MaxAgents"); @@ -706,27 +673,16 @@ namespace OpenSim.Framework config.Set("ExternalHostName", m_externalHostName); - if (m_nonphysPrimMin > 0) - config.Set("NonphysicalPrimMax", m_nonphysPrimMin); - - if (m_nonphysPrimMax > 0) + if (m_nonphysPrimMax != 0) config.Set("NonphysicalPrimMax", m_nonphysPrimMax); - - if (m_physPrimMin > 0) - config.Set("PhysicalPrimMax", m_physPrimMin); - - if (m_physPrimMax > 0) + if (m_physPrimMax != 0) config.Set("PhysicalPrimMax", m_physPrimMax); - config.Set("ClampPrimSize", m_clampPrimSize.ToString()); - if (m_objectCapacity > 0) + if (m_objectCapacity != 0) config.Set("MaxPrims", m_objectCapacity); - if (m_linksetCapacity > 0) - config.Set("LinksetPrims", m_linksetCapacity); - - if (m_agentCapacity > 0) + if (m_agentCapacity != 0) config.Set("MaxAgents", m_agentCapacity); if (ScopeID != UUID.Zero) @@ -803,15 +759,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); - configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true); - configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); - configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true); - configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for physical prims", m_physPrimMax.ToString(), true); @@ -821,9 +771,6 @@ namespace OpenSim.Framework configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", m_objectCapacity.ToString(), true); - configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, - "Max prims an object will hold", m_linksetCapacity.ToString(), true); - configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max avatars this sim will hold", m_agentCapacity.ToString(), true); @@ -945,9 +892,6 @@ namespace OpenSim.Framework case "object_capacity": m_objectCapacity = (int)configuration_result; break; - case "linkset_capacity": - m_linksetCapacity = (int)configuration_result; - break; case "agent_capacity": m_agentCapacity = (int)configuration_result; break; diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 48f1c4f..2c5e001 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -53,11 +53,6 @@ namespace OpenSim.Framework.Serialization public const string INVENTORY_PATH = "inventory/"; /// - /// Path for regions in a multi-region archive - /// - public const string REGIONS_PATH = "regions/"; - - /// /// Path for the prims file /// public const string OBJECTS_PATH = "objects/"; diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs index fa7160f..d31d27c 100644 --- a/OpenSim/Framework/Serialization/External/OspResolver.cs +++ b/OpenSim/Framework/Serialization/External/OspResolver.cs @@ -65,14 +65,9 @@ namespace OpenSim.Framework.Serialization UserAccount account = userService.GetUserAccount(UUID.Zero, userId); if (account != null) - { return MakeOspa(account.FirstName, account.LastName); - } // else -// { // m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId); -// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId); -// } return null; } @@ -84,13 +79,10 @@ namespace OpenSim.Framework.Serialization /// public static string MakeOspa(string firstName, string lastName) { - string ospa - = OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; - -// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); -// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); +// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName); - return ospa; + return + OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; } /// diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 605909d..cf19002 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -96,6 +96,11 @@ namespace OpenSim.Framework.Servers get { return m_httpServer; } } + /// + /// Holds the non-viewer statistics collection object for this service/server + /// + protected IStatsCollector m_stats; + public BaseOpenSimServer() { m_startuptime = DateTime.Now; @@ -172,6 +177,10 @@ namespace OpenSim.Framework.Servers "show info", "Show general information about the server", HandleShow); + m_console.Commands.AddCommand("General", false, "show stats", + "show stats", + "Show statistics", HandleShow); + m_console.Commands.AddCommand("General", false, "show threads", "show threads", "Show thread status", HandleShow); @@ -192,19 +201,8 @@ namespace OpenSim.Framework.Servers "threads show", "Show thread status. Synonym for \"show threads\"", (string module, string[] args) => Notice(GetThreadsReport())); - - m_console.Commands.AddCommand("General", false, "force gc", - "force gc", - "Manually invoke runtime garbage collection. For debugging purposes", - HandleForceGc); } } - - private void HandleForceGc(string module, string[] args) - { - MainConsole.Instance.Output("Manually invoking runtime garbage collection"); - GC.Collect(); - } /// /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing @@ -228,7 +226,12 @@ namespace OpenSim.Framework.Servers { StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); sb.Append(GetUptimeReport()); - sb.Append(StatsManager.SimExtraStats.Report()); + + if (m_stats != null) + { + sb.Append(m_stats.Report()); + } + sb.Append(Environment.NewLine); sb.Append(GetThreadsReport()); @@ -379,6 +382,10 @@ namespace OpenSim.Framework.Servers { Notice("set log level [level] - change the console logging level only. For example, off or debug."); Notice("show info - show server information (e.g. startup path)."); + + if (m_stats != null) + Notice("show stats - show statistical information for this server"); + Notice("show threads - list tracked threads"); Notice("show uptime - show server startup time and uptime."); Notice("show version - show server version."); @@ -402,6 +409,11 @@ namespace OpenSim.Framework.Servers ShowInfo(); break; + case "stats": + if (m_stats != null) + Notice(m_stats.Report()); + break; + case "threads": Notice(GetThreadsReport()); break; @@ -592,7 +604,8 @@ namespace OpenSim.Framework.Servers public string osSecret { // Secret uuid for the simulator - get { return m_osSecret; } + get { return m_osSecret; } + } public string StatReport(IOSHttpRequest httpRequest) @@ -600,11 +613,11 @@ namespace OpenSim.Framework.Servers // If we catch a request for "callback", wrap the response in the value for jsonp if (httpRequest.Query.ContainsKey("callback")) { - return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; + return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; } else { - return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); + return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); } } diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 3198891..788a0b9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -54,23 +54,8 @@ namespace OpenSim.Framework.Servers.HttpServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); - /// - /// Gets or sets the debug level. - /// - /// - /// See MainServer.DebugLevel. - /// public int DebugLevel { get; set; } - /// - /// Request number for diagnostic purposes. - /// - /// - /// This is an internal number. In some debug situations an external number may also be supplied in the - /// opensim-request-id header but we are not currently logging this. - /// - public int RequestNumber { get; private set; } - private volatile int NotSocketErrors = 0; public volatile bool HTTPDRunning = false; @@ -82,7 +67,7 @@ namespace OpenSim.Framework.Servers.HttpServer protected Dictionary m_llsdHandlers = new Dictionary(); protected Dictionary m_streamHandlers = new Dictionary(); protected Dictionary m_HTTPHandlers = new Dictionary(); -// protected Dictionary m_agentHandlers = new Dictionary(); + protected Dictionary m_agentHandlers = new Dictionary(); protected Dictionary m_pollHandlers = new Dictionary(); @@ -260,29 +245,29 @@ namespace OpenSim.Framework.Servers.HttpServer return new List(m_pollHandlers.Keys); } -// // Note that the agent string is provided simply to differentiate -// // the handlers - it is NOT required to be an actual agent header -// // value. -// public bool AddAgentHandler(string agent, IHttpAgentHandler handler) -// { -// lock (m_agentHandlers) -// { -// if (!m_agentHandlers.ContainsKey(agent)) -// { -// m_agentHandlers.Add(agent, handler); -// return true; -// } -// } -// -// //must already have a handler for that path so return false -// return false; -// } -// -// public List GetAgentHandlerKeys() -// { -// lock (m_agentHandlers) -// return new List(m_agentHandlers.Keys); -// } + // Note that the agent string is provided simply to differentiate + // the handlers - it is NOT required to be an actual agent header + // value. + public bool AddAgentHandler(string agent, IHttpAgentHandler handler) + { + lock (m_agentHandlers) + { + if (!m_agentHandlers.ContainsKey(agent)) + { + m_agentHandlers.Add(agent, handler); + return true; + } + } + + //must already have a handler for that path so return false + return false; + } + + public List GetAgentHandlerKeys() + { + lock (m_agentHandlers) + return new List(m_agentHandlers.Keys); + } public bool AddLLSDHandler(string path, LLSDMethod handler) { @@ -311,8 +296,6 @@ namespace OpenSim.Framework.Servers.HttpServer private void OnRequest(object source, RequestEventArgs args) { - RequestNumber++; - try { IHttpClientContext context = (IHttpClientContext)source; @@ -423,6 +406,7 @@ namespace OpenSim.Framework.Servers.HttpServer string requestMethod = request.HttpMethod; string uriString = request.RawUrl; +// string reqnum = "unknown"; int requestStartTick = Environment.TickCount; // Will be adjusted later on. @@ -439,22 +423,22 @@ namespace OpenSim.Framework.Servers.HttpServer Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); -// // This is the REST agent interface. We require an agent to properly identify -// // itself. If the REST handler recognizes the prefix it will attempt to -// // satisfy the request. If it is not recognizable, and no damage has occurred -// // the request can be passed through to the other handlers. This is a low -// // probability event; if a request is matched it is normally expected to be -// // handled -// IHttpAgentHandler agentHandler; -// -// if (TryGetAgentHandler(request, response, out agentHandler)) -// { -// if (HandleAgentRequest(agentHandler, request, response)) -// { -// requestEndTick = Environment.TickCount; -// return; -// } -// } + // This is the REST agent interface. We require an agent to properly identify + // itself. If the REST handler recognizes the prefix it will attempt to + // satisfy the request. If it is not recognizable, and no damage has occurred + // the request can be passed through to the other handlers. This is a low + // probability event; if a request is matched it is normally expected to be + // handled + IHttpAgentHandler agentHandler; + + if (TryGetAgentHandler(request, response, out agentHandler)) + { + if (HandleAgentRequest(agentHandler, request, response)) + { + requestEndTick = Environment.TickCount; + return; + } + } //response.KeepAlive = true; response.SendChunked = false; @@ -466,7 +450,9 @@ namespace OpenSim.Framework.Servers.HttpServer if (TryGetStreamHandler(handlerKey, out requestHandler)) { if (DebugLevel >= 3) - LogIncomingToStreamHandler(request, requestHandler); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", + request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. @@ -543,8 +529,11 @@ namespace OpenSim.Framework.Servers.HttpServer { case null: case "text/html": + if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleHTTPRequest(request, response); break; @@ -552,8 +541,11 @@ namespace OpenSim.Framework.Servers.HttpServer case "application/llsd+xml": case "application/xml+llsd": case "application/llsd+json": + if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleLLSDRequests(request, response); break; @@ -572,7 +564,9 @@ namespace OpenSim.Framework.Servers.HttpServer if (DoWeHaveALLSDHandler(request.RawUrl)) { if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleLLSDRequests(request, response); } @@ -580,14 +574,18 @@ namespace OpenSim.Framework.Servers.HttpServer else if (DoWeHaveAHTTPHandler(request.RawUrl)) { if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleHTTPRequest(request, response); } else { if (DebugLevel >= 3) - LogIncomingToXmlRpcHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", + request.HttpMethod, request.Url.PathAndQuery); // generic login request. buffer = HandleXmlRpcRequests(request, response); @@ -631,11 +629,11 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (IOException e) { - m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); + m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); } catch (Exception e) { - m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); + m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); SendHTML500(response); } finally @@ -646,93 +644,17 @@ namespace OpenSim.Framework.Servers.HttpServer if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) { m_log.InfoFormat( - "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", - RequestNumber, + "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", requestMethod, uriString, requestHandler != null ? requestHandler.Name : "", requestHandler != null ? requestHandler.Description : "", - request.RemoteIPEndPoint, - tickdiff); - } - else if (DebugLevel >= 4) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms", - RequestNumber, - Port, + request.RemoteIPEndPoint.ToString(), tickdiff); } } } - private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}", - RequestNumber, - Port, - request.HttpMethod, - request.Url.PathAndQuery, - requestHandler.Name, - requestHandler.Description, - request.RemoteIPEndPoint); - - if (DebugLevel >= 5) - LogIncomingInDetail(request); - } - - private void LogIncomingToContentTypeHandler(OSHttpRequest request) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", - RequestNumber, - Port, - (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType, - request.HttpMethod, - request.Url.PathAndQuery, - request.RemoteIPEndPoint); - - if (DebugLevel >= 5) - LogIncomingInDetail(request); - } - - private void LogIncomingToXmlRpcHandler(OSHttpRequest request) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}", - RequestNumber, - Port, - request.HttpMethod, - request.Url.PathAndQuery, - request.RemoteIPEndPoint); - - if (DebugLevel >= 5) - LogIncomingInDetail(request); - } - - private void LogIncomingInDetail(OSHttpRequest request) - { - using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8)) - { - string output; - - if (DebugLevel == 5) - { - const int sampleLength = 80; - char[] sampleChars = new char[sampleLength]; - reader.Read(sampleChars, 0, sampleLength); - output = new string(sampleChars); - } - else - { - output = reader.ReadToEnd(); - } - - m_log.DebugFormat("[BASE HTTP SERVER]: {0}...", output.Replace("\n", @"\n")); - } - } - private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler) { string bestMatch = null; @@ -825,24 +747,24 @@ namespace OpenSim.Framework.Servers.HttpServer } } -// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) -// { -// agentHandler = null; -// -// lock (m_agentHandlers) -// { -// foreach (IHttpAgentHandler handler in m_agentHandlers.Values) -// { -// if (handler.Match(request, response)) -// { -// agentHandler = handler; -// return true; -// } -// } -// } -// -// return false; -// } + private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) + { + agentHandler = null; + + lock (m_agentHandlers) + { + foreach (IHttpAgentHandler handler in m_agentHandlers.Values) + { + if (handler.Match(request, response)) + { + agentHandler = handler; + return true; + } + } + } + + return false; + } /// /// Try all the registered xmlrpc handlers when an xmlrpc request is received. @@ -1815,21 +1737,21 @@ namespace OpenSim.Framework.Servers.HttpServer m_pollHandlers.Remove(path); } -// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) -// { -// lock (m_agentHandlers) -// { -// IHttpAgentHandler foundHandler; -// -// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) -// { -// m_agentHandlers.Remove(agent); -// return true; -// } -// } -// -// return false; -// } + public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) + { + lock (m_agentHandlers) + { + IHttpAgentHandler foundHandler; + + if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) + { + m_agentHandlers.Remove(agent); + return true; + } + } + + return false; + } public void RemoveXmlRPCHandler(string method) { diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs index 0bd3aae..db58f6f 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs @@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer uint Port { get; } bool UseSSL { get; } -// // Note that the agent string is provided simply to differentiate -// // the handlers - it is NOT required to be an actual agent header -// // value. -// bool AddAgentHandler(string agent, IHttpAgentHandler handler); + // Note that the agent string is provided simply to differentiate + // the handlers - it is NOT required to be an actual agent header + // value. + bool AddAgentHandler(string agent, IHttpAgentHandler handler); /// /// Add a handler for an HTTP request. @@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); -// /// -// /// Remove the agent if it is registered. -// /// -// /// -// /// -// /// -// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); + /// + /// Remove the agent if it is registered. + /// + /// + /// + /// + bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); /// /// Remove an HTTP handler diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index ae7d515..8dc0e3a 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Net; -using System.Text; using log4net; using OpenSim.Framework; using OpenSim.Framework.Console; @@ -48,12 +47,9 @@ namespace OpenSim.Framework.Servers /// Control the printing of certain debug messages. /// /// - /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data. - /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data. - /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged. - /// If DebugLevel >= 4 then the time taken to fulfill the request is logged. - /// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged. - /// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged. + /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data. + /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data. + /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged. /// public static int DebugLevel { @@ -105,28 +101,17 @@ namespace OpenSim.Framework.Servers get { return new Dictionary(m_Servers); } } + public static void RegisterHttpConsoleCommands(ICommandConsole console) { console.Commands.AddCommand( - "Comms", false, "show http-handlers", - "show http-handlers", - "Show all registered http handlers", HandleShowHttpHandlersCommand); - - console.Commands.AddCommand( - "Debug", false, "debug http", "debug http []", - "Turn on http request logging.", - "If in or all and\n" - + " level <= 0 then no extra logging is done.\n" - + " level >= 1 then short warnings are logged when receiving bad input data.\n" - + " level >= 2 then long warnings are logged when receiving bad input data.\n" - + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n" - + " level >= 4 then the time taken to fulfill the request is logged.\n" - + " level >= 5 then a sample from the beginning of the incoming data is logged.\n" - + " level >= 6 then the entire incoming data is logged.\n" - + " no level is specified then the current level is returned.\n\n" - + "If out or all and\n" - + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n" - + " level >= 4 then the time taken to fulfill the request is logged.\n", + "Debug", false, "debug http", "debug http []", + "Turn on inbound non-poll http request debugging.", + "If level <= 0, then no extra logging is done.\n" + + "If level >= 1, then short warnings are logged when receiving bad input data.\n" + + "If level >= 2, then long warnings are logged when receiving bad input data.\n" + + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" + + "If no level is specified then the current level is returned.", HandleDebugHttpCommand); } @@ -134,120 +119,25 @@ namespace OpenSim.Framework.Servers /// Turn on some debugging values for OpenSim. /// /// - private static void HandleDebugHttpCommand(string module, string[] cmdparams) + private static void HandleDebugHttpCommand(string module, string[] args) { - if (cmdparams.Length < 3) - { - MainConsole.Instance.Output("Usage: debug http 0..6"); - return; - } - - bool inReqs = false; - bool outReqs = false; - bool allReqs = false; - - string subCommand = cmdparams[2]; - - if (subCommand.ToLower() == "in") - { - inReqs = true; - } - else if (subCommand.ToLower() == "out") - { - outReqs = true; - } - else if (subCommand.ToLower() == "all") - { - allReqs = true; - } - else + if (args.Length == 3) { - MainConsole.Instance.Output("You must specify in, out or all"); - return; - } - - if (cmdparams.Length >= 4) - { - string rawNewDebug = cmdparams[3]; int newDebug; - - if (!int.TryParse(rawNewDebug, out newDebug)) - { - MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug); - return; - } - - if (newDebug < 0 || newDebug > 6) - { - MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..6", newDebug); - return; - } - - if (allReqs || inReqs) + if (int.TryParse(args[2], out newDebug)) { MainServer.DebugLevel = newDebug; - MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug); - } - - if (allReqs || outReqs) - { - WebUtil.DebugLevel = newDebug; - MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug); + MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug); } } - else + else if (args.Length == 2) { - if (allReqs || inReqs) - MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel); - - if (allReqs || outReqs) - MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel); + MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel); } - } - - private static void HandleShowHttpHandlersCommand(string module, string[] args) - { - if (args.Length != 2) - { - MainConsole.Instance.Output("Usage: show http-handlers"); - return; - } - - StringBuilder handlers = new StringBuilder(); - - lock (m_Servers) + else { - foreach (BaseHttpServer httpServer in m_Servers.Values) - { - handlers.AppendFormat( - "Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port); - - handlers.AppendFormat("* XMLRPC:\n"); - foreach (String s in httpServer.GetXmlRpcHandlerKeys()) - handlers.AppendFormat("\t{0}\n", s); - - handlers.AppendFormat("* HTTP:\n"); - List poll = httpServer.GetPollServiceHandlerKeys(); - foreach (String s in httpServer.GetHTTPHandlerKeys()) - handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); - -// handlers.AppendFormat("* Agent:\n"); -// foreach (String s in httpServer.GetAgentHandlerKeys()) -// handlers.AppendFormat("\t{0}\n", s); - - handlers.AppendFormat("* LLSD:\n"); - foreach (String s in httpServer.GetLLSDHandlerKeys()) - handlers.AppendFormat("\t{0}\n", s); - - handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count); - foreach (String s in httpServer.GetStreamHandlerKeys()) - handlers.AppendFormat("\t{0}\n", s); - - handlers.Append("\n"); - } + MainConsole.Instance.Output("Usage: debug http 0..3"); } - - MainConsole.Instance.Output(handlers.ToString()); } /// diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index bb094ed..016a174 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.7.5CM"; + private const string VERSION_NUMBER = "0.7.4CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 62ecbd1..4d07746 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -39,12 +39,10 @@ using OpenMetaverse; namespace OpenSim.Framework { /// - /// A dictionary containing task inventory items. Indexed by item UUID. + /// A dictionary for task inventory. /// - /// /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before /// iterating over it. - /// public class TaskInventoryDictionary : Dictionary, ICloneable, IXmlSerializable { diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 574ee56..fb818ee 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -73,6 +73,9 @@ namespace OpenSim.Framework private bool _ownerChanged = false; + // This used ONLY during copy. It can't be relied on at other times! + private bool _scriptRunning = true; + public UUID AssetID { get { return _assetID; @@ -350,13 +353,14 @@ namespace OpenSim.Framework } } - /// - /// This used ONLY during copy. It can't be relied on at other times! - /// - /// - /// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now. - /// - public bool ScriptRunning { get; set; } + public bool ScriptRunning { + get { + return _scriptRunning; + } + set { + _scriptRunning = value; + } + } // See ICloneable @@ -384,7 +388,6 @@ namespace OpenSim.Framework public TaskInventoryItem() { - ScriptRunning = true; CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; } } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e76a37b..384f716 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -546,19 +546,6 @@ namespace OpenSim.Framework } /// - /// Determines whether a point is inside a bounding box. - /// - /// - /// - /// - /// - public static bool IsInsideBox(Vector3 v, Vector3 min, Vector3 max) - { - return v.X >= min.X & v.Y >= min.Y && v.Z >= min.Z - && v.X <= max.X && v.Y <= max.Y && v.Z <= max.Z; - } - - /// /// Are the co-ordinates of the new region visible from the old region? /// /// Old region x-coord @@ -875,12 +862,6 @@ namespace OpenSim.Framework return Math.Min(Math.Max(x, min), max); } - public static Vector3 Clip(Vector3 vec, float min, float max) - { - return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max), - Clip(vec.Z, min, max)); - } - /// /// Convert an UUID to a raw uuid string. Right now this is a string without hyphens. /// @@ -1032,38 +1013,6 @@ namespace OpenSim.Framework } } - /// - /// Copy data from one stream to another, leaving the read position of both streams at the beginning. - /// - /// - /// Input stream. Must be seekable. - /// - /// - /// Thrown if the input stream is not seekable. - /// - public static Stream Copy(Stream inputStream) - { - if (!inputStream.CanSeek) - throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek"); - - const int readSize = 256; - byte[] buffer = new byte[readSize]; - MemoryStream ms = new MemoryStream(); - - int count = inputStream.Read(buffer, 0, readSize); - - while (count > 0) - { - ms.Write(buffer, 0, count); - count = inputStream.Read(buffer, 0, readSize); - } - - ms.Position = 0; - inputStream.Position = 0; - - return ms; - } - public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) { return SendXmlRpcCommand(url, methodName, args); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index b85d93d..30a8c28 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -54,17 +54,9 @@ namespace OpenSim.Framework MethodBase.GetCurrentMethod().DeclaringType); /// - /// Control the printing of certain debug messages. - /// - /// - /// If DebugLevel >= 3 then short notices about outgoing HTTP requests are logged. - /// - public static int DebugLevel { get; set; } - - /// /// Request number for diagnostic purposes. /// - public static int RequestNumber { get; internal set; } + public static int RequestNumber = 0; /// /// this is the header field used to communicate the local request id @@ -154,11 +146,7 @@ namespace OpenSim.Framework private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) { int reqnum = RequestNumber++; - - if (DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})", - reqnum, method, url, timeout, compressed); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); @@ -242,7 +230,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, method, url, @@ -251,14 +239,10 @@ namespace OpenSim.Framework strBuffer != null ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) : ""); - else if (DebugLevel >= 4) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); } m_log.DebugFormat( - "[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage); + "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); return ErrorResponseMap(errorMessage); } @@ -334,11 +318,7 @@ namespace OpenSim.Framework { int reqnum = RequestNumber++; string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; - - if (DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})", - reqnum, method, url, timeout); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); @@ -401,7 +381,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, method, url, @@ -410,13 +390,9 @@ namespace OpenSim.Framework queryString != null ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString : ""); - else if (DebugLevel >= 4) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); } - m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage); + m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); return ErrorResponseMap(errorMessage); } @@ -668,6 +644,7 @@ namespace OpenSim.Framework /// public static string[] GetPreferredImageTypes(string accept) { + if (accept == null || accept == string.Empty) return new string[0]; @@ -726,16 +703,14 @@ namespace OpenSim.Framework int maxConnections) { int reqnum = WebUtil.RequestNumber++; - - if (WebUtil.DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}", - reqnum, verb, requestUrl); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); int tickstart = Util.EnvironmentTickCount(); // int tickdata = 0; int tickdiff = 0; +// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); + Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); @@ -893,7 +868,7 @@ namespace OpenSim.Framework } m_log.InfoFormat( - "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, @@ -908,12 +883,6 @@ namespace OpenSim.Framework requestUrl, tickdiff); } - else if (WebUtil.DebugLevel >= 4) - { - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms", - reqnum, tickdiff); - } } } @@ -934,11 +903,7 @@ namespace OpenSim.Framework public static string MakeRequest(string verb, string requestUrl, string obj) { int reqnum = WebUtil.RequestNumber++; - - if (WebUtil.DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}", - reqnum, verb, requestUrl); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; @@ -1025,7 +990,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > WebUtil.LongCallTime) m_log.InfoFormat( - "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}", reqnum, verb, requestUrl, @@ -1033,10 +998,6 @@ namespace OpenSim.Framework tickset, tickdata, obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); - else if (WebUtil.DebugLevel >= 4) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); return respstring; } @@ -1071,11 +1032,7 @@ namespace OpenSim.Framework public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) { int reqnum = WebUtil.RequestNumber++; - - if (WebUtil.DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}", - reqnum, verb, requestUrl); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; @@ -1194,7 +1151,7 @@ namespace OpenSim.Framework } m_log.InfoFormat( - "[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, @@ -1202,12 +1159,6 @@ namespace OpenSim.Framework tickdata, originalRequest); } - else if (WebUtil.DebugLevel >= 4) - { - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); - } return deserial; } -- cgit v1.1 From 5e0294815f7e3ec83b7e568e1468948ac0ff7331 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 17 Nov 2012 03:47:09 -0500 Subject: * Plumbing and basic setting of the GetMesh Cap Throttler. * Last step is to flip the throttle distribution. --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index e31c7f6..6559638 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1135,6 +1135,8 @@ namespace OpenSim.Framework void SetChildAgentThrottle(byte[] throttle); + void SetAgentThrottleSilent(int throttle, int setting); + void SendAvatarDataImmediate(ISceneEntity avatar); /// -- cgit v1.1