diff --git a/.gitignore b/.gitignore index e2bef71802..c8990d2f67 100644 --- a/.gitignore +++ b/.gitignore @@ -73,4 +73,20 @@ TAGS Makefile.local bin/.version compile.bat - +addon-modules +OpenSim/Data/Tests/test-results/ +OpenSim/Framework/Serialization/Tests/test-results/ +OpenSim/Framework/Servers/Tests/test-results/ +OpenSim/Framework/Tests/test-results/ +OpenSim/Region/ClientStack/Linden/Caps/test-results/ +OpenSim/Region/ClientStack/Linden/UDP/Tests/test-results/ +OpenSim/Region/CoreModules/test-results/ +OpenSim/Region/Framework/test-results/ +OpenSim/Region/OptionalModules/test-results/ +OpenSim/Region/Physics/BulletDotNETPlugin/ +OpenSim/Region/Physics/Manager/test-results/ +OpenSim/Region/Physics/OdePlugin/Tests/test-results/ +OpenSim/Region/ScriptEngine/test-results/ +OpenSim/Tests/Common/test-results/ +OpenSim/Tests/test-results/ +test-results/ diff --git a/.nant/local.include b/.nant/local.include index 955c2e53a0..698af3f993 100644 --- a/.nant/local.include +++ b/.nant/local.include @@ -303,6 +303,11 @@ + + + + + diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs index f4605da0b8..7c003eaf81 100644 --- a/OpenSim/ConsoleClient/ConsoleClient.cs +++ b/OpenSim/ConsoleClient/ConsoleClient.cs @@ -33,6 +33,7 @@ using System.IO; using System.Xml; using System.Collections.Generic; using OpenSim.Server.Base; +using OpenSim.Framework; using OpenSim.Framework.Console; using OpenMetaverse; diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index b4ce8773af..7afa68a79c 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs @@ -33,7 +33,7 @@ using System.Reflection; using System.Xml; using log4net; using OpenMetaverse; -using OpenSim.Framework.Console; +//using OpenSim.Framework.Console; namespace OpenSim.Framework { diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index be36cf2c10..f10b85794d 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -33,12 +33,11 @@ using System.Reflection; using System.Text; using System.Threading; using log4net; +using OpenSim.Framework; namespace OpenSim.Framework.Console { - public delegate void CommandDelegate(string module, string[] cmd); - - public class Commands + public class Commands : ICommands { /// /// Encapsulates a command that can be invoked from the console @@ -564,14 +563,16 @@ namespace OpenSim.Framework.Console /// /// A console that processes commands internally /// - public class CommandConsole : ConsoleBase + public class CommandConsole : ConsoleBase, ICommandConsole { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public Commands Commands = new Commands(); + public ICommands Commands { get; private set; } public CommandConsole(string defaultPrompt) : base(defaultPrompt) { + Commands = new Commands(); + Commands.AddCommand("console", false, "help", "help []", "Get general command list or more detailed help on a specific command", Help); } diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index c59fbca074..4b375d9963 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework.Console protected string prompt = "# "; - public object ConsoleScene = null; + public object ConsoleScene { get; set; } /// /// The default prompt text. diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs new file mode 100644 index 0000000000..d33b9b5772 --- /dev/null +++ b/OpenSim/Framework/ICommandConsole.cs @@ -0,0 +1,90 @@ +/* + * 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.Xml; + +namespace OpenSim.Framework +{ + public delegate void CommandDelegate(string module, string[] cmd); + + public interface ICommands + { + void FromXml(XmlElement root, CommandDelegate fn); + + /// + /// Get help for the given help string + /// + /// Parsed parts of the help string. If empty then general help is returned. + /// + List GetHelp(string[] cmd); + + /// + /// Add a command to those which can be invoked from the console. + /// + /// + /// + /// + /// + /// + void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn); + + /// + /// Add a command to those which can be invoked from the console. + /// + /// + /// + /// + /// + /// + /// + void AddCommand(string module, bool shared, string command, + string help, string longhelp, string descriptivehelp, + CommandDelegate fn); + + string[] FindNextOption(string[] cmd, bool term); + + string[] Resolve(string[] cmd); + + XmlElement GetXml(XmlDocument doc); + } + + public interface ICommandConsole : IConsole + { + ICommands Commands { get; } + + /// + /// Display a command prompt on the console and wait for user input + /// + void Prompt(); + + void RunCommand(string cmd); + + string ReadLine(string p, bool isCommand, bool e); + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IConsole.cs b/OpenSim/Framework/IConsole.cs new file mode 100644 index 0000000000..33024b2076 --- /dev/null +++ b/OpenSim/Framework/IConsole.cs @@ -0,0 +1,53 @@ +/* + * 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 +{ + public interface IConsole + { + object ConsoleScene { get; } + + void Output(string text, string level); + void Output(string text); + void OutputFormat(string format, params object[] components); + + string CmdPrompt(string p); + string CmdPrompt(string p, string def); + string CmdPrompt(string p, List excludedCharacters); + string CmdPrompt(string p, string def, List excludedCharacters); + + // Displays a command prompt and returns a default value, user may only enter 1 of 2 options + string CmdPrompt(string prompt, string defaultresponse, List options); + + // Displays a prompt and waits for the user to enter a string, then returns that string + // (Done with no echo and suitable for passwords) + string PasswdPrompt(string p); + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index e0cb897e40..f1b4732bf0 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -26,7 +26,7 @@ */ using OpenMetaverse; -using OpenSim.Framework.Console; +//using OpenSim.Framework.Console; using Nini.Config; namespace OpenSim.Framework @@ -108,7 +108,7 @@ namespace OpenSim.Framework void RegisterModuleInterface(M mod); void StackModuleInterface(M mod); - void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback); +// void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback); ISceneObject DeserializeObject(string representation); diff --git a/OpenSim/Framework/Console/MainConsole.cs b/OpenSim/Framework/MainConsole.cs similarity index 93% rename from OpenSim/Framework/Console/MainConsole.cs rename to OpenSim/Framework/MainConsole.cs index 24be6178db..4527b68a75 100644 --- a/OpenSim/Framework/Console/MainConsole.cs +++ b/OpenSim/Framework/MainConsole.cs @@ -25,13 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -namespace OpenSim.Framework.Console +namespace OpenSim.Framework { public class MainConsole { - private static CommandConsole instance; + private static ICommandConsole instance; - public static CommandConsole Instance + public static ICommandConsole Instance { get { return instance; } set { instance = value; } diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index b0202fbf99..db6c26fed0 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -36,7 +36,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; -using OpenSim.Framework.Console; +//using OpenSim.Framework.Console; namespace OpenSim.Framework { diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 64b9c3ed17..66d0813b1d 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -192,6 +192,15 @@ namespace OpenSim.Framework.Servers m_console.Commands.AddCommand("base", false, "show version", "show version", "Show server version", HandleShow); + + m_console.Commands.AddCommand("base", false, "threads abort", + "threads abort ", + "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort); + + m_console.Commands.AddCommand("base", false, "threads show", + "threads show", + "Show thread status. Synonym for \"show threads\"", + (string module, string[] args) => Notice(GetThreadsReport())); } } @@ -395,6 +404,27 @@ namespace OpenSim.Framework.Servers break; } } + + public virtual void HandleThreadsAbort(string module, string[] cmd) + { + if (cmd.Length != 3) + { + MainConsole.Instance.Output("Usage: threads abort "); + return; + } + + int threadId; + if (!int.TryParse(cmd[2], out threadId)) + { + MainConsole.Instance.Output("ERROR: Thread id must be an integer"); + return; + } + + if (Watchdog.AbortThread(threadId)) + MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId); + else + MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId); + } protected void ShowInfo() { diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs index 65b1eb5699..fd77984c22 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs @@ -49,7 +49,7 @@ namespace OpenSim.Framework.Servers.HttpServer /// /// Add a handler for an HTTP request. /// - /// + /// /// This handler can actually be invoked either as /// /// http://:/?method= @@ -70,7 +70,7 @@ namespace OpenSim.Framework.Servers.HttpServer /// In addition, the handler invoked by the HTTP server for any request is the one when best matches the request /// URI. So if a handler for "/myapp/" is registered and a request for "/myapp/page" is received, then /// the "/myapp/" handler is invoked if no "/myapp/page" handler exists. - /// + /// /// /// /// diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 0840a9db7d..d9965b6a64 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -31,6 +31,7 @@ using System.Threading; using System.Reflection; using log4net; using HttpServer; +using OpenSim.Framework; namespace OpenSim.Framework.Servers.HttpServer { @@ -54,21 +55,27 @@ namespace OpenSim.Framework.Servers.HttpServer m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; //startup worker threads - for (uint i=0;i 0; tc++) { //Loop over number of requests each thread handles. - for (int i=0;i 0;i++) + for (int i = 0; i < reqperthread && m_requests.Count > 0; i++) { try { @@ -125,14 +133,14 @@ namespace OpenSim.Framework.Servers.HttpServer } - - ~PollServiceRequestManager() { foreach (object o in m_requests) { PollServiceHttpRequest req = (PollServiceHttpRequest) o; - m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + m_server.DoHTTPGruntWork( + req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), + new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); } m_requests.Clear(); @@ -144,4 +152,4 @@ namespace OpenSim.Framework.Servers.HttpServer m_running = false; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index b91496be2a..16e56d2060 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -59,7 +59,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_timeout = pTimeout; } - public void ThreadStart(object o) + public void ThreadStart() { Run(); } diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs similarity index 98% rename from OpenSim/Framework/MainServer.cs rename to OpenSim/Framework/Servers/MainServer.cs index a3e0a26bb7..b8ab8d9b26 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -31,7 +31,7 @@ using System.Net; using log4net; using OpenSim.Framework.Servers.HttpServer; -namespace OpenSim.Framework +namespace OpenSim.Framework.Servers { public class MainServer { diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 3389ecb014..e26a6f28ad 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -40,19 +40,31 @@ namespace OpenSim.Framework { /// Timer interval in milliseconds for the watchdog timer const double WATCHDOG_INTERVAL_MS = 2500.0d; + /// Maximum timeout in milliseconds before a thread is considered dead const int WATCHDOG_TIMEOUT_MS = 5000; [System.Diagnostics.DebuggerDisplay("{Thread.Name}")] public class ThreadWatchdogInfo { - public Thread Thread; - public int LastTick; + public Thread Thread { get; private set; } + public int LastTick { get; set; } - public ThreadWatchdogInfo(Thread thread) + /// + /// Number of milliseconds before we notify that the thread is having a problem. + /// + public int Timeout { get; set; } + + /// + /// Is this thread considered timed out? + /// + public bool IsTimedOut { get; set; } + + public ThreadWatchdogInfo(Thread thread, int timeout) { Thread = thread; - LastTick = Environment.TickCount; + Timeout = timeout; + LastTick = Environment.TickCount & Int32.MaxValue; } } @@ -82,7 +94,7 @@ namespace OpenSim.Framework } /// - /// Start a new thread that is tracked by the watchdog timer + /// Start a new thread that is tracked by the watchdog timer. /// /// The method that will be executed in a new thread /// A name to give to the new thread @@ -91,6 +103,24 @@ namespace OpenSim.Framework /// thread, otherwise false /// The newly created Thread object public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground) + { + return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS); + } + + /// + /// Start a new thread that is tracked by the watchdog timer + /// + /// The method that will be executed in a new thread + /// A name to give to the new thread + /// Priority to run the thread at + /// True to run this thread as a background + /// thread, otherwise false + /// + /// Number of milliseconds to wait until we issue a warning about timeout. + /// + /// The newly created Thread object + public static Thread StartThread( + ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout) { Thread thread = new Thread(start); thread.Name = name; @@ -98,6 +128,13 @@ namespace OpenSim.Framework thread.IsBackground = isBackground; thread.Start(); + ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout); + + m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")"); + + lock (m_threads) + m_threads.Add(twi.Thread.ManagedThreadId, twi); + return thread; } @@ -112,27 +149,40 @@ namespace OpenSim.Framework /// /// Stops watchdog tracking on the current thread /// - /// True if the thread was removed from the list of tracked - /// threads, otherwise false + /// + /// True if the thread was removed from the list of tracked + /// threads, otherwise false + /// public static bool RemoveThread() { return RemoveThread(Thread.CurrentThread.ManagedThreadId); } - private static void AddThread(ThreadWatchdogInfo threadInfo) - { - m_log.Debug("[WATCHDOG]: Started tracking thread \"" + threadInfo.Thread.Name + "\" (ID " + threadInfo.Thread.ManagedThreadId + ")"); - - lock (m_threads) - m_threads.Add(threadInfo.Thread.ManagedThreadId, threadInfo); - } - - public static bool RemoveThread(int threadID) + private static bool RemoveThread(int threadID) { lock (m_threads) return m_threads.Remove(threadID); } + public static bool AbortThread(int threadID) + { + lock (m_threads) + { + if (m_threads.ContainsKey(threadID)) + { + ThreadWatchdogInfo twi = m_threads[threadID]; + twi.Thread.Abort(); + RemoveThread(threadID); + + return true; + } + else + { + return false; + } + } + } + private static void UpdateThread(int threadID) { ThreadWatchdogInfo threadInfo; @@ -144,9 +194,14 @@ namespace OpenSim.Framework try { if (m_threads.TryGetValue(threadID, out threadInfo)) - threadInfo.LastTick = Environment.TickCount; + { + threadInfo.LastTick = Environment.TickCount & Int32.MaxValue; + threadInfo.IsTimedOut = false; + } else - AddThread(new ThreadWatchdogInfo(Thread.CurrentThread)); + { + m_log.WarnFormat("[WATCHDOG]: Asked to update thread {0} which is not being monitored", threadID); + } } catch { } } @@ -157,7 +212,8 @@ namespace OpenSim.Framework /// public static ThreadWatchdogInfo[] GetThreads() { - return m_threads.Values.ToArray(); + lock (m_threads) + return m_threads.Values.ToArray(); } private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) @@ -174,10 +230,16 @@ namespace OpenSim.Framework foreach (ThreadWatchdogInfo threadInfo in m_threads.Values) { - if (threadInfo.Thread.ThreadState == ThreadState.Stopped || now - threadInfo.LastTick >= WATCHDOG_TIMEOUT_MS) + if (threadInfo.Thread.ThreadState == ThreadState.Stopped) { timedOut = threadInfo; - m_threads.Remove(threadInfo.Thread.ManagedThreadId); + RemoveThread(threadInfo.Thread.ManagedThreadId); + break; + } + else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) + { + threadInfo.IsTimedOut = true; + timedOut = threadInfo; break; } } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 971c0b7f79..60c1e15a82 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -39,9 +39,7 @@ using System.Text; using System.Web; using System.Xml; using System.Xml.Serialization; - using log4net; -using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse.StructuredData; namespace OpenSim.Framework @@ -65,35 +63,35 @@ namespace OpenSim.Framework // a "long" call for warning & debugging purposes public const int LongCallTime = 500; - /// - /// Send LLSD to an HTTP client in application/llsd+json form - /// - /// HTTP response to send the data in - /// LLSD to send to the client - public static void SendJSONResponse(OSHttpResponse response, OSDMap body) - { - byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body)); - - response.ContentEncoding = Encoding.UTF8; - response.ContentLength = responseData.Length; - response.ContentType = "application/llsd+json"; - response.Body.Write(responseData, 0, responseData.Length); - } - - /// - /// Send LLSD to an HTTP client in application/llsd+xml form - /// - /// HTTP response to send the data in - /// LLSD to send to the client - public static void SendXMLResponse(OSHttpResponse response, OSDMap body) - { - byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body); - - response.ContentEncoding = Encoding.UTF8; - response.ContentLength = responseData.Length; - response.ContentType = "application/llsd+xml"; - response.Body.Write(responseData, 0, responseData.Length); - } +// /// +// /// Send LLSD to an HTTP client in application/llsd+json form +// /// +// /// HTTP response to send the data in +// /// LLSD to send to the client +// public static void SendJSONResponse(OSHttpResponse response, OSDMap body) +// { +// byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body)); +// +// response.ContentEncoding = Encoding.UTF8; +// response.ContentLength = responseData.Length; +// response.ContentType = "application/llsd+json"; +// response.Body.Write(responseData, 0, responseData.Length); +// } +// +// /// +// /// Send LLSD to an HTTP client in application/llsd+xml form +// /// +// /// HTTP response to send the data in +// /// LLSD to send to the client +// public static void SendXMLResponse(OSHttpResponse response, OSDMap body) +// { +// byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body); +// +// response.ContentEncoding = Encoding.UTF8; +// response.ContentLength = responseData.Length; +// response.ContentType = "application/llsd+xml"; +// response.Body.Write(responseData, 0, responseData.Length); +// } /// /// Make a GET or GET-like request to a web service that returns LLSD diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e7ee8c407c..5ff9a38982 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -37,6 +37,7 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; using OpenSim.Framework.Statistics; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index 2ca02c5c57..a5209b7aec 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs @@ -34,6 +34,7 @@ using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.ClientStack.Linden; using OpenSim.Region.CoreModules.Framework; diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index f343f80237..80957b4f7b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog } else { - OpenSim.Framework.Console.MainConsole.Instance.Output( + MainConsole.Instance.Output( "Usage: alert | alert-user "); return; } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 4350cde6ba..a5131ecad0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -36,6 +36,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Communications; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index eb14603a36..72b448b9d6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs @@ -36,6 +36,7 @@ using Nwc.XmlRpc; using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index c1caf44770..ff743542eb 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -34,6 +34,7 @@ using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 7ae304c298..babeaabee6 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs @@ -35,6 +35,7 @@ using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Capabilities.Caps; diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index a75d94adaf..3f466be6fe 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs @@ -33,6 +33,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts; using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs index b7d3904db2..2cc0a0797f 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs @@ -37,6 +37,7 @@ using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 07999d16c1..f3677390a9 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -40,6 +40,7 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Capabilities; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Capabilities.Caps; diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index b6af1f2059..458426b440 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -34,6 +34,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs index 422f394d7a..554168499a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs index 2b5beba374..ccf22755b9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs index f29c074206..0e16e5ab82 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index a5b5637961..89abbb225b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs index 53a8ace14c..831ea27bd1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Server.Base; @@ -59,9 +60,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory { m_log.Info("[INVENTORY IN CONNECTOR]: Inventory Service In Connector enabled"); } - } - } public void PostInitialise() diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index fc642032b5..c8f45f69b9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs index f759470b28..ecdb380209 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs index e5af1f4133..d38af23dd1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs @@ -32,6 +32,7 @@ using log4net; using Mono.Addins; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs index 5c3263260e..3fd89b9b24 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs index 86b4926ac5..0a5275d3d0 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8c7ce24682..b2f5279c2c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1203,7 +1203,7 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); HeartbeatThread.Abort(); - Watchdog.RemoveThread(HeartbeatThread.ManagedThreadId); + Watchdog.AbortThread(HeartbeatThread.ManagedThreadId); HeartbeatThread = null; } m_lastUpdate = Util.EnvironmentTickCount(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c1097e4797..6e20d14d99 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2137,10 +2137,6 @@ namespace OpenSim.Region.Framework.Scenes public void PhysicsCollision(EventArgs e) { // single threaded here - if (e == null) - { - return; - } CollisionEventUpdate a = (CollisionEventUpdate)e; Dictionary collissionswith = a.m_objCollisionList; @@ -2302,6 +2298,7 @@ namespace OpenSim.Region.Framework.Scenes }); } } + if (colliding.Count > 0) { StartCollidingMessage.Colliders = colliding; @@ -2309,10 +2306,11 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup.Scene == null) return; - if (m_parentGroup.PassCollision == true) - { - //TODO: Add pass to root prim! - } +// if (m_parentGroup.PassCollision == true) +// { +// //TODO: Add pass to root prim! +// } + m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 99707637ae..0f13050656 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3649,9 +3649,6 @@ namespace OpenSim.Region.Framework.Scenes // Event called by the physics plugin to tell the avatar about a collision. private void PhysicsCollisionUpdate(EventArgs e) { - if (e == null) - return; - //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 39bb43a628..c5a76b2683 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -32,6 +32,7 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs index d49a4899ca..913d934cf3 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs @@ -34,6 +34,7 @@ using log4net; using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs index 97fa63cb45..74c51391c1 100644 --- a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index d469548236..54d4e92e8b 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -36,7 +36,7 @@ using Nwc.XmlRpc; using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; - +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs index cee8851c3a..48c242db51 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs @@ -36,6 +36,7 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Server.Base; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 682eb80234..9a6857bea4 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -443,7 +443,7 @@ public class BSCharacter : PhysicsActor Dictionary contactPoints = new Dictionary(); contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); - CollisionEventUpdate args = new CollisionEventUpdate(LocalID, (int)type, 1, contactPoints); + CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); base.SendCollisionUpdate(args); } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index bb8d601ad8..8782e6277b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1350,7 +1350,7 @@ public sealed class BSPrim : PhysicsActor // create the event for the collision Dictionary contactPoints = new Dictionary(); contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); - CollisionEventUpdate args = new CollisionEventUpdate(LocalID, (int)type, 1, contactPoints); + CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); base.SendCollisionUpdate(args); } } diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs index 1bce7607e5..58e2e4c728 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs @@ -1299,7 +1299,7 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_eventsubscription > 0) { - CollisionEventsThisFrame.addCollider(CollidedWith, contact); + CollisionEventsThisFrame.AddCollider(CollidedWith, contact); } } diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs index 82f1b942e4..5f802d0632 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs @@ -2438,7 +2438,7 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!"); { if (CollisionEventsThisFrame == null) CollisionEventsThisFrame = new CollisionEventUpdate(); - CollisionEventsThisFrame.addCollider(CollidedWith, contact); + CollisionEventsThisFrame.AddCollider(CollidedWith, contact); } public void SendCollisions() diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 96dcfb6b0a..362f997e18 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -66,42 +66,29 @@ namespace OpenSim.Region.Physics.Manager } } + /// + /// Used to pass collision information to OnCollisionUpdate listeners. + /// public class CollisionEventUpdate : EventArgs { - // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. + /// + /// Number of collision events in this update. + /// + public int Count { get { return m_objCollisionList.Count; } } - public int m_colliderType; - public int m_GenericStartEnd; - //public uint m_LocalID; - public Dictionary m_objCollisionList = new Dictionary(); + public Dictionary m_objCollisionList; - public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary objCollisionList) + public CollisionEventUpdate(Dictionary objCollisionList) { - m_colliderType = colliderType; - m_GenericStartEnd = GenericStartEnd; m_objCollisionList = objCollisionList; } public CollisionEventUpdate() { - m_colliderType = (int) ActorTypes.Unknown; - m_GenericStartEnd = 1; m_objCollisionList = new Dictionary(); } - public int collidertype - { - get { return m_colliderType; } - set { m_colliderType = value; } - } - - public int GenericStartEnd - { - get { return m_GenericStartEnd; } - set { m_GenericStartEnd = value; } - } - - public void addCollider(uint localID, ContactPoint contact) + public void AddCollider(uint localID, ContactPoint contact) { if (!m_objCollisionList.ContainsKey(localID)) { @@ -113,6 +100,14 @@ namespace OpenSim.Region.Physics.Manager m_objCollisionList[localID] = contact; } } + + /// + /// Clear added collision events. + /// + public void Clear() + { + m_objCollisionList.Clear(); + } } public abstract class PhysicsActor @@ -127,7 +122,13 @@ namespace OpenSim.Region.Physics.Manager public event VelocityUpdate OnVelocityUpdate; public event OrientationUpdate OnOrientationUpdate; public event RequestTerseUpdate OnRequestTerseUpdate; + + /// + /// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event + /// object is reused in subsequent physics frames. + /// public event CollisionUpdate OnCollisionUpdate; + public event OutOfBounds OnOutOfBounds; #pragma warning restore 67 diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index e9bab66320..c22d27fdff 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1210,11 +1210,13 @@ namespace OpenSim.Region.Physics.OdePlugin { m_requestedUpdateFrequency = ms; m_eventsubscription = ms; + CollisionEventsThisFrame.Clear(); _parent_scene.AddCollisionEventReporting(this); } public override void UnSubscribeEvents() { + CollisionEventsThisFrame.Clear(); _parent_scene.RemoveCollisionEventReporting(this); m_requestedUpdateFrequency = 0; m_eventsubscription = 0; @@ -1227,7 +1229,7 @@ namespace OpenSim.Region.Physics.OdePlugin // m_log.DebugFormat( // "[PHYSICS]: Adding collision event for {0}, collidedWith {1}, contact {2}", "", CollidedWith, contact); - CollisionEventsThisFrame.addCollider(CollidedWith, contact); + CollisionEventsThisFrame.AddCollider(CollidedWith, contact); } } @@ -1235,11 +1237,9 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_eventsubscription > m_requestedUpdateFrequency) { - if (CollisionEventsThisFrame != null) - { - base.SendCollisionUpdate(CollisionEventsThisFrame); - } - CollisionEventsThisFrame = new CollisionEventUpdate(); + base.SendCollisionUpdate(CollisionEventsThisFrame); + + CollisionEventsThisFrame.Clear(); m_eventsubscription = 0; } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 6638cbd4fe..3a17511f2d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -191,7 +191,7 @@ namespace OpenSim.Region.Physics.OdePlugin private d.Mass pMass; private int m_eventsubscription; - private CollisionEventUpdate CollisionEventsThisFrame; + private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); private IntPtr m_linkJoint = IntPtr.Zero; @@ -3020,23 +3020,13 @@ Console.WriteLine(" JointCreateFixed"); public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { - if (CollisionEventsThisFrame == null) - CollisionEventsThisFrame = new CollisionEventUpdate(); - - CollisionEventsThisFrame.addCollider(CollidedWith, contact); + CollisionEventsThisFrame.AddCollider(CollidedWith, contact); } public void SendCollisions() { - if (CollisionEventsThisFrame == null) - return; - - base.SendCollisionUpdate(CollisionEventsThisFrame); - - if (CollisionEventsThisFrame.m_objCollisionList.Count == 0) - CollisionEventsThisFrame = null; - else - CollisionEventsThisFrame = new CollisionEventUpdate(); + if (CollisionEventsThisFrame.Count > 0) + base.SendCollisionUpdate(CollisionEventsThisFrame); } public override bool SubscribedEvents() diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 0810ae0e0e..c3279c6911 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1633,6 +1633,8 @@ namespace OpenSim.Region.Physics.OdePlugin /// internal void AddCollisionEventReporting(PhysicsActor obj) { +// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName); + lock (_collisionEventPrim) { if (!_collisionEventPrim.Contains(obj)) @@ -1646,11 +1648,10 @@ namespace OpenSim.Region.Physics.OdePlugin /// internal void RemoveCollisionEventReporting(PhysicsActor obj) { +// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName); + lock (_collisionEventPrim) - { - if (!_collisionEventPrim.Contains(obj)) - _collisionEventPrim.Remove(obj); - } + _collisionEventPrim.Remove(obj); } #region Add/Remove Entities @@ -2859,14 +2860,14 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); { //if (timeStep < 0.2f) { - foreach (OdePrim actor in _activeprims) + foreach (OdePrim prim in _activeprims) { - if (actor.IsPhysical && (d.BodyIsEnabled(actor.Body) || !actor._zeroFlag)) + if (prim.IsPhysical && (d.BodyIsEnabled(prim.Body) || !prim._zeroFlag)) { - actor.UpdatePositionAndVelocity(); + prim.UpdatePositionAndVelocity(); if (SupportsNINJAJoints) - SimulateActorPendingJoints(actor); + SimulateActorPendingJoints(prim); } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0e0c2b79cd..e53fd5da9f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3648,12 +3648,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) { m_host.AddScriptLPS(1); - m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); - m_host.ScheduleTerseUpdate(); - m_host.SendTerseUpdateToAllClients(); - m_host.ParentGroup.HasGroupChanged = true; + TargetOmega(m_host, axis, spinrate, gain); } + protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) + { + part.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); + part.ScheduleTerseUpdate(); + part.SendTerseUpdateToAllClients(); + part.ParentGroup.HasGroupChanged = true; + } + public LSL_Integer llGetStartParameter() { m_host.AddScriptLPS(1); @@ -7936,6 +7941,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Rotation lr = rules.GetQuaternionItem(idx++); SetRot(part, Rot2Quaternion(lr)); break; + case (int)ScriptBaseClass.PRIM_OMEGA: + if (remain < 3) + return; + LSL_Vector axis = rules.GetVector3Item(idx++); + LSL_Float spinrate = rules.GetLSLFloatItem(idx++); + LSL_Float gain = rules.GetLSLFloatItem(idx++); + TargetOmega(part, axis, (double)spinrate, (double)gain); + break; + case (int)ScriptBaseClass.PRIM_LINK_TARGET: + if (remain < 1) + return; + LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); + part = part.ParentGroup.GetLinkNumPart((int)new_linknumber); + break; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ed2f221a10..ab0eec9c04 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -113,11 +113,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { public List AllowedCreators; public List AllowedOwners; + public List AllowedOwnerClasses; public FunctionPerms() { AllowedCreators = new List(); AllowedOwners = new List(); + AllowedOwnerClasses = new List(); } } @@ -254,6 +256,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Default behavior perms.AllowedOwners = null; perms.AllowedCreators = null; + perms.AllowedOwnerClasses = null; } else { @@ -274,12 +277,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (string id in ids) { string current = id.Trim(); - UUID uuid; - - if (UUID.TryParse(current, out uuid)) + if (current.ToUpper() == "PARCEL_GROUP_MEMBER" || current.ToUpper() == "PARCEL_OWNER" || current.ToUpper() == "ESTATE_MANAGER" || current.ToUpper() == "ESTATE_OWNER") { - if (uuid != UUID.Zero) - perms.AllowedOwners.Add(uuid); + if (!perms.AllowedOwnerClasses.Contains(current)) + perms.AllowedOwnerClasses.Add(current.ToUpper()); + } + else + { + UUID uuid; + + if (UUID.TryParse(current, out uuid)) + { + if (uuid != UUID.Zero) + perms.AllowedOwners.Add(uuid); + } } } @@ -335,11 +346,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api String.Format("{0} permission error. Can't find script in prim inventory.", function)); } + + UUID ownerID = ti.OwnerID; + + //OSSL only may be used if objet is in the same group as the parcel + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) + { + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) + { + return; + } + } + + //Only Parcelowners may use the function + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) + { + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.LandData.OwnerID == ownerID) + { + return; + } + } + + //Only Estate Managers may use the function + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) + { + //Only Estate Managers may use the function + if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) + { + return; + } + } + + //Only regionowners may use the function + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_OWNER")) + { + if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) + { + return; + } + } + if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) OSSLError( String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", function)); - if (ti.CreatorID != ti.OwnerID) + if (ti.CreatorID != ownerID) { if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) OSSLError( diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 3af99119e6..a1cf3df91c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -322,6 +322,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_NAME = 27; public const int PRIM_DESC = 28; public const int PRIM_ROT_LOCAL = 29; + public const int PRIM_OMEGA = 32; + public const int PRIM_LINK_TARGET = 34; public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1; diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index bb5ce96757..d47155984f 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -31,6 +31,7 @@ using System.Threading; using System.Reflection; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using log4net; using Nini.Config; diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 2652ff2869..36e66650c2 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -30,6 +30,7 @@ using System.IO; using System.Xml; using System.Threading; using System.Reflection; +using OpenSim.Framework; using OpenSim.Framework.Console; using log4net; using log4net.Config; @@ -208,7 +209,7 @@ namespace OpenSim.Server.Base } else { - consoleAppender.Console = MainConsole.Instance; + consoleAppender.Console = (ConsoleBase)MainConsole.Instance; if (null == consoleAppender.Threshold) consoleAppender.Threshold = Level.All; diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index 002a294420..77110bf6b8 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -27,6 +27,7 @@ using System; using Nini.Config; +using OpenSim.Framework; using OpenSim.Framework.Console; namespace pCampBot diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example old mode 100644 new mode 100755 index 44da31cb86..80f4c0ed92 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -617,6 +617,13 @@ ; Comma separated list of UUIDS allows the function for that list of UUIDS ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb + + ; Comma separated list of owner classes that allow the function for a particular class of owners. Choices are + ; - PARCEL_GROUP_MEMBER: allow if objectgroup is the same group as the parcel + ; - PARCEL_OWNER: allow if the objectowner is parcelowner + ; - ESTATE_MANAGER: allow if the object owner is a estate manager + ; - ESTATE_OWNER: allow if objectowner is estateowner + ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb, PARCEL_OWNER, ESTATE_OWNER>, ... ; You can also use script creators as the uuid ; Creators_osSetRegionWaterHeight = , ... diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 306c17fbc8..de2f7870a3 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1196,6 +1196,13 @@ ; Comma separated list of UUIDS allows the function for that list of UUIDS ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb + + ; Comma separated list of owner classes that allow the function for a particular class of owners. Choices are + ; - PARCEL_GROUP_MEMBER: allow if objectgroup is the same group as the parcel + ; - PARCEL_OWNER: allow if the objectowner is parcelowner + ; - ESTATE_MANAGER: allow if the object owner is a estate manager + ; - ESTATE_OWNER: allow if objectowner is estateowner + ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb, PARCEL_OWNER, ESTATE_OWNER>, ... ; You can also use script creators as the uuid ; Creators_osSetRegionWaterHeight = , ... diff --git a/prebuild.xml b/prebuild.xml index 3dffd90b3c..49086ae368 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -55,68 +55,6 @@ --> - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - @@ -162,8 +100,8 @@ - - + + @@ -174,6 +112,70 @@ + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ../../../bin/ + + + + + ../../../bin/ + + + + ../../../bin/ + + + + + + + + + + + + + @@ -840,6 +842,7 @@ + @@ -1505,21 +1508,21 @@ + - + + + + + + - - - - - - @@ -3122,6 +3125,7 @@ +