From 69c8cc787f0bcecd617aeeff3d2776ba159d82ee Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 13 Jan 2011 11:39:50 -0500 Subject: Make FireAndForgetWrapper a singleton class Made FireAndForgetWrapper a singleton class to allow us to drop dependancy on the BclExtras35 library. BclExtras is broken in Mono 2.8.2 and we used the library in only one function. --- OpenSim/Framework/Util.cs | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 8d1671a..d1d8736 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -46,7 +46,7 @@ using System.Threading; using log4net; using Nini.Config; using Nwc.XmlRpc; -using BclExtras; +// using BclExtras; using OpenMetaverse; using OpenMetaverse.StructuredData; using Amib.Threading; @@ -1375,8 +1375,29 @@ namespace OpenSim.Framework /// /// Created to work around a limitation in Mono with nested delegates /// - private class FireAndForgetWrapper + private sealed class FireAndForgetWrapper { + private static volatile FireAndForgetWrapper instance; + private static object syncRoot = new Object(); + + public static FireAndForgetWrapper Instance { + get { + + if (instance == null) + { + lock (syncRoot) + { + if (instance == null) + { + instance = new FireAndForgetWrapper(); + } + } + } + + return instance; + } + } + public void FireAndForget(System.Threading.WaitCallback callback) { callback.BeginInvoke(null, EndFireAndForget, callback); @@ -1445,7 +1466,7 @@ namespace OpenSim.Framework ThreadPool.QueueUserWorkItem(callback, obj); break; case FireAndForgetMethod.BeginInvoke: - FireAndForgetWrapper wrapper = Singleton.GetInstance(); + FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance; wrapper.FireAndForget(callback, obj); break; case FireAndForgetMethod.SmartThreadPool: -- cgit v1.1 From a42faca5b92f5c17c16b79fcf0df446d1aa08ae1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 19 Jan 2011 01:13:10 +0000 Subject: With mic's permission, adjust long call time info messages to 500ms from 200ms --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 5 +++-- OpenSim/Framework/WebUtil.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 86ad7aa..d4ee7ba 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -587,8 +587,9 @@ 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, 200ms limit can be adjusted int tickdiff = Environment.TickCount - tickstart; - if (tickdiff > 200) - m_log.InfoFormat("[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms",reqnum,request.RawUrl,tickdiff); + if (tickdiff > 500) + m_log.InfoFormat( + "[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms", reqnum, request.RawUrl, tickdiff); } } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index d88d095..d731ac5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -58,7 +58,7 @@ namespace OpenSim.Framework // number of milliseconds a call can take before it is considered // a "long" call for warning & debugging purposes - public const int LongCallTime = 200; + public const int LongCallTime = 500; /// /// Send LLSD to an HTTP client in application/llsd+json form -- cgit v1.1 From 28fda1cab60d3a403537a0606416a7c008fe6183 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 19 Jan 2011 01:41:32 +0000 Subject: with mic's permission, reduce appearance, baked texture logging verbosity for now --- OpenSim/Framework/Capabilities/Caps.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index dbb0781..c2f9c3a 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -765,8 +765,8 @@ namespace OpenSim.Framework.Capabilities { try { - m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + - m_regionName); +// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + +// m_regionName); string capsBase = "/CAPS/" + m_capsObjectPath; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); @@ -1332,7 +1332,7 @@ namespace OpenSim.Framework.Capabilities newAssetID = UUID.Random(); uploaderPath = path; httpListener = httpServer; - m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); +// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); } /// @@ -1360,7 +1360,7 @@ namespace OpenSim.Framework.Capabilities httpListener.RemoveStreamHandler("POST", uploaderPath); - m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); +// m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); return res; } -- cgit v1.1 From b0aebc6f3d8d0a9b086b4af3c8ad81c2daba7610 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 20 Jan 2011 21:41:48 +0000 Subject: minor: make "show info" help slightly clearer --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index cbab2db..865a0ed 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -175,7 +175,7 @@ namespace OpenSim.Framework.Servers m_console.Commands.AddCommand("base", false, "show info", "show info", - "Show general information", HandleShow); + "Show general information about the server", HandleShow); m_console.Commands.AddCommand("base", false, "show stats", "show stats", -- cgit v1.1 From 43f948d6913ab33a9f5e11c631b0d64b2ef73b04 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 21 Jan 2011 23:05:53 +0000 Subject: add current console log level to "show info" --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 865a0ed..6eb7686 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -371,8 +371,7 @@ namespace OpenSim.Framework.Servers switch (showParams[0]) { case "info": - Notice("Version: " + m_version); - Notice("Startup directory: " + m_startupDirectory); + ShowInfo(); break; case "stats": @@ -395,6 +394,14 @@ namespace OpenSim.Framework.Servers break; } } + + protected void ShowInfo() + { + Notice("Version: " + m_version); + Notice("Startup directory: " + m_startupDirectory); + if (null != m_consoleAppender) + Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold)); + } /// /// Console output is only possible if a console has been established. -- cgit v1.1 From e44ceaaea3ec42fad63c5437e57e8c96a74e64e0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 21 Jan 2011 23:07:19 +0000 Subject: make "show info" and "show version" show the same version text --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 6eb7686..147fbd5 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -388,20 +388,23 @@ namespace OpenSim.Framework.Servers break; case "version": - Notice( - String.Format( - "Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion)); + Notice(GetVersionText()); break; } } protected void ShowInfo() { - Notice("Version: " + m_version); + Notice(GetVersionText()); Notice("Startup directory: " + m_startupDirectory); if (null != m_consoleAppender) Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold)); } + + protected string GetVersionText() + { + return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); + } /// /// Console output is only possible if a console has been established. -- cgit v1.1 From cb14e1d2720fdee0c77280d7c397c02116c278ca Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 21 Jan 2011 23:59:55 +0000 Subject: Update the "config get
" command to "config get [
] []" The config get command shows a current config value on the console. Now, if is omitted then all the values for the given section are printed. If
is ommitted then all sections and all keys are printed. Current config can also be dumped to a file using "config save ". This can be handy for resolving or eliminating config issues --- OpenSim/Framework/Console/ConsoleBase.cs | 5 +++++ OpenSim/Framework/Servers/BaseOpenSimServer.cs | 14 ++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index 22ce880..3ef76cf 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -75,6 +75,11 @@ namespace OpenSim.Framework.Console { System.Console.WriteLine(text); } + + public virtual void OutputFormat(string format, params string[] components) + { + Output(string.Format(format, components)); + } public string CmdPrompt(string p) { diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 147fbd5..b28ad69 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -411,6 +411,7 @@ namespace OpenSim.Framework.Servers /// That is something that cannot be determined within this class. So /// all attempts to use the console MUST be verified. ///
+ /// protected void Notice(string msg) { if (m_console != null) @@ -418,6 +419,19 @@ namespace OpenSim.Framework.Servers m_console.Output(msg); } } + + /// + /// Console output is only possible if a console has been established. + /// That is something that cannot be determined within this class. So + /// all attempts to use the console MUST be verified. + /// + /// + /// + protected void Notice(string format, params string[] components) + { + if (m_console != null) + m_console.OutputFormat(format, components); + } /// /// Enhance the version string with extra information if it's available. -- cgit v1.1 From c4727645b864a92fc489427c516ccab3a21c2d91 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 25 Jan 2011 14:23:58 -0800 Subject: Removed a few more spurious appearance saves. When an avatar enters a region the attachments module tries to update the appearance with attachments that are already part of the appearance. Just added a check to only save if the attachments weren't there before. --- OpenSim/Framework/AvatarAppearance.cs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 18a5733..5a6b265 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -427,19 +427,30 @@ namespace OpenSim.Framework /// 0x80 bit set then we assume this is an append /// operation otherwise we replace whatever is /// currently attached at the attachpoint + /// return true if something actually changed /// - public void SetAttachment(int attachpoint, UUID item, UUID asset) + public bool SetAttachment(int attachpoint, UUID item, UUID asset) { if (attachpoint == 0) - return; + return false; if (item == UUID.Zero) { if (m_attachments.ContainsKey(attachpoint)) + { m_attachments.Remove(attachpoint); - return; + return true; + } + return false; } + // check if the item is already attached at this point + if (GetAttachpoint(item) == (attachpoint & 0x7F)) + { + // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item); + return false; + } + // check if this is an append or a replace, 0x80 marks it as an append if ((attachpoint & 0x80) > 0) { @@ -451,6 +462,7 @@ namespace OpenSim.Framework { ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); } + return true; } public int GetAttachpoint(UUID itemID) @@ -465,7 +477,7 @@ namespace OpenSim.Framework return 0; } - public void DetachAttachment(UUID itemID) + public bool DetachAttachment(UUID itemID) { foreach (KeyValuePair> kvp in m_attachments) { @@ -478,9 +490,10 @@ namespace OpenSim.Framework // And remove the list if there are no more attachments here if (m_attachments[kvp.Key].Count == 0) m_attachments.Remove(kvp.Key); - return; + return true; } } + return false; } public void ClearAttachments() -- cgit v1.1 From a0469daf759d09de040aa8b5287fab9a83555cc1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 26 Jan 2011 21:12:41 +0000 Subject: Implement command "land show". This shows all the parcels on the currently selected region/s This is useful for diagnostics. The command is "land show" rather than "show land" because it's implemented as a module specific subcommand. --- OpenSim/Framework/Console/ConsoleBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index 3ef76cf..c59fbca 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -76,7 +76,7 @@ namespace OpenSim.Framework.Console System.Console.WriteLine(text); } - public virtual void OutputFormat(string format, params string[] components) + public virtual void OutputFormat(string format, params object[] components) { Output(string.Format(format, components)); } -- cgit v1.1