From 2f394b7e7ebf991c7a70f93bf251d26d8043aaa2 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 01:30:12 -0700
Subject: * Allow SmartThreadPool to be initialized without setting max stack
size (like the original implementation) * Only initialize Util's
SmartThreadPool if it is actually being used * No longer initializing Util's
SmartThreadPool with a custom max stack size. From MSDN: "Avoid using this
constructor overload. The default stack size used by the Thread(ThreadStart)
constructor overload is the recommended stack size for threads."
---
OpenSim/Framework/Util.cs | 12 +++++++-----
OpenSim/Region/Application/OpenSim.cs | 7 ++++++-
ThirdParty/SmartThreadPool/SmartThreadPool.cs | 6 +++++-
bin/OpenSim.ini.example | 14 +++++++++-----
4 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index d09bd6d..167e34d 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -69,8 +69,6 @@ namespace OpenSim.Framework
///
public class Util
{
- private static SmartThreadPool m_ThreadPool = null;
-
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static uint nextXferID = 5000;
@@ -79,6 +77,9 @@ namespace OpenSim.Framework
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
private static object XferLock = new object();
+ /// Thread pool used for Util.FireAndForget if
+ /// FireAndForgetMethod.SmartThreadPool is used
+ private static SmartThreadPool m_ThreadPool;
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
private static readonly DateTime unixEpoch =
@@ -1319,8 +1320,11 @@ namespace OpenSim.Framework
FireAndForget(callback, null);
}
- public static void SetMaxThreads(int maxThreads)
+ public static void InitThreadPool(int maxThreads)
{
+ if (maxThreads < 2)
+ throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
+
if (m_ThreadPool != null)
return;
@@ -1328,9 +1332,7 @@ namespace OpenSim.Framework
startInfo.IdleTimeout = 2000; // 2 seconds
startInfo.MaxWorkerThreads = maxThreads;
startInfo.MinWorkerThreads = 2;
- startInfo.StackSize = 524288;
startInfo.ThreadPriority = ThreadPriority.Normal;
-
startInfo.StartSuspended = false;
m_ThreadPool = new SmartThreadPool(startInfo);
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index c04b8c2..26298e7 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -67,7 +67,7 @@ namespace OpenSim
IConfig startupConfig = m_config.Source.Configs["Startup"];
- Util.SetMaxThreads(startupConfig.GetInt("MaxPoolThreads", 15));
+ int stpMaxThreads = 15;
if (startupConfig != null)
{
@@ -100,8 +100,13 @@ namespace OpenSim
FireAndForgetMethod asyncCallMethod;
if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse(asyncCallMethodStr, out asyncCallMethod))
Util.FireAndForgetMethod = asyncCallMethod;
+
+ stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15);
}
+ if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
+ Util.InitThreadPool(stpMaxThreads);
+
m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
}
diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
index c21984e..bd52f62 100644
--- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs
+++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
@@ -499,7 +499,11 @@ namespace Amib.Threading
}
// Create a new thread
- Thread workerThread = new Thread(new ThreadStart(ProcessQueuedItems), _stpStartInfo.StackSize);
+ Thread workerThread;
+ if (_stpStartInfo.StackSize > 0)
+ workerThread = new Thread(ProcessQueuedItems, _stpStartInfo.StackSize);
+ else
+ workerThread = new Thread(ProcessQueuedItems);
// Configure the new thread and start it
workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 79d57d2..08f87d6 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -38,8 +38,15 @@
; Sets the method that OpenSim will use to fire asynchronous
; events. Valid values are UnsafeQueueUserWorkItem,
- ; QueueUserWorkItem, BeginInvoke, SmartThreadPool, and Thread
- ; async_call_method = SmartThreadPool
+ ; QueueUserWorkItem, BeginInvoke, SmartThreadPool, and Thread.
+ ; SmartThreadPool is reported to work well on Mono/Linux, but
+ ; UnsafeQueueUserWorkItem has been benchmarked with better
+ ; performance on .NET/Windows
+ ;async_call_method = SmartThreadPool
+
+ ; Max threads to allocate on the FireAndForget thread pool
+ ; when running with the SmartThreadPool option above
+ MaxPoolThreads = 15
; ##
; ## CLIENTS
@@ -51,9 +58,6 @@
; Set this to the DLL containing the client stack to use.
clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll"
- ; Max threads to allocate on the FireAndForget pool
- MaxPoolThreads = 15
-
; ##
; ## REGIONS
; ##
--
cgit v1.1
From 5d07e18980ce5969b26648332435d9f7e61b22b6 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 02:27:06 -0700
Subject: A synchronous call to the messaging server was blocking the process
of promoting an agent to a root agent (logins and teleports). Changed to an
async method
---
.../Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index ad05bab..f5ab454 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -274,8 +274,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
m_RootAgents[agentID] = scene;
}
+
// inform messaging server that agent changed the region
- NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
+ Util.FireAndForget(
+ delegate(object o)
+ {
+ NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
+ }
+ );
}
private void OnEconomyDataRequest(UUID agentID)
--
cgit v1.1
From d756fa01aea63e9b50be00a6f1f229ff7afef779 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Thu, 22 Oct 2009 18:57:14 +0900
Subject: Add copyright header. Formatting cleanup.
---
OpenSim/Framework/MinHeap.cs | 27 ++++++++++++++++++++++
.../Region/ClientStack/LindenUDP/LLClientView.cs | 2 +-
2 files changed, 28 insertions(+), 1 deletion(-)
mode change 100755 => 100644 OpenSim/Framework/MinHeap.cs
diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs
old mode 100755
new mode 100644
index ad39bbc..33d0364
--- a/OpenSim/Framework/MinHeap.cs
+++ b/OpenSim/Framework/MinHeap.cs
@@ -1,3 +1,30 @@
+/*
+ * 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.Threading;
using System.Collections;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 0ba76ec..5acf25f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -827,7 +827,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
for (int i = x1; i <= x2; i++)
SendLayerData(i, y1, map);
- // Column
+ // Column
for (int j = y1 + 1; j <= y2; j++)
SendLayerData(x2, j, map);
--
cgit v1.1
From 47d8b6c5f50a494bca520e2a8532c59561339963 Mon Sep 17 00:00:00 2001
From: Snowcrash
Date: Tue, 20 Oct 2009 15:51:19 +0200
Subject: Fix rounding error in PRIM_SIZE portion of llSetPrimitiveParams
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6e17639..c3e89f6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1263,11 +1263,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void SetScale(SceneObjectPart part, LSL_Vector scale)
{
// TODO: this needs to trigger a persistance save as well
-
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
-
- if (scale.x < 0.01 || scale.y < 0.01 || scale.z < 0.01)
+ // scale.x < 0.01 in a manner which handles rounding errors
+ if (Math.Round(scale.x - 0.01) > 0.0 || Math.Round(scale.y - 0.01) > 0.0 || Math.Round(scale.z - 0.01) > 0.0)
return;
if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical)
@@ -1279,12 +1278,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (scale.z > World.m_maxPhys)
scale.z = World.m_maxPhys;
}
+
if (scale.x > World.m_maxNonphys)
scale.x = World.m_maxNonphys;
if (scale.y > World.m_maxNonphys)
scale.y = World.m_maxNonphys;
if (scale.z > World.m_maxNonphys)
scale.z = World.m_maxNonphys;
+
Vector3 tmp = part.Scale;
tmp.X = (float)scale.x;
tmp.Y = (float)scale.y;
--
cgit v1.1
From 84ac0f56f5c6a52f975efa125e9128d559d47d0e Mon Sep 17 00:00:00 2001
From: Snowcrash
Date: Thu, 22 Oct 2009 15:48:21 +0200
Subject: Fixing the patch to the patch
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c3e89f6..435b6e3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1265,9 +1265,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// TODO: this needs to trigger a persistance save as well
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
- // scale.x < 0.01 in a manner which handles rounding errors
- if (Math.Round(scale.x - 0.01) > 0.0 || Math.Round(scale.y - 0.01) > 0.0 || Math.Round(scale.z - 0.01) > 0.0)
- return;
+ if (scale.x < 0.01)
+ scale.x = 0.01;
+ if (scale.y < 0.01)
+ scale.y = 0.01;
+ if (scale.z < 0.01)
+ scale.z = 0.01;
if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical)
{
--
cgit v1.1
From 5d12170df92b3bfad2862c40da9742fbc3cf219b Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 22 Oct 2009 17:41:42 +0100
Subject: Correct version number after merge
---
OpenSim/Framework/Servers/VersionInfo.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 62e7e92..9f98310 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,8 +29,8 @@ namespace OpenSim
{
public class VersionInfo
{
- private const string VERSION_NUMBER = "0.6.7";
- private const Flavour VERSION_FLAVOUR = Flavour.RC1;
+ private const string VERSION_NUMBER = "0.6.8";
+ private const Flavour VERSION_FLAVOUR = Flavour.Dev;
public enum Flavour
{
--
cgit v1.1
From 4121a02936b306895840cf1574197b0f6621c19e Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 10:15:28 -0700
Subject: OpenSim.ini.example had the wrong names for default values in the
[InterestManagement] section. Fixed
---
bin/OpenSim.ini.example | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 08f87d6..6ff70fc 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1396,12 +1396,13 @@
;TextureDataLimit = 5
[InterestManagement]
- ; This section controls how state updates are prioritized for each client
- UpdatePrioritizationScheme = Distance
- ReprioritizeUpdate = true
- RootUpdateReprioritizationDistance = 10.0
- ChildUpdateReprioritizationDistance = 20.0
- ReprioritizeUpdatesInterval = 5000.0
+ ; This section controls how state updates are prioritized for each client
+ ; Valid values are Time, Distance, and SimpleAngularDistance
+ UpdatePrioritizationScheme = Distance;
+ ReprioritizationEnabled = true;
+ ReprioritizationInterval = 2000.0;
+ RootReprioritizationDistance = 10.0;
+ ChildReprioritizationDistance = 20.0;
;;
;; These are defaults that are overwritten below in [Architecture].
--
cgit v1.1
From 6ca4b0f36622833688136e9ace7d5545063293ba Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 10:37:11 -0700
Subject: * Added a check if Util.m_ThreadPool is null before trying to use it,
and if so initialize it to sane defaults * Simplified the InitThreadPool()
function
---
OpenSim/Framework/Util.cs | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 167e34d..a18a827 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1324,18 +1324,10 @@ namespace OpenSim.Framework
{
if (maxThreads < 2)
throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
-
if (m_ThreadPool != null)
- return;
-
- STPStartInfo startInfo = new STPStartInfo();
- startInfo.IdleTimeout = 2000; // 2 seconds
- startInfo.MaxWorkerThreads = maxThreads;
- startInfo.MinWorkerThreads = 2;
- startInfo.ThreadPriority = ThreadPriority.Normal;
- startInfo.StartSuspended = false;
+ throw new InvalidOperationException("SmartThreadPool is already initialized");
- m_ThreadPool = new SmartThreadPool(startInfo);
+ m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2);
}
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
@@ -1343,20 +1335,22 @@ namespace OpenSim.Framework
switch (FireAndForgetMethod)
{
case FireAndForgetMethod.UnsafeQueueUserWorkItem:
- System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, obj);
+ ThreadPool.UnsafeQueueUserWorkItem(callback, obj);
break;
case FireAndForgetMethod.QueueUserWorkItem:
- System.Threading.ThreadPool.QueueUserWorkItem(callback, obj);
+ ThreadPool.QueueUserWorkItem(callback, obj);
break;
case FireAndForgetMethod.BeginInvoke:
FireAndForgetWrapper wrapper = Singleton.GetInstance();
wrapper.FireAndForget(callback, obj);
break;
case FireAndForgetMethod.SmartThreadPool:
+ if (m_ThreadPool != null)
+ m_ThreadPool = new SmartThreadPool(2000, 15, 2);
m_ThreadPool.QueueWorkItem(delegate(object o) { callback(o); return null; }, obj);
break;
case FireAndForgetMethod.Thread:
- System.Threading.Thread thread = new System.Threading.Thread(delegate(object o) { callback(o); });
+ Thread thread = new Thread(delegate(object o) { callback(o); });
thread.Start(obj);
break;
default:
--
cgit v1.1
From 36b0e5e1d3112212ef988a8b2e7c10284c7e9276 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 11:07:23 -0700
Subject: Terrible typo in the previous commit!
---
OpenSim/Framework/Util.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a18a827..b96367a 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1345,7 +1345,7 @@ namespace OpenSim.Framework
wrapper.FireAndForget(callback, obj);
break;
case FireAndForgetMethod.SmartThreadPool:
- if (m_ThreadPool != null)
+ if (m_ThreadPool == null)
m_ThreadPool = new SmartThreadPool(2000, 15, 2);
m_ThreadPool.QueueWorkItem(delegate(object o) { callback(o); return null; }, obj);
break;
--
cgit v1.1
From 227c832d3b86d47c7f097379bef6ff6ede519b72 Mon Sep 17 00:00:00 2001
From: KittoFlora
Date: Thu, 22 Oct 2009 21:14:00 +0200
Subject: Commented out instrumentation in ODEPrim.cs
---
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 864ea80..f59f0ae 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1564,6 +1564,8 @@ Console.WriteLine(" JointCreateFixed");
}
else
{
+//Console.WriteLine("Move " + m_primName);
+ if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
// NON-'VEHICLES' are dealt with here
if (d.BodyIsEnabled(Body) && !m_angularlock.IsIdentical(PhysicsVector.Zero, 0.003f))
{
@@ -1592,6 +1594,7 @@ Console.WriteLine(" JointCreateFixed");
if (m_usePID)
{
+//Console.WriteLine("PID " + m_primName);
// KF - this is for object move? eg. llSetPos() ?
//if (!d.BodyIsEnabled(Body))
//d.BodySetForce(Body, 0f, 0f, 0f);
@@ -1663,6 +1666,8 @@ Console.WriteLine(" JointCreateFixed");
// Hover PID Controller needs to be mutually exlusive to MoveTo PID controller
if (m_useHoverPID && !m_usePID)
{
+//Console.WriteLine("Hover " + m_primName);
+
// If we're using the PID controller, then we have no gravity
fz = (-1 * _parent_scene.gravityz) * m_mass;
@@ -1779,6 +1784,7 @@ Console.WriteLine(" JointCreateFixed");
if (fy < nmin)
fy = nmin;
d.BodyAddForce(Body, fx, fy, fz);
+//Console.WriteLine("AddForce " + fx + "," + fy + "," + fz);
}
}
}
@@ -1786,6 +1792,8 @@ Console.WriteLine(" JointCreateFixed");
{ // is not physical, or is not a body or is selected
// _zeroPosition = d.BodyGetPosition(Body);
return;
+//Console.WriteLine("Nothing " + m_primName);
+
}
}
--
cgit v1.1
From b2ed348aa2746fbf034b713d006e40366c479d5a Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 12:33:23 -0700
Subject: Implemented a Watchdog class. Do not manually create Thread objects
anymore, use Watchdog.StartThread(). While your thread is running call
Watchdog.UpdateThread(). When it is shutting down call
Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated
---
.../Client/MXP/PacketHandler/MXPPacketServer.cs | 5 +-
.../Framework/Servers/HttpServer/BaseHttpServer.cs | 8 -
.../HttpServer/PollServiceRequestManager.cs | 6 +-
OpenSim/Framework/Watchdog.cs | 183 +++++++++++++++++++++
.../UserServer.Modules/MessageServersConnector.cs | 8 +-
OpenSim/Region/Application/OpenSim.cs | 11 ++
.../Region/ClientStack/LindenUDP/LLUDPServer.cs | 19 ++-
.../InterGrid/OpenGridProtocolModule.cs | 15 +-
.../CoreModules/World/Archiver/AssetsRequest.cs | 8 +-
.../CoreModules/World/WorldMap/WorldMapModule.cs | 13 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 20 +--
.../Server/IRCClientView.cs | 10 +-
.../InternetRelayClientView/Server/IRCServer.cs | 7 +-
.../ContentManagementSystem/CMController.cs | 10 +-
.../DotNetEngine/EventQueueThreadClass.cs | 12 +-
.../ScriptEngine/DotNetEngine/MaintenanceThread.cs | 83 +++++-----
.../Api/Implementation/AsyncCommandManager.cs | 8 +-
17 files changed, 306 insertions(+), 120 deletions(-)
create mode 100644 OpenSim/Framework/Watchdog.cs
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
index ba9c653..63381a4 100644
--- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
+++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
@@ -85,10 +85,7 @@ namespace OpenSim.Client.MXP.PacketHandler
m_transmitter = new Transmitter(port);
- m_clientThread = new Thread(StartListener);
- m_clientThread.Name = "MXPThread";
- m_clientThread.IsBackground = true;
- m_clientThread.Start();
+ StartListener();
}
public void StartListener()
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 85d7be2..bec5ed3 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -1559,15 +1559,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public void Start()
{
m_log.Info("[HTTPD]: Starting up HTTP Server");
-
- //m_workerThread = new Thread(new ThreadStart(StartHTTP));
- //m_workerThread.Name = "HttpThread";
- //m_workerThread.IsBackground = true;
- //m_workerThread.Start();
- //ThreadTracker.Add(m_workerThread);
StartHTTP();
-
-
}
private void StartHTTP()
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 1c54581..e7a64f7 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -50,9 +50,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_WorkerThreadCount = pWorkerThreadCount;
m_workerThreads = new Thread[m_WorkerThreadCount];
m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
- m_watcherThread = new Thread(ThreadStart);
-
//startup worker threads
for (uint i=0;i
+ /// Manages launching threads and keeping watch over them for timeouts
+ ///
+ public static class Watchdog
+ {
+ /// 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}")]
+ private class ThreadWatchdogInfo
+ {
+ public Thread Thread;
+ public int LastTick;
+
+ public ThreadWatchdogInfo(Thread thread)
+ {
+ Thread = thread;
+ LastTick = Environment.TickCount & Int32.MaxValue;
+ }
+ }
+
+ ///
+ /// This event is called whenever a tracked thread is stopped or
+ /// has not called UpdateThread() in time
+ ///
+ /// The thread that has been identified as dead
+ /// The last time this thread called UpdateThread()
+ public delegate void WatchdogTimeout(Thread thread, int lastTick);
+
+ /// This event is called whenever a tracked thread is
+ /// stopped or has not called UpdateThread() in time
+ public static event WatchdogTimeout OnWatchdogTimeout;
+
+ private static Dictionary m_threads;
+ private static System.Timers.Timer m_watchdogTimer;
+
+ static Watchdog()
+ {
+ m_threads = new Dictionary();
+ m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS);
+ m_watchdogTimer.AutoReset = false;
+ m_watchdogTimer.Elapsed += WatchdogTimerElapsed;
+ m_watchdogTimer.Start();
+ }
+
+ ///
+ /// 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
+ /// The newly created Thread object
+ public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground)
+ {
+ Thread thread = new Thread(start);
+ thread.Name = name;
+ thread.Priority = priority;
+ thread.IsBackground = isBackground;
+ thread.Start();
+
+ lock (m_threads)
+ m_threads.Add(thread.ManagedThreadId, new ThreadWatchdogInfo(thread));
+
+ return thread;
+ }
+
+ ///
+ /// Marks the current thread as alive
+ ///
+ public static void UpdateThread()
+ {
+ UpdateThread(Thread.CurrentThread.ManagedThreadId);
+ }
+
+ ///
+ /// Marks a thread as alive
+ ///
+ /// The ManagedThreadId of the thread to mark as
+ /// alive
+ public static void UpdateThread(int threadID)
+ {
+ ThreadWatchdogInfo threadInfo;
+
+ lock (m_threads)
+ {
+ if (m_threads.TryGetValue(threadID, out threadInfo))
+ {
+ threadInfo.LastTick = Environment.TickCount & Int32.MaxValue;
+ }
+ }
+ }
+
+ ///
+ /// Stops watchdog tracking on the current thread
+ ///
+ /// True if the thread was removed from the list of tracked
+ /// threads, otherwise false
+ public static bool RemoveThread()
+ {
+ return RemoveThread(Thread.CurrentThread.ManagedThreadId);
+ }
+
+ ///
+ /// Stops watchdog tracking on a thread
+ ///
+ /// The ManagedThreadId of the thread to stop
+ /// tracking
+ /// True if the thread was removed from the list of tracked
+ /// threads, otherwise false
+ public static bool RemoveThread(int threadID)
+ {
+ lock (m_threads)
+ return m_threads.Remove(threadID);
+ }
+
+ private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ WatchdogTimeout callback = OnWatchdogTimeout;
+
+ if (callback != null)
+ {
+ ThreadWatchdogInfo timedOut = null;
+
+ lock (m_threads)
+ {
+ int now = Environment.TickCount;
+
+ foreach (ThreadWatchdogInfo threadInfo in m_threads.Values)
+ {
+ if (threadInfo.Thread.ThreadState == ThreadState.Stopped || now - threadInfo.LastTick >= WATCHDOG_TIMEOUT_MS)
+ {
+ timedOut = threadInfo;
+ m_threads.Remove(threadInfo.Thread.ManagedThreadId);
+ break;
+ }
+ }
+ }
+
+ if (timedOut != null)
+ callback(timedOut.Thread, timedOut.LastTick);
+ }
+
+ m_watchdogTimer.Start();
+ }
+ }
+}
diff --git a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs
index 8ce353c..f24cef6 100644
--- a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs
+++ b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs
@@ -78,8 +78,6 @@ namespace OpenSim.Grid.UserServer.Modules
private OpenSim.Framework.BlockingQueue m_NotifyQueue =
new OpenSim.Framework.BlockingQueue();
- Thread m_NotifyThread;
-
private IGridServiceCore m_core;
public event AgentLocationDelegate OnAgentLocation;
@@ -96,8 +94,8 @@ namespace OpenSim.Grid.UserServer.Modules
{
m_core = core;
m_core.RegisterInterface(this);
- m_NotifyThread = new Thread(new ThreadStart(NotifyQueueRunner));
- m_NotifyThread.Start();
+
+ Watchdog.StartThread(NotifyQueueRunner, "NotifyQueueRunner", ThreadPriority.Normal, true);
}
public void PostInitialise()
@@ -427,6 +425,8 @@ namespace OpenSim.Grid.UserServer.Modules
{
TellMessageServersAboutUserLogoffInternal(presence.agentID);
}
+
+ Watchdog.UpdateThread();
}
}
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 26298e7..0366d94 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -172,6 +172,9 @@ namespace OpenSim
m_scriptTimer.Elapsed += RunAutoTimerScript;
}
+ // Hook up to the watchdog timer
+ Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
+
PrintFileToConsole("startuplogo.txt");
// For now, start at the 'root' level by default
@@ -384,6 +387,14 @@ namespace OpenSim
}
}
+ private void WatchdogTimeoutHandler(System.Threading.Thread thread, int lastTick)
+ {
+ int now = Environment.TickCount & Int32.MaxValue;
+
+ m_log.ErrorFormat("[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago",
+ thread.Name, thread.ThreadState, now - lastTick);
+ }
+
#region Console Commands
///
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index a9f4b2c..734471e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -187,14 +187,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
base.Start(m_recvBufferSize, m_asyncPacketHandling);
- // Start the incoming packet processing thread
- Thread incomingThread = new Thread(IncomingPacketHandler);
- incomingThread.Name = "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")";
- incomingThread.Start();
-
- Thread outgoingThread = new Thread(OutgoingPacketHandler);
- outgoingThread.Name = "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")";
- outgoingThread.Start();
+ // Start the packet processing threads
+ Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
+ Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
}
public new void Stop()
@@ -775,11 +770,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
}
+
+ Watchdog.UpdateThread();
}
if (packetInbox.Count > 0)
m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets");
packetInbox.Clear();
+
+ Watchdog.RemoveThread();
}
private void OutgoingPacketHandler()
@@ -842,12 +841,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// token bucket could get more tokens
if (!m_packetSent)
Thread.Sleep((int)TickCountResolution);
+
+ Watchdog.UpdateThread();
}
catch (Exception ex)
{
m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex);
}
}
+
+ Watchdog.RemoveThread();
}
private void ClientOutgoingPacketHandler(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index d636b1c..62500a2 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -1208,10 +1208,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
if (homeScene.TryGetAvatar(avatarId,out avatar))
{
KillAUser ku = new KillAUser(avatar,mod);
- Thread ta = new Thread(ku.ShutdownNoLogout);
- ta.IsBackground = true;
- ta.Name = "ShutdownThread";
- ta.Start();
+ Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true);
}
}
@@ -1261,7 +1258,13 @@ namespace OpenSim.Region.CoreModules.InterGrid
avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false;
- Thread.Sleep(30000);
+ int sleepMS = 30000;
+ while (sleepMS > 0)
+ {
+ Watchdog.UpdateThread();
+ Thread.Sleep(1000);
+ sleepMS -= 1000;
+ }
// test for child agent because they might have come back
if (avToBeKilled.IsChildAgent)
@@ -1270,6 +1273,8 @@ namespace OpenSim.Region.CoreModules.InterGrid
avToBeKilled.ControllingClient.Close();
}
}
+
+ Watchdog.RemoveThread();
}
}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index fe9c8d9..c9fce91 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (m_repliesRequired == 0)
{
m_requestState = RequestState.Completed;
- PerformAssetsRequestCallback();
+ PerformAssetsRequestCallback(null);
return;
}
@@ -246,9 +246,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// We want to stop using the asset cache thread asap
// as we now need to do the work of producing the rest of the archive
- Thread newThread = new Thread(PerformAssetsRequestCallback);
- newThread.Name = "OpenSimulator archiving thread post assets receipt";
- newThread.Start();
+ Util.FireAndForget(PerformAssetsRequestCallback);
}
else
{
@@ -265,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
///
/// Perform the callback on the original requester of the assets
///
- protected void PerformAssetsRequestCallback()
+ protected void PerformAssetsRequestCallback(object o)
{
try
{
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 4e40084..a4bcbad 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -74,7 +74,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private Dictionary m_blacklistedregions = new Dictionary();
private Dictionary m_cachedRegionMapItemsAddress = new Dictionary();
private List m_rootAgents = new List();
- private Thread mapItemReqThread;
private volatile bool threadrunning = false;
//private int CacheRegionsDistance = 256;
@@ -338,13 +337,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
if (threadrunning) return;
threadrunning = true;
+
m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread");
- mapItemReqThread = new Thread(new ThreadStart(process));
- mapItemReqThread.IsBackground = true;
- mapItemReqThread.Name = "MapItemRequestThread";
- mapItemReqThread.Priority = ThreadPriority.BelowNormal;
- mapItemReqThread.SetApartmentState(ApartmentState.MTA);
- mapItemReqThread.Start();
+
+ Watchdog.StartThread(process, "MapItemRequestThread", ThreadPriority.BelowNormal, true);
}
///
@@ -461,6 +457,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
RequestMapItemsCompleted(response);
}
+
+ Watchdog.UpdateThread();
}
}
catch (Exception e)
@@ -469,6 +467,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}
threadrunning = false;
+ Watchdog.RemoveThread();
}
///
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5005ac9..4b87f92 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -81,8 +81,6 @@ namespace OpenSim.Region.Framework.Scenes
protected Timer m_restartWaitTimer = new Timer();
- protected Thread m_updateEntitiesThread;
-
public SimStatsReporter StatsReporter;
protected List m_regionRestartNotifyList = new List();
@@ -945,11 +943,8 @@ namespace OpenSim.Region.Framework.Scenes
HeartbeatThread = null;
}
m_lastUpdate = Environment.TickCount;
- HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
- HeartbeatThread.SetApartmentState(ApartmentState.MTA);
- HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
- HeartbeatThread.Priority = ThreadPriority.AboveNormal;
- HeartbeatThread.Start();
+
+ HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
}
///
@@ -976,12 +971,13 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Performs per-frame updates regularly
///
- ///
- ///
- private void Heartbeat(object sender)
+ private void Heartbeat()
{
if (!Monitor.TryEnter(m_heartbeatLock))
+ {
+ Watchdog.RemoveThread();
return;
+ }
try
{
@@ -998,6 +994,8 @@ namespace OpenSim.Region.Framework.Scenes
Monitor.Pulse(m_heartbeatLock);
Monitor.Exit(m_heartbeatLock);
}
+
+ Watchdog.RemoveThread();
}
///
@@ -1146,6 +1144,8 @@ namespace OpenSim.Region.Framework.Scenes
if ((maintc < (m_timespan * 1000)) && maintc > 0)
Thread.Sleep(maintc);
+
+ Watchdog.UpdateThread();
}
}
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index df03b8d..4b0d01a 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -67,9 +67,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
{
m_client = client;
m_scene = scene;
-
- Thread loopThread = new Thread(InternalLoop);
- loopThread.Start();
+
+ Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false);
}
private void SendServerCommand(string command)
@@ -102,7 +101,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
{
try
{
- string strbuf = "";
+ string strbuf = String.Empty;
while (m_connected && m_client.Connected)
{
@@ -140,6 +139,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
Thread.Sleep(0);
+ Watchdog.UpdateThread();
}
}
catch (IOException)
@@ -156,6 +156,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
m_log.Warn("[IRCd] Disconnected client.");
}
+
+ Watchdog.RemoveThread();
}
private void ProcessInMessage(string message, string command)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
index 91ce9f1..eb39026 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
@@ -33,6 +33,7 @@ using System.Reflection;
using System.Text;
using System.Threading;
using log4net;
+using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
@@ -56,8 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
m_listener.Start(50);
- Thread thread = new Thread(ListenLoop);
- thread.Start();
+ Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false);
m_baseScene = baseScene;
}
@@ -72,7 +72,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
while (m_running)
{
AcceptClient(m_listener.AcceptTcpClient());
+ Watchdog.UpdateThread();
}
+
+ Watchdog.RemoveThread();
}
private void AcceptClient(TcpClient client)
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
index 16fe9e9..8d6c41d 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
@@ -86,7 +86,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
///
Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable());
State m_state = State.NONE;
- Thread m_thread = null;
CMView m_view = null;
#endregion Fields
@@ -148,10 +147,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
lock (this)
{
m_estateModule = scene.RequestModuleInterface();
- m_thread = new Thread(MainLoop);
- m_thread.Name = "Content Management";
- m_thread.IsBackground = true;
- m_thread.Start();
+ Watchdog.StartThread(MainLoop, "Content Management", ThreadPriority.Normal, true);
m_state = State.NONE;
}
}
@@ -200,6 +196,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?");
break;
}
+
+ Watchdog.UpdateThread();
}
}
catch (Exception e)
@@ -209,6 +207,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
"[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
e);
}
+
+ Watchdog.RemoveThread();
}
///
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
index 583d2ff..51fd41a 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
@@ -132,12 +132,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
///
private void Start()
{
- EventQueueThread = new Thread(EventQueueThreadLoop);
- EventQueueThread.IsBackground = true;
-
- EventQueueThread.Priority = MyThreadPriority;
- EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount;
- EventQueueThread.Start();
+ EventQueueThread = Watchdog.StartThread(EventQueueThreadLoop, "EventQueueManagerThread_" + ThreadCount, MyThreadPriority, true);
// Look at this... Don't you wish everyone did that solid
// coding everywhere? :P
@@ -184,6 +179,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
while (true)
{
DoProcessQueue();
+ Watchdog.UpdateThread();
}
}
catch (ThreadAbortException)
@@ -214,6 +210,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
m_log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString());
throw e;
}
+
+ Watchdog.UpdateThread();
}
}
catch (ThreadAbortException)
@@ -226,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
"[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}",
ScriptEngineName, e);
}
+
+ Watchdog.RemoveThread();
}
public void DoProcessQueue()
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
index 7ffdb1a..87fdf1f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
@@ -93,10 +93,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
if (MaintenanceThreadThread == null)
{
- MaintenanceThreadThread = new Thread(MaintenanceLoop);
- MaintenanceThreadThread.Name = "ScriptMaintenanceThread";
- MaintenanceThreadThread.IsBackground = true;
- MaintenanceThreadThread.Start();
+ MaintenanceThreadThread = Watchdog.StartThread(MaintenanceLoop, "ScriptMaintenanceThread", ThreadPriority.Normal, true);
}
}
@@ -164,56 +161,54 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
MaintenanceLoopTicks_ScriptLoadUnload_Count++;
MaintenanceLoopTicks_Other_Count++;
-
- //lock (ScriptEngine.ScriptEngines)
- //{
- foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
+ foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
+ {
+ // lastScriptEngine = m_ScriptEngine;
+ // Re-reading config every x seconds
+ if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other)
{
- // lastScriptEngine = m_ScriptEngine;
- // Re-reading config every x seconds
- if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other)
+ MaintenanceLoopTicks_Other_ResetCount = true;
+ if (m_ScriptEngine.RefreshConfigFilens > 0)
{
- MaintenanceLoopTicks_Other_ResetCount = true;
- if (m_ScriptEngine.RefreshConfigFilens > 0)
+ // Check if its time to re-read config
+ if (DateTime.Now.Ticks - Last_ReReadConfigFilens >
+ m_ScriptEngine.RefreshConfigFilens)
{
- // Check if its time to re-read config
- if (DateTime.Now.Ticks - Last_ReReadConfigFilens >
- m_ScriptEngine.RefreshConfigFilens)
- {
- //m_log.Debug("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens);
- // Its time to re-read config file
- m_ScriptEngine.ReadConfig();
- Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
- }
+ //m_log.Debug("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens);
+ // Its time to re-read config file
+ m_ScriptEngine.ReadConfig();
+ Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
+ }
- // Adjust number of running script threads if not correct
- if (m_ScriptEngine.m_EventQueueManager != null)
- m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
+ // Adjust number of running script threads if not correct
+ if (m_ScriptEngine.m_EventQueueManager != null)
+ m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
- // Check if any script has exceeded its max execution time
- if (EventQueueManager.EnforceMaxExecutionTime)
+ // Check if any script has exceeded its max execution time
+ if (EventQueueManager.EnforceMaxExecutionTime)
+ {
+ // We are enforcing execution time
+ if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
+ EventQueueManager.maxFunctionExecutionTimens)
{
- // We are enforcing execution time
- if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
- EventQueueManager.maxFunctionExecutionTimens)
- {
- // Its time to check again
- m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
- Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
- }
+ // Its time to check again
+ m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
+ Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
}
}
}
- if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload)
- {
- MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = true;
- // LOAD / UNLOAD SCRIPTS
- if (m_ScriptEngine.m_ScriptManager != null)
- m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
- }
}
- //}
+ if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload)
+ {
+ MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = true;
+ // LOAD / UNLOAD SCRIPTS
+ if (m_ScriptEngine.m_ScriptManager != null)
+ m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
+ }
+ }
+
+ Watchdog.UpdateThread();
}
}
catch(ThreadAbortException)
@@ -225,6 +220,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
m_log.ErrorFormat("Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: {0}", ex.ToString());
}
}
+
+ Watchdog.RemoveThread();
}
#endregion
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 1607d34..9d97cb2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -137,11 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (cmdHandlerThread == null)
{
// Start the thread that will be doing the work
- cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
- cmdHandlerThread.Name = "AsyncLSLCmdHandlerThread";
- cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
- cmdHandlerThread.IsBackground = true;
- cmdHandlerThread.Start();
+ cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true);
}
}
@@ -185,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Thread.Sleep(cmdHandlerThreadCycleSleepms);
DoOneCmdHandlerPass();
+
+ Watchdog.UpdateThread();
}
}
catch
--
cgit v1.1
From 167d8e39fa34c52593c640058287184026c95288 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 13:14:41 -0700
Subject: * Sending (position - hipoffset) instead of position * Sending
m_rotation instead of m_bodyRot in full updates to match terse updates (no
idea which one is right!)
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d7113bf..99fd86c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2517,15 +2517,12 @@ namespace OpenSim.Region.Framework.Scenes
if (m_appearance.Texture == null)
return;
- // Note: because Quaternion is a struct, it can't be null
- Quaternion rot = m_bodyRot;
-
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
- LocalId, m_pos, m_appearance.Texture.GetBytes(),
- m_parentID, rot));
+ LocalId, pos, m_appearance.Texture.GetBytes(),
+ m_parentID, m_bodyRot));
m_scene.StatsReporter.AddAgentUpdates(1);
}
--
cgit v1.1
From 4ba3842d712ccb47e1b7effe0fdf2ed7da531431 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 13:24:24 -0700
Subject: Forgot to hit save in the last commit
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 99fd86c..cfd3fcc 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2522,7 +2522,7 @@ namespace OpenSim.Region.Framework.Scenes
remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
LocalId, pos, m_appearance.Texture.GetBytes(),
- m_parentID, m_bodyRot));
+ m_parentID, m_rotation));
m_scene.StatsReporter.AddAgentUpdates(1);
}
--
cgit v1.1
From ba2972eaf6d608fe4e6a6610089ab9fb8bae3f2d Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 14:33:54 -0700
Subject: * Send out m_bodyRot everywhere instead of m_rotation. Still have no
clue which is right * Fix WorldMapModule.process() to not trip the watchdog
timer
---
.../CoreModules/World/WorldMap/WorldMapModule.cs | 31 +++++++++++-----------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 +++++------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index a4bcbad..f4b54aa 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
-
+ private static readonly UUID STOP_UUID = UUID.Random();
private static readonly string m_mapLayerPath = "0001/";
private OpenSim.Framework.BlockingQueue requests = new OpenSim.Framework.BlockingQueue();
@@ -349,7 +349,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private void StopThread()
{
MapRequestState st = new MapRequestState();
- st.agentID=UUID.Zero;
+ st.agentID=STOP_UUID;
st.EstateID=0;
st.flags=0;
st.godlike=false;
@@ -437,25 +437,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
while (true)
{
- MapRequestState st = requests.Dequeue();
+ MapRequestState st = requests.Dequeue(1000);
// end gracefully
- if (st.agentID == UUID.Zero)
- {
+ if (st.agentID == STOP_UUID)
break;
- }
- bool dorequest = true;
- lock (m_rootAgents)
+ if (st.agentID != UUID.Zero)
{
- if (!m_rootAgents.Contains(st.agentID))
- dorequest = false;
- }
+ bool dorequest = true;
+ lock (m_rootAgents)
+ {
+ if (!m_rootAgents.Contains(st.agentID))
+ dorequest = false;
+ }
- if (dorequest)
- {
- OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
- RequestMapItemsCompleted(response);
+ if (dorequest)
+ {
+ OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
+ RequestMapItemsCompleted(response);
+ }
}
Watchdog.UpdateThread();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cfd3fcc..ccfffe7 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2417,7 +2417,7 @@ namespace OpenSim.Region.Framework.Scenes
pos.Z -= m_appearance.HipOffset;
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
- pos, m_velocity, Vector3.Zero, m_rotation, Vector4.Zero, m_uuid, null, GetUpdatePriority(remoteClient)));
+ pos, m_velocity, Vector3.Zero, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(remoteClient)));
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentUpdates(1);
@@ -2522,7 +2522,7 @@ namespace OpenSim.Region.Framework.Scenes
remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
LocalId, pos, m_appearance.Texture.GetBytes(),
- m_parentID, m_rotation));
+ m_parentID, m_bodyRot));
m_scene.StatsReporter.AddAgentUpdates(1);
}
@@ -2585,14 +2585,11 @@ namespace OpenSim.Region.Framework.Scenes
// the inventory arrives
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
- // Note: because Quaternion is a struct, it can't be null
- Quaternion rot = m_bodyRot;
-
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
- m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
+ pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
if (!m_isChildAgent)
{
@@ -2697,9 +2694,11 @@ namespace OpenSim.Region.Framework.Scenes
m_startAnimationSet = true;
}
- Quaternion rot = m_bodyRot;
+ Vector3 pos = m_pos;
+ pos.Z -= m_appearance.HipOffset;
+
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
- m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
+ pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
}
--
cgit v1.1
From f34e8adffb7d84df6c9189f69a16699c69e89fa8 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Thu, 22 Oct 2009 18:28:42 -0400
Subject: * Moved Copyrights above the comments in ODEPrim and ODEDynamics so
they're consistent with the rest (and so chi11ken's auto copyright adding
script doesn't duplicate the copyright.
---
OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | 25 +++++++++++----------
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 29 +++++++++++++------------
2 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
index 467eba0..019c78b 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
@@ -1,16 +1,4 @@
/*
- * Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
- * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
- * ODEPrim.cs contains methods dealing with Prim editing, Prim
- * characteristics and Kinetic motion.
- * ODEDynamics.cs contains methods dealing with Prim Physical motion
- * (dynamics) and the associated settings. Old Linear and angular
- * motors for dynamic motion have been replace with MoveLinear()
- * and MoveAngular(); 'Physical' is used only to switch ODE dynamic
- * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_ is to
- * switch between 'VEHICLE' parameter use and general dynamics
- * settings use.
- *
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -37,6 +25,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
+ * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
+ * ODEPrim.cs contains methods dealing with Prim editing, Prim
+ * characteristics and Kinetic motion.
+ * ODEDynamics.cs contains methods dealing with Prim Physical motion
+ * (dynamics) and the associated settings. Old Linear and angular
+ * motors for dynamic motion have been replace with MoveLinear()
+ * and MoveAngular(); 'Physical' is used only to switch ODE dynamic
+ * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_ is to
+ * switch between 'VEHICLE' parameter use and general dynamics
+ * settings use.
+ */
+
using System;
using System.Collections.Generic;
using System.Reflection;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index f59f0ae..412f84d 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1,18 +1,5 @@
-/*
- * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces
- * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
- * ODEPrim.cs contains methods dealing with Prim editing, Prim
- * characteristics and Kinetic motion.
- * ODEDynamics.cs contains methods dealing with Prim Physical motion
- * (dynamics) and the associated settings. Old Linear and angular
- * motors for dynamic motion have been replace with MoveLinear()
- * and MoveAngular(); 'Physical' is used only to switch ODE dynamic
- * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_ is to
- * switch between 'VEHICLE' parameter use and general dynamics
- * settings use.
- * Copyright (c) Contributors, http://opensimulator.org/
+/* 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
@@ -35,6 +22,20 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+/*
+ * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces
+ * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
+ * ODEPrim.cs contains methods dealing with Prim editing, Prim
+ * characteristics and Kinetic motion.
+ * ODEDynamics.cs contains methods dealing with Prim Physical motion
+ * (dynamics) and the associated settings. Old Linear and angular
+ * motors for dynamic motion have been replace with MoveLinear()
+ * and MoveAngular(); 'Physical' is used only to switch ODE dynamic
+ * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_ is to
+ * switch between 'VEHICLE' parameter use and general dynamics
+ * settings use.
+ */
using System;
using System.Collections.Generic;
using System.Reflection;
--
cgit v1.1
From 96d53f11e554f37c135fa2d009f9ffed1a5ec724 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 22 Oct 2009 17:03:13 -0700
Subject: Added VS2010 support to Prebuild and created runprebuild2010.bat
---
Prebuild/src/Core/Nodes/ProjectNode.cs | 4 +
Prebuild/src/Core/Targets/VS2008Target.cs | 2 +-
Prebuild/src/Core/Targets/VS2010Target.cs | 134 +++++++++++++++++++++++++++
Prebuild/src/Core/Targets/VSGenericTarget.cs | 2 +-
Prebuild/src/Core/Targets/VSVersion.cs | 6 +-
bin/Prebuild.exe | Bin 246272 -> 237568 bytes
prebuild.xml | 2 +-
runprebuild2010.bat | 2 +
8 files changed, 148 insertions(+), 4 deletions(-)
create mode 100644 Prebuild/src/Core/Targets/VS2010Target.cs
create mode 100644 runprebuild2010.bat
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs
index 0a24abf..04af7a3 100644
--- a/Prebuild/src/Core/Nodes/ProjectNode.cs
+++ b/Prebuild/src/Core/Nodes/ProjectNode.cs
@@ -90,6 +90,10 @@ namespace Prebuild.Core.Nodes
/// .NET 3.5
///
v3_5,
+ ///
+ /// .NET 4.0
+ ///
+ v4_0,
}
///
/// The Node object representing /Prebuild/Solution/Project elements
diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs
index f30017b..e685962 100644
--- a/Prebuild/src/Core/Targets/VS2008Target.cs
+++ b/Prebuild/src/Core/Targets/VS2008Target.cs
@@ -120,7 +120,7 @@ namespace Prebuild.Core.Targets
#region Constructors
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public VS2008Target()
: base()
diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs
new file mode 100644
index 0000000..8772d18
--- /dev/null
+++ b/Prebuild/src/Core/Targets/VS2010Target.cs
@@ -0,0 +1,134 @@
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+using System.CodeDom.Compiler;
+
+namespace Prebuild.Core.Targets
+{
+
+ ///
+ ///
+ ///
+ [Target("vs2010")]
+ public class VS2010Target : VSGenericTarget
+ {
+ #region Fields
+ string solutionVersion = "11.00";
+ string productVersion = "9.0.21022";
+ string schemaVersion = "2.0";
+ string versionName = "Visual Studio 2010";
+ string name = "vs2008";
+ VSVersion version = VSVersion.VS10;
+
+ Hashtable tools;
+ Kernel kernel;
+
+ ///
+ /// Gets or sets the solution version.
+ ///
+ /// The solution version.
+ public override string SolutionVersion
+ {
+ get
+ {
+ return solutionVersion;
+ }
+ }
+ ///
+ /// Gets or sets the product version.
+ ///
+ /// The product version.
+ public override string ProductVersion
+ {
+ get
+ {
+ return productVersion;
+ }
+ }
+ ///
+ /// Gets or sets the schema version.
+ ///
+ /// The schema version.
+ public override string SchemaVersion
+ {
+ get
+ {
+ return schemaVersion;
+ }
+ }
+ ///
+ /// Gets or sets the name of the version.
+ ///
+ /// The name of the version.
+ public override string VersionName
+ {
+ get
+ {
+ return versionName;
+ }
+ }
+ ///
+ /// Gets or sets the version.
+ ///
+ /// The version.
+ public override VSVersion Version
+ {
+ get
+ {
+ return version;
+ }
+ }
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public override string Name
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
+ {
+ switch (frameworkVersion)
+ {
+ case FrameworkVersion.v4_0:
+ return "ToolsVersion=\"4.0\"";
+ case FrameworkVersion.v3_5:
+ return "ToolsVersion=\"3.5\"";
+ case FrameworkVersion.v3_0:
+ return "ToolsVersion=\"3.0\"";
+ default:
+ return "ToolsVersion=\"2.0\"";
+ }
+ }
+
+ public override string SolutionTag
+ {
+ get { return "# Visual Studio 2010"; }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VS2010Target()
+ : base()
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs
index 84f1df5..fdcc2b9 100644
--- a/Prebuild/src/Core/Targets/VSGenericTarget.cs
+++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs
@@ -173,7 +173,7 @@ namespace Prebuild.Core.Targets
#region Project File
using (ps)
{
- ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion));
+ ps.WriteLine("", this.Version == VSVersion.VS10 ? "4.0" : "3.5");
ps.WriteLine(" ");
ps.WriteLine(" Local");
ps.WriteLine(" {0}", this.ProductVersion);
diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs
index f477086..59549b0 100644
--- a/Prebuild/src/Core/Targets/VSVersion.cs
+++ b/Prebuild/src/Core/Targets/VSVersion.cs
@@ -45,6 +45,10 @@ namespace Prebuild.Core.Targets
///
/// Visual Studio 2008
///
- VS90
+ VS90,
+ ///
+ /// Visual Studio 2010
+ ///
+ VS10
}
}
diff --git a/bin/Prebuild.exe b/bin/Prebuild.exe
index e58657c..eb4c224 100755
Binary files a/bin/Prebuild.exe and b/bin/Prebuild.exe differ
diff --git a/prebuild.xml b/prebuild.xml
index 81f907d..1c44ebf 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3135,7 +3135,7 @@
-
+
../../../bin/
diff --git a/runprebuild2010.bat b/runprebuild2010.bat
new file mode 100644
index 0000000..8c832b3
--- /dev/null
+++ b/runprebuild2010.bat
@@ -0,0 +1,2 @@
+bin\Prebuild.exe /target vs2010
+echo C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild OpenSim.sln > compile.bat
--
cgit v1.1
From 588361e2a2398b963871762c2b5485c6a086cf47 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 23 Oct 2009 01:02:36 -0700
Subject: Experimental change to use an immutable array for iterating
ScenePresences, avoiding locking and copying the list each time it is
accessed
---
.../Region/ClientStack/LindenUDP/LLClientView.cs | 141 +++++++++---------
.../CoreModules/Avatar/Combat/CombatModule.cs | 8 +-
.../CoreModules/Avatar/Dialog/DialogModule.cs | 17 ++-
.../World/Estate/EstateManagementModule.cs | 7 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 25 ++--
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 160 +++++++++++----------
OpenSim/Region/Framework/Scenes/SceneManager.cs | 53 +++----
.../Region/Framework/Scenes/SceneObjectGroup.cs | 4 +-
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 121 ++++++++--------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 21 +--
.../Shared/Api/Implementation/LSL_Api.cs | 8 +-
.../Api/Implementation/Plugins/SensorRepeat.cs | 13 +-
.../Region/UserStatistics/ActiveConnectionsAJAX.cs | 14 +-
13 files changed, 308 insertions(+), 284 deletions(-)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 5acf25f..e81ff4b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4434,6 +4434,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected virtual void RegisterLocalPacketHandlers()
{
AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
+ AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate);
AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
@@ -4446,6 +4447,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Packet Handlers
+ private bool HandleAgentUpdate(IClientAPI sener, Packet Pack)
+ {
+ if (OnAgentUpdate != null)
+ {
+ bool update = false;
+ AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
+
+ #region Packet Session and User Check
+ if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId)
+ return false;
+ #endregion
+
+ AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
+
+ // We can only check when we have something to check
+ // against.
+
+ if (lastarg != null)
+ {
+ update =
+ (
+ (x.BodyRotation != lastarg.BodyRotation) ||
+ (x.CameraAtAxis != lastarg.CameraAtAxis) ||
+ (x.CameraCenter != lastarg.CameraCenter) ||
+ (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
+ (x.CameraUpAxis != lastarg.CameraUpAxis) ||
+ (x.ControlFlags != lastarg.ControlFlags) ||
+ (x.Far != lastarg.Far) ||
+ (x.Flags != lastarg.Flags) ||
+ (x.State != lastarg.State) ||
+ (x.HeadRotation != lastarg.HeadRotation) ||
+ (x.SessionID != lastarg.SessionID) ||
+ (x.AgentID != lastarg.AgentID)
+ );
+ }
+ else
+ update = true;
+
+ // These should be ordered from most-likely to
+ // least likely to change. I've made an initial
+ // guess at that.
+
+ if (update)
+ {
+ AgentUpdateArgs arg = new AgentUpdateArgs();
+ arg.AgentID = x.AgentID;
+ arg.BodyRotation = x.BodyRotation;
+ arg.CameraAtAxis = x.CameraAtAxis;
+ arg.CameraCenter = x.CameraCenter;
+ arg.CameraLeftAxis = x.CameraLeftAxis;
+ arg.CameraUpAxis = x.CameraUpAxis;
+ arg.ControlFlags = x.ControlFlags;
+ arg.Far = x.Far;
+ arg.Flags = x.Flags;
+ arg.HeadRotation = x.HeadRotation;
+ arg.SessionID = x.SessionID;
+ arg.State = x.State;
+ UpdateAgent handlerAgentUpdate = OnAgentUpdate;
+ lastarg = arg; // save this set of arguments for nexttime
+ if (handlerAgentUpdate != null)
+ OnAgentUpdate(this, arg);
+
+ handlerAgentUpdate = null;
+ }
+ }
+
+ return true;
+ }
+
private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
{
MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack;
@@ -5631,77 +5701,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break;
- case PacketType.AgentUpdate:
- if (OnAgentUpdate != null)
- {
- bool update = false;
- AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
-
- #region Packet Session and User Check
- if (m_checkPackets)
- {
- if (agenUpdate.AgentData.SessionID != SessionId ||
- agenUpdate.AgentData.AgentID != AgentId)
- break;
- }
- #endregion
-
- AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
-
- // We can only check when we have something to check
- // against.
-
- if (lastarg != null)
- {
- update =
- (
- (x.BodyRotation != lastarg.BodyRotation) ||
- (x.CameraAtAxis != lastarg.CameraAtAxis) ||
- (x.CameraCenter != lastarg.CameraCenter) ||
- (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
- (x.CameraUpAxis != lastarg.CameraUpAxis) ||
- (x.ControlFlags != lastarg.ControlFlags) ||
- (x.Far != lastarg.Far) ||
- (x.Flags != lastarg.Flags) ||
- (x.State != lastarg.State) ||
- (x.HeadRotation != lastarg.HeadRotation) ||
- (x.SessionID != lastarg.SessionID) ||
- (x.AgentID != lastarg.AgentID)
- );
- }
- else
- update = true;
-
- // These should be ordered from most-likely to
- // least likely to change. I've made an initial
- // guess at that.
-
- if (update)
- {
- AgentUpdateArgs arg = new AgentUpdateArgs();
- arg.AgentID = x.AgentID;
- arg.BodyRotation = x.BodyRotation;
- arg.CameraAtAxis = x.CameraAtAxis;
- arg.CameraCenter = x.CameraCenter;
- arg.CameraLeftAxis = x.CameraLeftAxis;
- arg.CameraUpAxis = x.CameraUpAxis;
- arg.ControlFlags = x.ControlFlags;
- arg.Far = x.Far;
- arg.Flags = x.Flags;
- arg.HeadRotation = x.HeadRotation;
- arg.SessionID = x.SessionID;
- arg.State = x.State;
- UpdateAgent handlerAgentUpdate = OnAgentUpdate;
- lastarg = arg; // save this set of arguments for nexttime
- if (handlerAgentUpdate != null)
- OnAgentUpdate(this, arg);
-
- handlerAgentUpdate = null;
- }
-
- }
- break;
-
case PacketType.AgentAnimation:
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 9387bce..61b6d65 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -96,12 +96,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
else
{
bool foundResult = false;
- string resultstring = "";
- List allav = DeadAvatar.Scene.GetScenePresences();
+ string resultstring = String.Empty;
+ ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences();
try
{
- foreach (ScenePresence av in allav)
+ for (int i = 0; i < allav.Length; i++)
{
+ ScenePresence av = allav[i];
+
if (av.LocalId == killerObjectLocalID)
{
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index ebebaf9..72ec869 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -85,10 +85,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
{
- List presenceList = m_scene.GetScenePresences();
+ ScenePresence[] presenceList = m_scene.GetScenePresences();
- foreach (ScenePresence presence in presenceList)
+ for (int i = 0; i < presenceList.Length; i++)
{
+ ScenePresence presence = presenceList[i];
+
if (presence.Firstname == firstName && presence.Lastname == lastName)
{
presence.ControllingClient.SendAgentAlertMessage(message, modal);
@@ -99,10 +101,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendGeneralAlert(string message)
{
- List presenceList = m_scene.GetScenePresences();
+ ScenePresence[] presenceList = m_scene.GetScenePresences();
- foreach (ScenePresence presence in presenceList)
+ for (int i = 0; i < presenceList.Length; i++)
{
+ ScenePresence presence = presenceList[i];
+
if (!presence.IsChildAgent)
presence.ControllingClient.SendAlertMessage(message);
}
@@ -150,10 +154,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendNotificationToUsersInRegion(
UUID fromAvatarID, string fromAvatarName, string message)
{
- List presenceList = m_scene.GetScenePresences();
+ ScenePresence[] presences = m_scene.GetScenePresences();
- foreach (ScenePresence presence in presenceList)
+ for (int i = 0; i < presences.Length; i++)
{
+ ScenePresence presence = presences[i];
if (!presence.IsChildAgent)
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
}
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 3bb162e..e3a395e 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -414,9 +414,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
{
// Get a fresh list that will not change as people get teleported away
- List prescences = m_scene.GetScenePresences();
- foreach (ScenePresence p in prescences)
+ ScenePresence[] presences = m_scene.GetScenePresences();
+
+ for (int i = 0; i < presences.Length; i++)
{
+ ScenePresence p = presences[i];
+
if (p.UUID != senderID)
{
// make sure they are still there, we could be working down a long list
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4b87f92..d5e3445 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -253,7 +253,7 @@ namespace OpenSim.Region.Framework.Scenes
protected int m_fps = 10;
protected int m_frame = 0;
protected float m_timespan = 0.089f;
- protected DateTime m_lastupdate = DateTime.Now;
+ protected DateTime m_lastupdate = DateTime.UtcNow;
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
@@ -1014,7 +1014,7 @@ namespace OpenSim.Region.Framework.Scenes
//#endif
maintc = Environment.TickCount;
- TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
+ TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
float physicsFPS = 0;
frameMS = Environment.TickCount;
@@ -1137,7 +1137,7 @@ namespace OpenSim.Region.Framework.Scenes
}
m_timedilation = tmpval;
- m_lastupdate = DateTime.Now;
+ m_lastupdate = DateTime.UtcNow;
}
maintc = Environment.TickCount - maintc;
maintc = (int)(m_timespan * 1000) - maintc;
@@ -3496,9 +3496,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{
ScenePresence presence;
-
- lock (m_sceneGraph.ScenePresences)
- m_sceneGraph.ScenePresences.TryGetValue(agentID, out presence);
+ m_sceneGraph.TryGetAvatar(agentID, out presence);
if (presence != null)
{
@@ -3709,8 +3707,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 lookAt, uint teleportFlags)
{
ScenePresence sp;
- lock (m_sceneGraph.ScenePresences)
- m_sceneGraph.ScenePresences.TryGetValue(remoteClient.AgentId, out sp);
+ m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp);
if (sp != null)
{
@@ -4112,7 +4109,7 @@ namespace OpenSim.Region.Framework.Scenes
/// This list is a new object, so it can be iterated over without locking.
///
///
- public List GetScenePresences()
+ public ScenePresence[] GetScenePresences()
{
return m_sceneGraph.GetScenePresences();
}
@@ -4159,15 +4156,13 @@ namespace OpenSim.Region.Framework.Scenes
public void ForEachScenePresence(Action action)
{
// We don't want to try to send messages if there are no avatars.
- if (m_sceneGraph != null && m_sceneGraph.ScenePresences != null)
+ if (m_sceneGraph != null)
{
try
{
- List presenceList = GetScenePresences();
- foreach (ScenePresence presence in presenceList)
- {
- action(presence);
- }
+ ScenePresence[] presences = GetScenePresences();
+ for (int i = 0; i < presences.Length; i++)
+ action(presences[i]);
}
catch (Exception e)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index deee6c3..db055f9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -66,7 +66,9 @@ namespace OpenSim.Region.Framework.Scenes
#region Fields
- protected internal Dictionary ScenePresences = new Dictionary();
+ protected Dictionary m_scenePresences = new Dictionary();
+ protected ScenePresence[] m_scenePresenceArray = new ScenePresence[0];
+
// SceneObjects is not currently populated or used.
//public Dictionary SceneObjects;
protected internal EntityManager Entities = new EntityManager();
@@ -126,10 +128,12 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void Close()
{
- lock (ScenePresences)
+ lock (m_scenePresences)
{
- ScenePresences.Clear();
+ m_scenePresences.Clear();
+ m_scenePresenceArray = new ScenePresence[0];
}
+
lock (m_dictionary_lock)
{
SceneObjectGroupsByFullID.Clear();
@@ -157,11 +161,9 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void UpdatePresences()
{
- List updateScenePresences = GetScenePresences();
- foreach (ScenePresence pres in updateScenePresences)
- {
- pres.Update();
- }
+ ScenePresence[] updateScenePresences = GetScenePresences();
+ for (int i = 0; i < updateScenePresences.Length; i++)
+ updateScenePresences[i].Update();
}
protected internal float UpdatePhysics(double elapsed)
@@ -190,15 +192,9 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void UpdateScenePresenceMovement()
{
- List moveEntities = GetScenePresences();
-
- foreach (EntityBase entity in moveEntities)
- {
- //cfk. This throws occaisional exceptions on a heavily used region
- //and I added this null check to try to preclude the exception.
- if (entity != null)
- entity.UpdateMovement();
- }
+ ScenePresence[] moveEntities = GetScenePresences();
+ for (int i = 0; i < moveEntities.Length; i++)
+ moveEntities[i].UpdateMovement();
}
#endregion
@@ -645,9 +641,34 @@ namespace OpenSim.Region.Framework.Scenes
Entities[presence.UUID] = presence;
- lock (ScenePresences)
+ lock (m_scenePresences)
{
- ScenePresences[presence.UUID] = presence;
+ if (!m_scenePresences.ContainsKey(presence.UUID))
+ {
+ m_scenePresences.Add(presence.UUID, presence);
+
+ // Create a new array of ScenePresence references
+ int oldLength = m_scenePresenceArray.Length;
+ ScenePresence[] newArray = new ScenePresence[oldLength + 1];
+ Array.Copy(m_scenePresenceArray, newArray, oldLength);
+ newArray[oldLength] = presence;
+ m_scenePresenceArray = newArray;
+ }
+ else
+ {
+ m_scenePresences[presence.UUID] = presence;
+
+ // Do a linear search through the array of ScenePresence references
+ // and update the modified entry
+ for (int i = 0; i < m_scenePresenceArray.Length; i++)
+ {
+ if (m_scenePresenceArray[i].UUID == presence.UUID)
+ {
+ m_scenePresenceArray[i] = presence;
+ break;
+ }
+ }
+ }
}
}
@@ -663,16 +684,30 @@ namespace OpenSim.Region.Framework.Scenes
agentID);
}
- lock (ScenePresences)
+ lock (m_scenePresences)
{
- if (!ScenePresences.Remove(agentID))
+ if (m_scenePresences.Remove(agentID))
+ {
+ // Copy all of the elements from the previous array
+ // into the new array except the removed element
+ int oldLength = m_scenePresenceArray.Length;
+ ScenePresence[] newArray = new ScenePresence[oldLength - 1];
+ int j = 0;
+ for (int i = 0; i < m_scenePresenceArray.Length; i++)
+ {
+ ScenePresence presence = m_scenePresenceArray[i];
+ if (presence.UUID != agentID)
+ {
+ newArray[j] = presence;
+ ++j;
+ }
+ }
+ m_scenePresenceArray = newArray;
+ }
+ else
{
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
}
-// else
-// {
-// m_log.InfoFormat("[SCENE] Removed scene presence {0} from scene presences list", agentID);
-// }
}
}
@@ -704,20 +739,21 @@ namespace OpenSim.Region.Framework.Scenes
public void RecalculateStats()
{
- List SPList = GetScenePresences();
+ ScenePresence[] presences = GetScenePresences();
int rootcount = 0;
int childcount = 0;
- foreach (ScenePresence user in SPList)
+ for (int i = 0; i < presences.Length; i++)
{
+ ScenePresence user = presences[i];
if (user.IsChildAgent)
- childcount++;
+ ++childcount;
else
- rootcount++;
+ ++rootcount;
}
+
m_numRootAgents = rootcount;
m_numChildAgents = childcount;
-
}
public int GetChildAgentCount()
@@ -767,12 +803,9 @@ namespace OpenSim.Region.Framework.Scenes
/// locking is required to iterate over it.
///
///
- protected internal List GetScenePresences()
+ protected internal ScenePresence[] GetScenePresences()
{
- lock (ScenePresences)
- {
- return new List(ScenePresences.Values);
- }
+ return m_scenePresenceArray;
}
protected internal List GetAvatars()
@@ -817,14 +850,13 @@ namespace OpenSim.Region.Framework.Scenes
// No locking of scene presences here since we're passing back a list...
List result = new List();
- List ScenePresencesList = GetScenePresences();
+ ScenePresence[] scenePresences = GetScenePresences();
- foreach (ScenePresence avatar in ScenePresencesList)
+ for (int i = 0; i < scenePresences.Length; i++)
{
+ ScenePresence avatar = scenePresences[i];
if (filter(avatar))
- {
result.Add(avatar);
- }
}
return result;
@@ -839,9 +871,9 @@ namespace OpenSim.Region.Framework.Scenes
{
ScenePresence sp;
- lock (ScenePresences)
+ lock (m_scenePresences)
{
- ScenePresences.TryGetValue(agentID, out sp);
+ m_scenePresences.TryGetValue(agentID, out sp);
}
return sp;
@@ -1000,48 +1032,24 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
{
- ScenePresence presence;
-
- lock (ScenePresences)
- {
- if (ScenePresences.TryGetValue(avatarId, out presence))
- {
- avatar = presence;
- return true;
-
- //if (!presence.IsChildAgent)
- //{
- // avatar = presence;
- // return true;
- //}
- //else
- //{
- // m_log.WarnFormat(
- // "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!",
- // avatarId, m_parentScene.RegionInfo.RegionName);
- //}
- }
- }
-
- avatar = null;
- return false;
+ lock (m_scenePresences)
+ return m_scenePresences.TryGetValue(avatarId, out avatar);
}
protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
{
- lock (ScenePresences)
+ ScenePresence[] presences = GetScenePresences();
+
+ for (int i = 0; i < presences.Length; i++)
{
- foreach (ScenePresence presence in ScenePresences.Values)
+ ScenePresence presence = presences[i];
+
+ if (!presence.IsChildAgent)
{
- if (!presence.IsChildAgent)
+ if (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0)
{
- string name = presence.ControllingClient.Name;
-
- if (String.Compare(avatarName, name, true) == 0)
- {
- avatar = presence;
- return true;
- }
+ avatar = presence;
+ return true;
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 3097929..dfaa7ea 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -411,41 +411,46 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SetDebugPacketLevelOnCurrentScene(int newDebug)
{
- ForEachCurrentScene(delegate(Scene scene)
- {
- List scenePresences = scene.GetScenePresences();
+ ForEachCurrentScene(
+ delegate(Scene scene)
+ {
+ ScenePresence[] scenePresences = scene.GetScenePresences();
+
+ for (int i = 0; i < scenePresences.Length; i++)
+ {
+ ScenePresence scenePresence = scenePresences[i];
- foreach (ScenePresence scenePresence in scenePresences)
- {
- if (!scenePresence.IsChildAgent)
- {
- m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
- scenePresence.Firstname,
- scenePresence.Lastname,
- newDebug);
+ if (!scenePresence.IsChildAgent)
+ {
+ m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
+ scenePresence.Firstname,
+ scenePresence.Lastname,
+ newDebug);
- scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
- }
- }
- });
+ scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
+ }
+ }
+ }
+ );
}
public List GetCurrentSceneAvatars()
{
List avatars = new List();
- ForEachCurrentScene(delegate(Scene scene)
- {
- List scenePresences = scene.GetScenePresences();
-
- foreach (ScenePresence scenePresence in scenePresences)
+ ForEachCurrentScene(
+ delegate(Scene scene)
{
- if (!scenePresence.IsChildAgent)
+ ScenePresence[] scenePresences = scene.GetScenePresences();
+
+ for (int i = 0; i < scenePresences.Length; i++)
{
- avatars.Add(scenePresence);
+ ScenePresence scenePresence = scenePresences[i];
+ if (!scenePresence.IsChildAgent)
+ avatars.Add(scenePresence);
}
}
- });
+ );
return avatars;
}
@@ -456,7 +461,7 @@ namespace OpenSim.Region.Framework.Scenes
ForEachCurrentScene(delegate(Scene scene)
{
- List scenePresences = scene.GetScenePresences();
+ ScenePresence[] scenePresences = scene.GetScenePresences();
presences.AddRange(scenePresences);
});
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 69b3ded..4f19761 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1182,8 +1182,8 @@ namespace OpenSim.Region.Framework.Scenes
{
// part.Inventory.RemoveScriptInstances();
- List avatars = Scene.GetScenePresences();
- for (int i = 0; i < avatars.Count; i++)
+ ScenePresence[] avatars = Scene.GetScenePresences();
+ for (int i = 0; i < avatars.Length; i++)
{
if (avatars[i].ParentID == LocalId)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 32171a0..7193002 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1077,8 +1077,8 @@ if (m_shape != null) {
private void SendObjectPropertiesToClient(UUID AgentID)
{
- List avatars = m_parentGroup.Scene.GetScenePresences();
- for (int i = 0; i < avatars.Count; i++)
+ ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
+ for (int i = 0; i < avatars.Length; i++)
{
// Ugly reference :(
if (avatars[i].UUID == AgentID)
@@ -1140,8 +1140,8 @@ if (m_shape != null) {
///
public void AddFullUpdateToAllAvatars()
{
- List avatars = m_parentGroup.Scene.GetScenePresences();
- for (int i = 0; i < avatars.Count; i++)
+ ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
+ for (int i = 0; i < avatars.Length; i++)
{
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
@@ -1165,8 +1165,8 @@ if (m_shape != null) {
/// Terse updates
public void AddTerseUpdateToAllAvatars()
{
- List avatars = m_parentGroup.Scene.GetScenePresences();
- for (int i = 0; i < avatars.Count; i++)
+ ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
+ for (int i = 0; i < avatars.Length; i++)
{
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
@@ -1894,24 +1894,24 @@ if (m_shape != null) {
}
else
{
- List avlist = m_parentGroup.Scene.GetScenePresences();
- if (avlist != null)
+ ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
+
+ for (int i = 0; i < avlist.Length; i++)
{
- foreach (ScenePresence av in avlist)
+ ScenePresence av = avlist[i];
+
+ if (av.LocalId == localId)
{
- if (av.LocalId == localId)
- {
- DetectedObject detobj = new DetectedObject();
- detobj.keyUUID = av.UUID;
- detobj.nameStr = av.ControllingClient.Name;
- detobj.ownerUUID = av.UUID;
- detobj.posVector = av.AbsolutePosition;
- detobj.rotQuat = av.Rotation;
- detobj.velVector = av.Velocity;
- detobj.colliderType = 0;
- detobj.groupUUID = av.ControllingClient.ActiveGroupId;
- colliding.Add(detobj);
- }
+ DetectedObject detobj = new DetectedObject();
+ detobj.keyUUID = av.UUID;
+ detobj.nameStr = av.ControllingClient.Name;
+ detobj.ownerUUID = av.UUID;
+ detobj.posVector = av.AbsolutePosition;
+ detobj.rotQuat = av.Rotation;
+ detobj.velVector = av.Velocity;
+ detobj.colliderType = 0;
+ detobj.groupUUID = av.ControllingClient.ActiveGroupId;
+ colliding.Add(detobj);
}
}
}
@@ -1965,26 +1965,25 @@ if (m_shape != null) {
}
else
{
- List avlist = m_parentGroup.Scene.GetScenePresences();
- if (avlist != null)
+ ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
+
+ for (int i = 0; i < avlist.Length; i++)
{
- foreach (ScenePresence av in avlist)
+ ScenePresence av = avlist[i];
+
+ if (av.LocalId == localId)
{
- if (av.LocalId == localId)
- {
- DetectedObject detobj = new DetectedObject();
- detobj.keyUUID = av.UUID;
- detobj.nameStr = av.Name;
- detobj.ownerUUID = av.UUID;
- detobj.posVector = av.AbsolutePosition;
- detobj.rotQuat = av.Rotation;
- detobj.velVector = av.Velocity;
- detobj.colliderType = 0;
- detobj.groupUUID = av.ControllingClient.ActiveGroupId;
- colliding.Add(detobj);
- }
+ DetectedObject detobj = new DetectedObject();
+ detobj.keyUUID = av.UUID;
+ detobj.nameStr = av.Name;
+ detobj.ownerUUID = av.UUID;
+ detobj.posVector = av.AbsolutePosition;
+ detobj.rotQuat = av.Rotation;
+ detobj.velVector = av.Velocity;
+ detobj.colliderType = 0;
+ detobj.groupUUID = av.ControllingClient.ActiveGroupId;
+ colliding.Add(detobj);
}
-
}
}
}
@@ -2035,24 +2034,24 @@ if (m_shape != null) {
}
else
{
- List avlist = m_parentGroup.Scene.GetScenePresences();
- if (avlist != null)
+ ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
+
+ for (int i = 0; i < avlist.Length; i++)
{
- foreach (ScenePresence av in avlist)
+ ScenePresence av = avlist[i];
+
+ if (av.LocalId == localId)
{
- if (av.LocalId == localId)
- {
- DetectedObject detobj = new DetectedObject();
- detobj.keyUUID = av.UUID;
- detobj.nameStr = av.Name;
- detobj.ownerUUID = av.UUID;
- detobj.posVector = av.AbsolutePosition;
- detobj.rotQuat = av.Rotation;
- detobj.velVector = av.Velocity;
- detobj.colliderType = 0;
- detobj.groupUUID = av.ControllingClient.ActiveGroupId;
- colliding.Add(detobj);
- }
+ DetectedObject detobj = new DetectedObject();
+ detobj.keyUUID = av.UUID;
+ detobj.nameStr = av.Name;
+ detobj.ownerUUID = av.UUID;
+ detobj.posVector = av.AbsolutePosition;
+ detobj.rotQuat = av.Rotation;
+ detobj.velVector = av.Velocity;
+ detobj.colliderType = 0;
+ detobj.groupUUID = av.ControllingClient.ActiveGroupId;
+ colliding.Add(detobj);
}
}
}
@@ -2312,8 +2311,8 @@ if (m_shape != null) {
///
public void SendFullUpdateToAllClients()
{
- List avatars = m_parentGroup.Scene.GetScenePresences();
- for (int i = 0; i < avatars.Count; i++)
+ ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
+ for (int i = 0; i < avatars.Length; i++)
{
// Ugly reference :(
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
@@ -2323,8 +2322,8 @@ if (m_shape != null) {
public void SendFullUpdateToAllClientsExcept(UUID agentID)
{
- List avatars = m_parentGroup.Scene.GetScenePresences();
- for (int i = 0; i < avatars.Count; i++)
+ ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
+ for (int i = 0; i < avatars.Length; i++)
{
// Ugly reference :(
if (avatars[i].UUID != agentID)
@@ -2467,8 +2466,8 @@ if (m_shape != null) {
///
public void SendTerseUpdateToAllClients()
{
- List avatars = m_parentGroup.Scene.GetScenePresences();
- for (int i = 0; i < avatars.Count; i++)
+ ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
+ for (int i = 0; i < avatars.Length; i++)
{
SendTerseUpdateToClient(avatars[i].ControllingClient);
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ccfffe7..77706ac 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -869,14 +869,16 @@ namespace OpenSim.Region.Framework.Scenes
m_isChildAgent = false;
- List AnimAgents = m_scene.GetScenePresences();
- foreach (ScenePresence p in AnimAgents)
+ ScenePresence[] animAgents = m_scene.GetScenePresences();
+ for (int i = 0; i < animAgents.Length; i++)
{
- if (p != this)
- p.SendAnimPackToClient(ControllingClient);
+ ScenePresence presence = animAgents[i];
+
+ if (presence != this)
+ presence.SendAnimPackToClient(ControllingClient);
}
- m_scene.EventManager.TriggerOnMakeRootAgent(this);
+ m_scene.EventManager.TriggerOnMakeRootAgent(this);
}
///
@@ -2533,9 +2535,12 @@ namespace OpenSim.Region.Framework.Scenes
{
m_perfMonMS = Environment.TickCount;
- List avatars = m_scene.GetScenePresences();
- foreach (ScenePresence avatar in avatars)
+ ScenePresence[] avatars = m_scene.GetScenePresences();
+
+ for (int i = 0; i < avatars.Length; i++)
{
+ ScenePresence avatar = avatars[i];
+
// only send if this is the root (children are only "listening posts" in a foreign region)
if (!IsChildAgent)
{
@@ -2553,7 +2558,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
+ m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
//SendAnimPack();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 669189d..56d4d28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7227,13 +7227,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetNumberOfPrims()
{
m_host.AddScriptLPS(1);
- List presences = World.GetScenePresences();
- if (presences.Count == 0)
+ ScenePresence[] presences = World.GetScenePresences();
+ if (presences.Length == 0)
return 0;
int avatarCount = 0;
- foreach (ScenePresence presence in presences)
+ for (int i = 0; i < presences.Length; i++)
{
+ ScenePresence presence = presences[i];
+
if (!presence.IsChildAgent && presence.ParentID != 0)
{
if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index a09c8db..ee01c3c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -404,7 +404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
private List doAgentSensor(SenseRepeatClass ts)
{
- List Presences;
+ List presences;
List sensedEntities = new List();
// If this is an avatar sense by key try to get them directly
@@ -414,16 +414,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID);
if (p == null)
return sensedEntities;
- Presences = new List();
- Presences.Add(p);
+ presences = new List();
+ presences.Add(p);
}
else
{
- Presences = m_CmdManager.m_ScriptEngine.World.GetScenePresences();
+ presences = new List(m_CmdManager.m_ScriptEngine.World.GetScenePresences());
}
// If nobody about quit fast
- if (Presences.Count == 0)
+ if (presences.Count == 0)
return sensedEntities;
SceneObjectPart SensePoint = ts.host;
@@ -440,8 +440,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
Vector3 toRegionPos;
double dis;
- foreach (ScenePresence presence in Presences)
+ for (int i = 0; i < presences.Count; i++)
{
+ ScenePresence presence = presences[i];
bool keep = true;
if (presence.IsDeleted)
diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
index d7c39a3..704b74f 100644
--- a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
+++ b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
@@ -68,11 +68,11 @@ namespace OpenSim.Region.UserStatistics
HTMLUtil.OL_O(ref output, "");
foreach (Scene scene in all_scenes)
{
- List avatarInScene = scene.GetScenePresences();
+ ScenePresence[] avatarInScene = scene.GetScenePresences();
- HTMLUtil.LI_O(ref output, "");
+ HTMLUtil.LI_O(ref output, String.Empty);
output.Append(scene.RegionInfo.RegionName);
- HTMLUtil.OL_O(ref output, "");
+ HTMLUtil.OL_O(ref output, String.Empty);
foreach (ScenePresence av in avatarInScene)
{
Dictionary queues = new Dictionary();
@@ -81,7 +81,7 @@ namespace OpenSim.Region.UserStatistics
IStatsCollector isClient = (IStatsCollector) av.ControllingClient;
queues = decodeQueueReport(isClient.Report());
}
- HTMLUtil.LI_O(ref output, "");
+ HTMLUtil.LI_O(ref output, String.Empty);
output.Append(av.Name);
output.Append(" ");
output.Append((av.IsChildAgent ? "Child" : "Root"));
@@ -96,12 +96,12 @@ namespace OpenSim.Region.UserStatistics
(int) av.AbsolutePosition.Z));
}
Dictionary throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
-
- HTMLUtil.UL_O(ref output, "");
+
+ HTMLUtil.UL_O(ref output, String.Empty);
foreach (string throttlename in throttles.Keys)
{
- HTMLUtil.LI_O(ref output, "");
+ HTMLUtil.LI_O(ref output, String.Empty);
output.Append(throttlename);
output.Append(":");
output.Append(throttles[throttlename].ToString());
--
cgit v1.1
From 53bf479bab05e689b1403a27a175bedad379ea6d Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 23 Oct 2009 01:11:40 -0700
Subject: Commented out noisy debugging about resent packets (normal) and
agents setting throttles (normal)
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 4 ++--
OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index a9bc7d2..460938e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -304,8 +304,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int total = resend + land + wind + cloud + task + texture + asset + state;
- m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, State={8}, Total={9}",
- AgentID, resend, land, wind, cloud, task, texture, asset, state, total);
+ //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, State={8}, Total={9}",
+ // AgentID, resend, land, wind, cloud, task, texture, asset, state, total);
// Update the token buckets with new throttle values
TokenBucket bucket;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 734471e..2973d4b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -405,7 +405,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (expiredPackets != null)
{
- m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
+ //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
// Resend packets
for (int i = 0; i < expiredPackets.Count; i++)
--
cgit v1.1
From ac0acb02962c37f870dc38a356e1530803f699e8 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 23 Oct 2009 01:33:05 -0700
Subject: * Changed the max RTO value to 60 seconds to comply with RFC 2988 *
Implemented section 5.5, exponential backoff of the RTO after a resend
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 2 +-
OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 460938e..d2cd6d9 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -500,7 +500,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
RTO = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
// Clamp the retransmission timeout to manageable values
- RTO = Utils.Clamp(RTO, 3000, 10000);
+ RTO = Utils.Clamp(RTO, 3000, 60000);
//m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
// RTTVAR + " based on new RTT of " + r + "ms");
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 2973d4b..7e929e5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -407,6 +407,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
//m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
+ // Backoff the RTO
+ udpClient.RTO = Math.Min(udpClient.RTO * 2, 60000);
+
// Resend packets
for (int i = 0; i < expiredPackets.Count; i++)
{
--
cgit v1.1
From 37f7277378d38cdf2633e79d551cc0c83bf5e479 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 23 Oct 2009 01:33:43 -0700
Subject: Uncommented the resend log line so the previous commit can be seen in
action
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 7e929e5..e9faf2e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -405,7 +405,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (expiredPackets != null)
{
- //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
+ m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
// Backoff the RTO
udpClient.RTO = Math.Min(udpClient.RTO * 2, 60000);
--
cgit v1.1
From d0019704e60da8392f505f1bb783ee668b0299b1 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Fri, 23 Oct 2009 09:47:45 +0100
Subject: Adding the presence service skeleton
---
OpenSim/Data/IPresenceData.cs | 55 ++++++++++++++
.../Services/PresenceService/PresenceService.cs | 53 ++++++++++++++
.../PresenceService/PresenceServiceBase.cs | 84 ++++++++++++++++++++++
prebuild.xml | 31 ++++++++
4 files changed, 223 insertions(+)
create mode 100644 OpenSim/Data/IPresenceData.cs
create mode 100644 OpenSim/Services/PresenceService/PresenceService.cs
create mode 100644 OpenSim/Services/PresenceService/PresenceServiceBase.cs
diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs
new file mode 100644
index 0000000..ca661a2
--- /dev/null
+++ b/OpenSim/Data/IPresenceData.cs
@@ -0,0 +1,55 @@
+/*
+ * 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 OpenMetaverse;
+using OpenSim.Framework;
+
+namespace OpenSim.Data
+{
+ public class PresenceData
+ {
+ public UUID PrincipalID;
+ public UUID RegionID;
+ public Dictionary Data;
+ }
+
+ ///
+ /// An interface for connecting to the authentication datastore
+ ///
+ public interface IPresenceData
+ {
+ bool Store(PresenceData data);
+
+ PresenceData Get(UUID principalID);
+
+ bool SetDataItem(UUID principalID, string item, string value);
+
+ bool Delete(UUID regionID);
+ }
+}
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
new file mode 100644
index 0000000..6e59642
--- /dev/null
+++ b/OpenSim/Services/PresenceService/PresenceService.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;
+using System.Net;
+using System.Reflection;
+using Nini.Config;
+using log4net;
+using OpenSim.Framework;
+using OpenSim.Framework.Console;
+using OpenSim.Data;
+using OpenSim.Services.Interfaces;
+using OpenMetaverse;
+
+namespace OpenSim.Services.PresenceService
+{
+ public class PresenceService : PresenceServiceBase, IPresenceService
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ public PresenceService(IConfigSource config)
+ : base(config)
+ {
+ }
+ }
+}
diff --git a/OpenSim/Services/PresenceService/PresenceServiceBase.cs b/OpenSim/Services/PresenceService/PresenceServiceBase.cs
new file mode 100644
index 0000000..60a246b
--- /dev/null
+++ b/OpenSim/Services/PresenceService/PresenceServiceBase.cs
@@ -0,0 +1,84 @@
+/*
+ * 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.Reflection;
+using Nini.Config;
+using OpenSim.Framework;
+using OpenSim.Data;
+using OpenSim.Services.Interfaces;
+using OpenSim.Services.Base;
+
+namespace OpenSim.Services.PresenceService
+{
+ public class PresenceServiceBase : ServiceBase
+ {
+ protected IPresenceData m_Database = null;
+
+ public PresenceServiceBase(IConfigSource config)
+ : base(config)
+ {
+ string dllName = String.Empty;
+ string connString = String.Empty;
+ string realm = "agents";
+
+ //
+ // Try reading the [DatabaseService] section, if it exists
+ //
+ IConfig dbConfig = config.Configs["DatabaseService"];
+ if (dbConfig != null)
+ {
+ if (dllName == String.Empty)
+ dllName = dbConfig.GetString("StorageProvider", String.Empty);
+ if (connString == String.Empty)
+ connString = dbConfig.GetString("ConnectionString", String.Empty);
+ }
+
+ //
+ // [PresenceService] section overrides [DatabaseService], if it exists
+ //
+ IConfig presenceConfig = config.Configs["PresenceService"];
+ if (presenceConfig != null)
+ {
+ dllName = presenceConfig.GetString("StorageProvider", dllName);
+ connString = presenceConfig.GetString("ConnectionString", connString);
+ realm = presenceConfig.GetString("Realm", realm);
+ }
+
+ //
+ // We tried, but this doesn't exist. We can't proceed.
+ //
+ if (dllName.Equals(String.Empty))
+ throw new Exception("No StorageProvider configured");
+
+ m_Database = LoadPlugin(dllName, new Object[] { connString, realm });
+ if (m_Database == null)
+ throw new Exception("Could not find a storage interface in the given module");
+
+ }
+ }
+}
diff --git a/prebuild.xml b/prebuild.xml
index 1c44ebf..d2d1e6d 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1411,6 +1411,37 @@
+
+
+
+ ../../../bin/
+
+
+
+
+ ../../../bin/
+
+
+
+ ../../../bin/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.1
From 62f1a5e36d85b95e8f80bc073ba876873494963a Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 23 Oct 2009 02:38:59 -0700
Subject: Implemented a "FrontBack" prioritizer, using distance plus the plane
equation to give double weight to prims/avatars in front of you
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++
.../Region/Framework/Scenes/SceneObjectGroup.cs | 33 ++++++++++++++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 44 ++++++++++++++++++++++
bin/OpenSim.ini.example | 4 +-
4 files changed, 80 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d5e3445..ee848bb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
Time = 0,
Distance = 1,
SimpleAngularDistance = 2,
+ FrontBack = 3,
}
public delegate void SynchronizeSceneHandler(Scene scene);
@@ -540,6 +541,9 @@ namespace OpenSim.Region.Framework.Scenes
case "simpleangulardistance":
m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
break;
+ case "frontback":
+ m_update_prioritization_scheme = UpdatePrioritizationSchemes.FrontBack;
+ break;
default:
m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4f19761..dd8da20 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -493,8 +493,8 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 GroupScale()
{
- Vector3 minScale = new Vector3(Constants.RegionSize,Constants.RegionSize,Constants.RegionSize);
- Vector3 maxScale = new Vector3(0f,0f,0f);
+ Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
+ Vector3 maxScale = Vector3.Zero;
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
lock (m_parts)
@@ -577,7 +577,6 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart part in m_parts.Values)
{
-
Vector3 worldPos = part.GetWorldPosition();
Vector3 offset = worldPos - AbsolutePosition;
Quaternion worldRot;
@@ -3366,6 +3365,8 @@ namespace OpenSim.Region.Framework.Scenes
return GetPriorityByDistance(client);
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
return GetPriorityBySimpleAngularDistance(client);
+ case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
+ return GetPriorityByFrontBack(client);
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
}
@@ -3398,6 +3399,16 @@ namespace OpenSim.Region.Framework.Scenes
return double.NaN;
}
+ private double GetPriorityByFrontBack(IClientAPI client)
+ {
+ ScenePresence presence = Scene.GetScenePresence(client.AgentId);
+ if (presence != null)
+ {
+ return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
+ }
+ return double.NaN;
+ }
+
public double GetPriorityByDistance(Vector3 position)
{
return Vector3.Distance(AbsolutePosition, position);
@@ -3427,5 +3438,21 @@ namespace OpenSim.Region.Framework.Scenes
else
return double.MinValue;
}
+
+ public double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
+ {
+ // Distance
+ double priority = Vector3.Distance(camPosition, AbsolutePosition);
+
+ // Scale
+ //priority -= GroupScale().Length();
+
+ // Plane equation
+ float d = -Vector3.Dot(camPosition, camAtAxis);
+ float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
+ if (p < 0.0f) priority *= 2.0f;
+
+ return priority;
+ }
}
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 77706ac..a610e42 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -297,6 +297,21 @@ namespace OpenSim.Region.Framework.Scenes
get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); }
}
+ public Vector3 CameraAtAxis
+ {
+ get { return m_CameraAtAxis; }
+ }
+
+ public Vector3 CameraLeftAxis
+ {
+ get { return m_CameraLeftAxis; }
+ }
+
+ public Vector3 CameraUpAxis
+ {
+ get { return m_CameraUpAxis; }
+ }
+
public Vector3 Lookat
{
get
@@ -3867,6 +3882,8 @@ namespace OpenSim.Region.Framework.Scenes
return GetPriorityByDistance(client);
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
return GetPriorityByDistance(client);
+ case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
+ return GetPriorityByFrontBack(client);
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
}
@@ -3888,11 +3905,34 @@ namespace OpenSim.Region.Framework.Scenes
return double.NaN;
}
+ private double GetPriorityByFrontBack(IClientAPI client)
+ {
+ ScenePresence presence = Scene.GetScenePresence(client.AgentId);
+ if (presence != null)
+ {
+ return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
+ }
+ return double.NaN;
+ }
+
private double GetPriorityByDistance(Vector3 position)
{
return Vector3.Distance(AbsolutePosition, position);
}
+ private double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
+ {
+ // Distance
+ double priority = Vector3.Distance(camPosition, AbsolutePosition);
+
+ // Plane equation
+ float d = -Vector3.Dot(camPosition, camAtAxis);
+ float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
+ if (p < 0.0f) priority *= 2.0f;
+
+ return priority;
+ }
+
private double GetSOGUpdatePriority(SceneObjectGroup sog)
{
switch (Scene.UpdatePrioritizationScheme)
@@ -3903,6 +3943,8 @@ namespace OpenSim.Region.Framework.Scenes
return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
+ case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
+ return sog.GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
}
@@ -3929,6 +3971,8 @@ namespace OpenSim.Region.Framework.Scenes
case Scene.UpdatePrioritizationSchemes.Distance:
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
+ case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
+ return GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
}
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 6ff70fc..3dc746e 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1397,8 +1397,8 @@
[InterestManagement]
; This section controls how state updates are prioritized for each client
- ; Valid values are Time, Distance, and SimpleAngularDistance
- UpdatePrioritizationScheme = Distance;
+ ; Valid values are Time, Distance, SimpleAngularDistance, and FrontBack
+ UpdatePrioritizationScheme = FrontBack;
ReprioritizationEnabled = true;
ReprioritizationInterval = 2000.0;
RootReprioritizationDistance = 10.0;
--
cgit v1.1
From b0923e0d73da51718332a9741931442673c84fe0 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Fri, 23 Oct 2009 10:41:05 +0100
Subject: Fix a glitch in a ROBUST message
---
OpenSim/Server/ServerMain.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs
index a7b33c9..10cd9c5 100644
--- a/OpenSim/Server/ServerMain.cs
+++ b/OpenSim/Server/ServerMain.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Server
if (port != 0)
server = m_Server.GetHttpServer(port);
- if (port != m_Server.DefaultPort)
+ if (port != m_Server.DefaultPort && port != 0)
m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port);
else
m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName);
--
cgit v1.1
From 71c929137f48a0a7d97dbc866cbe2b12319aa40b Mon Sep 17 00:00:00 2001
From: unknown
Date: Fri, 23 Oct 2009 03:52:49 -0700
Subject: Inconsistent locking of SenseRepeaters in Script Engine.
When I attempt to 'save oar' on a region with thousands of scripts with timers, I get a NullReferenceException every time. The problem comes from inconsistent locking in SensorRepeat.cs of the SenseRepeaters List. It is iterated and modified in many places and these places are all wrapped in a lock except in the GetSerializationData(). This is the function throwing the exception because an item in the list becomes null during iteration.
The attached patch locks SenseRepeatListLock in GetSerializationData()
---
.../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index ee01c3c..b75a2e4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -516,16 +516,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{
List
- public override PhysicsVector Position
+ public override Vector3 Position
{
get { return _position; }
set
{
if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
- if (value.Z > 9999999)
+ if (value.Z > 9999999f)
{
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
}
- if (value.Z < -90000)
+ if (value.Z < -90000f)
{
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
}
@@ -447,7 +438,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
- public override PhysicsVector RotationalVelocity
+ public override Vector3 RotationalVelocity
{
get { return m_rotationalVelocity; }
set { m_rotationalVelocity = value; }
@@ -457,20 +448,20 @@ namespace OpenSim.Region.Physics.OdePlugin
/// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight
/// and use it to offset landings properly
///
- public override PhysicsVector Size
+ public override Vector3 Size
{
- get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
+ get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
m_pidControllerActive = true;
- PhysicsVector SetSize = value;
+ Vector3 SetSize = value;
m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f;
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
- Velocity = new PhysicsVector(0f, 0f, 0f);
+ Velocity = Vector3.Zero;
_parent_scene.AddPhysicsActorTaint(this);
}
@@ -481,7 +472,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
- private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector)
+ private void AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3 movementVector)
{
movementVector.Z = 0f;
float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y));
@@ -643,7 +634,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// (with -0..0 motor stops) falls into the terrain for reasons yet
// to be comprehended in their entirety.
#endregion
- AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0));
+ AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
@@ -688,7 +679,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
- public override void LockAngularMotion(PhysicsVector axis)
+ public override void LockAngularMotion(Vector3 axis)
{
}
@@ -716,9 +707,9 @@ namespace OpenSim.Region.Physics.OdePlugin
// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
// }
- public override PhysicsVector Force
+ public override Vector3 Force
{
- get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); }
+ get { return _target_velocity; }
set { return; }
}
@@ -733,7 +724,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
- public override void VehicleVectorParam(int param, PhysicsVector value)
+ public override void VehicleVectorParam(int param, Vector3 value)
{
}
@@ -748,14 +739,14 @@ namespace OpenSim.Region.Physics.OdePlugin
}
- public override PhysicsVector CenterOfMass
+ public override Vector3 CenterOfMass
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
- public override PhysicsVector GeometricCenter
+ public override Vector3 GeometricCenter
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
public override PrimitiveBaseShape Shape
@@ -763,18 +754,18 @@ namespace OpenSim.Region.Physics.OdePlugin
set { return; }
}
- public override PhysicsVector Velocity
+ public override Vector3 Velocity
{
get {
- // There's a problem with PhysicsVector.Zero! Don't Use it Here!
+ // There's a problem with Vector3.Zero! Don't Use it Here!
if (_zeroFlag)
- return new PhysicsVector(0f, 0f, 0f);
+ return Vector3.Zero;
m_lastUpdateSent = false;
return _velocity;
}
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
m_pidControllerActive = true;
_target_velocity = value;
@@ -786,9 +777,9 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
- public override PhysicsVector Torque
+ public override Vector3 Torque
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
@@ -814,12 +805,12 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
- public override PhysicsVector Acceleration
+ public override Vector3 Acceleration
{
get { return _acceleration; }
}
- public void SetAcceleration(PhysicsVector accel)
+ public void SetAcceleration(Vector3 accel)
{
m_pidControllerActive = true;
_acceleration = accel;
@@ -830,9 +821,9 @@ namespace OpenSim.Region.Physics.OdePlugin
/// The PID controller takes this target velocity and tries to make it a reality
///
///
- public override void AddForce(PhysicsVector force, bool pushforce)
+ public override void AddForce(Vector3 force, bool pushforce)
{
- if (PhysicsVector.isFinite(force))
+ if (force.IsFinite())
{
if (pushforce)
{
@@ -861,7 +852,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//m_lastUpdateSent = false;
}
- public override void AddAngularForce(PhysicsVector force, bool pushforce)
+ public override void AddAngularForce(Vector3 force, bool pushforce)
{
}
@@ -870,7 +861,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// After all of the forces add up with 'add force' we apply them with doForce
///
///
- public void doForce(PhysicsVector force)
+ public void doForce(Vector3 force)
{
if (!collidelock)
{
@@ -881,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
- public override void SetMomentum(PhysicsVector momentum)
+ public override void SetMomentum(Vector3 momentum)
{
}
@@ -908,9 +899,9 @@ namespace OpenSim.Region.Physics.OdePlugin
//PidStatus = true;
d.Vector3 localpos = d.BodyGetPosition(Body);
- PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z);
+ Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z);
- if (!PhysicsVector.isFinite(localPos))
+ if (!localPos.IsFinite())
{
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
@@ -946,7 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return;
}
- PhysicsVector vec = new PhysicsVector();
+ Vector3 vec = Vector3.Zero;
d.Vector3 vel = d.BodyGetLinearVel(Body);
float movementdivisor = 1f;
@@ -1059,12 +1050,12 @@ namespace OpenSim.Region.Physics.OdePlugin
}
// end add Kitto Flora
}
- if (PhysicsVector.isFinite(vec))
+ if (vec.IsFinite())
{
doForce(vec);
if (!_zeroFlag)
{
- AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z));
+ AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
}
}
else
@@ -1197,7 +1188,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
}
- public override PhysicsVector PIDTarget { set { return; } }
+ public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override float PIDTau { set { return; } }
@@ -1311,7 +1302,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomDestroy(Shell);
AvatarGeomAndBodyCreation(_position.X, _position.Y,
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
- Velocity = new PhysicsVector(0f, 0f, 0f);
+ Velocity = Vector3.Zero;
_parent_scene.geom_name_map[Shell] = m_name;
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
@@ -1325,7 +1316,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
- if (!m_taintPosition.IsIdentical(_position, 0.05f))
+ if (!m_taintPosition.ApproxEquals(_position, 0.05f))
{
if (Body != IntPtr.Zero)
{
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
index 019c78b..4a802cd 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
@@ -232,7 +232,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}//end ProcessFloatVehicleParam
- internal void ProcessVectorVehicleParam(Vehicle pParam, PhysicsVector pValue)
+ internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
{
switch (pParam)
{
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 09c8582..5ff9d32 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -57,44 +57,43 @@ namespace OpenSim.Region.Physics.OdePlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private PhysicsVector _position;
- private PhysicsVector _velocity;
- private PhysicsVector _torque = new PhysicsVector(0,0,0);
- private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
- private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
+ private Vector3 _position;
+ private Vector3 _velocity;
+ private Vector3 _torque;
+ private Vector3 m_lastVelocity;
+ private Vector3 m_lastposition;
private Quaternion m_lastorientation = new Quaternion();
- private PhysicsVector m_rotationalVelocity;
- private PhysicsVector _size;
- private PhysicsVector _acceleration;
+ private Vector3 m_rotationalVelocity;
+ private Vector3 _size;
+ private Vector3 _acceleration;
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
private Quaternion _orientation;
- private PhysicsVector m_taintposition;
- private PhysicsVector m_taintsize;
- private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0);
- private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0);
+ private Vector3 m_taintposition;
+ private Vector3 m_taintsize;
+ private Vector3 m_taintVelocity;
+ private Vector3 m_taintTorque;
private Quaternion m_taintrot;
- private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f);
- private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f);
+ private Vector3 m_angularlock = Vector3.One;
+ private Vector3 m_taintAngularLock = Vector3.One;
private IntPtr Amotor = IntPtr.Zero;
- private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0);
- // private PhysicsVector m_taintPIDTarget = new PhysicsVector(0, 0, 0);
- private float m_PIDTau = 0f;
+ private Vector3 m_PIDTarget;
+ private float m_PIDTau;
private float PID_D = 35f;
private float PID_G = 25f;
- private bool m_usePID = false;
+ private bool m_usePID;
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
// and are for non-VEHICLES only.
-
- private float m_PIDHoverHeight = 0f;
- private float m_PIDHoverTau = 0f;
- private bool m_useHoverPID = false;
+
+ private float m_PIDHoverHeight;
+ private float m_PIDHoverTau;
+ private bool m_useHoverPID;
private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
- private float m_targetHoverHeight = 0f;
- private float m_groundHeight = 0f;
- private float m_waterHeight = 0f;
- private float m_buoyancy = 0f; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
+ private float m_targetHoverHeight;
+ private float m_groundHeight;
+ private float m_waterHeight;
+ private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
// private float m_tensor = 5f;
private int body_autodisable_frames = 20;
@@ -105,11 +104,11 @@ namespace OpenSim.Region.Physics.OdePlugin
| CollisionCategories.Body
| CollisionCategories.Character
);
- private bool m_taintshape = false;
- private bool m_taintPhysics = false;
+ private bool m_taintshape;
+ private bool m_taintPhysics;
private bool m_collidesLand = true;
- private bool m_collidesWater = false;
- public bool m_returnCollisions = false;
+ private bool m_collidesWater;
+ public bool m_returnCollisions;
// Default we're a Geometry
private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
@@ -117,85 +116,83 @@ namespace OpenSim.Region.Physics.OdePlugin
// Default, Collide with Other Geometries, spaces and Bodies
private CollisionCategories m_collisionFlags = m_default_collisionFlags;
- public bool m_taintremove = false;
- public bool m_taintdisable = false;
- public bool m_disabled = false;
- public bool m_taintadd = false;
- public bool m_taintselected = false;
- public bool m_taintCollidesWater = false;
+ public bool m_taintremove;
+ public bool m_taintdisable;
+ public bool m_disabled;
+ public bool m_taintadd;
+ public bool m_taintselected;
+ public bool m_taintCollidesWater;
- public uint m_localID = 0;
+ public uint m_localID;
//public GCHandle gc;
private CollisionLocker ode;
private bool m_taintforce = false;
private bool m_taintaddangularforce = false;
- private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
- private List m_forcelist = new List();
- private List m_angularforcelist = new List();
+ private Vector3 m_force;
+ private List m_forcelist = new List();
+ private List m_angularforcelist = new List();
private IMesh _mesh;
private PrimitiveBaseShape _pbs;
private OdeScene _parent_scene;
- public IntPtr m_targetSpace = (IntPtr) 0;
+ public IntPtr m_targetSpace = IntPtr.Zero;
public IntPtr prim_geom;
public IntPtr prev_geom;
public IntPtr _triMeshData;
- private IntPtr _linkJointGroup = (IntPtr)0;
- private PhysicsActor _parent = null;
- private PhysicsActor m_taintparent = null;
+ private IntPtr _linkJointGroup = IntPtr.Zero;
+ private PhysicsActor _parent;
+ private PhysicsActor m_taintparent;
private List childrenPrim = new List();
- private bool iscolliding = false;
- private bool m_isphysical = false;
- private bool m_isSelected = false;
+ private bool iscolliding;
+ private bool m_isphysical;
+ private bool m_isSelected;
- internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively
+ internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
- private bool m_throttleUpdates = false;
- private int throttleCounter = 0;
- public int m_interpenetrationcount = 0;
- public float m_collisionscore = 0;
- public int m_roundsUnderMotionThreshold = 0;
- private int m_crossingfailures = 0;
+ private bool m_throttleUpdates;
+ private int throttleCounter;
+ public int m_interpenetrationcount;
+ public float m_collisionscore;
+ public int m_roundsUnderMotionThreshold;
+ private int m_crossingfailures;
- public bool outofBounds = false;
+ public bool outofBounds;
private float m_density = 10.000006836f; // Aluminum g/cm3;
- public bool _zeroFlag = false;
- private bool m_lastUpdateSent = false;
+ public bool _zeroFlag;
+ private bool m_lastUpdateSent;
- public IntPtr Body = (IntPtr) 0;
+ public IntPtr Body = IntPtr.Zero;
public String m_primName;
-// private String m_primName;
- private PhysicsVector _target_velocity;
+ private Vector3 _target_velocity;
public d.Mass pMass;
- public int m_eventsubscription = 0;
- private CollisionEventUpdate CollisionEventsThisFrame = null;
+ public int m_eventsubscription;
+ private CollisionEventUpdate CollisionEventsThisFrame;
- private IntPtr m_linkJoint = (IntPtr)0;
+ private IntPtr m_linkJoint = IntPtr.Zero;
- public volatile bool childPrim = false;
+ public volatile bool childPrim;
private ODEDynamics m_vehicle;
internal int m_material = (int)Material.Wood;
- public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size,
+ public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
{
- _target_velocity = new PhysicsVector(0, 0, 0);
m_vehicle = new ODEDynamics();
//gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
ode = dode;
- _velocity = new PhysicsVector();
- if (!PhysicsVector.isFinite(pos))
+ if (!pos.IsFinite())
{
- pos = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f)) + 0.5f);
+ pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f),
+ parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f);
m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
}
_position = pos;
@@ -210,9 +207,9 @@ namespace OpenSim.Region.Physics.OdePlugin
prim_geom = IntPtr.Zero;
prev_geom = IntPtr.Zero;
- if (!PhysicsVector.isFinite(pos))
+ if (!pos.IsFinite())
{
- size = new PhysicsVector(0.5f, 0.5f, 0.5f);
+ size = new Vector3(0.5f, 0.5f, 0.5f);
m_log.Warn("[PHYSICS]: Got nonFinite Object create Size");
}
@@ -222,8 +219,6 @@ namespace OpenSim.Region.Physics.OdePlugin
_size = size;
m_taintsize = _size;
- _acceleration = new PhysicsVector();
- m_rotationalVelocity = PhysicsVector.Zero;
if (!QuaternionIsFinite(rotation))
{
@@ -388,7 +383,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_disabled = false;
// The body doesn't already have a finite rotation mode set here
- if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
+ if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null)
{
createAMotor(m_angularlock);
}
@@ -882,7 +877,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (prim_geom != IntPtr.Zero)
{
- if (!_position.IsIdentical(m_taintposition,0f))
+ if (!_position.ApproxEquals(m_taintposition, 0f))
changemove(timestep);
if (m_taintrot != _orientation)
@@ -907,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
changePhysicsStatus(timestep);
//
- if (!_size.IsIdentical(m_taintsize,0))
+ if (!_size.ApproxEquals(m_taintsize,0f))
changesize(timestep);
//
@@ -921,7 +916,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (m_taintaddangularforce)
changeAddAngularForce(timestep);
- if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f))
+ if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
changeSetTorque(timestep);
if (m_taintdisable)
@@ -930,7 +925,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (m_taintselected != m_isSelected)
changeSelectedStatus(timestep);
- if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f))
+ if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
changevelocity(timestep);
if (m_taintparent != _parent)
@@ -939,7 +934,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (m_taintCollidesWater != m_collidesWater)
changefloatonwater(timestep);
- if (!m_angularlock.IsIdentical(m_taintAngularLock,0))
+ if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
changeAngularLock(timestep);
}
@@ -959,7 +954,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//If we have a parent then we're not authorative here
if (_parent == null)
{
- if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f,1f,1f), 0))
+ if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f))
{
//d.BodySetFiniteRotationMode(Body, 0);
//d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
@@ -976,7 +971,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
// Store this for later in case we get turned into a separate body
- m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z);
+ m_angularlock = m_taintAngularLock;
}
@@ -1120,7 +1115,7 @@ namespace OpenSim.Region.Physics.OdePlugin
prm.m_disabled = false;
// The body doesn't already have a finite rotation mode set here
- if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
+ if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
{
prm.createAMotor(m_angularlock);
}
@@ -1163,7 +1158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_disabled = false;
// The body doesn't already have a finite rotation mode set here
- if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
+ if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
{
createAMotor(m_angularlock);
}
@@ -1347,7 +1342,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintshape = false;
m_taintforce = false;
m_taintdisable = false;
- m_taintVelocity = PhysicsVector.Zero;
+ m_taintVelocity = Vector3.Zero;
}
public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
@@ -1576,7 +1571,7 @@ Console.WriteLine(" JointCreateFixed");
//Console.WriteLine("Move " + m_primName);
if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
// NON-'VEHICLES' are dealt with here
- if (d.BodyIsEnabled(Body) && !m_angularlock.IsIdentical(PhysicsVector.Zero, 0.003f))
+ if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
{
d.Vector3 avel2 = d.BodyGetAngularVel(Body);
if (m_angularlock.X == 1)
@@ -1633,7 +1628,7 @@ Console.WriteLine(" JointCreateFixed");
d.Vector3 pos = d.BodyGetPosition(Body);
_target_velocity =
- new PhysicsVector(
+ new Vector3(
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
(m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
(m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
@@ -1641,7 +1636,7 @@ Console.WriteLine(" JointCreateFixed");
// if velocity is zero, use position control; otherwise, velocity control
- if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f))
+ if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f))
{
// keep track of where we stopped. No more slippin' & slidin'
@@ -1726,13 +1721,13 @@ Console.WriteLine(" JointCreateFixed");
_target_velocity =
- new PhysicsVector(0.0f, 0.0f,
+ new Vector3(0.0f, 0.0f,
(m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
);
// if velocity is zero, use position control; otherwise, velocity control
- if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f))
+ if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
{
// keep track of where we stopped. No more slippin' & slidin'
@@ -1821,7 +1816,7 @@ Console.WriteLine(" JointCreateFixed");
d.BodySetQuaternion(Body, ref myrot);
if (m_isphysical)
{
- if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0))
+ if (!m_angularlock.ApproxEquals(Vector3.One, 0f))
createAMotor(m_angularlock);
}
}
@@ -2130,7 +2125,7 @@ Console.WriteLine(" JointCreateFixed");
//m_log.Info("[PHYSICS]: dequeing forcelist");
if (IsPhysical)
{
- PhysicsVector iforce = new PhysicsVector();
+ Vector3 iforce = Vector3.Zero;
for (int i = 0; i < m_forcelist.Count; i++)
{
iforce = iforce + (m_forcelist[i] * 100);
@@ -2160,8 +2155,8 @@ Console.WriteLine(" JointCreateFixed");
d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z);
}
}
-
- m_taintTorque = new PhysicsVector(0, 0, 0);
+
+ m_taintTorque = Vector3.Zero;
}
public void changeAddAngularForce(float timestamp)
@@ -2173,7 +2168,7 @@ Console.WriteLine(" JointCreateFixed");
//m_log.Info("[PHYSICS]: dequeing forcelist");
if (IsPhysical)
{
- PhysicsVector iforce = new PhysicsVector();
+ Vector3 iforce = Vector3.Zero;
for (int i = 0; i < m_angularforcelist.Count; i++)
{
iforce = iforce + (m_angularforcelist[i] * 100);
@@ -2207,7 +2202,7 @@ Console.WriteLine(" JointCreateFixed");
//resetCollisionAccounting();
}
- m_taintVelocity = PhysicsVector.Zero;
+ m_taintVelocity = Vector3.Zero;
}
public override bool IsPhysical
@@ -2216,7 +2211,7 @@ Console.WriteLine(" JointCreateFixed");
set {
m_isphysical = value;
if (!m_isphysical) // Zero the remembered last velocity
- m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
+ m_lastVelocity = Vector3.Zero;
}
}
@@ -2261,7 +2256,7 @@ Console.WriteLine(" JointCreateFixed");
get { return _zeroFlag; }
}
- public override PhysicsVector Position
+ public override Vector3 Position
{
get { return _position; }
@@ -2270,12 +2265,12 @@ Console.WriteLine(" JointCreateFixed");
}
}
- public override PhysicsVector Size
+ public override Vector3 Size
{
get { return _size; }
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
_size = value;
}
@@ -2291,13 +2286,13 @@ Console.WriteLine(" JointCreateFixed");
get { return CalculateMass(); }
}
- public override PhysicsVector Force
+ public override Vector3 Force
{
- //get { return PhysicsVector.Zero; }
+ //get { return Vector3.Zero; }
get { return m_force; }
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
m_force = value;
}
@@ -2319,7 +2314,7 @@ Console.WriteLine(" JointCreateFixed");
m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value);
}
- public override void VehicleVectorParam(int param, PhysicsVector value)
+ public override void VehicleVectorParam(int param, Vector3 value)
{
m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value);
}
@@ -2337,14 +2332,14 @@ Console.WriteLine(" JointCreateFixed");
}
}
- public override PhysicsVector CenterOfMass
+ public override Vector3 CenterOfMass
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
- public override PhysicsVector GeometricCenter
+ public override Vector3 GeometricCenter
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
public override PrimitiveBaseShape Shape
@@ -2356,13 +2351,13 @@ Console.WriteLine(" JointCreateFixed");
}
}
- public override PhysicsVector Velocity
+ public override Vector3 Velocity
{
get
{
// Averate previous velocity with the new one so
// client object interpolation works a 'little' better
- PhysicsVector returnVelocity = new PhysicsVector();
+ Vector3 returnVelocity = Vector3.Zero;
returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2;
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2;
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
@@ -2370,7 +2365,7 @@ Console.WriteLine(" JointCreateFixed");
}
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
_velocity = value;
@@ -2385,19 +2380,19 @@ Console.WriteLine(" JointCreateFixed");
}
}
- public override PhysicsVector Torque
+ public override Vector3 Torque
{
get
{
if (!m_isphysical || Body == IntPtr.Zero)
- return new PhysicsVector(0,0,0);
+ return Vector3.Zero;
return _torque;
}
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
m_taintTorque = value;
_parent_scene.AddPhysicsActorTaint(this);
@@ -2449,20 +2444,20 @@ Console.WriteLine(" JointCreateFixed");
return true;
}
- public override PhysicsVector Acceleration
+ public override Vector3 Acceleration
{
get { return _acceleration; }
}
- public void SetAcceleration(PhysicsVector accel)
+ public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
- public override void AddForce(PhysicsVector force, bool pushforce)
+ public override void AddForce(Vector3 force, bool pushforce)
{
- if (PhysicsVector.isFinite(force))
+ if (force.IsFinite())
{
m_forcelist.Add(force);
m_taintforce = true;
@@ -2474,9 +2469,9 @@ Console.WriteLine(" JointCreateFixed");
//m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
}
- public override void AddAngularForce(PhysicsVector force, bool pushforce)
+ public override void AddAngularForce(Vector3 force, bool pushforce)
{
- if (PhysicsVector.isFinite(force))
+ if (force.IsFinite())
{
m_angularforcelist.Add(force);
m_taintaddangularforce = true;
@@ -2487,23 +2482,23 @@ Console.WriteLine(" JointCreateFixed");
}
}
- public override PhysicsVector RotationalVelocity
+ public override Vector3 RotationalVelocity
{
get
{
- PhysicsVector pv = new PhysicsVector(0, 0, 0);
+ Vector3 pv = Vector3.Zero;
if (_zeroFlag)
return pv;
m_lastUpdateSent = false;
- if (m_rotationalVelocity.IsIdentical(pv, 0.2f))
+ if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
return pv;
return m_rotationalVelocity;
}
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
m_rotationalVelocity = value;
}
@@ -2544,16 +2539,16 @@ Console.WriteLine(" JointCreateFixed");
m_taintparent = null;
}
- public override void LockAngularMotion(PhysicsVector axis)
+ public override void LockAngularMotion(Vector3 axis)
{
// reverse the zero/non zero values for ODE.
- if (PhysicsVector.isFinite(axis))
+ if (axis.IsFinite())
{
axis.X = (axis.X > 0) ? 1f : 0f;
axis.Y = (axis.Y > 0) ? 1f : 0f;
axis.Z = (axis.Z > 0) ? 1f : 0f;
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
- m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z);
+ m_taintAngularLock = axis;
}
else
{
@@ -2566,7 +2561,7 @@ Console.WriteLine(" JointCreateFixed");
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
if (_parent == null)
{
- PhysicsVector pv = new PhysicsVector(0, 0, 0);
+ Vector3 pv = Vector3.Zero;
bool lastZeroFlag = _zeroFlag;
if (Body != (IntPtr)0) // FIXME -> or if it is a joint
{
@@ -2575,9 +2570,9 @@ Console.WriteLine(" JointCreateFixed");
d.Vector3 vel = d.BodyGetLinearVel(Body);
d.Vector3 rotvel = d.BodyGetAngularVel(Body);
d.Vector3 torque = d.BodyGetTorque(Body);
- _torque.setValues(torque.X, torque.Y, torque.Z);
- PhysicsVector l_position = new PhysicsVector();
- Quaternion l_orientation = new Quaternion();
+ _torque = new Vector3(torque.X, torque.Y, torque.Z);
+ Vector3 l_position = Vector3.Zero;
+ Quaternion l_orientation = Quaternion.Identity;
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
//if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); }
@@ -2712,16 +2707,16 @@ Console.WriteLine(" JointCreateFixed");
_velocity.Z = vel.Z;
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
- _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
+ _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
- if (_velocity.IsIdentical(pv, 0.5f))
+ if (_velocity.ApproxEquals(pv, 0.5f))
{
m_rotationalVelocity = pv;
}
else
{
- m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z);
+ m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z);
}
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
@@ -2769,15 +2764,15 @@ Console.WriteLine(" JointCreateFixed");
}
}
- public override void SetMomentum(PhysicsVector momentum)
+ public override void SetMomentum(Vector3 momentum)
{
}
- public override PhysicsVector PIDTarget
+ public override Vector3 PIDTarget
{
set
{
- if (PhysicsVector.isFinite(value))
+ if (value.IsFinite())
{
m_PIDTarget = value;
}
@@ -2793,7 +2788,7 @@ Console.WriteLine(" JointCreateFixed");
public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
- private void createAMotor(PhysicsVector axis)
+ private void createAMotor(Vector3 axis)
{
if (Body == IntPtr.Zero)
return;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 0eb0c45..2f42646 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -684,7 +684,7 @@ namespace OpenSim.Region.Physics.OdePlugin
///
///
/// Returns which split up space the given position is in.
- public string whichspaceamIin(PhysicsVector pos)
+ public string whichspaceamIin(Vector3 pos)
{
return calculateSpaceForGeom(pos).ToString();
}
@@ -963,7 +963,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//p2.CollidingObj = true;
contacts[i].depth = 0.00000003f;
- p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f);
+ p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f);
contacts[i].pos =
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
contacts[i].pos.Y + (p1.Size.Y/2),
@@ -981,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//p2.CollidingObj = true;
contacts[i].depth = 0.00000003f;
- p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f);
+ p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f);
contacts[i].pos =
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
contacts[i].pos.Y + (p1.Size.Y/2),
@@ -1646,9 +1646,9 @@ namespace OpenSim.Region.Physics.OdePlugin
#region Add/Remove Entities
- public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
+ public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
{
- PhysicsVector pos = new PhysicsVector();
+ Vector3 pos;
pos.X = position.X;
pos.Y = position.Y;
pos.Z = position.Z;
@@ -1698,18 +1698,12 @@ namespace OpenSim.Region.Physics.OdePlugin
}
- private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
+ private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
{
-
- PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
- //pos.X = position.X;
- //pos.Y = position.Y;
- //pos.Z = position.Z;
- PhysicsVector siz = new PhysicsVector();
- siz.X = size.X;
- siz.Y = size.Y;
- siz.Z = size.Z;
+
+ Vector3 pos = position;
+ Vector3 siz = size;
Quaternion rot = rotation;
OdePrim newPrim;
@@ -1736,14 +1730,14 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
- public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, Quaternion rotation) //To be removed
+ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
+ Vector3 size, Quaternion rotation) //To be removed
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
- public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, Quaternion rotation, bool isPhysical)
+ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
+ Vector3 size, Quaternion rotation, bool isPhysical)
{
PhysicsActor result;
IMesh mesh = null;
@@ -1976,7 +1970,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// this joint will just be added to a waiting list that is NOT processed during the main
// Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests.
- public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position,
+ public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
Quaternion rotation, string parms, List bodyNames, string trackedBodyName, Quaternion localRotation)
{
@@ -1984,7 +1978,7 @@ namespace OpenSim.Region.Physics.OdePlugin
OdePhysicsJoint joint = new OdePhysicsJoint();
joint.ObjectNameInScene = objectNameInScene;
joint.Type = jointType;
- joint.Position = new PhysicsVector(position.X, position.Y, position.Z);
+ joint.Position = position;
joint.Rotation = rotation;
joint.RawParams = parms;
joint.BodyNames = new List(bodyNames);
@@ -2036,7 +2030,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
- public override PhysicsVector GetJointAnchor(PhysicsJoint joint)
+ public override Vector3 GetJointAnchor(PhysicsJoint joint)
{
Debug.Assert(joint.IsInPhysicsEngine);
d.Vector3 pos = new d.Vector3();
@@ -2058,14 +2052,14 @@ namespace OpenSim.Region.Physics.OdePlugin
break;
}
}
- return new PhysicsVector(pos.X, pos.Y, pos.Z);
+ return new Vector3(pos.X, pos.Y, pos.Z);
}
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
// WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
// appears to be unreliable. Fortunately we can compute the joint axis ourselves by
// keeping track of the joint's original orientation relative to one of the involved bodies.
- public override PhysicsVector GetJointAxis(PhysicsJoint joint)
+ public override Vector3 GetJointAxis(PhysicsJoint joint)
{
Debug.Assert(joint.IsInPhysicsEngine);
d.Vector3 axis = new d.Vector3();
@@ -2087,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin
break;
}
}
- return new PhysicsVector(axis.X, axis.Y, axis.Z);
+ return new Vector3(axis.X, axis.Y, axis.Z);
}
@@ -2255,7 +2249,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// the position that the geom moved to
/// a pointer to the space it was in before it was moved.
/// a pointer to the new space it's in
- public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace)
+ public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace)
{
// Called from setting the Position and Size of an ODEPrim so
// it's already in locked space.
@@ -2402,7 +2396,7 @@ namespace OpenSim.Region.Physics.OdePlugin
///
///
/// a pointer to the space. This could be a new space or reused space.
- public IntPtr calculateSpaceForGeom(PhysicsVector pos)
+ public IntPtr calculateSpaceForGeom(Vector3 pos)
{
int[] xyspace = calculateSpaceArrayItemFromPos(pos);
//m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
@@ -2414,7 +2408,7 @@ namespace OpenSim.Region.Physics.OdePlugin
///
///
/// an array item based on the position
- public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos)
+ public int[] calculateSpaceArrayItemFromPos(Vector3 pos)
{
int[] returnint = new int[2];
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
index cdd38c4..69e2d03 100644
--- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
+++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
@@ -76,8 +76,8 @@ namespace OpenSim.Region.Physics.OdePlugin
public void CreateAndDropPhysicalCube()
{
PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
- PhysicsVector position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
- PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f);
+ Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
+ Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
Quaternion rot = Quaternion.Identity;
PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
OdePrim oprim = (OdePrim)prim;
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index 35fc616..26cd1dd 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -36,20 +36,17 @@ namespace OpenSim.Region.Physics.POSPlugin
{
public class POSCharacter : PhysicsActor
{
- private PhysicsVector _position;
- public PhysicsVector _velocity;
- public PhysicsVector _target_velocity = PhysicsVector.Zero;
- public PhysicsVector _size = PhysicsVector.Zero;
- private PhysicsVector _acceleration;
- private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
+ private Vector3 _position;
+ public Vector3 _velocity;
+ public Vector3 _target_velocity = Vector3.Zero;
+ public Vector3 _size = Vector3.Zero;
+ private Vector3 _acceleration;
+ private Vector3 m_rotationalVelocity = Vector3.Zero;
private bool flying;
private bool isColliding;
public POSCharacter()
{
- _velocity = new PhysicsVector();
- _position = new PhysicsVector();
- _acceleration = new PhysicsVector();
}
public override int PhysicsActorType
@@ -58,7 +55,7 @@ namespace OpenSim.Region.Physics.POSPlugin
set { return; }
}
- public override PhysicsVector RotationalVelocity
+ public override Vector3 RotationalVelocity
{
get { return m_rotationalVelocity; }
set { m_rotationalVelocity = value; }
@@ -137,13 +134,13 @@ namespace OpenSim.Region.Physics.POSPlugin
get { return false; }
}
- public override PhysicsVector Position
+ public override Vector3 Position
{
get { return _position; }
set { _position = value; }
}
- public override PhysicsVector Size
+ public override Vector3 Size
{
get { return _size; }
set
@@ -158,9 +155,9 @@ namespace OpenSim.Region.Physics.POSPlugin
get { return 0f; }
}
- public override PhysicsVector Force
+ public override Vector3 Force
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
@@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.POSPlugin
}
- public override void VehicleVectorParam(int param, PhysicsVector value)
+ public override void VehicleVectorParam(int param, Vector3 value)
{
}
@@ -190,14 +187,14 @@ namespace OpenSim.Region.Physics.POSPlugin
}
- public override PhysicsVector CenterOfMass
+ public override Vector3 CenterOfMass
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
- public override PhysicsVector GeometricCenter
+ public override Vector3 GeometricCenter
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
public override PrimitiveBaseShape Shape
@@ -205,15 +202,15 @@ namespace OpenSim.Region.Physics.POSPlugin
set { return; }
}
- public override PhysicsVector Velocity
+ public override Vector3 Velocity
{
get { return _velocity; }
set { _target_velocity = value; }
}
- public override PhysicsVector Torque
+ public override Vector3 Torque
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
@@ -229,7 +226,7 @@ namespace OpenSim.Region.Physics.POSPlugin
set { }
}
- public override PhysicsVector Acceleration
+ public override Vector3 Acceleration
{
get { return _acceleration; }
}
@@ -248,24 +245,24 @@ namespace OpenSim.Region.Physics.POSPlugin
{
}
- public override void LockAngularMotion(PhysicsVector axis)
+ public override void LockAngularMotion(Vector3 axis)
{
}
- public void SetAcceleration(PhysicsVector accel)
+ public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
- public override void AddForce(PhysicsVector force, bool pushforce)
+ public override void AddForce(Vector3 force, bool pushforce)
{
}
- public override void AddAngularForce(PhysicsVector force, bool pushforce)
+ public override void AddAngularForce(Vector3 force, bool pushforce)
{
}
- public override void SetMomentum(PhysicsVector momentum)
+ public override void SetMomentum(Vector3 momentum)
{
}
@@ -273,7 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
{
}
- public override PhysicsVector PIDTarget
+ public override Vector3 PIDTarget
{
set { return; }
}
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index b50364b..96c3e26 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -36,19 +36,16 @@ namespace OpenSim.Region.Physics.POSPlugin
{
public class POSPrim : PhysicsActor
{
- private PhysicsVector _position;
- private PhysicsVector _velocity;
- private PhysicsVector _acceleration;
- private PhysicsVector _size;
- private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
+ private Vector3 _position;
+ private Vector3 _velocity;
+ private Vector3 _acceleration;
+ private Vector3 _size;
+ private Vector3 m_rotationalVelocity = Vector3.Zero;
private Quaternion _orientation;
private bool iscolliding;
public POSPrim()
{
- _velocity = new PhysicsVector();
- _position = new PhysicsVector();
- _acceleration = new PhysicsVector();
}
public override int PhysicsActorType
@@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.POSPlugin
set { return; }
}
- public override PhysicsVector RotationalVelocity
+ public override Vector3 RotationalVelocity
{
get { return m_rotationalVelocity; }
set { m_rotationalVelocity = value; }
@@ -98,13 +95,13 @@ namespace OpenSim.Region.Physics.POSPlugin
get { return false; }
}
- public override PhysicsVector Position
+ public override Vector3 Position
{
get { return _position; }
set { _position = value; }
}
- public override PhysicsVector Size
+ public override Vector3 Size
{
get { return _size; }
set { _size = value; }
@@ -115,9 +112,9 @@ namespace OpenSim.Region.Physics.POSPlugin
get { return 0f; }
}
- public override PhysicsVector Force
+ public override Vector3 Force
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
@@ -132,7 +129,7 @@ namespace OpenSim.Region.Physics.POSPlugin
}
- public override void VehicleVectorParam(int param, PhysicsVector value)
+ public override void VehicleVectorParam(int param, Vector3 value)
{
}
@@ -147,14 +144,14 @@ namespace OpenSim.Region.Physics.POSPlugin
}
- public override PhysicsVector CenterOfMass
+ public override Vector3 CenterOfMass
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
- public override PhysicsVector GeometricCenter
+ public override Vector3 GeometricCenter
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
public override PrimitiveBaseShape Shape
@@ -173,7 +170,7 @@ namespace OpenSim.Region.Physics.POSPlugin
set { return; }
}
- public override PhysicsVector Velocity
+ public override Vector3 Velocity
{
get { return _velocity; }
set { _velocity = value; }
@@ -191,7 +188,7 @@ namespace OpenSim.Region.Physics.POSPlugin
set { _orientation = value; }
}
- public override PhysicsVector Acceleration
+ public override Vector3 Acceleration
{
get { return _acceleration; }
}
@@ -202,26 +199,26 @@ namespace OpenSim.Region.Physics.POSPlugin
set { }
}
- public void SetAcceleration(PhysicsVector accel)
+ public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
- public override void AddForce(PhysicsVector force, bool pushforce)
+ public override void AddForce(Vector3 force, bool pushforce)
{
}
- public override void AddAngularForce(PhysicsVector force, bool pushforce)
+ public override void AddAngularForce(Vector3 force, bool pushforce)
{
}
- public override PhysicsVector Torque
+ public override Vector3 Torque
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
- public override void SetMomentum(PhysicsVector momentum)
+ public override void SetMomentum(Vector3 momentum)
{
}
@@ -255,7 +252,7 @@ namespace OpenSim.Region.Physics.POSPlugin
{
}
- public override void LockAngularMotion(PhysicsVector axis)
+ public override void LockAngularMotion(Vector3 axis)
{
}
@@ -268,7 +265,7 @@ namespace OpenSim.Region.Physics.POSPlugin
{
}
- public override PhysicsVector PIDTarget
+ public override Vector3 PIDTarget
{
set { return; }
}
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index fa8cc70..c3f5040 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.POSPlugin
{
}
- public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
+ public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
{
POSCharacter act = new POSCharacter();
act.Position = position;
@@ -84,20 +84,20 @@ namespace OpenSim.Region.Physics.POSPlugin
}
/*
- public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
+ public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
{
return null;
}
*/
- public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, Quaternion rotation)
+ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
+ Vector3 size, Quaternion rotation)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
- public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, Quaternion rotation, bool isPhysical)
+ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
+ Vector3 size, Quaternion rotation, bool isPhysical)
{
POSPrim prim = new POSPrim();
prim.Position = position;
@@ -152,23 +152,25 @@ namespace OpenSim.Region.Physics.POSPlugin
character._target_velocity.Z += gravity * timeStep;
}
- character.Position.X += character._target_velocity.X * timeStep;
- character.Position.Y += character._target_velocity.Y * timeStep;
+ Vector3 characterPosition = character.Position;
- character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
- character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
+ characterPosition.X += character._target_velocity.X * timeStep;
+ characterPosition.Y += character._target_velocity.Y * timeStep;
+
+ characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
+ characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
bool forcedZ = false;
float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2)
{
- character.Position.Z = terrainheight + character.Size.Z;
+ characterPosition.Z = terrainheight + character.Size.Z;
forcedZ = true;
}
else
{
- character.Position.Z += character._target_velocity.Z*timeStep;
+ characterPosition.Z += character._target_velocity.Z*timeStep;
}
/// this is it -- the magic you've all been waiting for! Ladies and gentlemen --
@@ -177,29 +179,29 @@ namespace OpenSim.Region.Physics.POSPlugin
if (isCollidingWithPrim(character))
{
- character.Position.Z = oldposZ; // first try Z axis
+ characterPosition.Z = oldposZ; // first try Z axis
if (isCollidingWithPrim(character))
{
- character.Position.Z = oldposZ + character.Size.Z / 4.4f; // try harder
+ characterPosition.Z = oldposZ + character.Size.Z / 4.4f; // try harder
if (isCollidingWithPrim(character))
{
- character.Position.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
+ characterPosition.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
if (isCollidingWithPrim(character))
{
- character.Position.X = oldposX;
- character.Position.Y = oldposY;
- character.Position.Z = oldposZ;
+ characterPosition.X = oldposX;
+ characterPosition.Y = oldposY;
+ characterPosition.Z = oldposZ;
- character.Position.X += character._target_velocity.X * timeStep;
+ characterPosition.X += character._target_velocity.X * timeStep;
if (isCollidingWithPrim(character))
{
- character.Position.X = oldposX;
+ characterPosition.X = oldposX;
}
- character.Position.Y += character._target_velocity.Y * timeStep;
+ characterPosition.Y += character._target_velocity.Y * timeStep;
if (isCollidingWithPrim(character))
{
- character.Position.Y = oldposY;
+ characterPosition.Y = oldposY;
}
}
else
@@ -218,8 +220,10 @@ namespace OpenSim.Region.Physics.POSPlugin
}
}
- character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
- character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
+ characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
+ characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
+
+ character.Position = characterPosition;
character._velocity.X = (character.Position.X - oldposX)/timeStep;
character._velocity.Y = (character.Position.Y - oldposY)/timeStep;
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index e7d989c..8bdb18d 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -34,6 +34,7 @@ using PhysXWrapper;
using Quaternion=OpenMetaverse.Quaternion;
using System.Reflection;
using log4net;
+using OpenMetaverse;
namespace OpenSim.Region.Physics.PhysXPlugin
{
@@ -106,7 +107,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
- public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
+ public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
{
Vec3 pos = new Vec3();
pos.X = position.X;
@@ -127,7 +128,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{
}
- private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
+ private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
{
Vec3 pos = new Vec3();
pos.X = position.X;
@@ -142,14 +143,14 @@ namespace OpenSim.Region.Physics.PhysXPlugin
return act;
}
- public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, Quaternion rotation) //To be removed
+ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
+ Vector3 size, Quaternion rotation) //To be removed
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
- public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, Quaternion rotation, bool isPhysical)
+ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
+ Vector3 size, Quaternion rotation, bool isPhysical)
{
return AddPrim(position, size, rotation);
}
@@ -219,10 +220,10 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public class PhysXCharacter : PhysicsActor
{
- private PhysicsVector _position;
- private PhysicsVector _velocity;
- private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
- private PhysicsVector _acceleration;
+ private Vector3 _position;
+ private Vector3 _velocity;
+ private Vector3 m_rotationalVelocity = Vector3.Zero;
+ private Vector3 _acceleration;
private NxCharacter _character;
private bool flying;
private bool iscolliding = false;
@@ -230,9 +231,6 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public PhysXCharacter(NxCharacter character)
{
- _velocity = new PhysicsVector();
- _position = new PhysicsVector();
- _acceleration = new PhysicsVector();
_character = character;
}
@@ -310,7 +308,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
set { return; }
}
- public override PhysicsVector RotationalVelocity
+ public override Vector3 RotationalVelocity
{
get { return m_rotationalVelocity; }
set { m_rotationalVelocity = value; }
@@ -321,7 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
get { return false; }
}
- public override PhysicsVector Position
+ public override Vector3 Position
{
get { return _position; }
set
@@ -335,9 +333,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
}
- public override PhysicsVector Size
+ public override Vector3 Size
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { }
}
@@ -346,9 +344,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
get { return 0f; }
}
- public override PhysicsVector Force
+ public override Vector3 Force
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
@@ -363,7 +361,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
- public override void VehicleVectorParam(int param, PhysicsVector value)
+ public override void VehicleVectorParam(int param, Vector3 value)
{
}
@@ -379,17 +377,17 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
- public override PhysicsVector CenterOfMass
+ public override Vector3 CenterOfMass
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
- public override PhysicsVector GeometricCenter
+ public override Vector3 GeometricCenter
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
- public override PhysicsVector Velocity
+ public override Vector3 Velocity
{
get { return _velocity; }
set { _velocity = value; }
@@ -413,25 +411,25 @@ namespace OpenSim.Region.Physics.PhysXPlugin
set { }
}
- public override PhysicsVector Acceleration
+ public override Vector3 Acceleration
{
get { return _acceleration; }
}
- public void SetAcceleration(PhysicsVector accel)
+ public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
- public override void AddForce(PhysicsVector force, bool pushforce)
+ public override void AddForce(Vector3 force, bool pushforce)
{
}
- public override PhysicsVector Torque
+ public override Vector3 Torque
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
- public override void AddAngularForce(PhysicsVector force, bool pushforce)
+ public override void AddAngularForce(Vector3 force, bool pushforce)
{
}
@@ -445,12 +443,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
- public override void LockAngularMotion(PhysicsVector axis)
+ public override void LockAngularMotion(Vector3 axis)
{
}
- public override void SetMomentum(PhysicsVector momentum)
+ public override void SetMomentum(Vector3 momentum)
{
}
@@ -492,7 +490,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
- public override PhysicsVector PIDTarget { set { return; } }
+ public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override float PIDTau { set { return; } }
@@ -518,15 +516,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public class PhysXPrim : PhysicsActor
{
- private PhysicsVector _velocity;
- private PhysicsVector _acceleration;
- private PhysicsVector m_rotationalVelocity;
+ private Vector3 _velocity;
+ private Vector3 _acceleration;
+ private Vector3 m_rotationalVelocity;
private NxActor _prim;
public PhysXPrim(NxActor prim)
{
- _velocity = new PhysicsVector();
- _acceleration = new PhysicsVector();
+ _velocity = Vector3.Zero;
+ _acceleration = Vector3.Zero;
_prim = prim;
}
@@ -580,7 +578,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
set { return; }
}
- public override PhysicsVector RotationalVelocity
+ public override Vector3 RotationalVelocity
{
get { return m_rotationalVelocity; }
set { m_rotationalVelocity = value; }
@@ -616,11 +614,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
get { return false; }
}
- public override PhysicsVector Position
+ public override Vector3 Position
{
get
{
- PhysicsVector pos = new PhysicsVector();
+ Vector3 pos = Vector3.Zero;
Vec3 vec = _prim.Position;
pos.X = vec.X;
pos.Y = vec.Y;
@@ -629,7 +627,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
set
{
- PhysicsVector vec = value;
+ Vector3 vec = value;
Vec3 pos = new Vec3();
pos.X = vec.X;
pos.Y = vec.Y;
@@ -643,15 +641,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
set { return; }
}
- public override PhysicsVector Velocity
+ public override Vector3 Velocity
{
get { return _velocity; }
set { _velocity = value; }
}
- public override PhysicsVector Torque
+ public override Vector3 Torque
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
@@ -682,31 +680,31 @@ namespace OpenSim.Region.Physics.PhysXPlugin
set { }
}
- public override PhysicsVector Acceleration
+ public override Vector3 Acceleration
{
get { return _acceleration; }
}
- public void SetAcceleration(PhysicsVector accel)
+ public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
- public override void AddForce(PhysicsVector force, bool pushforce)
+ public override void AddForce(Vector3 force, bool pushforce)
{
}
- public override void AddAngularForce(PhysicsVector force, bool pushforce)
+ public override void AddAngularForce(Vector3 force, bool pushforce)
{
}
- public override void SetMomentum(PhysicsVector momentum)
+ public override void SetMomentum(Vector3 momentum)
{
}
- public override PhysicsVector Size
+ public override Vector3 Size
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { }
}
@@ -718,7 +716,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{
}
- public override void LockAngularMotion(PhysicsVector axis)
+ public override void LockAngularMotion(Vector3 axis)
{
}
@@ -728,9 +726,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
get { return 0f; }
}
- public override PhysicsVector Force
+ public override Vector3 Force
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
set { return; }
}
@@ -745,7 +743,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
- public override void VehicleVectorParam(int param, PhysicsVector value)
+ public override void VehicleVectorParam(int param, Vector3 value)
{
}
@@ -760,21 +758,21 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
- public override PhysicsVector CenterOfMass
+ public override Vector3 CenterOfMass
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
- public override PhysicsVector GeometricCenter
+ public override Vector3 GeometricCenter
{
- get { return PhysicsVector.Zero; }
+ get { return Vector3.Zero; }
}
public override void CrossingFailure()
{
}
- public override PhysicsVector PIDTarget { set { return; } }
+ public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override float PIDTau { set { return; } }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 56d4d28..3849558 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2047,7 +2047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (local != 0)
force *= llGetRot();
- m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z));
+ m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
}
}
}
@@ -2062,7 +2062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (!m_host.ParentGroup.IsDeleted)
{
- PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce();
+ Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
force.x = tmpForce.X;
force.y = tmpForce.Y;
force.z = tmpForce.Z;
@@ -4180,7 +4180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
applied_linear_impulse *= m_host.GetWorldRotation();
}
- pusheeav.PhysicsActor.AddForce(new PhysicsVector(applied_linear_impulse.X, applied_linear_impulse.Y, applied_linear_impulse.Z), true);
+ pusheeav.PhysicsActor.AddForce(applied_linear_impulse, true);
}
}
}
@@ -6088,7 +6088,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
- new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z));
+ new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
}
}
}
--
cgit v1.1
From f5cad91578d9f7dbfb54d17bb476929e935682a8 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Mon, 26 Oct 2009 19:03:55 -0700
Subject: * Switched from OpenJPEG to CSJ2K in Meshmerizer * Tested the
previous patch and found no regressions
---
OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index a90a89a..fbe1949 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using OpenMetaverse;
-using OpenMetaverse.Imaging;
using System.Drawing;
using System.Drawing.Imaging;
using PrimMesher;
@@ -285,8 +284,7 @@ namespace OpenSim.Region.Physics.Meshing
try
{
- ManagedImage managedImage; // we never use this
- OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata);
+ idata = CSJ2K.J2kImage.FromBytes(primShape.SculptData);
if (cacheSculptMaps)
{
--
cgit v1.1
From 322b39804d3659b637c2b9a4df13c247dfa561c6 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Mon, 26 Oct 2009 22:05:07 -0700
Subject: Adding missing CSJ2K reference to OpenSim.Region.Physics.Meshing
---
prebuild.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/prebuild.xml b/prebuild.xml
index 640d530..12e33e9 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -588,6 +588,7 @@
../../../../bin/
+
--
cgit v1.1
From c75d4156487b35aac47aa6818144862a99bb841c Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 00:26:56 -0700
Subject: * Converts ClientManager.ForEach() (and as a result,
Scene.ForEachClient()) to use a non-blocking parallel method when operating
in async mode * Minor code readability cleanup
---
OpenSim/Framework/ClientManager.cs | 5 ++++-
OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 8 +++++---
OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 2 +-
OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 5 ++---
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 61b59e7..baff2f4 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -204,7 +204,10 @@ namespace OpenSim.Framework
public void ForEach(Action action)
{
IClientAPI[] localArray = m_array;
- Parallel.ForEach(localArray, action);
+ Parallel.For(0, localArray.Length,
+ delegate(int i)
+ { action(localArray[i]); }
+ );
}
///
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 31028b3..f6a7a0c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2105,12 +2105,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
{
ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
- packet.Effect = effectBlocks;
+ packet.Header.Reliable = false;
+ packet.Header.Zerocoded = true;
packet.AgentData.AgentID = AgentId;
packet.AgentData.SessionID = SessionId;
- packet.Header.Reliable = false;
- packet.Header.Zerocoded = true;
+
+ packet.Effect = effectBlocks;
+
OutPacket(packet, ThrottleOutPacketType.State);
}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index a823f3b..84a4959 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OpenSim.Framework.LocklessQueue queue = m_packetOutboxes[category];
TokenBucket bucket = m_throttleCategories[category];
- if (m_throttleCategories[category].RemoveTokens(packet.Buffer.DataLength))
+ if (bucket.RemoveTokens(packet.Buffer.DataLength))
{
// Enough tokens were removed from the bucket, the packet will not be queued
return false;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index cfe32d0..1a91f0c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -394,7 +394,7 @@ namespace OpenSim.Region.Framework.Scenes
void ProcessViewerEffect(IClientAPI remoteClient, List args)
{
// TODO: don't create new blocks if recycling an old packet
- List effectBlock = new List();
+ ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
for (int i = 0; i < args.Count; i++)
{
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
@@ -404,9 +404,8 @@ namespace OpenSim.Region.Framework.Scenes
effect.ID = args[i].ID;
effect.Type = args[i].Type;
effect.TypeData = args[i].TypeData;
- effectBlock.Add(effect);
+ effectBlockArray[i] = effect;
}
- ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
ForEachClient(
delegate(IClientAPI client)
--
cgit v1.1
From b498693cff9b044e8ab3c7a88a18e9d67f16461b Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 01:46:14 -0700
Subject: * Tweak to region module loading to check for a matching constructor
first instead of throwing and catching exceptions * Commenting out the MySQL
startup sequence that cleans out dropped attachments under the advice that it
is no longer relevant. If anything, it could be brought back as a database
cleanup console command * Updated to the latest libomv 0.8.0-pre.
UUID.TryParse() will no longer throw and catch exceptions for most failed
UUID parses
---
.../RegionModulesControllerPlugin.cs | 13 +++++----
OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 32 ++++++++++++---------
OpenSim/Tools/pCampBot/PhysicsBot.cs | 7 +++--
bin/OpenMetaverse.dll | Bin 1638400 -> 1642496 bytes
bin/OpenMetaverseTypes.dll | Bin 102400 -> 102400 bytes
5 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
index ddc37ed..6c0c74d 100644
--- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
@@ -341,14 +341,15 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
// Actually load it
INonSharedRegionModule module = null;
- try
- {
+
+ Type[] ctorParamTypes = new Type[ctorArgs.Length];
+ for (int i = 0; i < ctorParamTypes.Length; i++)
+ ctorParamTypes[i] = ctorArgs[i].GetType();
+
+ if (node.Type.GetConstructor(ctorParamTypes) != null)
module = (INonSharedRegionModule)Activator.CreateInstance(node.Type, ctorArgs);
- }
- catch
- {
+ else
module = (INonSharedRegionModule)Activator.CreateInstance(node.Type);
- }
// Check for replaceable interfaces
Type replaceableInterface = module.ReplaceableInterface;
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index c07963c..a807948 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -66,22 +66,26 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(m_Connection, assem, "RegionStore");
m.Update();
+ // NOTE: This is a very slow query that times out on regions with a lot of prims.
+ // I'm told that it is no longer relevant so it's commented out now, but if it
+ // is relevant it should be added as a console command instead of part of the
+ // startup phase
// Clean dropped attachments
//
- try
- {
- using (MySqlCommand cmd = m_Connection.CreateCommand())
- {
- cmd.CommandText = "delete from prims, primshapes using prims " +
- "left join primshapes on prims.uuid = primshapes.uuid " +
- "where PCode = 9 and State <> 0";
- ExecuteNonQuery(cmd);
- }
- }
- catch (MySqlException ex)
- {
- m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
- }
+ //try
+ //{
+ // using (MySqlCommand cmd = m_Connection.CreateCommand())
+ // {
+ // cmd.CommandText = "delete from prims, primshapes using prims " +
+ // "left join primshapes on prims.uuid = primshapes.uuid " +
+ // "where PCode = 9 and State <> 0";
+ // ExecuteNonQuery(cmd);
+ // }
+ //}
+ //catch (MySqlException ex)
+ //{
+ // m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
+ //}
}
private IDataReader ExecuteReader(MySqlCommand c)
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs
index 426ef29..38986a2 100644
--- a/OpenSim/Tools/pCampBot/PhysicsBot.cs
+++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs
@@ -154,7 +154,7 @@ namespace pCampBot
client.Network.OnConnected += new NetworkManager.ConnectedCallback(this.Network_OnConnected);
client.Network.OnSimConnected += new NetworkManager.SimConnectedCallback(this.Network_OnConnected);
client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(this.Network_OnDisconnected);
- client.Objects.OnNewPrim += Objects_NewPrim;
+ client.Objects.ObjectUpdate += Objects_NewPrim;
//client.Assets.OnAssetReceived += Asset_ReceivedCallback;
if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name"))
{
@@ -369,8 +369,10 @@ namespace pCampBot
}
}
- public void Objects_NewPrim(Simulator simulator, Primitive prim, ulong regionHandle, ushort timeDilation)
+ public void Objects_NewPrim(object sender, PrimEventArgs args)
{
+ Primitive prim = args.Prim;
+
if (prim != null)
{
if (prim.Textures != null)
@@ -396,7 +398,6 @@ namespace pCampBot
client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture);
}
}
-
}
diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll
index 3f9255e..8b07942 100644
Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ
diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll
index 6cea131..331d58b 100644
Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ
--
cgit v1.1
From 3a1ee79ee4239213b35f6b73a65c127c2af977fb Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 02:36:57 -0700
Subject: Finally hunted down the Parallel deadlock. Packets were being handled
asynchronously (filling up the threadpool with handlers), which would turn
around and try to do parallel operations on the starved threadpool. The
solution for now is to disable Parallel.cs operations until we can gracefully
handle parallel operations with a potentially starved threadpool
---
OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++++------
bin/OpenSim.ini.example | 2 +-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6c34056..42051d0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Framework.Scenes
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds;
private volatile bool m_backingup;
- private bool m_useAsyncWhenPossible = true;
+ private bool m_useAsyncWhenPossible;
private Dictionary m_returns = new Dictionary();
private Dictionary m_groupsWithTargets = new Dictionary();
@@ -480,7 +480,7 @@ namespace OpenSim.Region.Framework.Scenes
IConfig startupConfig = m_config.Configs["Startup"];
// Should we try to run loops synchronously or asynchronously?
- m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", true);
+ m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", false);
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
@@ -4261,10 +4261,13 @@ namespace OpenSim.Region.Framework.Scenes
public void ForEachClient(Action action, bool doAsynchronous)
{
- if (doAsynchronous)
- m_clientManager.ForEach(action);
- else
- m_clientManager.ForEachSync(action);
+ // FIXME: Asynchronous iteration is disabled until we have a threading model that
+ // can support calling this function from an async packet handler without
+ // potentially deadlocking
+ //if (doAsynchronous)
+ // m_clientManager.ForEach(action);
+ //else
+ // m_clientManager.ForEachSync(action);
}
public bool TryGetClient(UUID avatarID, out IClientAPI client)
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 2adc87f..4f1799e 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -49,7 +49,7 @@
; in parallel. Running in parallel should increase performance
; on a multi-core system, but will make debugging more
; difficult if something deadlocks or times out
- use_async_when_possible = true
+ use_async_when_possible = false
; Max threads to allocate on the FireAndForget thread pool
; when running with the SmartThreadPool option above
--
cgit v1.1
From bcd7593dfbd7ed3a2436b0eb0a1c7e2577d6b7ea Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 10:07:35 -0700
Subject: Forgot a line in the previous commit
---
OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 42051d0..3c23c74 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4264,6 +4264,8 @@ namespace OpenSim.Region.Framework.Scenes
// FIXME: Asynchronous iteration is disabled until we have a threading model that
// can support calling this function from an async packet handler without
// potentially deadlocking
+ m_clientManager.ForEachSync(action);
+
//if (doAsynchronous)
// m_clientManager.ForEach(action);
//else
--
cgit v1.1
From a718d7d56a3f7d99b33f0ebc246b419aeec06308 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 10:17:20 -0700
Subject: Making the defaults for interest management variables match whether
you have the [InterestManagement] section in your config or not
---
OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3c23c74..7c3875d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -282,9 +282,9 @@ namespace OpenSim.Region.Framework.Scenes
private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritization_enabled = true;
- private double m_reprioritization_interval = 2000.0;
- private double m_root_reprioritization_distance = 5.0;
- private double m_child_reprioritization_distance = 10.0;
+ private double m_reprioritization_interval = 5000.0;
+ private double m_root_reprioritization_distance = 10.0;
+ private double m_child_reprioritization_distance = 20.0;
private object m_deleting_scene_object = new object();
--
cgit v1.1
From fefe767476f3233a7cf2d2dd68d967f23231c73e Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 13:16:58 -0700
Subject: Lowering the position tolerance of terse updates for ScenePresences
to mitigate some of the rubberbanding issues while we are sending incorrect
time dilation values
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 70f3112..9b11582 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2394,7 +2394,7 @@ if (m_shape != null) {
public void SendScheduledUpdates()
{
const float VELOCITY_TOLERANCE = 0.01f;
- const float POSITION_TOLERANCE = 10.0f;
+ const float POSITION_TOLERANCE = 0.1f;
if (m_updateFlag == 1)
{
--
cgit v1.1
From 2525810e2a1b23f9c5b17b3d075e02c0c6255e2c Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 13:31:04 -0700
Subject: Removed the DotNetEngine scripting engine. You will need to create a
fresh checkout or clean out all *DotNet*.dll assemblies from the bin/
directory to run OpenSim moving forward
---
.../ScriptEngine/DotNetEngine/AppDomainManager.cs | 234 -------
OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs | 51 --
.../ScriptEngine/DotNetEngine/EventManager.cs | 544 ----------------
.../ScriptEngine/DotNetEngine/EventQueueManager.cs | 460 --------------
.../DotNetEngine/EventQueueThreadClass.cs | 428 -------------
.../ScriptEngine/DotNetEngine/MaintenanceThread.cs | 238 -------
.../DotNetEngine/Properties/AssemblyInfo.cs | 65 --
.../DotNetEngine/Resources/DotNetEngine.addin.xml | 13 -
.../ScriptEngine/DotNetEngine/ScriptEngine.cs | 485 --------------
.../ScriptEngine/DotNetEngine/ScriptManager.cs | 703 ---------------------
.../DotNetEngine/Commands_LSL/Commands_LSL.cs | 40 --
.../DotNetEngine/Commands_LSL/LSL_BaseClass.cs | 56 --
.../Commands_LSL/Properties/AssemblyInfo.cs | 63 --
.../DotNetEngine/Commands_OSSL/Commands_OSSL.cs | 44 --
.../Commands_OSSL/Properties/AssemblyInfo.cs | 63 --
.../DotNetEngine/Compilers/CILCompiler.cs | 187 ------
.../DotNetEngine/Compilers/Compiler_CS.cs | 70 --
.../DotNetEngine/Compilers/Compiler_JS.cs | 56 --
.../DotNetEngine/Compilers/Compiler_LSL.cs | 57 --
.../DotNetEngine/Compilers/Compiler_VB.cs | 56 --
.../DotNetEngine/Compilers/Compiler_YP.cs | 55 --
.../DotNetEngine/Compilers/LSL/LSL2CS.cs | 44 --
.../Compilers/Properties/AssemblyInfo.cs | 63 --
.../Components/DotNetEngine/Compilers/YP/YP2CS.cs | 54 --
.../DotNetEngine/Events/LSLEventProvider.cs | 121 ----
.../DotNetEngine/Events/Properties/AssemblyInfo.cs | 63 --
.../DotNetEngine/Scheduler/BaseClassFactory.cs | 240 -------
.../DotNetEngine/Scheduler/LoadUnloadStructure.cs | 49 --
.../Scheduler/Properties/AssemblyInfo.cs | 63 --
.../Components/DotNetEngine/Scheduler/Scheduler.cs | 55 --
.../DotNetEngine/Scheduler/ScriptLoader.cs | 216 -------
.../DotNetEngine/Scheduler/ScriptManager.cs | 203 ------
.../Scheduler/ScriptManager_ScriptLoadUnload.cs | 287 ---------
.../Engines/DotNetEngine/DotNetEngine.cs | 196 ------
.../DotNetEngine/DotNetEngine_ScriptLoadUnload.cs | 95 ---
.../DotNetEngine/Properties/AssemblyInfo.cs | 63 --
bin/OpenSim.ini.example | 128 +---
37 files changed, 1 insertion(+), 5907 deletions(-)
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/Resources/DotNetEngine.addin.xml
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs
delete mode 100644 OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs
delete mode 100644 OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
delete mode 100644 OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
delete mode 100644 OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
deleted file mode 100644
index 7116512..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ /dev/null
@@ -1,234 +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;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Security;
-using System.Security.Policy;
-using System.Security.Permissions;
-using OpenSim.Region.ScriptEngine.Interfaces;
-using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
-using log4net;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- public class AppDomainManager
- {
- //
- // This class does AppDomain handling and loading/unloading of
- // scripts in it. It is instanced in "ScriptEngine" and controlled
- // from "ScriptManager"
- //
- // 1. Create a new AppDomain if old one is full (or doesn't exist)
- // 2. Load scripts into AppDomain
- // 3. Unload scripts from AppDomain (stopping them and marking
- // them as inactive)
- // 4. Unload AppDomain completely when all scripts in it has stopped
- //
-
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private int maxScriptsPerAppDomain = 1;
-
- // Internal list of all AppDomains
- private List appDomains =
- new List();
-
- // Structure to keep track of data around AppDomain
- private class AppDomainStructure
- {
- // The AppDomain itself
- public AppDomain CurrentAppDomain;
-
- // Number of scripts loaded into AppDomain
- public int ScriptsLoaded;
-
- // Number of dead scripts
- public int ScriptsWaitingUnload;
- }
-
- // Current AppDomain
- private AppDomainStructure currentAD;
-
- private object getLock = new object(); // Mutex
- private object freeLock = new object(); // Mutex
-
- private ScriptEngine m_scriptEngine;
- //public AppDomainManager(ScriptEngine scriptEngine)
- public AppDomainManager(ScriptEngine scriptEngine)
- {
- m_scriptEngine = scriptEngine;
- ReadConfig();
- }
-
- public void ReadConfig()
- {
- maxScriptsPerAppDomain = m_scriptEngine.ScriptConfigSource.GetInt(
- "ScriptsPerAppDomain", 1);
- }
-
- // Find a free AppDomain, creating one if necessary
- private AppDomainStructure GetFreeAppDomain()
- {
- lock (getLock)
- {
- // Current full?
- if (currentAD != null &&
- currentAD.ScriptsLoaded >= maxScriptsPerAppDomain)
- {
- // Add it to AppDomains list and empty current
- appDomains.Add(currentAD);
- currentAD = null;
- }
- // No current
- if (currentAD == null)
- {
- // Create a new current AppDomain
- currentAD = new AppDomainStructure();
- currentAD.CurrentAppDomain = PrepareNewAppDomain();
- }
-
- return currentAD;
- }
- }
-
- private int AppDomainNameCount;
-
- // Create and prepare a new AppDomain for scripts
- private AppDomain PrepareNewAppDomain()
- {
- // Create and prepare a new AppDomain
- AppDomainNameCount++;
-
- // TODO: Currently security match current appdomain
-
- // Construct and initialize settings for a second AppDomain.
- AppDomainSetup ads = new AppDomainSetup();
- ads.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
- ads.DisallowBindingRedirects = true;
- ads.DisallowCodeDownload = true;
- ads.LoaderOptimization = LoaderOptimization.MultiDomainHost;
- ads.ShadowCopyFiles = "false"; // Disable shadowing
- ads.ConfigurationFile =
- AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
-
- AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" +
- AppDomainNameCount, null, ads);
-
- m_log.Info("[" + m_scriptEngine.ScriptEngineName +
- "]: AppDomain Loading: " +
- AssemblyName.GetAssemblyName(
- "OpenSim.Region.ScriptEngine.Shared.dll").ToString());
- AD.Load(AssemblyName.GetAssemblyName(
- "OpenSim.Region.ScriptEngine.Shared.dll"));
-
- // Return the new AppDomain
- return AD;
- }
-
- // Unload appdomains that are full and have only dead scripts
- private void UnloadAppDomains()
- {
- lock (freeLock)
- {
- // Go through all
- foreach (AppDomainStructure ads in new ArrayList(appDomains))
- {
- // Don't process current AppDomain
- if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
- {
- // Not current AppDomain
- // Is number of unloaded bigger or equal to number of loaded?
- if (ads.ScriptsLoaded <= ads.ScriptsWaitingUnload)
- {
- // Remove from internal list
- appDomains.Remove(ads);
-
- // Unload
- AppDomain.Unload(ads.CurrentAppDomain);
- }
- }
- }
- }
- }
-
- public IScript LoadScript(string FileName, out AppDomain ad)
- {
- // Find next available AppDomain to put it in
- AppDomainStructure FreeAppDomain = GetFreeAppDomain();
-
- IScript mbrt = (IScript)
- FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(
- FileName, "SecondLife.Script");
-
- FreeAppDomain.ScriptsLoaded++;
- ad = FreeAppDomain.CurrentAppDomain;
-
- return mbrt;
- }
-
-
- // Increase "dead script" counter for an AppDomain
- public void StopScript(AppDomain ad)
- {
- lock (freeLock)
- {
- // Check if it is current AppDomain
- if (currentAD.CurrentAppDomain == ad)
- {
- // Yes - increase
- currentAD.ScriptsWaitingUnload++;
- return;
- }
-
- // Lopp through all AppDomains
- foreach (AppDomainStructure ads in new ArrayList(appDomains))
- {
- if (ads.CurrentAppDomain == ad)
- {
- // Found it
- ads.ScriptsWaitingUnload++;
- break;
- }
- }
- }
-
- UnloadAppDomains(); // Outsite lock, has its own GetLock
- }
-
- // If set to true then threads and stuff should try
- // to make a graceful exit
- public bool PleaseShutdown
- {
- get { return _PleaseShutdown; }
- set { _PleaseShutdown = value; }
- }
- private bool _PleaseShutdown = false;
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
deleted file mode 100644
index 1cd60e3..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
+++ /dev/null
@@ -1,51 +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.Reflection;
-using log4net;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- public static class Common
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public static ScriptEngine mySE;
-
- // This class just contains some static log stuff used for debugging.
-
- public static void SendToDebug(string message)
- {
- m_log.Info("[" + mySE.ScriptEngineName + "]: Debug: " + message);
- }
-
- public static void SendToLog(string message)
- {
- m_log.Info("[" + mySE.ScriptEngineName + "]: LOG: " + message);
- }
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
deleted file mode 100644
index 4e13fb3..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ /dev/null
@@ -1,544 +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 OpenSim.Framework;
-using OpenSim.Region.CoreModules;
-using OpenSim.Region;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.ScriptEngine.Shared;
-using log4net;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- ///
- /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it.
- ///
- [Serializable]
- public class EventManager
- {
- //
- // Class is instanced in "ScriptEngine" and Uses "EventQueueManager"
- // that is also instanced in "ScriptEngine".
- // This class needs a bit of explaining:
- //
- // This class it the link between an event inside OpenSim and
- // the corresponding event in a user script being executed.
- //
- // For example when an user touches an object then the
- // "myScriptEngine.World.EventManager.OnObjectGrab" event is fired
- // inside OpenSim.
- // We hook up to this event and queue a touch_start in
- // EventQueueManager with the proper LSL parameters.
- // It will then be delivered to the script by EventQueueManager.
- //
- // You can check debug C# dump of an LSL script if you need to
- // verify what exact parameters are needed.
- //
-
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private ScriptEngine myScriptEngine;
-
- public EventManager(ScriptEngine _ScriptEngine, bool performHookUp)
- {
- myScriptEngine = _ScriptEngine;
- ReadConfig();
-
- if (performHookUp)
- {
- myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
- }
- }
-
- public void HookUpEvents()
- {
- m_log.Info("[" + myScriptEngine.ScriptEngineName +
- "]: Hooking up to server events");
-
- myScriptEngine.World.EventManager.OnObjectGrab +=
- touch_start;
- myScriptEngine.World.EventManager.OnObjectDeGrab +=
- touch_end;
- myScriptEngine.World.EventManager.OnRemoveScript +=
- OnRemoveScript;
- myScriptEngine.World.EventManager.OnScriptChangedEvent +=
- changed;
- myScriptEngine.World.EventManager.OnScriptAtTargetEvent +=
- at_target;
- myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent +=
- not_at_target;
- myScriptEngine.World.EventManager.OnScriptControlEvent +=
- control;
- myScriptEngine.World.EventManager.OnScriptColliderStart +=
- collision_start;
- myScriptEngine.World.EventManager.OnScriptColliding +=
- collision;
- myScriptEngine.World.EventManager.OnScriptCollidingEnd +=
- collision_end;
-
- IMoneyModule money =
- myScriptEngine.World.RequestModuleInterface();
- if (money != null)
- money.OnObjectPaid+=HandleObjectPaid;
- }
-
- public void ReadConfig()
- {
- }
-
- private void HandleObjectPaid(UUID objectID, UUID agentID, int amount)
- {
- SceneObjectPart part =
- myScriptEngine.World.GetSceneObjectPart(objectID);
-
- if (part != null)
- {
- money(part.LocalId, agentID, amount);
- }
- }
-
- public void changed(uint localID, uint change)
- {
- // Add to queue for all scripts in localID, Object pass change.
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "changed",new object[] { new LSL_Types.LSLInteger(change) },
- new DetectParams[0]));
- }
-
- public void state_entry(uint localID)
- {
- // Add to queue for all scripts in ObjectID object
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "state_entry",new object[] { },
- new DetectParams[0]));
- }
-
- public void touch_start(uint localID, uint originalID,
- Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
- {
- // Add to queue for all scripts in ObjectID object
- DetectParams[] det = new DetectParams[1];
- det[0] = new DetectParams();
- det[0].Key = remoteClient.AgentId;
- det[0].Populate(myScriptEngine.World);
-
- if (originalID == 0)
- {
- SceneObjectPart part =
- myScriptEngine.World.GetSceneObjectPart(localID);
-
- if (part == null)
- return;
-
- det[0].LinkNum = part.LinkNum;
- }
- else
- {
- SceneObjectPart originalPart =
- myScriptEngine.World.GetSceneObjectPart(originalID);
- det[0].LinkNum = originalPart.LinkNum;
- }
- if (surfaceArgs != null)
- {
- det[0].SurfaceTouchArgs = surfaceArgs;
- }
-
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "touch_start", new Object[] { new LSL_Types.LSLInteger(1) },
- det));
- }
-
- public void touch(uint localID, uint originalID, Vector3 offsetPos,
- IClientAPI remoteClient)
- {
- // Add to queue for all scripts in ObjectID object
- DetectParams[] det = new DetectParams[1];
- det[0] = new DetectParams();
- det[0].Key = remoteClient.AgentId;
- det[0].Populate(myScriptEngine.World);
- det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X,
- offsetPos.Y,
- offsetPos.Z);
-
- if (originalID == 0)
- {
- SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
- if (part == null)
- return;
-
- det[0].LinkNum = part.LinkNum;
- }
- else
- {
- SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
- det[0].LinkNum = originalPart.LinkNum;
- }
-
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "touch", new Object[] { new LSL_Types.LSLInteger(1) },
- det));
- }
-
- public void touch_end(uint localID, uint originalID, IClientAPI remoteClient,
- SurfaceTouchEventArgs surfaceArgs)
- {
- // Add to queue for all scripts in ObjectID object
- DetectParams[] det = new DetectParams[1];
- det[0] = new DetectParams();
- det[0].Key = remoteClient.AgentId;
- det[0].Populate(myScriptEngine.World);
-
- if (originalID == 0)
- {
- SceneObjectPart part =
- myScriptEngine.World.GetSceneObjectPart(localID);
- if (part == null)
- return;
-
- det[0].LinkNum = part.LinkNum;
- }
- else
- {
- SceneObjectPart originalPart =
- myScriptEngine.World.GetSceneObjectPart(originalID);
- det[0].LinkNum = originalPart.LinkNum;
- }
-
- if (surfaceArgs != null)
- {
- det[0].SurfaceTouchArgs = surfaceArgs;
- }
-
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "touch_end", new Object[] { new LSL_Types.LSLInteger(1) },
- det));
- }
-
- public void OnRezScript(uint localID, UUID itemID, string script,
- int startParam, bool postOnRez, string engine, int stateSource)
- {
- if (script.StartsWith("//MRM:"))
- return;
-
- List engines =
- new List(
- myScriptEngine.World.RequestModuleInterfaces());
-
- List names = new List();
- foreach (IScriptModule m in engines)
- names.Add(m.ScriptEngineName);
-
- int lineEnd = script.IndexOf('\n');
-
- if (lineEnd > 1)
- {
- string firstline = script.Substring(0, lineEnd).Trim();
-
- int colon = firstline.IndexOf(':');
- if (firstline.Length > 2 &&
- firstline.Substring(0, 2) == "//" && colon != -1)
- {
- string engineName = firstline.Substring(2, colon-2);
-
- if (names.Contains(engineName))
- {
- engine = engineName;
- script = "//" + script.Substring(script.IndexOf(':')+1);
- }
- else
- {
- if (engine == myScriptEngine.ScriptEngineName)
- {
- SceneObjectPart part =
- myScriptEngine.World.GetSceneObjectPart(
- localID);
-
- TaskInventoryItem item =
- part.Inventory.GetInventoryItem(itemID);
-
- ScenePresence presence =
- myScriptEngine.World.GetScenePresence(
- item.OwnerID);
-
- if (presence != null)
- {
- presence.ControllingClient.SendAgentAlertMessage(
- "Selected engine unavailable. "+
- "Running script on "+
- myScriptEngine.ScriptEngineName,
- false);
- }
- }
- }
- }
- }
-
- if (engine != myScriptEngine.ScriptEngineName)
- return;
-
- // m_log.Debug("OnRezScript localID: " + localID +
- // " LLUID: " + itemID.ToString() + " Size: " +
- // script.Length);
-
- myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script,
- startParam, postOnRez);
- }
-
- public void OnRemoveScript(uint localID, UUID itemID)
- {
- // m_log.Debug("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString());
- myScriptEngine.m_ScriptManager.StopScript(
- localID,
- itemID
- );
- }
-
- public void money(uint localID, UUID agentID, int amount)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "money", new object[] {
- new LSL_Types.LSLString(agentID.ToString()),
- new LSL_Types.LSLInteger(amount) },
- new DetectParams[0]));
- }
-
- // TODO: Replace placeholders below
- // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT!
- // These needs to be hooked up to OpenSim during init of this class
- // then queued in EventQueueManager.
- // When queued in EventQueueManager they need to be LSL compatible (name and params)
-
- public void state_exit(uint localID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "state_exit", new object[] { },
- new DetectParams[0]));
- }
-
- public void collision_start(uint localID, ColliderArgs col)
- {
- // Add to queue for all scripts in ObjectID object
- List det = new List();
-
- foreach (DetectedObject detobj in col.Colliders)
- {
- DetectParams d = new DetectParams();
- d.Key =detobj.keyUUID;
- d.Populate(myScriptEngine.World);
- det.Add(d);
- }
-
- if (det.Count > 0)
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "collision_start",
- new Object[] { new LSL_Types.LSLInteger(det.Count) },
- det.ToArray()));
- }
-
- public void collision(uint localID, ColliderArgs col)
- {
- // Add to queue for all scripts in ObjectID object
- List det = new List();
-
- foreach (DetectedObject detobj in col.Colliders)
- {
- DetectParams d = new DetectParams();
- d.Key =detobj.keyUUID;
- d.Populate(myScriptEngine.World);
- det.Add(d);
- }
-
- if (det.Count > 0)
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "collision", new Object[] { new LSL_Types.LSLInteger(det.Count) },
- det.ToArray()));
- }
-
- public void collision_end(uint localID, ColliderArgs col)
- {
- // Add to queue for all scripts in ObjectID object
- List det = new List();
-
- foreach (DetectedObject detobj in col.Colliders)
- {
- DetectParams d = new DetectParams();
- d.Key =detobj.keyUUID;
- d.Populate(myScriptEngine.World);
- det.Add(d);
- }
-
- if (det.Count > 0)
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "collision_end",
- new Object[] { new LSL_Types.LSLInteger(det.Count) },
- det.ToArray()));
- }
-
- public void land_collision_start(uint localID, UUID itemID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "land_collision_start",
- new object[0],
- new DetectParams[0]));
- }
-
- public void land_collision(uint localID, UUID itemID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "land_collision",
- new object[0],
- new DetectParams[0]));
- }
-
- public void land_collision_end(uint localID, UUID itemID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "land_collision_end",
- new object[0],
- new DetectParams[0]));
- }
-
- // Handled by long commands
- public void timer(uint localID, UUID itemID)
- {
- }
-
- public void listen(uint localID, UUID itemID)
- {
- }
-
- public void control(uint localID, UUID itemID, UUID agentID, uint held, uint change)
- {
- if ((change == 0) && (myScriptEngine.m_EventQueueManager.CheckEeventQueueForEvent(localID,"control"))) return;
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "control",new object[] {
- new LSL_Types.LSLString(agentID.ToString()),
- new LSL_Types.LSLInteger(held),
- new LSL_Types.LSLInteger(change)},
- new DetectParams[0]));
- }
-
- public void email(uint localID, UUID itemID, string timeSent,
- string address, string subject, string message, int numLeft)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "email",new object[] {
- new LSL_Types.LSLString(timeSent),
- new LSL_Types.LSLString(address),
- new LSL_Types.LSLString(subject),
- new LSL_Types.LSLString(message),
- new LSL_Types.LSLInteger(numLeft)},
- new DetectParams[0]));
- }
-
- public void at_target(uint localID, uint handle, Vector3 targetpos,
- Vector3 atpos)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "at_target", new object[] {
- new LSL_Types.LSLInteger(handle),
- new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z),
- new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) },
- new DetectParams[0]));
- }
-
- public void not_at_target(uint localID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "not_at_target",new object[0],
- new DetectParams[0]));
- }
-
- public void at_rot_target(uint localID, UUID itemID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "at_rot_target",new object[0],
- new DetectParams[0]));
- }
-
- public void not_at_rot_target(uint localID, UUID itemID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "not_at_rot_target",new object[0],
- new DetectParams[0]));
- }
-
- public void attach(uint localID, UUID itemID)
- {
- }
-
- public void dataserver(uint localID, UUID itemID)
- {
- }
-
- public void link_message(uint localID, UUID itemID)
- {
- }
-
- public void moving_start(uint localID, UUID itemID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "moving_start",new object[0],
- new DetectParams[0]));
- }
-
- public void moving_end(uint localID, UUID itemID)
- {
- myScriptEngine.PostObjectEvent(localID, new EventParams(
- "moving_end",new object[0],
- new DetectParams[0]));
- }
-
- public void object_rez(uint localID, UUID itemID)
- {
- }
-
- public void remote_data(uint localID, UUID itemID)
- {
- }
-
- // Handled by long commands
- public void http_response(uint localID, UUID itemID)
- {
- }
-
- ///
- /// If set to true then threads and stuff should try to make a graceful exit
- ///
- public bool PleaseShutdown
- {
- get { return _PleaseShutdown; }
- set { _PleaseShutdown = value; }
- }
- private bool _PleaseShutdown = false;
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
deleted file mode 100644
index 5865452..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ /dev/null
@@ -1,460 +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;
-using System.Collections.Generic;
-using System.Reflection;
-using OpenMetaverse;
-using OpenSim.Region.ScriptEngine.Shared;
-using log4net;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- ///
- /// EventQueueManager handles event queues
- /// Events are queued and executed in separate thread
- ///
- [Serializable]
- public class EventQueueManager
- {
- //
- // Class is instanced in "ScriptEngine" and used by "EventManager" which is also instanced in "ScriptEngine".
- //
- // Class purpose is to queue and execute functions that are received by "EventManager":
- // - allowing "EventManager" to release its event thread immediately, thus not interrupting server execution.
- // - allowing us to prioritize and control execution of script functions.
- // Class can use multiple threads for simultaneous execution. Mutexes are used for thread safety.
- //
- // 1. Hold an execution queue for scripts
- // 2. Use threads to process queue, each thread executes one script function on each pass.
- // 3. Catch any script error and process it
- //
- //
- // Notes:
- // * Current execution load balancing is optimized for 1 thread, and can cause unfair execute balancing between scripts.
- // Not noticeable unless server is under high load.
- //
-
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public ScriptEngine m_ScriptEngine;
-
- ///
- /// List of threads (classes) processing event queue
- /// Note that this may or may not be a reference to a static object depending on PrivateRegionThreads config setting.
- ///
- internal static List eventQueueThreads = new List(); // Thread pool that we work on
- ///
- /// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads.
- ///
-// private object eventQueueThreadsLock = new object();
- // Static objects for referencing the objects above if we don't have private threads:
- //internal static List staticEventQueueThreads; // A static reference used if we don't use private threads
-// internal static object staticEventQueueThreadsLock; // Statick lock object reference for same reason
-
- ///
- /// Global static list of all threads (classes) processing event queue -- used by max enforcment thread
- ///
- //private List staticGlobalEventQueueThreads = new List();
-
- ///
- /// Used internally to specify how many threads should exit gracefully
- ///
- public static int ThreadsToExit;
- public static object ThreadsToExitLock = new object();
-
-
- //public object queueLock = new object(); // Mutex lock object
-
- ///
- /// How many threads to process queue with
- ///
- internal static int numberOfThreads;
-
- internal static int EventExecutionMaxQueueSize;
-
- ///
- /// Maximum time one function can use for execution before we perform a thread kill.
- ///
- private static int maxFunctionExecutionTimems
- {
- get { return (int)(maxFunctionExecutionTimens / 10000); }
- set { maxFunctionExecutionTimens = value * 10000; }
- }
-
- ///
- /// Contains nanoseconds version of maxFunctionExecutionTimems so that it matches time calculations better (performance reasons).
- /// WARNING! ONLY UPDATE maxFunctionExecutionTimems, NEVER THIS DIRECTLY.
- ///
- public static long maxFunctionExecutionTimens;
-
- ///
- /// Enforce max execution time
- ///
- public static bool EnforceMaxExecutionTime;
-
- ///
- /// Kill script (unload) when it exceeds execution time
- ///
- private static bool KillScriptOnMaxFunctionExecutionTime;
-
- ///
- /// List of localID locks for mutex processing of script events
- ///
- private List objectLocks = new List();
- private object tryLockLock = new object(); // Mutex lock object
-
- ///
- /// Queue containing events waiting to be executed
- ///
- public Queue eventQueue = new Queue();
-
- #region " Queue structures "
- ///
- /// Queue item structure
- ///
- public struct QueueItemStruct
- {
- public uint localID;
- public UUID itemID;
- public string functionName;
- public DetectParams[] llDetectParams;
- public object[] param;
- public Dictionary,KeyValuePair>
- LineMap;
- }
-
- #endregion
-
- #region " Initialization / Startup "
- public EventQueueManager(ScriptEngine _ScriptEngine)
- {
- m_ScriptEngine = _ScriptEngine;
-
- ReadConfig();
- AdjustNumberOfScriptThreads();
- }
-
- public void ReadConfig()
- {
- // Refresh config
- numberOfThreads = m_ScriptEngine.ScriptConfigSource.GetInt("NumberOfScriptThreads", 2);
- maxFunctionExecutionTimems = m_ScriptEngine.ScriptConfigSource.GetInt("MaxEventExecutionTimeMs", 5000);
- EnforceMaxExecutionTime = m_ScriptEngine.ScriptConfigSource.GetBoolean("EnforceMaxEventExecutionTime", true);
- KillScriptOnMaxFunctionExecutionTime = m_ScriptEngine.ScriptConfigSource.GetBoolean("DeactivateScriptOnTimeout", false);
- EventExecutionMaxQueueSize = m_ScriptEngine.ScriptConfigSource.GetInt("EventExecutionMaxQueueSize", 300);
-
- // Now refresh config in all threads
- lock (eventQueueThreads)
- {
- foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads)
- {
- EventQueueThread.ReadConfig();
- }
- }
- }
-
- #endregion
-
- #region " Shutdown all threads "
- ~EventQueueManager()
- {
- Stop();
- }
-
- private void Stop()
- {
- if (eventQueueThreads != null)
- {
- // Kill worker threads
- lock (eventQueueThreads)
- {
- foreach (EventQueueThreadClass EventQueueThread in new ArrayList(eventQueueThreads))
- {
- AbortThreadClass(EventQueueThread);
- }
- //eventQueueThreads.Clear();
- //staticGlobalEventQueueThreads.Clear();
- }
- }
-
- // Remove all entries from our event queue
- lock (eventQueue)
- {
- eventQueue.Clear();
- }
- }
-
- #endregion
-
- #region " Start / stop script execution threads (ThreadClasses) "
- private void StartNewThreadClass()
- {
- EventQueueThreadClass eqtc = new EventQueueThreadClass();
- eventQueueThreads.Add(eqtc);
- //m_log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count);
- }
-
- private void AbortThreadClass(EventQueueThreadClass threadClass)
- {
- if (eventQueueThreads.Contains(threadClass))
- eventQueueThreads.Remove(threadClass);
-
- try
- {
- threadClass.Stop();
- }
- catch (Exception)
- {
- //m_log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:");
- //m_log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString());
- }
- //m_log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count);
- }
- #endregion
-
- #region " Mutex locks for queue access "
- ///
- /// Try to get a mutex lock on localID
- ///
- ///
- ///
- public bool TryLock(uint localID)
- {
- lock (tryLockLock)
- {
- if (objectLocks.Contains(localID) == true)
- {
- return false;
- }
- else
- {
- objectLocks.Add(localID);
- return true;
- }
- }
- }
-
- ///
- /// Release mutex lock on localID
- ///
- ///
- public void ReleaseLock(uint localID)
- {
- lock (tryLockLock)
- {
- if (objectLocks.Contains(localID) == true)
- {
- objectLocks.Remove(localID);
- }
- }
- }
- #endregion
-
- #region " Check execution queue for a specified Event"
- ///
- /// checks to see if a specified event type is already in the queue
- ///
- /// Region object ID
- /// Name of the function, will be state + "_event_" + FunctionName
- /// true if event is found , false if not found
- ///
- public bool CheckEeventQueueForEvent(uint localID, string FunctionName)
- {
- if (eventQueue.Count > 0)
- {
- lock (eventQueue)
- {
- foreach (EventQueueManager.QueueItemStruct QIS in eventQueue)
- {
- if ((QIS.functionName == FunctionName) && (QIS.localID == localID))
- return true;
- }
- }
- }
- return false;
- }
- #endregion
-
- #region " Add events to execution queue "
- ///
- /// Add event to event execution queue
- ///
- /// Region object ID
- /// Name of the function, will be state + "_event_" + FunctionName
- /// Array of parameters to match event mask
- public bool AddToObjectQueue(uint localID, string FunctionName, DetectParams[] qParams, params object[] param)
- {
- // Determine all scripts in Object and add to their queue
- //myScriptEngine.log.Info("[" + ScriptEngineName + "]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName);
-
- // Do we have any scripts in this object at all? If not, return
- if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false)
- {
- //m_log.Debug("Event \String.Empty + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID.");
- return false;
- }
-
- List scriptKeys =
- m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
-
- foreach (UUID itemID in scriptKeys)
- {
- // Add to each script in that object
- // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter?
- AddToScriptQueue(localID, itemID, FunctionName, qParams, param);
- }
- return true;
- }
-
- ///
- /// Add event to event execution queue
- ///
- /// Region object ID
- /// Region script ID
- /// Name of the function, will be state + "_event_" + FunctionName
- /// Array of parameters to match event mask
- public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, DetectParams[] qParams, params object[] param)
- {
- List keylist = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
-
- if (!keylist.Contains(itemID)) // We don't manage that script
- {
- return false;
- }
-
- lock (eventQueue)
- {
- if (eventQueue.Count >= EventExecutionMaxQueueSize)
- {
- m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event.");
- m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
- return false;
- }
-
- InstanceData id = m_ScriptEngine.m_ScriptManager.GetScript(
- localID, itemID);
-
- // Create a structure and add data
- QueueItemStruct QIS = new QueueItemStruct();
- QIS.localID = localID;
- QIS.itemID = itemID;
- QIS.functionName = FunctionName;
- QIS.llDetectParams = qParams;
- QIS.param = param;
- if (id != null)
- QIS.LineMap = id.LineMap;
-
- // Add it to queue
- eventQueue.Enqueue(QIS);
- }
- return true;
- }
- #endregion
-
- #region " Maintenance thread "
-
- ///
- /// Adjust number of script thread classes. It can start new, but if it needs to stop it will just set number of threads in "ThreadsToExit" and threads will have to exit themselves.
- /// Called from MaintenanceThread
- ///
- public void AdjustNumberOfScriptThreads()
- {
- // Is there anything here for us to do?
- if (eventQueueThreads.Count == numberOfThreads)
- return;
-
- lock (eventQueueThreads)
- {
- int diff = numberOfThreads - eventQueueThreads.Count;
- // Positive number: Start
- // Negative number: too many are running
- if (diff > 0)
- {
- // We need to add more threads
- for (int ThreadCount = eventQueueThreads.Count; ThreadCount < numberOfThreads; ThreadCount++)
- {
- StartNewThreadClass();
- }
- }
- if (diff < 0)
- {
- // We need to kill some threads
- lock (ThreadsToExitLock)
- {
- ThreadsToExit = Math.Abs(diff);
- }
- }
- }
- }
-
- ///
- /// Check if any thread class has been executing an event too long
- ///
- public void CheckScriptMaxExecTime()
- {
- // Iterate through all ScriptThreadClasses and check how long their current function has been executing
- lock (eventQueueThreads)
- {
- foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads)
- {
- // Is thread currently executing anything?
- if (EventQueueThread.InExecution)
- {
- // Has execution time expired?
- if (DateTime.Now.Ticks - EventQueueThread.LastExecutionStarted >
- maxFunctionExecutionTimens)
- {
- // Yes! We need to kill this thread!
-
- // Set flag if script should be removed or not
- EventQueueThread.KillCurrentScript = KillScriptOnMaxFunctionExecutionTime;
-
- // Abort this thread
- AbortThreadClass(EventQueueThread);
-
- // We do not need to start another, MaintenenceThread will do that for us
- //StartNewThreadClass();
- }
- }
- }
- }
- }
- #endregion
-
- /////
- ///// If set to true then threads and stuff should try to make a graceful exit
- /////
- //public bool PleaseShutdown
- //{
- // get { return _PleaseShutdown; }
- // set { _PleaseShutdown = value; }
- //}
- //private bool _PleaseShutdown = false;
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
deleted file mode 100644
index 51fd41a..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
+++ /dev/null
@@ -1,428 +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;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Globalization;
-using OpenMetaverse;
-using log4net;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Region.Framework.Scenes.Scripting;
-using OpenSim.Region.ScriptEngine.Shared;
-using OpenSim.Region.ScriptEngine.Shared.CodeTools;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- // Because every thread needs some data set for it
- // (time started to execute current function), it will do its work
- // within a class
- public class EventQueueThreadClass
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- // How many ms to sleep if queue is empty
- private static int nothingToDoSleepms;// = 50;
- private static ThreadPriority MyThreadPriority;
-
- public long LastExecutionStarted;
- public bool InExecution = false;
- public bool KillCurrentScript = false;
-
- //private EventQueueManager eventQueueManager;
- public Thread EventQueueThread;
- private static int ThreadCount = 0;
-
- private string ScriptEngineName = "ScriptEngine.Common";
-
- public EventQueueThreadClass()//EventQueueManager eqm
- {
- CultureInfo USCulture = new CultureInfo("en-US");
- Thread.CurrentThread.CurrentCulture = USCulture;
-
- //eventQueueManager = eqm;
- ReadConfig();
- Start();
- }
-
- ~EventQueueThreadClass()
- {
- Stop();
- }
-
- public void ReadConfig()
- {
- lock (ScriptEngine.ScriptEngines)
- {
- foreach (ScriptEngine m_ScriptEngine in
- ScriptEngine.ScriptEngines)
- {
- ScriptEngineName = m_ScriptEngine.ScriptEngineName;
- nothingToDoSleepms =
- m_ScriptEngine.ScriptConfigSource.GetInt(
- "SleepTimeIfNoScriptExecutionMs", 50);
-
- string pri = m_ScriptEngine.ScriptConfigSource.GetString(
- "ScriptThreadPriority", "BelowNormal");
-
- switch (pri.ToLower())
- {
- case "lowest":
- MyThreadPriority = ThreadPriority.Lowest;
- break;
- case "belownormal":
- MyThreadPriority = ThreadPriority.BelowNormal;
- break;
- case "normal":
- MyThreadPriority = ThreadPriority.Normal;
- break;
- case "abovenormal":
- MyThreadPriority = ThreadPriority.AboveNormal;
- break;
- case "highest":
- MyThreadPriority = ThreadPriority.Highest;
- break;
- default:
- MyThreadPriority = ThreadPriority.BelowNormal;
- m_log.Error(
- "[ScriptEngine.DotNetEngine]: Unknown "+
- "priority type \"" + pri +
- "\" in config file. Defaulting to "+
- "\"BelowNormal\".");
- break;
- }
- }
- }
- // Now set that priority
- if (EventQueueThread != null)
- if (EventQueueThread.IsAlive)
- EventQueueThread.Priority = MyThreadPriority;
- }
-
- ///
- /// Start thread
- ///
- private void Start()
- {
- EventQueueThread = Watchdog.StartThread(EventQueueThreadLoop, "EventQueueManagerThread_" + ThreadCount, MyThreadPriority, true);
-
- // Look at this... Don't you wish everyone did that solid
- // coding everywhere? :P
-
- if (ThreadCount == int.MaxValue)
- ThreadCount = 0;
-
- ThreadCount++;
- }
-
- public void Stop()
- {
- if (EventQueueThread != null && EventQueueThread.IsAlive == true)
- {
- try
- {
- EventQueueThread.Abort(); // Send abort
- }
- catch (Exception)
- {
- }
- }
- }
-
- private EventQueueManager.QueueItemStruct BlankQIS =
- new EventQueueManager.QueueItemStruct();
-
- private ScriptEngine lastScriptEngine;
- private uint lastLocalID;
- private UUID lastItemID;
-
- // Queue processing thread loop
- private void EventQueueThreadLoop()
- {
- CultureInfo USCulture = new CultureInfo("en-US");
- Thread.CurrentThread.CurrentCulture = USCulture;
-
- try
- {
- while (true)
- {
- try
- {
- while (true)
- {
- DoProcessQueue();
- Watchdog.UpdateThread();
- }
- }
- catch (ThreadAbortException)
- {
- m_log.Info("[" + ScriptEngineName +
- "]: ThreadAbortException while executing "+
- "function.");
- }
- catch (SelfDeleteException) // Must delete SOG
- {
- SceneObjectPart part =
- lastScriptEngine.World.GetSceneObjectPart(
- lastLocalID);
- if (part != null && part.ParentGroup != null)
- lastScriptEngine.World.DeleteSceneObject(
- part.ParentGroup, false);
- }
- catch (ScriptDeleteException) // Must delete item
- {
- SceneObjectPart part =
- lastScriptEngine.World.GetSceneObjectPart(
- lastLocalID);
- if (part != null && part.ParentGroup != null)
- part.Inventory.RemoveInventoryItem(lastItemID);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString());
- throw e;
- }
-
- Watchdog.UpdateThread();
- }
- }
- catch (ThreadAbortException)
- {
- }
- catch (Exception e)
- {
- // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
- m_log.ErrorFormat(
- "[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}",
- ScriptEngineName, e);
- }
-
- Watchdog.RemoveThread();
- }
-
- public void DoProcessQueue()
- {
- foreach (ScriptEngine m_ScriptEngine in
- new ArrayList(ScriptEngine.ScriptEngines))
- {
- lastScriptEngine = m_ScriptEngine;
-
- EventQueueManager.QueueItemStruct QIS = BlankQIS;
- bool GotItem = false;
-
- //if (PleaseShutdown)
- // return;
-
- if (m_ScriptEngine.m_EventQueueManager == null ||
- m_ScriptEngine.m_EventQueueManager.eventQueue == null)
- continue;
-
- if (m_ScriptEngine.m_EventQueueManager.eventQueue.Count == 0)
- {
- // Nothing to do? Sleep a bit waiting for something to do
- Thread.Sleep(nothingToDoSleepms);
- }
- else
- {
- // Something in queue, process
-
- // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME
- // OBJECT IS NOT GOOD
- lock (m_ScriptEngine.m_EventQueueManager.eventQueue)
- {
- GotItem = false;
- for (int qc = 0; qc < m_ScriptEngine.m_EventQueueManager.eventQueue.Count; qc++)
- {
- // Get queue item
- QIS = m_ScriptEngine.m_EventQueueManager.eventQueue.Dequeue();
-
- // Check if object is being processed by
- // someone else
- if (m_ScriptEngine.m_EventQueueManager.TryLock(
- QIS.localID) == false)
- {
- // Object is already being processed, requeue it
- m_ScriptEngine.m_EventQueueManager.
- eventQueue.Enqueue(QIS);
- }
- else
- {
- // We have lock on an object and can process it
- GotItem = true;
- break;
- }
- }
- }
-
- if (GotItem == true)
- {
- // Execute function
- try
- {
- // Only pipe event if land supports it.
- if (m_ScriptEngine.World.PipeEventsForScript(
- QIS.localID))
- {
- lastLocalID = QIS.localID;
- lastItemID = QIS.itemID;
- LastExecutionStarted = DateTime.Now.Ticks;
- KillCurrentScript = false;
- InExecution = true;
- m_ScriptEngine.m_ScriptManager.ExecuteEvent(
- QIS.localID,
- QIS.itemID,
- QIS.functionName,
- QIS.llDetectParams,
- QIS.param);
-
- InExecution = false;
- }
- }
- catch (TargetInvocationException tie)
- {
- Exception e = tie.InnerException;
-
- if (e is SelfDeleteException) // Forward it
- throw e;
-
- InExecution = false;
- string text = FormatException(tie, QIS.LineMap);
-
- // DISPLAY ERROR INWORLD
-
-// if (e.InnerException != null)
-// {
-// // Send inner exception
-// string line = " (unknown line)";
-// Regex rx = new Regex(@"SecondLife\.Script\..+[\s:](?\d+)\.?\r?$", RegexOptions.Compiled);
-// if (rx.Match(e.InnerException.ToString()).Success)
-// line = " (line " + rx.Match(e.InnerException.ToString()).Result("${line}") + ")";
-// text += e.InnerException.Message.ToString() + line;
-// }
-// else
-// {
-// text += "\r\n";
-// // Send normal
-// text += e.Message.ToString();
-// }
-// if (KillCurrentScript)
-// text += "\r\nScript will be deactivated!";
-
- try
- {
- if (text.Length >= 1100)
- text = text.Substring(0, 1099);
- IScriptHost m_host =
- m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
- m_ScriptEngine.World.SimChat(
- Utils.StringToBytes(text),
- ChatTypeEnum.DebugChannel, 2147483647,
- m_host.AbsolutePosition,
- m_host.Name, m_host.UUID, false);
- }
- catch (Exception)
- {
- m_log.Error("[" +
- ScriptEngineName + "]: " +
- "Unable to send text in-world:\r\n" +
- text);
- }
- finally
- {
- // So we are done sending message in-world
- if (KillCurrentScript)
- {
- m_ScriptEngine.m_EventQueueManager.
- m_ScriptEngine.m_ScriptManager.
- StopScript(
- QIS.localID, QIS.itemID);
- }
- }
- }
- catch (Exception)
- {
- throw;
- }
- finally
- {
- InExecution = false;
- m_ScriptEngine.m_EventQueueManager.ReleaseLock(
- QIS.localID);
- }
- }
- }
- }
- }
-
- string FormatException(Exception e, Dictionary,
- KeyValuePair> LineMap)
- {
- if (e.InnerException == null)
- return e.ToString();
-
- string message = "Runtime error:\n" + e.InnerException.StackTrace;
- string[] lines = message.Split(new char[] {'\n'});
-
- foreach (string line in lines)
- {
- if (line.Contains("SecondLife.Script"))
- {
- int idx = line.IndexOf(':');
- if (idx != -1)
- {
- string val = line.Substring(idx+1);
- int lineNum = 0;
- if (int.TryParse(val, out lineNum))
- {
- KeyValuePair pos =
- Compiler.FindErrorPosition(
- lineNum, 0, LineMap);
-
- int scriptLine = pos.Key;
- int col = pos.Value;
- if (scriptLine == 0)
- scriptLine++;
- if (col == 0)
- col++;
- message = string.Format("Runtime error:\n" +
- "Line ({0}): {1}", scriptLine - 1,
- e.InnerException.Message);
-
- return message;
- }
- }
- }
- }
-
- return message;
- }
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
deleted file mode 100644
index 87fdf1f..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
+++ /dev/null
@@ -1,238 +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;
-using System.Reflection;
-using System.Threading;
-using log4net;
-using OpenSim.Framework;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- ///
- /// This class does maintenance on script engine.
- ///
- public class MaintenanceThread
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- //public ScriptEngine m_ScriptEngine;
- private int MaintenanceLoopms;
- private int MaintenanceLoopTicks_ScriptLoadUnload;
- private int MaintenanceLoopTicks_Other;
-
-
- public MaintenanceThread()
- {
- //m_ScriptEngine = _ScriptEngine;
-
- ReadConfig();
-
- // Start maintenance thread
- StartMaintenanceThread();
- }
-
- ~MaintenanceThread()
- {
- StopMaintenanceThread();
- }
-
- public void ReadConfig()
- {
- // Bad hack, but we need a m_ScriptEngine :)
- lock (ScriptEngine.ScriptEngines)
- {
- foreach (ScriptEngine m_ScriptEngine in ScriptEngine.ScriptEngines)
- {
- MaintenanceLoopms = m_ScriptEngine.ScriptConfigSource.GetInt("MaintenanceLoopms", 50);
- MaintenanceLoopTicks_ScriptLoadUnload =
- m_ScriptEngine.ScriptConfigSource.GetInt("MaintenanceLoopTicks_ScriptLoadUnload", 1);
- MaintenanceLoopTicks_Other =
- m_ScriptEngine.ScriptConfigSource.GetInt("MaintenanceLoopTicks_Other", 10);
-
- return;
- }
- }
- }
-
- #region " Maintenance thread "
- ///
- /// Maintenance thread. Enforcing max execution time for example.
- ///
- public Thread MaintenanceThreadThread;
-
- ///
- /// Starts maintenance thread
- ///
- private void StartMaintenanceThread()
- {
- if (MaintenanceThreadThread == null)
- {
- MaintenanceThreadThread = Watchdog.StartThread(MaintenanceLoop, "ScriptMaintenanceThread", ThreadPriority.Normal, true);
- }
- }
-
- ///
- /// Stops maintenance thread
- ///
- private void StopMaintenanceThread()
- {
-#if DEBUG
- //m_log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called");
-#endif
- //PleaseShutdown = true;
- Thread.Sleep(100);
- try
- {
- if (MaintenanceThreadThread != null && MaintenanceThreadThread.IsAlive)
- {
- MaintenanceThreadThread.Abort();
- }
- }
- catch (Exception)
- {
- //m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString());
- }
- }
-
- // private ScriptEngine lastScriptEngine; // Keep track of what ScriptEngine instance we are at so we can give exception
- ///
- /// A thread should run in this loop and check all running scripts
- ///
- public void MaintenanceLoop()
- {
- //if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms)
- // m_log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " +
- // "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run.");
-
- long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks;
- long Last_ReReadConfigFilens = DateTime.Now.Ticks;
- int MaintenanceLoopTicks_ScriptLoadUnload_Count = 0;
- int MaintenanceLoopTicks_Other_Count = 0;
- bool MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = false;
- bool MaintenanceLoopTicks_Other_ResetCount = false;
-
- while (true)
- {
- try
- {
- while (true)
- {
- Thread.Sleep(MaintenanceLoopms); // Sleep before next pass
-
- // Reset counters?
- if (MaintenanceLoopTicks_ScriptLoadUnload_ResetCount)
- {
- MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = false;
- MaintenanceLoopTicks_ScriptLoadUnload_Count = 0;
- }
- if (MaintenanceLoopTicks_Other_ResetCount)
- {
- MaintenanceLoopTicks_Other_ResetCount = false;
- MaintenanceLoopTicks_Other_Count = 0;
- }
-
- // Increase our counters
- MaintenanceLoopTicks_ScriptLoadUnload_Count++;
- MaintenanceLoopTicks_Other_Count++;
-
- foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
- {
- // lastScriptEngine = m_ScriptEngine;
- // Re-reading config every x seconds
- if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other)
- {
- MaintenanceLoopTicks_Other_ResetCount = true;
- if (m_ScriptEngine.RefreshConfigFilens > 0)
- {
- // Check if its time to re-read config
- if (DateTime.Now.Ticks - Last_ReReadConfigFilens >
- m_ScriptEngine.RefreshConfigFilens)
- {
- //m_log.Debug("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens);
- // Its time to re-read config file
- m_ScriptEngine.ReadConfig();
- Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
- }
-
-
- // Adjust number of running script threads if not correct
- if (m_ScriptEngine.m_EventQueueManager != null)
- m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
-
- // Check if any script has exceeded its max execution time
- if (EventQueueManager.EnforceMaxExecutionTime)
- {
- // We are enforcing execution time
- if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
- EventQueueManager.maxFunctionExecutionTimens)
- {
- // Its time to check again
- m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
- Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
- }
- }
- }
- }
- if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload)
- {
- MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = true;
- // LOAD / UNLOAD SCRIPTS
- if (m_ScriptEngine.m_ScriptManager != null)
- m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
- }
- }
-
- Watchdog.UpdateThread();
- }
- }
- catch(ThreadAbortException)
- {
- m_log.Error("Thread aborted in MaintenanceLoopThread. If this is during shutdown, please ignore");
- }
- catch (Exception ex)
- {
- m_log.ErrorFormat("Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: {0}", ex.ToString());
- }
- }
-
- Watchdog.RemoveThread();
- }
- #endregion
-
- /////
- ///// If set to true then threads and stuff should try to make a graceful exit
- /////
- //public bool PleaseShutdown
- //{
- // get { return _PleaseShutdown; }
- // set { _PleaseShutdown = value; }
- //}
- //private bool _PleaseShutdown = false;
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4c4c5e7..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,65 +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.Reflection;
-using System.Runtime.InteropServices;
-
-// General information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")]
-[assembly : AssemblyDescription("")]
-[assembly : AssemblyConfiguration("")]
-[assembly : AssemblyCompany("http://opensimulator.org")]
-[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")]
-[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
-[assembly : AssemblyTrademark("")]
-[assembly : AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly : ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly : AssemblyVersion("0.6.5.*")]
-[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Resources/DotNetEngine.addin.xml b/OpenSim/Region/ScriptEngine/DotNetEngine/Resources/DotNetEngine.addin.xml
deleted file mode 100644
index 78a8dca..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Resources/DotNetEngine.addin.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
deleted file mode 100644
index 9806218..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ /dev/null
@@ -1,485 +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 log4net;
-using Nini.Config;
-using OpenSim.Framework;
-using OpenSim.Region.CoreModules.Framework.EventQueue;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Region.ScriptEngine.Interfaces;
-using OpenMetaverse;
-using OpenMetaverse.StructuredData;
-using OpenSim.Region.ScriptEngine.Shared;
-using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- [Serializable]
- public class ScriptEngine : INonSharedRegionModule, IScriptEngine, IScriptModule
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public static List ScriptEngines =
- new List();
-
- private Scene m_Scene;
- public Scene World
- {
- get { return m_Scene; }
- }
-
- // Handles and queues incoming events from OpenSim
- public EventManager m_EventManager;
-
- // Executes events, handles script threads
- public EventQueueManager m_EventQueueManager;
-
- // Load, unload and execute scripts
- public ScriptManager m_ScriptManager;
-
- // Handles loading/unloading of scripts into AppDomains
- public AppDomainManager m_AppDomainManager;
-
- // Thread that does different kinds of maintenance,
- // for example refreshing config and killing scripts
- // that has been running too long
- public static MaintenanceThread m_MaintenanceThread;
-
- private IConfigSource m_ConfigSource;
- public IConfig ScriptConfigSource;
- private bool m_enabled = false;
-
- public IConfig Config
- {
- get { return ScriptConfigSource; }
- }
-
- public IConfigSource ConfigSource
- {
- get { return m_ConfigSource; }
- }
-
- // How many seconds between re-reading config-file.
- // 0 = never. ScriptEngine will try to adjust to new config changes.
- public int RefreshConfigFileSeconds {
- get { return (int)(RefreshConfigFilens / 10000000); }
- set { RefreshConfigFilens = value * 10000000; }
- }
-
- public long RefreshConfigFilens;
-
- public string ScriptEngineName
- {
- get { return "ScriptEngine.DotNetEngine"; }
- }
-
- public IScriptModule ScriptModule
- {
- get { return this; }
- }
-
- public event ScriptRemoved OnScriptRemoved;
- public event ObjectRemoved OnObjectRemoved;
-
- public ScriptEngine()
- {
- // For logging, just need any instance, doesn't matter
- Common.mySE = this;
-
- lock (ScriptEngines)
- {
- // Keep a list of ScriptEngines for shared threads
- // to process all instances
- ScriptEngines.Add(this);
- }
- }
-
- public void Initialise(IConfigSource config)
- {
- m_ConfigSource = config;
- }
-
- public void AddRegion(Scene Sceneworld)
- {
- // Make sure we have config
- if (ConfigSource.Configs[ScriptEngineName] == null)
- ConfigSource.AddConfig(ScriptEngineName);
-
- ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
-
- m_enabled = ScriptConfigSource.GetBoolean("Enabled", true);
- if (!m_enabled)
- return;
-
- m_log.Info("[" + ScriptEngineName + "]: ScriptEngine initializing");
-
- m_Scene = Sceneworld;
-
- // Create all objects we'll be using
- m_EventQueueManager = new EventQueueManager(this);
- m_EventManager = new EventManager(this, true);
-
- // We need to start it
- m_ScriptManager = new ScriptManager(this);
- m_ScriptManager.Setup();
- m_AppDomainManager = new AppDomainManager(this);
- if (m_MaintenanceThread == null)
- m_MaintenanceThread = new MaintenanceThread();
-
- m_log.Info("[" + ScriptEngineName + "]: Reading configuration "+
- "from config section \"" + ScriptEngineName + "\"");
-
- ReadConfig();
-
- m_Scene.StackModuleInterface(this);
- }
-
- public void RemoveRegion(Scene scene)
- {
- }
-
- public void RegionLoaded(Scene scene)
- {
- if (!m_enabled)
- return;
-
- m_EventManager.HookUpEvents();
-
- m_Scene.EventManager.OnScriptReset += OnScriptReset;
- m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning;
- m_Scene.EventManager.OnStartScript += OnStartScript;
- m_Scene.EventManager.OnStopScript += OnStopScript;
-
- m_ScriptManager.Start();
- }
-
- public void Shutdown()
- {
- // We are shutting down
- lock (ScriptEngines)
- {
- ScriptEngines.Remove(this);
- }
- }
-
- public void ReadConfig()
- {
- RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 0);
-
- if (m_EventQueueManager != null) m_EventQueueManager.ReadConfig();
- if (m_EventManager != null) m_EventManager.ReadConfig();
- if (m_ScriptManager != null) m_ScriptManager.ReadConfig();
- if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig();
- if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig();
- }
-
- #region IRegionModule
-
- public void Close()
- {
- }
-
- public Type ReplaceableInterface
- {
- get { return null; }
- }
-
- public string Name
- {
- get { return "Common." + ScriptEngineName; }
- }
-
- public bool IsSharedModule
- {
- get { return false; }
- }
-
- public bool PostObjectEvent(uint localID, EventParams p)
- {
- return m_EventQueueManager.AddToObjectQueue(localID, p.EventName,
- p.DetectParams, p.Params);
- }
-
- public bool PostScriptEvent(UUID itemID, EventParams p)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- return m_EventQueueManager.AddToScriptQueue(localID, itemID,
- p.EventName, p.DetectParams, p.Params);
- }
-
- public bool PostScriptEvent(UUID itemID, string name, Object[] p)
- {
- Object[] lsl_p = new Object[p.Length];
- for (int i = 0; i < p.Length ; i++)
- {
- if (p[i] is int)
- lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]);
- else if (p[i] is string)
- lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
- else if (p[i] is Vector3)
- lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
- else if (p[i] is Quaternion)
- lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
- else if (p[i] is float)
- lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
- else
- lsl_p[i] = p[i];
- }
-
- return PostScriptEvent(itemID, new EventParams(name, lsl_p, new DetectParams[0]));
- }
-
- public bool PostObjectEvent(UUID itemID, string name, Object[] p)
- {
- SceneObjectPart part = m_Scene.GetSceneObjectPart(itemID);
- if (part == null)
- return false;
-
- Object[] lsl_p = new Object[p.Length];
- for (int i = 0; i < p.Length ; i++)
- {
- if (p[i] is int)
- lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]);
- else if (p[i] is string)
- lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
- else if (p[i] is Vector3)
- lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
- else if (p[i] is Quaternion)
- lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
- else if (p[i] is float)
- lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
- else
- lsl_p[i] = p[i];
- }
-
- return PostObjectEvent(part.LocalId, new EventParams(name, lsl_p, new DetectParams[0]));
- }
-
- public DetectParams GetDetectParams(UUID itemID, int number)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- if (localID == 0)
- return null;
-
- InstanceData id = m_ScriptManager.GetScript(localID, itemID);
-
- if (id == null)
- return null;
-
- DetectParams[] det = m_ScriptManager.GetDetectParams(id);
-
- if (number < 0 || number >= det.Length)
- return null;
-
- return det[number];
- }
-
- public int GetStartParameter(UUID itemID)
- {
- return m_ScriptManager.GetStartParameter(itemID);
- }
-
- public void SetMinEventDelay(UUID itemID, double delay)
- {
- // TODO in DotNet, done in XEngine
- throw new NotImplementedException();
- }
-
- #endregion
-
- public void SetState(UUID itemID, string state)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- if (localID == 0)
- return;
-
- InstanceData id = m_ScriptManager.GetScript(localID, itemID);
-
- if (id == null)
- return;
-
- string currentState = id.State;
-
- if (currentState != state)
- {
- try
- {
- m_EventManager.state_exit(localID);
-
- }
- catch (AppDomainUnloadedException)
- {
- m_log.Error("[SCRIPT]: state change called when "+
- "script was unloaded. Nothing to worry about, "+
- "but noting the occurance");
- }
-
- id.State = state;
-
- try
- {
- int eventFlags = m_ScriptManager.GetStateEventFlags(localID,
- itemID);
-
- SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
- if (part != null)
- part.SetScriptEvents(itemID, eventFlags);
-
- m_EventManager.state_entry(localID);
- }
- catch (AppDomainUnloadedException)
- {
- m_log.Error("[SCRIPT]: state change called when "+
- "script was unloaded. Nothing to worry about, but "+
- "noting the occurance");
- }
- }
- }
-
- public bool GetScriptState(UUID itemID)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- if (localID == 0)
- return false;
-
- InstanceData id = m_ScriptManager.GetScript(localID, itemID);
- if (id == null)
- return false;
-
- return id.Running;
- }
-
- public void SetScriptState(UUID itemID, bool state)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- if (localID == 0)
- return;
-
- InstanceData id = m_ScriptManager.GetScript(localID, itemID);
- if (id == null)
- return;
-
- if (!id.Disabled)
- id.Running = state;
- }
-
- public void ApiResetScript(UUID itemID)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- if (localID == 0)
- return;
-
- m_ScriptManager.ResetScript(localID, itemID);
- }
-
- public void ResetScript(UUID itemID)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- if (localID == 0)
- return;
-
- m_ScriptManager.ResetScript(localID, itemID);
- }
-
- public void OnScriptReset(uint localID, UUID itemID)
- {
- ResetScript(itemID);
- }
-
- public void OnStartScript(uint localID, UUID itemID)
- {
- InstanceData id = m_ScriptManager.GetScript(localID, itemID);
- if (id == null)
- return;
-
- if (!id.Disabled)
- id.Running = true;
- }
-
- public void OnStopScript(uint localID, UUID itemID)
- {
- InstanceData id = m_ScriptManager.GetScript(localID, itemID);
- if (id == null)
- return;
-
- id.Running = false;
- }
-
- public void OnGetScriptRunning(IClientAPI controllingClient,
- UUID objectID, UUID itemID)
- {
- uint localID = m_ScriptManager.GetLocalID(itemID);
- if (localID == 0)
- return;
-
- InstanceData id = m_ScriptManager.GetScript(localID, itemID);
- if (id == null)
- return;
-
- IEventQueue eq = World.RequestModuleInterface();
- if (eq == null)
- {
- controllingClient.SendScriptRunningReply(objectID, itemID,
- id.Running);
- }
- else
- {
- eq.Enqueue(EventQueueHelper.ScriptRunningReplyEvent(objectID, itemID, id.Running, true),
- controllingClient.AgentId);
- }
- }
-
- public IScriptApi GetApi(UUID itemID, string name)
- {
- return m_ScriptManager.GetApi(itemID, name);
- }
-
- public IScriptWorkItem QueueEventHandler(Object o)
- {
- return null;
- }
-
- public string GetAssemblyName(UUID itemID)
- {
- return "";
- }
-
- public string GetXMLState(UUID itemID)
- {
- return "";
- }
-
- public bool CanBeDeleted(UUID itemID)
- {
- return true;
- }
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
deleted file mode 100644
index 6ac209e..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ /dev/null
@@ -1,703 +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.Reflection;
-using System.Globalization;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Lifetime;
-using log4net;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Region.ScriptEngine.Interfaces;
-using OpenSim.Region.ScriptEngine.Shared;
-using OpenSim.Region.ScriptEngine.Shared.Api;
-using System.Collections.Generic;
-using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Threading;
-using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
-using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
-using OpenSim.Region.ScriptEngine.Shared.CodeTools;
-
-namespace OpenSim.Region.ScriptEngine.DotNetEngine
-{
- public class InstanceData
- {
- public IScript Script;
- public string State;
- public bool Running;
- public bool Disabled;
- public string Source;
- public int StartParam;
- public AppDomain AppDomain;
- public Dictionary Apis;
- public Dictionary, KeyValuePair>
- LineMap;
-// public ISponsor ScriptSponsor;
- }
-
- public class ScriptManager
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- #region Declares
-
- private Thread scriptLoadUnloadThread;
- private static Thread staticScriptLoadUnloadThread = null;
- private Queue LUQueue = new Queue();
- private static bool PrivateThread;
- private int LoadUnloadMaxQueueSize;
- private Object scriptLock = new Object();
- private bool m_started = false;
- private Dictionary detparms =
- new Dictionary();
-
- // Load/Unload structure
- private struct LUStruct
- {
- public uint localID;
- public UUID itemID;
- public string script;
- public LUType Action;
- public int startParam;
- public bool postOnRez;
- }
-
- private enum LUType
- {
- Unknown = 0,
- Load = 1,
- Unload = 2
- }
-
- public Dictionary> Scripts =
- new Dictionary>();
-
- private Compiler LSLCompiler;
-
- public Scene World
- {
- get { return m_scriptEngine.World; }
- }
-
- #endregion
-
- public void Initialize()
- {
- // Create our compiler
- LSLCompiler = new Compiler(m_scriptEngine);
- }
-
- public void _StartScript(uint localID, UUID itemID, string Script,
- int startParam, bool postOnRez)
- {
- m_log.DebugFormat(
- "[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}",
- m_scriptEngine.ScriptEngineName, localID, itemID);
-
- // We will initialize and start the script.
- // It will be up to the script itself to hook up the correct events.
- string CompiledScriptFile = String.Empty;
-
- SceneObjectPart m_host = World.GetSceneObjectPart(localID);
-
- if (null == m_host)
- {
- m_log.ErrorFormat(
- "[{0}]: Could not find scene object part corresponding "+
- "to localID {1} to start script",
- m_scriptEngine.ScriptEngineName, localID);
-
- return;
- }
-
- UUID assetID = UUID.Zero;
- TaskInventoryItem taskInventoryItem = new TaskInventoryItem();
- if (m_host.TaskInventory.TryGetValue(itemID, out taskInventoryItem))
- assetID = taskInventoryItem.AssetID;
-
- ScenePresence presence =
- World.GetScenePresence(taskInventoryItem.OwnerID);
-
- CultureInfo USCulture = new CultureInfo("en-US");
- Thread.CurrentThread.CurrentCulture = USCulture;
-
- try
- {
- // Compile (We assume LSL)
- CompiledScriptFile =
- (string)LSLCompiler.PerformScriptCompile(Script,
- assetID.ToString(), taskInventoryItem.OwnerID);
-
- if (presence != null && (!postOnRez))
- presence.ControllingClient.SendAgentAlertMessage(
- "Compile successful", false);
-
- m_log.InfoFormat("[SCRIPT]: Compiled assetID {0}: {1}",
- assetID, CompiledScriptFile);
-
- InstanceData id = new InstanceData();
-
- IScript CompiledScript;
- CompiledScript =
- m_scriptEngine.m_AppDomainManager.LoadScript(
- CompiledScriptFile, out id.AppDomain);
- //Register the sponsor
-// ISponsor scriptSponsor = new ScriptSponsor();
-// ILease lease = (ILease)RemotingServices.GetLifetimeService(CompiledScript as MarshalByRefObject);
-// lease.Register(scriptSponsor);
-// id.ScriptSponsor = scriptSponsor;
-
- id.LineMap = LSLCompiler.LineMap();
- id.Script = CompiledScript;
- id.Source = Script;
- id.StartParam = startParam;
- id.State = "default";
- id.Running = true;
- id.Disabled = false;
-
- // Add it to our script memstruct
- m_scriptEngine.m_ScriptManager.SetScript(localID, itemID, id);
-
- id.Apis = new Dictionary();
-
- ApiManager am = new ApiManager();
-
- foreach (string api in am.GetApis())
- {
- id.Apis[api] = am.CreateApi(api);
- id.Apis[api].Initialize(m_scriptEngine, m_host,
- localID, itemID);
- }
-
- foreach (KeyValuePair kv in id.Apis)
- {
- CompiledScript.InitApi(kv.Key, kv.Value);
- }
-
- // Fire the first start-event
- int eventFlags =
- m_scriptEngine.m_ScriptManager.GetStateEventFlags(
- localID, itemID);
-
- m_host.SetScriptEvents(itemID, eventFlags);
-
- m_scriptEngine.m_EventQueueManager.AddToScriptQueue(
- localID, itemID, "state_entry", new DetectParams[0],
- new object[] { });
-
- if (postOnRez)
- {
- m_scriptEngine.m_EventQueueManager.AddToScriptQueue(
- localID, itemID, "on_rez", new DetectParams[0],
- new object[] { new LSL_Types.LSLInteger(startParam) });
- }
-
- string[] warnings = LSLCompiler.GetWarnings();
-
- if (warnings != null && warnings.Length != 0)
- {
- if (presence != null && (!postOnRez))
- presence.ControllingClient.SendAgentAlertMessage(
- "Script saved with warnings, check debug window!",
- false);
-
- foreach (string warning in warnings)
- {
- try
- {
- // DISPLAY WARNING INWORLD
- string text = "Warning:\n" + warning;
- if (text.Length > 1100)
- text = text.Substring(0, 1099);
-
- World.SimChat(Utils.StringToBytes(text),
- ChatTypeEnum.DebugChannel, 2147483647,
- m_host.AbsolutePosition, m_host.Name, m_host.UUID,
- false);
- }
- catch (Exception e2) // LEGIT: User Scripting
- {
- m_log.Error("[" +
- m_scriptEngine.ScriptEngineName +
- "]: Error displaying warning in-world: " +
- e2.ToString());
- m_log.Error("[" +
- m_scriptEngine.ScriptEngineName + "]: " +
- "Warning:\r\n" +
- warning);
- }
- }
- }
- }
- catch (Exception e) // LEGIT: User Scripting
- {
- if (presence != null && (!postOnRez))
- presence.ControllingClient.SendAgentAlertMessage(
- "Script saved with errors, check debug window!",
- false);
- try
- {
- // DISPLAY ERROR INWORLD
- string text = "Error compiling script:\n" +
- e.Message.ToString();
- if (text.Length > 1100)
- text = text.Substring(0, 1099);
-
- World.SimChat(Utils.StringToBytes(text),
- ChatTypeEnum.DebugChannel, 2147483647,
- m_host.AbsolutePosition, m_host.Name, m_host.UUID,
- false);
- }
- catch (Exception e2) // LEGIT: User Scripting
- {
- m_log.Error("[" +
- m_scriptEngine.ScriptEngineName +
- "]: Error displaying error in-world: " +
- e2.ToString());
- m_log.Error("[" +
- m_scriptEngine.ScriptEngineName + "]: " +
- "Errormessage: Error compiling script:\r\n" +
- e2.Message.ToString());
- }
- }
- }
-
- public void _StopScript(uint localID, UUID itemID)
- {
- InstanceData id = GetScript(localID, itemID);
- if (id == null)
- return;
-
- m_log.DebugFormat("[{0}]: Unloading script",
- m_scriptEngine.ScriptEngineName);
-
- // Stop long command on script
- AsyncCommandManager.RemoveScript(m_scriptEngine, localID, itemID);
-
- try
- {
- // Get AppDomain
- // Tell script not to accept new requests
- id.Running = false;
- id.Disabled = true;
- AppDomain ad = id.AppDomain;
-
- // Remove from internal structure
- RemoveScript(localID, itemID);
-
- // Tell AppDomain that we have stopped script
- m_scriptEngine.m_AppDomainManager.StopScript(ad);
- }
- catch (Exception e) // LEGIT: User Scripting
- {
- m_log.Error("[" +
- m_scriptEngine.ScriptEngineName +
- "]: Exception stopping script localID: " +
- localID + " LLUID: " + itemID.ToString() +
- ": " + e.ToString());
- }
- }
-
- public void ReadConfig()
- {
- // TODO: Requires sharing of all ScriptManagers to single thread
- PrivateThread = true;
- LoadUnloadMaxQueueSize = m_scriptEngine.ScriptConfigSource.GetInt(
- "LoadUnloadMaxQueueSize", 100);
- }
-
- #region Object init/shutdown
-
- public ScriptEngine m_scriptEngine;
-
- public ScriptManager(ScriptEngine scriptEngine)
- {
- m_scriptEngine = scriptEngine;
- }
-
- public void Setup()
- {
- ReadConfig();
- Initialize();
- }
-
- public void Start()
- {
- m_started = true;
-
-
- AppDomain.CurrentDomain.AssemblyResolve +=
- new ResolveEventHandler(CurrentDomain_AssemblyResolve);
-
- //
- // CREATE THREAD
- // Private or shared
- //
- if (PrivateThread)
- {
- // Assign one thread per region
- //scriptLoadUnloadThread = StartScriptLoadUnloadThread();
- }
- else
- {
- // Shared thread - make sure one exist, then assign it to the private
- if (staticScriptLoadUnloadThread == null)
- {
- //staticScriptLoadUnloadThread =
- // StartScriptLoadUnloadThread();
- }
- scriptLoadUnloadThread = staticScriptLoadUnloadThread;
- }
- }
-
- ~ScriptManager()
- {
- // Abort load/unload thread
- try
- {
- if (scriptLoadUnloadThread != null &&
- scriptLoadUnloadThread.IsAlive == true)
- {
- scriptLoadUnloadThread.Abort();
- //scriptLoadUnloadThread.Join();
- }
- }
- catch
- {
- }
- }
-
- #endregion
-
- #region Load / Unload scripts (Thread loop)
-
- public void DoScriptLoadUnload()
- {
- if (!m_started)
- return;
-
- lock (LUQueue)
- {
- if (LUQueue.Count > 0)
- {
- LUStruct item = LUQueue.Dequeue();
-
- if (item.Action == LUType.Unload)
- {
- _StopScript(item.localID, item.itemID);
- RemoveScript(item.localID, item.itemID);
- }
- else if (item.Action == LUType.Load)
- {
- m_log.DebugFormat("[{0}]: Loading script",
- m_scriptEngine.ScriptEngineName);
- _StartScript(item.localID, item.itemID, item.script,
- item.startParam, item.postOnRez);
- }
- }
- }
- }
-
- #endregion
-
- #region Helper functions
-
- private static Assembly CurrentDomain_AssemblyResolve(
- object sender, ResolveEventArgs args)
- {
- return Assembly.GetExecutingAssembly().FullName == args.Name ?
- Assembly.GetExecutingAssembly() : null;
- }
-
- #endregion
-
- #region Start/Stop/Reset script
-
- ///
- /// Fetches, loads and hooks up a script to an objects events
- ///
- ///
- ///
- public void StartScript(uint localID, UUID itemID, string Script, int startParam, bool postOnRez)
- {
- lock (LUQueue)
- {
- if ((LUQueue.Count >= LoadUnloadMaxQueueSize) && m_started)
- {
- m_log.Error("[" +
- m_scriptEngine.ScriptEngineName +
- "]: ERROR: Load/unload queue item count is at " +
- LUQueue.Count +
- ". Config variable \"LoadUnloadMaxQueueSize\" "+
- "is set to " + LoadUnloadMaxQueueSize +
- ", so ignoring new script.");
-
- return;
- }
-
- LUStruct ls = new LUStruct();
- ls.localID = localID;
- ls.itemID = itemID;
- ls.script = Script;
- ls.Action = LUType.Load;
- ls.startParam = startParam;
- ls.postOnRez = postOnRez;
- LUQueue.Enqueue(ls);
- }
- }
-
- ///
- /// Disables and unloads a script
- ///
- ///
- ///
- public void StopScript(uint localID, UUID itemID)
- {
- LUStruct ls = new LUStruct();
- ls.localID = localID;
- ls.itemID = itemID;
- ls.Action = LUType.Unload;
- ls.startParam = 0;
- ls.postOnRez = false;
- lock (LUQueue)
- {
- LUQueue.Enqueue(ls);
- }
- }
-
- #endregion
-
- #region Perform event execution in script
-
- // Execute a LL-event-function in Script
- internal void ExecuteEvent(uint localID, UUID itemID,
- string FunctionName, DetectParams[] qParams, object[] args)
- {
- int ExeStage=0; // ;^) Ewe Loon, for debuging
- InstanceData id=null;
- try // ;^) Ewe Loon,fix
- { // ;^) Ewe Loon,fix
- ExeStage = 1; // ;^) Ewe Loon, for debuging
- id = GetScript(localID, itemID);
- if (id == null)
- return;
- ExeStage = 2; // ;^) Ewe Loon, for debuging
- if (qParams.Length>0) // ;^) Ewe Loon,fix
- detparms[id] = qParams;
- ExeStage = 3; // ;^) Ewe Loon, for debuging
- if (id.Running)
- id.Script.ExecuteEvent(id.State, FunctionName, args);
- ExeStage = 4; // ;^) Ewe Loon, for debuging
- if (qParams.Length>0) // ;^) Ewe Loon,fix
- detparms.Remove(id);
- ExeStage = 5; // ;^) Ewe Loon, for debuging
- }
- catch (Exception e) // ;^) Ewe Loon, From here down tis fix
- {
- if ((ExeStage == 3)&&(qParams.Length>0))
- detparms.Remove(id);
- SceneObjectPart ob = m_scriptEngine.World.GetSceneObjectPart(localID);
- m_log.InfoFormat("[Script Error] ,{0},{1},@{2},{3},{4},{5}", ob.Name , FunctionName, ExeStage, e.Message, qParams.Length, detparms.Count);
- if (ExeStage != 2) throw e;
- }
- }
-
- public uint GetLocalID(UUID itemID)
- {
- foreach (KeyValuePair > k
- in Scripts)
- {
- if (k.Value.ContainsKey(itemID))
- return k.Key;
- }
- return 0;
- }
-
- public int GetStateEventFlags(uint localID, UUID itemID)
- {
- try
- {
- InstanceData id = GetScript(localID, itemID);
- if (id == null)
- {
- return 0;
- }
- int evflags = id.Script.GetStateEventFlags(id.State);
-
- return (int)evflags;
- }
- catch (Exception)
- {
- }
-
- return 0;
- }
-
- #endregion
-
- #region Internal functions to keep track of script
-
- public List GetScriptKeys(uint localID)
- {
- if (Scripts.ContainsKey(localID) == false)
- return new List();
-
- Dictionary Obj;
- Scripts.TryGetValue(localID, out Obj);
-
- return new List(Obj.Keys);
- }
-
- public InstanceData GetScript(uint localID, UUID itemID)
- {
- lock (scriptLock)
- {
- InstanceData id = null;
-
- if (Scripts.ContainsKey(localID) == false)
- return null;
-
- Dictionary Obj;
- Scripts.TryGetValue(localID, out Obj);
- if (Obj==null) return null;
- if (Obj.ContainsKey(itemID) == false)
- return null;
-
- // Get script
- Obj.TryGetValue(itemID, out id);
- return id;
- }
- }
-
- public void SetScript(uint localID, UUID itemID, InstanceData id)
- {
- lock (scriptLock)
- {
- // Create object if it doesn't exist
- if (Scripts.ContainsKey(localID) == false)
- {
- Scripts.Add(localID, new Dictionary());
- }
-
- // Delete script if it exists
- Dictionary Obj;
- Scripts.TryGetValue(localID, out Obj);
- if (Obj.ContainsKey(itemID) == true)
- Obj.Remove(itemID);
-
- // Add to object
- Obj.Add(itemID, id);
- }
- }
-
- public void RemoveScript(uint localID, UUID itemID)
- {
- if (localID == 0)
- localID = GetLocalID(itemID);
-
- // Don't have that object?
- if (Scripts.ContainsKey(localID) == false)
- return;
-
- // Delete script if it exists
- Dictionary Obj;
- Scripts.TryGetValue(localID, out Obj);
- if (Obj.ContainsKey(itemID) == true)
- Obj.Remove(itemID);
- }
-
- #endregion
-
- public void ResetScript(uint localID, UUID itemID)
- {
- InstanceData id = GetScript(localID, itemID);
- string script = id.Source;
- StopScript(localID, itemID);
- SceneObjectPart part = World.GetSceneObjectPart(localID);
- part.Inventory.GetInventoryItem(itemID).PermsMask = 0;
- part.Inventory.GetInventoryItem(itemID).PermsGranter = UUID.Zero;
- StartScript(localID, itemID, script, id.StartParam, false);
- }
-
- #region Script serialization/deserialization
-
- public void GetSerializedScript(uint localID, UUID itemID)
- {
- // Serialize the script and return it
- // Should not be a problem
- FileStream fs = File.Create("SERIALIZED_SCRIPT_" + itemID);
- BinaryFormatter b = new BinaryFormatter();
- b.Serialize(fs, GetScript(localID, itemID));
- fs.Close();
- }
-
- public void PutSerializedScript(uint localID, UUID itemID)
- {
- // Deserialize the script and inject it into an AppDomain
-
- // How to inject into an AppDomain?
- }
-
- #endregion
-
- public DetectParams[] GetDetectParams(InstanceData id)
- {
- if (detparms.ContainsKey(id))
- return detparms[id];
-
- return null;
- }
-
- public int GetStartParameter(UUID itemID)
- {
- uint localID = GetLocalID(itemID);
- InstanceData id = GetScript(localID, itemID);
-
- if (id == null)
- return 0;
-
- return id.StartParam;
- }
-
- public IScriptApi GetApi(UUID itemID, string name)
- {
- uint localID = GetLocalID(itemID);
-
- InstanceData id = GetScript(localID, itemID);
- if (id == null)
- return null;
-
- if (id.Apis.ContainsKey(name))
- return id.Apis[name];
-
- return null;
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs
deleted file mode 100644
index 0b7c894..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs
+++ /dev/null
@@ -1,40 +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.Text;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL
-{
- public class Commands_LSL : IScriptEngineComponent
- {
-
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs
deleted file mode 100644
index fdbc699..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs
+++ /dev/null
@@ -1,56 +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 System.Text;
-using log4net;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL
-{
- public class Script : IScriptCommandProvider
- {
- internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public void llSay(int channelID, string text)
- {
- m_log.InfoFormat("[{0}] llSay({1}, \"{2}\")", "(Commands_LSL)OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL.Script", channelID, text);
- }
-
- public void ExecuteCommand(string functionName, params object[] args)
- {
-
- }
-
- public string Name
- {
- get { return "SECS.DotNetEngine.Commands_LSL.Script"; }
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs
deleted file mode 100644
index fc67ec1..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs
deleted file mode 100644
index 86eab09..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs
+++ /dev/null
@@ -1,44 +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.Text;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Commands_OSSL
-{
- public class Commands_OSSL : IScriptEngineComponent
- {
- //private RegionInfoStructure CurrentRegion;
- public void Initialize(RegionInfoStructure currentRegion)
- {
- //CurrentRegion = currentRegion;
- }
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs
deleted file mode 100644
index c6b15cf..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_OSSL")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_OSSL")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs
deleted file mode 100644
index 3d2d9d2..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs
+++ /dev/null
@@ -1,187 +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.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Text.RegularExpressions;
-using log4net;
-using OpenSim.ScriptEngine.Shared;
-using ScriptAssemblies;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
-{
- public abstract class CILCompiler
- {
- internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private string ScriptEnginesPath = "ScriptEngines";
- private string Name { get { return "SECS.DotNetEngine.CILCompiler"; } }
- private string m_scriptAssemblyName;
- internal string ScriptAssemblyName { get { return m_scriptAssemblyName; } set { m_scriptAssemblyName = value; } }
-
- // Default inherit
- protected string ScriptInheritFrom = typeof(ScriptAssemblies.ScriptBase).Name;
- private readonly System.Security.Cryptography.MD5CryptoServiceProvider MD5Sum = new System.Security.Cryptography.MD5CryptoServiceProvider();
- protected CodeDomProvider CompileProvider;
-
- //private string[] AppDomainAssemblies = new string[] { "OpenSim.Region.ScriptEngine.Shared.dll", "OpenSim.Region.ScriptEngine.Shared.Script.dll", "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll" };
- private readonly string[] AppDomainAssemblies = new string[] {
- Assembly.GetAssembly(typeof(Int32)).Location,
- "OpenSim.ScriptEngine.Shared.dll",
- "OpenSim.ScriptEngine.Shared.Script.dll",
- Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.Shared.dll")
- };
-
- public abstract string PreProcessScript(ref string script);
-
- public CILCompiler()
- {
- }
-
- private static readonly Regex FileNameFixer = new Regex(@"[^a-zA-Z0-9\.\-]", RegexOptions.Compiled | RegexOptions.Singleline);
- public string Compile(ScriptMetaData data, ref string _script)
- {
- // Add "using", "inherit", default constructor, etc around script.
- string script = PreProcessScript(ref _script);
-
- // Get filename based on content
- string md5Sum = System.Convert.ToBase64String(
- MD5Sum.ComputeHash(
- System.Text.Encoding.ASCII.GetBytes(script)
- ));
- // Unique name for this assembly
- ScriptAssemblyName = "SECS_Script_" + FileNameFixer.Replace(md5Sum, "_");
-
- string OutFile = Path.Combine(ScriptEnginesPath, ScriptAssemblyName + ".dll");
-
- // Make sure target dir exist
- if (!Directory.Exists(ScriptEnginesPath))
- try { Directory.CreateDirectory(ScriptEnginesPath); }
- catch { }
-
- // Already exist? No point in recompiling
- if (File.Exists(OutFile))
- return OutFile;
-
- //
- // Dump source code
- //
- string dumpFile = OutFile + ".txt";
- try
- {
- if (File.Exists(dumpFile))
- File.Delete(dumpFile);
- File.WriteAllText(dumpFile, script);
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[{0}] Exception trying to dump script source code to file \"{1}\": {2}", Name, dumpFile, e.ToString());
- }
-
- //
- // COMPILE
- //
-
- CompilerParameters parameters = new CompilerParameters();
- parameters.IncludeDebugInformation = true;
- //string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
-
- foreach (string file in AppDomainAssemblies)
- {
- parameters.ReferencedAssemblies.Add(file);
- m_log.DebugFormat("[{0}] Adding reference for compile: \"{1}\".", Name, file);
- }
- //lock (commandProvider)
- //{
- // foreach (string key in commandProvider.Keys)
- // {
- // IScriptCommandProvider cp = commandProvider[key];
- // string
- // file = cp.GetType().Assembly.Location;
- // parameters.ReferencedAssemblies.Add(file);
- // m_log.DebugFormat("[{0}] Loading command provider assembly \"{1}\" into AppDomain: \"{2}\".", Name,
- // key, file);
- // }
- //}
-
- parameters.GenerateExecutable = false;
- parameters.OutputAssembly = OutFile;
- parameters.IncludeDebugInformation = true;
- //parameters.WarningLevel = 1; // Should be 4?
- parameters.TreatWarningsAsErrors = false;
-
- // Do compile
- CompilerResults results = CompileProvider.CompileAssemblyFromSource(parameters, script);
-
-
- //
- // WARNINGS AND ERRORS
- //
- //TODO
- int display = 5;
- if (results.Errors.Count > 0)
- {
- string errtext = String.Empty;
- foreach (CompilerError CompErr in results.Errors)
- {
- // Show 5 errors max
- //
- if (display <= 0)
- break;
- display--;
-
- string severity = "Error";
- if (CompErr.IsWarning)
- severity = "Warning";
-
- //TODO: Implement
- KeyValuePair lslPos = new KeyValuePair();
-
- //lslPos = "NOT IMPLEMENTED";// FindErrorPosition(CompErr.Line, CompErr.Column);
-
- string text = CompErr.ErrorText;
-
- // The Second Life viewer's script editor begins
- // countingn lines and columns at 0, so we subtract 1.
- errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
- lslPos.Key - 1, lslPos.Value - 1,
- CompErr.ErrorNumber, text, severity);
- }
-
- if (!File.Exists(OutFile))
- {
- throw new Exception(errtext);
- }
- }
-
- // TODO: Process errors
- return OutFile;
- }
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs
deleted file mode 100644
index a8599bf..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs
+++ /dev/null
@@ -1,70 +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.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.CSharp;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
-{
- public class Compiler_CS : CILCompiler, IScriptCompiler
- {
- private string[] ScriptUsing = new string[]
- {
- "System",
- "OpenSim.ScriptEngine.Shared",
- "OpenSim.Region.ScriptEngine.Shared",
- "System.Collections.Generic"
- };
-
- public Compiler_CS()
- {
- CompileProvider = new CSharpCodeProvider();
- }
-
- public override string PreProcessScript(ref string script)
- {
- string s = "";
- foreach (string u in ScriptUsing)
- {
- s += "using " + u + ";";
- }
-
- s += "\r\n"
- + String.Empty + "namespace ScriptAssemblies { "
- + String.Empty + "public class UserScript" + " : " + ScriptInheritFrom + " { \r\n" +
- @"public Script() { } " +
- script +
- "} }\r\n";
-
- return s;
- }
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs
deleted file mode 100644
index 4361ae2..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs
+++ /dev/null
@@ -1,56 +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.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.JScript;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
-{
- public class Compiler_JS : CILCompiler, IScriptCompiler
- {
-
- public Compiler_JS()
- {
- CompileProvider = new JScriptCodeProvider() as CodeDomProvider;
- }
-
- public override string PreProcessScript(ref string script)
- {
- return
- "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
- "package SecondLife {\r\n" +
- "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
- script +
- "} }\r\n";
-
- }
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs
deleted file mode 100644
index 496afc9..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs
+++ /dev/null
@@ -1,57 +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 System.Text;
-using OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.LSL;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
-{
- public class Compiler_LSL : IScriptCompiler
- {
-
-
- private readonly Compiler_CS m_Compiler_CS = new Compiler_CS();
- private readonly LSL2CS m_LSL2CS = new LSL2CS();
-
- public string Compile(ScriptMetaData scriptMetaData, ref string script)
- {
- // Convert script to CS
- string scriptCS = m_LSL2CS.Convert(ref script);
- // Use CS compiler to compile it
- return m_Compiler_CS.Compile(scriptMetaData, ref scriptCS);
- }
-
- public string PreProcessScript(ref string script)
- {
- // This is handled by our converter
- return script;
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs
deleted file mode 100644
index 04597ba..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs
+++ /dev/null
@@ -1,56 +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.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.VisualBasic;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
-{
- public class Compiler_VB : CILCompiler, IScriptCompiler
- {
-
- public Compiler_VB()
- {
- CompileProvider = new VBCodeProvider() as CodeDomProvider;
- }
-
- public override string PreProcessScript(ref string script)
- {
- return
- "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
- String.Empty + "NameSpace SecondLife:" +
- String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass: " +
- "\r\nPublic Sub New()\r\nEnd Sub: " +
- script +
- ":End Class :End Namespace\r\n";
- }
- }
-}
-
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs
deleted file mode 100644
index dce17ad..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs
+++ /dev/null
@@ -1,55 +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 System.Text;
-using OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.YP;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
-{
- public class Compiler_YP: IScriptCompiler
- {
-
- private readonly Compiler_CS m_Compiler_CS = new Compiler_CS();
-
- public string Compile(ScriptMetaData scriptMetaData, ref string script)
- {
- // Convert script to CS
- string scriptCS = YP2CS.Convert(ref script);
- // Use CS compiler to compile it
- return m_Compiler_CS.Compile(scriptMetaData, ref scriptCS);
- }
-
- public string PreProcessScript(ref string script)
- {
- // This is handled by our converter
- return script;
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs
deleted file mode 100644
index d4af1c7..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs
+++ /dev/null
@@ -1,44 +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.Text;
-using OpenSim.Region.ScriptEngine.Shared.CodeTools;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.LSL
-{
- public class LSL2CS
- {
- private ICodeConverter Converter = new CSCodeGenerator();
-
- public string Convert(ref string script)
- {
- //m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap;
- return Converter.Convert(script);
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs
deleted file mode 100644
index dedc48e..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Compilers")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Compilers")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs
deleted file mode 100644
index 10b5715..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs
+++ /dev/null
@@ -1,54 +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.Text;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.YP
-{
- public class YP2CS
- {
- public static string Convert(ref string script)
- {
- return script;
- }
-
- public string PreProcessScript(ref string script)
- {
- return
- "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " +
- "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
- String.Empty + "namespace SecondLife { " +
- String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
- //@"public Script() { } " +
- @"static OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP YP=null; " +
- @"public Script() { YP= new OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP(); } " +
- script +
- "} }\r\n";
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
deleted file mode 100644
index 81dc62d..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
+++ /dev/null
@@ -1,121 +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.Text;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Region.ScriptEngine.Shared;
-using OpenSim.ScriptEngine.Shared;
-using EventParams = OpenSim.ScriptEngine.Shared.EventParams;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Events
-{
- public class LSLEventProvider : IScriptEventProvider
- {
- public delegate void RezScriptDelegate(uint localID, UUID itemID, string script, int startParam, bool postOnRez,
- string engine);
- public event RezScriptDelegate RezScript;
- public delegate void RemoveScriptDelegate(uint localID, UUID itemID);
- public event RemoveScriptDelegate RemoveScript;
- public delegate void ScriptChangedDelegate(uint localID, uint change);
- public event ScriptChangedDelegate ScriptChanged;
-
- private RegionInfoStructure CurrentRegion;
- public void Initialize(RegionInfoStructure currentRegion)
- {
- CurrentRegion = currentRegion;
- HookupEvents();
- }
-
- private void HookupEvents()
- {
- CurrentRegion.Scene.EventManager.OnObjectGrab += OnObjectGrab;
- CurrentRegion.Scene.EventManager.OnRezScript += OnRezScript;
- CurrentRegion.Scene.EventManager.OnRemoveScript += OnRemoveScript;
- CurrentRegion.Scene.EventManager.OnScriptChangedEvent += OnScriptChangedEvent;
-
-
- }
-
- private void OnScriptChangedEvent(uint localID, uint change)
- {
- // Script is being changed, fire event
- if (ScriptChanged != null)
- ScriptChanged(localID, change);
- }
-
- private void OnRemoveScript(uint localID, UUID itemID)
- {
- // Script is being removed, fire event
- if (RemoveScript != null)
- RemoveScript(localID, itemID);
- }
-
- private void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
- {
- // New script being created, fire event
- if (RezScript != null)
- RezScript(localID, itemID, script, startParam, postOnRez, engine);
- }
-
- private void OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
- {
- // Add to queue for all scripts in ObjectID object
- DetectParams[] det = new DetectParams[1];
- det[0] = new DetectParams();
- det[0].Key = remoteClient.AgentId;
- //det[0].Populate(World);
-
- if (originalID == 0)
- {
- SceneObjectPart part =
- CurrentRegion.Scene.GetSceneObjectPart(localID);
-
- if (part == null)
- return;
-
- det[0].LinkNum = part.LinkNum;
- }
- else
- {
- SceneObjectPart originalPart =
- CurrentRegion.Scene.GetSceneObjectPart(originalID);
- det[0].LinkNum = originalPart.LinkNum;
- }
- if (surfaceArgs != null)
- {
- det[0].SurfaceTouchArgs = surfaceArgs;
- }
- Shared.EventParams ep =
- new Shared.EventParams(localID, "touch_start", new Object[] {new LSL_Types.LSLInteger(1)}, det);
- CurrentRegion.Executors_Execute(ep);
-
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs
deleted file mode 100644
index 299304a..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs
deleted file mode 100644
index afa2300..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs
+++ /dev/null
@@ -1,240 +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.Reflection;
-using System.Reflection.Emit;
-using System.Text;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
-{
- public class BaseClassFactory
- {
-
-
- public static void MakeBaseClass(ScriptStructure script)
- {
- string asmName = "ScriptAssemblies";
- string ModuleID = asmName;
- string ClassID = "Script";
- string moveToDir = "ScriptEngines";
- string asmFileName = ModuleID + "_" + ClassID + ".dll";
- if (!Directory.Exists(moveToDir))
- Directory.CreateDirectory(moveToDir);
-
- ILGenerator ilgen;
- AssemblyBuilder asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
- new AssemblyName(asmName), AssemblyBuilderAccess.RunAndSave);
-
- // The module builder
- ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule(ModuleID, asmFileName);
-
- // The class builder
- TypeBuilder classBuilder = modBuilder.DefineType(ClassID, TypeAttributes.Class | TypeAttributes.Public);
-
- // The default constructor
- //ConstructorBuilder ctorBuilder = classBuilder.DefineDefaultConstructor(MethodAttributes.Public);
-
-
- Type[] paramsTypeArray = new Type[] {typeof (System.ParamArrayAttribute)};
- Type[] executeFunctionTypeArray = new Type[] {typeof (string), typeof (System.ParamArrayAttribute)};
- foreach (IScriptCommandProvider cp in script.RegionInfo.CommandProviders.Values)
- {
- Type t = cp.GetType();
- foreach (MethodInfo mi in t.GetMethods())
- {
- MethodBuilder methodBuilder = classBuilder.DefineMethod(mi.Name, mi.Attributes, mi.GetType(), Type.EmptyTypes);
- methodBuilder.SetParameters(paramsTypeArray);
- //ParameterBuilder paramBuilder = methodBuilder.DefineParameter(1, ParameterAttributes.None, "args");
-
- ilgen = methodBuilder.GetILGenerator();
- //ilgen.Emit(OpCodes.Nop);
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Ldc_I4_0);
- //ilgen.Emit(OpCodes.Ldelem_Ref);
- //ilgen.MarkSequencePoint(doc, 6, 1, 6, 100);
-
- //MethodInfo ExecuteFunction = typeof(ScriptAssemblies.IScript).GetMethod(
- // "ExecuteFunction",
- // executeFunctionTypeArray);
-
- ilgen.DeclareLocal(typeof(string));
- ilgen.Emit(OpCodes.Nop);
- ilgen.Emit(OpCodes.Ldstr, mi.Name);
- ilgen.Emit(OpCodes.Stloc_0);
- ilgen.Emit(OpCodes.Ldarg_0);
- ilgen.Emit(OpCodes.Ldloc_0);
- ilgen.Emit(OpCodes.Ldarg_1);
-
- // FieldInfo testInfo = classBuilder.
- //BindingFlags.NonPublic | BindingFlags.Instance);
-
- //ilgen.Emit(OpCodes.Ldfld, testInfo);
-
- //ilgen.EmitCall(OpCodes.Call, ExecuteFunction, executeFunctionTypeArray);
- ilgen.EmitCall(OpCodes.Call, typeof(System.Console).GetMethod("WriteLine"), executeFunctionTypeArray);
-
- // // string.Format("Hello, {0} World!", toWhom)
- // //
- // ilgen.Emit(OpCodes.Ldstr, "Hello, {0} World!");
- // ilgen.Emit(OpCodes.Ldarg_1);
- // ilgen.Emit(OpCodes.Call, typeof(string).GetMethod
- //("Format", new Type[] { typeof(string), typeof(object) }));
-
- // // m_log.Debug("Hello, World!");
- // //
- // ilgen.Emit(OpCodes.Call, typeof(Console).GetMethod
- // ("WriteLine", new Type[] { typeof(string) }));
- ilgen.Emit(OpCodes.Ret);
-
-
-
- //Label eom = ilgen.DefineLabel();
- //ilgen.Emit(OpCodes.Br_S, eom);
- //ilgen.MarkLabel(eom);
- //ilgen.Emit(OpCodes.Ret);
- //Type test = methodBuilder.SetParameters();
-
-
- //methodBuilder.SetParameters(typeof (object[]));
-
-
- }
- }
-
-
- //// Two fields: m_firstname, m_lastname
- //FieldBuilder fBuilderFirstName = classBuilder.DefineField("m_firstname", typeof(string), FieldAttributes.Private);
- //FieldBuilder fBuilderLastName = classBuilder.DefineField("m_lastname", typeof(string), FieldAttributes.Private);
-
- //// Two properties for this object: FirstName, LastName
- //PropertyBuilder pBuilderFirstName = classBuilder.DefineProperty("FirstName", System.Reflection.PropertyAttributes.HasDefault, typeof(string), null);
- //PropertyBuilder pBuilderLastName = classBuilder.DefineProperty("LastName", System.Reflection.PropertyAttributes.HasDefault, typeof(string), null);
-
- //// Custom attributes for get, set accessors
- //MethodAttributes getSetAttr = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName;
-
- //// get,set accessors for FirstName
- //MethodBuilder mGetFirstNameBuilder = classBuilder.DefineMethod("get_FirstName", getSetAttr, typeof(string), Type.EmptyTypes);
-
- //// Code generation
- //ilgen = mGetFirstNameBuilder.GetILGenerator();
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Ldfld, fBuilderFirstName); // returning the firstname field
- //ilgen.Emit(OpCodes.Ret);
-
- //MethodBuilder mSetFirstNameBuilder = classBuilder.DefineMethod("set_FirstName", getSetAttr, null, new Type[] { typeof(string) });
-
- //// Code generation
- //ilgen = mSetFirstNameBuilder.GetILGenerator();
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Ldarg_1);
- //ilgen.Emit(OpCodes.Stfld, fBuilderFirstName); // setting the firstname field from the first argument (1)
- //ilgen.Emit(OpCodes.Ret);
-
- //// get,set accessors for LastName
- //MethodBuilder mGetLastNameBuilder = classBuilder.DefineMethod("get_LastName", getSetAttr, typeof(string), Type.EmptyTypes);
-
- //// Code generation
- //ilgen = mGetLastNameBuilder.GetILGenerator();
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Ldfld, fBuilderLastName); // returning the firstname field
- //ilgen.Emit(OpCodes.Ret);
-
- //MethodBuilder mSetLastNameBuilder = classBuilder.DefineMethod("set_LastName", getSetAttr, null, new Type[] { typeof(string) });
-
- //// Code generation
- //ilgen = mSetLastNameBuilder.GetILGenerator();
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Ldarg_1);
- //ilgen.Emit(OpCodes.Stfld, fBuilderLastName); // setting the firstname field from the first argument (1)
- //ilgen.Emit(OpCodes.Ret);
-
- //// Assigning get/set accessors
- //pBuilderFirstName.SetGetMethod(mGetFirstNameBuilder);
- //pBuilderFirstName.SetSetMethod(mSetFirstNameBuilder);
-
- //pBuilderLastName.SetGetMethod(mGetLastNameBuilder);
- //pBuilderLastName.SetSetMethod(mSetLastNameBuilder);
-
- //// Now, a custom method named GetFullName that concatenates FirstName and LastName properties
- //MethodBuilder mGetFullNameBuilder = classBuilder.DefineMethod("GetFullName", MethodAttributes.Public, typeof(string), Type.EmptyTypes);
-
- //// Code generation
- //ilgen = mGetFullNameBuilder.GetILGenerator();
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Call, mGetFirstNameBuilder); // getting the firstname
- //ilgen.Emit(OpCodes.Ldstr, " "); // an space
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Call, mGetLastNameBuilder); // getting the lastname
-
- //// We need the 'Concat' method from string type
- //MethodInfo concatMethod = typeof(String).GetMethod("Concat", new Type[] { typeof(string), typeof(string), typeof(string) });
-
- //ilgen.Emit(OpCodes.Call, concatMethod); // calling concat and returning the result
- //ilgen.Emit(OpCodes.Ret);
-
- //// Another constructor that initializes firstname and lastname
- //ConstructorBuilder ctorBuilder2 = classBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(string), typeof(string) });
- //ctorBuilder2.DefineParameter(1, ParameterAttributes.In, "firstname");
- //ctorBuilder2.DefineParameter(2, ParameterAttributes.In, "lastname");
-
- //// Code generation
- //ilgen = ctorBuilder2.GetILGenerator();
-
- //// First of all, we need to call the base constructor,
- //// the Object's constructor in this sample
- //Type objType = Type.GetType("System.Object");
- //ConstructorInfo objCtor = objType.GetConstructor(Type.EmptyTypes);
-
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Call, objCtor); // calling the Object's constructor
-
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Ldarg_1);
- //ilgen.Emit(OpCodes.Call, mSetFirstNameBuilder); // setting the firstname field from the first argument (1)
- //ilgen.Emit(OpCodes.Ldarg_0);
- //ilgen.Emit(OpCodes.Ldarg_2);
- //ilgen.Emit(OpCodes.Call, mSetLastNameBuilder); // setting the lastname field from the second argument (2)
- //ilgen.Emit(OpCodes.Ret);
-
- // Finally, create the type and save the assembly
- classBuilder.CreateType();
-
- asmBuilder.Save(asmFileName);
- string toFile = Path.Combine(moveToDir, asmFileName);
- if (File.Exists(toFile))
- File.Delete(toFile);
- File.Move(asmFileName, toFile);
-
- //string a = "";
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs
deleted file mode 100644
index 9468c18..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs
+++ /dev/null
@@ -1,49 +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.Text;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
-{
- public struct LoadUnloadStructure
- {
- public ScriptStructure Script;
- public LUType Action;
- public bool PostOnRez;
- public int StartParam;
-
- public enum LUType
- {
- Unknown = 0,
- Load = 1,
- Unload = 2
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1831e50..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.Grid.ScriptEngine.Components.DefaultScheduler")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.Components.DefaultScheduler")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs
deleted file mode 100644
index 8c36764..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs
+++ /dev/null
@@ -1,55 +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.Text;
-using OpenMetaverse;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
-{
- public class Scheduler : IScriptScheduler
- {
-
- private ScriptManager m_ScriptManager = new ScriptManager();
- public void AddScript(ScriptStructure scriptStructure)
- {
- m_ScriptManager.AddScript(scriptStructure);
- }
-
- public void Removecript(uint id, UUID itemID)
- {
- m_ScriptManager.RemoveScript(id, itemID);
- }
-
- public void Close()
- {
- m_ScriptManager.Close();
- }
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs
deleted file mode 100644
index 3c20f20..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs
+++ /dev/null
@@ -1,216 +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;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Text;
-using log4net;
-using OpenSim.ScriptEngine.Shared;
-using IScript=OpenSim.Region.ScriptEngine.Shared.ScriptBase.IScript;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
-{
- public class ScriptLoader : IScriptLoader
- {
- //
- // This class does AppDomain handling and loading/unloading of
- // scripts in it. It is instanced in "ScriptEngine" and controlled
- // from "ScriptManager"
- //
- // 1. Create a new AppDomain if old one is full (or doesn't exist)
- // 2. Load scripts into AppDomain
- // 3. Unload scripts from AppDomain (stopping them and marking
- // them as inactive)
- // 4. Unload AppDomain completely when all scripts in it has stopped
- //
-
- public string Name { get { return "SECS.DotNetEngine.Scheduler.ScriptLoader"; } }
- private int maxScriptsPerAppDomain = 10;
-
- // Internal list of all AppDomains
- private List appDomains =
- new List();
- private Dictionary AppDomainFiles = new Dictionary();
- public readonly string[] AssembliesInAppDomain = new string[] { "OpenSim.ScriptEngine.Shared.Script.dll", "OpenSim.Region.ScriptEngine.Shared.dll" };
-
- internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- // Structure to keep track of data around AppDomain
- private class AppDomainStructure
- {
- public AppDomain CurrentAppDomain; // The AppDomain itself
- public int ScriptsLoaded; // Number of scripts loaded into AppDomain
- public int ScriptsWaitingUnload; // Number of dead scripts
- }
-
- // Current AppDomain
- private AppDomainStructure currentAD;
-
- private object getLock = new object(); // Mutex
- private object freeLock = new object(); // Mutex
-
- // Find a free AppDomain, creating one if necessary
- private AppDomainStructure GetFreeAppDomain()
- {
- lock (getLock)
- {
- // Current full?
- if (currentAD != null &&
- currentAD.ScriptsLoaded >= maxScriptsPerAppDomain)
- {
- // Add it to AppDomains list and empty current
- appDomains.Add(currentAD);
- currentAD = null;
- }
- // No current
- if (currentAD == null)
- {
- // Create a new current AppDomain
- currentAD = new AppDomainStructure();
- currentAD.CurrentAppDomain = PrepareNewAppDomain();
- }
-
- return currentAD;
- }
- }
-
- private int AppDomainNameCount;
- public ScriptAssemblies.IScript LoadScript(ScriptStructure script)
- {
- // Find next available AppDomain to put it in
- AppDomainStructure FreeAppDomain;
-
- // If we already have loaded file, then reuse that AppDomains
- if (AppDomainFiles.ContainsKey(script.AssemblyFileName))
- FreeAppDomain = AppDomainFiles[script.AssemblyFileName];
- else
- FreeAppDomain = GetFreeAppDomain();
-
- // Set script object AppDomain
- script.AppDomain = FreeAppDomain.CurrentAppDomain;
-
- // Create instance of script
- ScriptAssemblies.IScript mbrt = (ScriptAssemblies.IScript)
- FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(
- script.AssemblyFileName, "ScriptAssemblies.Script");
- //, true, BindingFlags.CreateInstance, null);
- FreeAppDomain.ScriptsLoaded++;
-
- return mbrt;
- }
-
- // Create and prepare a new AppDomain for scripts
- private AppDomain PrepareNewAppDomain()
- {
- // Create and prepare a new AppDomain
- AppDomainNameCount++;
-
- // TODO: Currently security match current appdomain
-
- // Construct and initialize settings for a second AppDomain.
- AppDomainSetup ads = new AppDomainSetup();
- ads.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
- ads.DisallowBindingRedirects = true;
- ads.DisallowCodeDownload = true;
- ads.LoaderOptimization = LoaderOptimization.MultiDomainHost;
- ads.ShadowCopyFiles = "false"; // Disable shadowing
- ads.ConfigurationFile =
- AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
-
- AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" +
- AppDomainNameCount, null, ads);
-
- foreach (string file in AssembliesInAppDomain)
- {
- m_log.InfoFormat("[{0}] AppDomain Loading: \"{1}\"->\"{2}\".", Name, file,
- AssemblyName.GetAssemblyName(file).ToString());
- AD.Load(AssemblyName.GetAssemblyName(file));
- }
-
- // Return the new AppDomain
- return AD;
- }
-
- // Unload appdomains that are full and have only dead scripts
- private void UnloadAppDomains()
- {
- lock (freeLock)
- {
- // Go through all
- foreach (AppDomainStructure ads in new ArrayList(appDomains))
- {
- // Don't process current AppDomain
- if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
- {
- // Not current AppDomain
- // Is number of unloaded bigger or equal to number of loaded?
- if (ads.ScriptsLoaded <= ads.ScriptsWaitingUnload)
- {
- // Remove from internal list
- appDomains.Remove(ads);
-
- // Unload
- AppDomain.Unload(ads.CurrentAppDomain);
- }
- }
- }
- }
- }
-
- // Increase "dead script" counter for an AppDomain
- public void StopScript(AppDomain ad)
- {
- lock (freeLock)
- {
- // Check if it is current AppDomain
- if (currentAD.CurrentAppDomain == ad)
- {
- // Yes - increase
- currentAD.ScriptsWaitingUnload++;
- return;
- }
-
- // Lopp through all AppDomains
- foreach (AppDomainStructure ads in new ArrayList(appDomains))
- {
- if (ads.CurrentAppDomain == ad)
- {
- // Found it
- ads.ScriptsWaitingUnload++;
- break;
- }
- }
- }
-
- UnloadAppDomains(); // Outsite lock, has its own GetLock
- }
-
-
-
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs
deleted file mode 100644
index 3dad902..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs
+++ /dev/null
@@ -1,203 +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.Diagnostics;
-using System.Reflection;
-using System.Text;
-using System.Threading;
-using log4net;
-using OpenMetaverse;
-using OpenSim.Region.ScriptEngine.Shared;
-using OpenSim.ScriptEngine.Shared;
-using EventParams=OpenSim.ScriptEngine.Shared.EventParams;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
-{
- public partial class ScriptManager: IScriptExecutor
- {
- private const int NoWorkSleepMs = 50;
- private const int NoWorkSleepMsInc = 1; // How much time to increase wait with on every iteration
- private const int NoWorkSleepMsIncMax = 300; // Max time to wait
-
- internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public string Name { get { return "SECS.DotNetEngine.ScriptManager"; } }
- private static Thread ScriptLoadUnloadThread;
- public Dictionary> Scripts = new Dictionary>();
-
- private RegionInfoStructure CurrentRegion;
- public void Initialize(RegionInfoStructure currentRegion)
- {
- CurrentRegion = currentRegion;
- }
-
- public ScriptManager()
- {
- ScriptLoadUnloadThread = new Thread(LoadUnloadLoop);
- ScriptLoadUnloadThread.Name = "ScriptLoadUnloadThread";
- ScriptLoadUnloadThread.IsBackground = true;
- ScriptLoadUnloadThread.Start();
- }
- public void Close() { }
-
- private void LoadUnloadLoop ()
- {
- int _NoWorkSleepMsInc = 0;
- while (true)
- {
- if (DoScriptLoadUnload())
- {
- // We found work, reset counter
- _NoWorkSleepMsInc = NoWorkSleepMs;
- } else
- {
- // We didn't find work
- // Sleep
- Thread.Sleep(NoWorkSleepMs + NoWorkSleepMsInc);
- // Increase sleep delay
- _NoWorkSleepMsInc += NoWorkSleepMsInc;
- // Make sure we don't exceed max
- if (_NoWorkSleepMsInc > NoWorkSleepMsIncMax)
- _NoWorkSleepMsInc = NoWorkSleepMsIncMax;
- }
- }
- }
-
- #region Add/Remove/Find script functions for our Script memory structure
- private void MemAddScript(ScriptStructure script)
- {
- lock (scriptLock)
- {
- // Create object if it doesn't exist
- if (!Scripts.ContainsKey(script.LocalID))
- Scripts.Add(script.LocalID, new Dictionary());
-
- // Delete script if it exists
- Dictionary Obj;
- if (Scripts.TryGetValue(script.LocalID, out Obj))
- if (Obj.ContainsKey(script.ItemID) == true)
- Obj.Remove(script.ItemID);
-
- // Add to object
- Obj.Add(script.ItemID, script);
- }
- }
- private void MemRemoveScript(uint LocalID, UUID ItemID)
- {
- // TODO: Also clean up command queue and async commands for object
- lock (scriptLock)
- {
- // Create object if it doesn't exist
- if (!Scripts.ContainsKey(LocalID))
- return;
-
- // Delete script if it exists
- Dictionary Obj;
- if (Scripts.TryGetValue(LocalID, out Obj))
- if (Obj.ContainsKey(ItemID) == true)
- Obj.Remove(ItemID);
-
- // Empty?
- if (Obj.Count == 0)
- Scripts.Remove(LocalID);
-
- }
- }
- public bool TryGetScript(uint localID, UUID itemID, ref ScriptStructure script)
- {
- lock (scriptLock)
- {
-
- if (Scripts.ContainsKey(localID) == false)
- return false;
-
- Dictionary Obj;
- if (Scripts.TryGetValue(localID, out Obj))
- if (Obj.ContainsKey(itemID) == false)
- return false;
-
- // Get script
- return Obj.TryGetValue(itemID, out script);
- }
- }
- public ScriptStructure GetScript(uint localID, UUID itemID)
- {
- lock (scriptLock)
- {
-
- if (Scripts.ContainsKey(localID) == false)
- throw new Exception("No script with LocalID " + localID + " was found.");
-
- Dictionary Obj;
- if (Scripts.TryGetValue(localID, out Obj))
- if (Obj.ContainsKey(itemID) == false)
- throw new Exception("No script with ItemID " + itemID + " was found.");
-
- // Get script
- return Obj[itemID];
- }
- }
- public bool TryGetScripts(uint localID, ref Dictionary returnList)
- {
- Dictionary getList = GetScripts(localID);
- if (getList != null)
- {
- returnList = getList;
- return true;
- }
- return false;
- }
- public Dictionary GetScripts(uint localID)
- {
- lock (scriptLock)
- {
-
- if (Scripts.ContainsKey(localID) == false)
- return null;
- return Scripts[localID];
- }
- }
- #endregion
-
- public void ExecuteCommand(EventParams p)
- {
- ScriptStructure ss = new ScriptStructure();
- if (TryGetScript(p.LocalID, p.ItemID, ref ss))
- ExecuteCommand(ref ss, p);
- }
-
- public void ExecuteCommand(ref ScriptStructure scriptContainer, EventParams p)
- {
- m_log.DebugFormat("[{0}] ######################################################", Name);
- m_log.DebugFormat("[{0}] Command execution ItemID {1}: \"{2}\".", Name, scriptContainer.ItemID, p.EventName);
- scriptContainer.ExecuteEvent(p);
- m_log.DebugFormat("[{0}] ######################################################", Name);
- }
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs
deleted file mode 100644
index dd72dbf..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs
+++ /dev/null
@@ -1,287 +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.Globalization;
-using System.Reflection;
-using System.Text;
-using System.Threading;
-using log4net;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Region.ScriptEngine.Interfaces;
-using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
-{
- public partial class ScriptManager
- {
- private Queue LUQueue = new Queue();
- private int LoadUnloadMaxQueueSize = 500;
- private Object scriptLock = new Object();
- //private Dictionary detparms = new Dictionary();
-
- // Load/Unload structure
-
-
- public void AddScript(ScriptStructure script)
- {
- lock (LUQueue)
- {
- if ((LUQueue.Count >= LoadUnloadMaxQueueSize))
- {
- m_log.ErrorFormat("[{0}] ERROR: Load queue count is at {1} of max {2}. Ignoring load request for script LocalID: {3}, ItemID: {4}.",
- Name, LUQueue.Count, LoadUnloadMaxQueueSize, script.LocalID, script.ItemID);
- return;
- }
-
- LoadUnloadStructure ls = new LoadUnloadStructure();
- ls.Script = script;
- ls.Action = LoadUnloadStructure.LUType.Load;
- LUQueue.Enqueue(ls);
- }
-
- }
- public void RemoveScript(uint localID, UUID itemID)
- {
- LoadUnloadStructure ls = new LoadUnloadStructure();
-
- // See if we can find script
- if (!TryGetScript(localID, itemID, ref ls.Script))
- {
- // Set manually
- ls.Script.LocalID = localID;
- ls.Script.ItemID = itemID;
- }
- ls.Script.StartParam = 0;
-
- ls.Action = LoadUnloadStructure.LUType.Unload;
- ls.PostOnRez = false;
-
- lock (LUQueue)
- {
- LUQueue.Enqueue(ls);
- }
- }
-
- internal bool DoScriptLoadUnload()
- {
- bool ret = false;
- // if (!m_started)
- // return;
-
- lock (LUQueue)
- {
- if (LUQueue.Count > 0)
- {
- LoadUnloadStructure item = LUQueue.Dequeue();
- ret = true;
-
- if (item.Action == LoadUnloadStructure.LUType.Unload)
- {
- _StopScript(item.Script.LocalID, item.Script.ItemID);
- RemoveScript(item.Script.LocalID, item.Script.ItemID);
- }
- else if (item.Action == LoadUnloadStructure.LUType.Load)
- {
- m_log.DebugFormat("[{0}] Loading script", Name);
- _StartScript(item);
- }
- }
- }
- return ret;
- }
-
- //public void _StartScript(uint localID, UUID itemID, string Script, int startParam, bool postOnRez)
- private void _StartScript(LoadUnloadStructure ScriptObject)
- {
- m_log.DebugFormat(
- "[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}",
- Name, ScriptObject.Script.LocalID, ScriptObject.Script.ItemID);
-
- // We will initialize and start the script.
- // It will be up to the script itself to hook up the correct events.
-
- SceneObjectPart m_host = ScriptObject.Script.RegionInfo.Scene.GetSceneObjectPart(ScriptObject.Script.LocalID);
-
- if (null == m_host)
- {
- m_log.ErrorFormat(
- "[{0}]: Could not find scene object part corresponding " +
- "to localID {1} to start script",
- Name, ScriptObject.Script.LocalID);
-
- return;
- }
-
- //UUID assetID = UUID.Zero;
- TaskInventoryItem taskInventoryItem = new TaskInventoryItem();
- //if (m_host.TaskInventory.TryGetValue(ScriptObject.Script.ItemID, out taskInventoryItem))
- // assetID = taskInventoryItem.AssetID;
-
- ScenePresence presence =
- ScriptObject.Script.RegionInfo.Scene.GetScenePresence(taskInventoryItem.OwnerID);
-
- CultureInfo USCulture = new CultureInfo("en-US");
- Thread.CurrentThread.CurrentCulture = USCulture;
-
- try
- {
- //
- // Compile script to an assembly
- //
- //TODO: DEBUG
- BaseClassFactory.MakeBaseClass(ScriptObject.Script);
-
- m_log.DebugFormat("[{0}] Compiling script {1}", Name, ScriptObject.Script.Name);
-
- string fileName = "";
- try
- {
- IScriptCompiler compiler =
- ScriptObject.Script.RegionInfo.FindCompiler(ScriptObject.Script.ScriptMetaData);
- //RegionInfoStructure currentRegionInfo = ScriptObject.Script.RegionInfo;
- fileName = compiler.Compile(ScriptObject.Script.ScriptMetaData,
- ref ScriptObject.Script.Source);
- ScriptObject.Script.AssemblyFileName = fileName;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[{0}] Internal error while compiling \"{1}\": {2}", Name, ScriptObject.Script.Name, e.ToString());
- }
- m_log.DebugFormat("[{0}] Compiled \"{1}\" to assembly: \"{2}\".", Name, ScriptObject.Script.Name, fileName);
-
- // Add it to our script memstruct
- MemAddScript(ScriptObject.Script);
-
- ScriptAssemblies.IScript CompiledScript;
- CompiledScript = CurrentRegion.ScriptLoader.LoadScript(ScriptObject.Script);
- ScriptObject.Script.State = "default";
- ScriptObject.Script.ScriptObject = CompiledScript;
- ScriptObject.Script.Disabled = false;
- ScriptObject.Script.Running = true;
- //id.LineMap = LSLCompiler.LineMap();
- //id.Script = CompiledScript;
- //id.Source = item.Script.Script;
- //item.StartParam = startParam;
-
-
-
- // TODO: Fire the first start-event
- //int eventFlags =
- // m_scriptEngine.m_ScriptManager.GetStateEventFlags(
- // localID, itemID);
-
- //m_host.SetScriptEvents(itemID, eventFlags);
- ScriptObject.Script.RegionInfo.Executors_Execute(ScriptObject.Script,
- new EventParams(ScriptObject.Script.LocalID, ScriptObject.Script.ItemID, "state_entry", new object[] { }, new Region.ScriptEngine.Shared.DetectParams[0])
- );
-
- if (ScriptObject.PostOnRez)
- {
- ScriptObject.Script.RegionInfo.Executors_Execute(ScriptObject.Script,
- new EventParams(ScriptObject.Script.LocalID, "on_rez", new object[]
- {new Region.ScriptEngine.Shared.LSL_Types.LSLInteger(ScriptObject.StartParam)
- }, new Region.ScriptEngine.Shared.DetectParams[0]));
- }
- }
- catch (Exception e) // LEGIT: User Scripting
- {
- if (presence != null && (!ScriptObject.PostOnRez))
- presence.ControllingClient.SendAgentAlertMessage(
- "Script saved with errors, check debug window!",
- false);
- try
- {
- // DISPLAY ERROR INWORLD
- string text = "Error compiling script:\n" +
- e.Message.ToString();
- if (text.Length > 1100)
- text = text.Substring(0, 1099);
-
- ScriptObject.Script.RegionInfo.Scene.SimChat(Utils.StringToBytes(text),
- ChatTypeEnum.DebugChannel, 2147483647,
- m_host.AbsolutePosition, m_host.Name, m_host.UUID,
- false);
- }
- catch (Exception e2) // LEGIT: User Scripting
- {
- m_log.Error("[" +
- Name +
- "]: Error displaying error in-world: " +
- e2.ToString());
- m_log.Error("[" +
- Name + "]: " +
- "Errormessage: Error compiling script:\r\n" +
- e2.Message.ToString());
- }
- }
- }
-
-
-
- public void _StopScript(uint localID, UUID itemID)
- {
- ScriptStructure ss = new ScriptStructure();
- if (!TryGetScript(localID, itemID, ref ss))
- return;
-
- m_log.DebugFormat("[{0}] Unloading script", Name);
-
- // Stop long command on script
- //AsyncCommandManager.RemoveScript(ss);
-
- try
- {
- // Get AppDomain
- // Tell script not to accept new requests
- ss.Running = false;
- ss.Disabled = true;
- //AppDomain ad = ss.AppDomain;
-
- // Remove from internal structure
- MemRemoveScript(localID, itemID);
-
- // TODO: Tell AppDomain that we have stopped script
-
- }
- catch (Exception e) // LEGIT: User Scripting
- {
- m_log.Error("[" +
- Name +
- "]: Exception stopping script localID: " +
- localID + " LLUID: " + itemID.ToString() +
- ": " + e.ToString());
- }
- }
-
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
deleted file mode 100644
index 3b8a0ae..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
+++ /dev/null
@@ -1,196 +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 System.Text;
-using System.Text.RegularExpressions;
-using log4net;
-using Nini.Config;
-using OpenMetaverse;
-using OpenSim.ApplicationPlugins.ScriptEngine;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.ScriptEngine.Components.DotNetEngine.Events;
-using OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler;
-using OpenSim.ScriptEngine.Shared;
-using ComponentFactory = OpenSim.ApplicationPlugins.ScriptEngine.ComponentFactory;
-
-namespace OpenSim.ScriptEngine.Engines.DotNetEngine
-{
- // This is a sample engine
- public partial class DotNetEngine : IScriptEngine
- {
-
- //private string[] _ComponentNames = new string[] {
- // "Commands_LSL",
- // "Commands_OSSL",
- // "Compiler_CS",
- // "Compiler_JS",
- // "Compiler_LSL",
- // "Compiler_VB",
- // "LSLEventProvider",
- // "Scheduler"
- // };
- internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public string Name { get { return "SECS.DotNetEngine"; } }
- //public bool IsSharedModule { get { return true; } }
- internal RegionInfoStructure RegionInfo;
-
- private string[] commandNames = new string[]
- {
- "Commands_LSL"
- };
-
- private string[] compilerNames = new string[]
- {
- "Compiler_CS",
- "Compiler_JS",
- "Compiler_LSL",
- "Compiler_YP",
- "Compiler_VB"
- };
- private string[] schedulerNames = new string[]
- {
- "Scheduler"
- };
-
- //internal IScriptLoader m_ScriptLoader;
- internal LSLEventProvider m_LSLEventProvider;
- //internal IScriptExecutor m_Executor;
- //internal Dictionary Compilers = new Dictionary();
- internal Dictionary Schedulers = new Dictionary();
- public static Dictionary Compilers = new Dictionary();
-// private static bool haveInitialized = false;
-
- public DotNetEngine()
- {
- RegionInfo = new RegionInfoStructure();
- RegionInfo.Compilers = Compilers;
- RegionInfo.Schedulers = Schedulers;
- RegionInfo.Executors = new Dictionary();
- RegionInfo.CommandProviders = new Dictionary();
- RegionInfo.EventProviders = new Dictionary();
- }
-
- public void Initialise(Scene scene, IConfigSource source)
- {
- RegionInfo.Scene = scene;
- RegionInfo.ConfigSource = source;
-
- m_log.DebugFormat("[{0}] Initializing components", Name);
- InitializeComponents();
- }
-
- public void PostInitialise() { }
-
- ///
- /// Called on region close
- ///
- public void Close()
- {
- ComponentClose();
- }
- #region Initialize the Script Engine Components we need
- public void InitializeComponents()
- {
- string cname = "";
- m_log.DebugFormat("[{0}] Component initialization", Name);
- // Initialize an instance of all module we want
- try
- {
- cname = "ScriptManager";
- m_log.DebugFormat("[{0}] Executor: {1}", Name, cname);
- RegionInfo.Executors.Add(cname,
- ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptExecutor);
-
- cname = "ScriptLoader";
- m_log.DebugFormat("[{0}] ScriptLoader: {1}", Name, cname);
- RegionInfo.ScriptLoader =
- ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptExecutor as ScriptLoader;
-
- // CommandProviders
- foreach (string cn in commandNames)
- {
- cname = cn;
- m_log.DebugFormat("[{0}] CommandProvider: {1}", Name, cname);
- RegionInfo.CommandProviders.Add(cname,
- ComponentFactory.GetComponentInstance(RegionInfo, cname) as
- IScriptCommandProvider);
- }
-
- // Compilers
- foreach (string cn in compilerNames)
- {
- cname = cn;
- m_log.DebugFormat("[{0}] Compiler: {1}", Name, cname);
- RegionInfo.Compilers.Add(cname,
- ComponentFactory.GetComponentInstance(RegionInfo, cname) as
- IScriptCompiler);
- }
-
- // Schedulers
- foreach (string cn in schedulerNames)
- {
- cname = cn;
- m_log.DebugFormat("[{0}] Scheduler: {1}", Name, cname);
- RegionInfo.Schedulers.Add(cname,
- ComponentFactory.GetComponentInstance(RegionInfo, cname) as
- IScriptScheduler);
- }
-
- // Event provider
- cname = "LSLEventProvider";
- m_log.DebugFormat("[{0}] EventProvider: {1}", Name, cname);
- IScriptEventProvider sep = ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptEventProvider;
- RegionInfo.EventProviders.Add(cname, sep);
- m_LSLEventProvider = sep as LSLEventProvider;
-
- // Hook up events
- m_LSLEventProvider.RezScript += Events_RezScript;
- m_LSLEventProvider.RemoveScript += Events_RemoveScript;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[{0}] Exception while loading \"{1}\": {2}", Name, cname, e.ToString());
- }
- }
-
- private void ComponentClose()
- {
- // Close schedulers
- foreach (IScriptScheduler scheduler in RegionInfo.Schedulers.Values)
- {
- scheduler.Close();
- }
- }
-
- #endregion
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
deleted file mode 100644
index a113c1e..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
+++ /dev/null
@@ -1,95 +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.Text;
-using OpenMetaverse;
-using OpenSim.ScriptEngine.Components.DotNetEngine.Events;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Engines.DotNetEngine
-{
- public partial class DotNetEngine
- {
-
- //internal Dictionary ScriptMapping = new Dictionary();
-
-
- //
- // HANDLE EVENTS FROM SCRIPTS
- // We will handle script add, change and remove events outside of command pipeline
- //
- #region Script Add/Change/Remove
- void Events_RezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
- {
- // ###
- // # New script created
- // ###
- m_log.DebugFormat(
- "[{0}] NEW SCRIPT: localID: {1}, itemID: {2}, startParam: {3}, postOnRez: {4}, engine: {5}",
- Name, localID, itemID, startParam, postOnRez, engine);
-
- // Make a script object
- ScriptStructure scriptObject = new ScriptStructure();
- scriptObject.RegionInfo = RegionInfo;
- scriptObject.LocalID = localID;
- scriptObject.ItemID = itemID;
- scriptObject.Source = script;
-
- //
- // Get MetaData from script header
- //
- ScriptMetaData scriptMetaData = ScriptMetaData.Extract(ref script);
- scriptObject.ScriptMetaData = scriptMetaData;
- foreach (string key in scriptObject.ScriptMetaData.Keys)
- {
- m_log.DebugFormat("[{0}] Script metadata: Key: \"{1}\", Value: \"{2}\".", Name, key, scriptObject.ScriptMetaData[key]);
- }
-
- //
- // Load this assembly
- //
- // TODO: Use Executor to send a command instead?
- m_log.DebugFormat("[{0}] Adding script to scheduler", Name);
- RegionInfo.FindScheduler(scriptObject.ScriptMetaData).AddScript(scriptObject);
- // Add to our internal mapping
- //ScriptMapping.Add(itemID, Schedulers[scheduler]);
- }
-
- private void Events_RemoveScript(uint localID, UUID itemID)
- {
- // Tell all schedulers to remove this item
- foreach (IScriptScheduler scheduler in RegionInfo.Schedulers.Values)
- {
- scheduler.Removecript(localID, itemID);
- }
- }
- #endregion
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs
deleted file mode 100644
index bca9c2c..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.ScriptEngine.Engines.DotNetEngine")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.ScriptEngine.Engines.DotNetEngine")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1d1c68a7-026f-4556-a060-4af69f488d2a")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 4f1799e..927eb7a 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -218,7 +218,6 @@
; ## SCRIPT ENGINE
; ##
- ;DefaultScriptEngine = "ScriptEngine.DotNetEngine"
DefaultScriptEngine = "XEngine"
; ##
@@ -826,137 +825,12 @@
; Density of tree population
tree_density = 1000.0
+
[VectorRender]
; the font to use for rendering text (default: Arial)
; font_name = "Arial"
-[ScriptEngine.DotNetEngine]
- Enabled = true
-
- ScriptDelayFactor = 1.0
- ScriptDistanceLimitFactor = 1.0
-
- ; Maximum length of notecard line read
- ; Increasing this to large values potentially opens
- ; up the system to malicious scripters
- ; NotecardLineReadCharsMax = 255
-
- ;
- ; These settings are specific to DotNetEngine script engine
- ; Other script engines based on OpenSim.Region.ScriptEngine.Common.dll will have almost identical settings, but in another section of this config file.
- ;
-
- ; When a script receives an event the event is queued.
- ; Any free thread will start executing this event. One script can only have one event executed simultaneously.
- ; If you have only one thread, and one script has a loop or does a lot of work, then no other scripts can run at the same time.
- ; Same if you have 10 threads, then only 10 scripts can be run simultaneously.
- ; But because most scripts exit after their task, the threads are free to go on to the next script.
-
- ; Refresh ScriptEngine config options (these settings) every xx seconds
- ; 0 = Do not refresh
- ; Set it to number of seconds between refresh, for example 30.
- ; Will allow you to change ScriptEngine settings while server is running just by using "CONFIG SET" on console
- ; For example to increase or decrease number of threads: CONFIG SET NumberOfScriptThreads 10
- ; NOTE! Disabled for now. Feature does not work.
- RefreshConfig=0
-
- ; Number of threads to use for script event execution
- ; Threads are shared across all regions
- NumberOfScriptThreads=2
-
- ; Script event execution thread priority inside application.
- ; Valid values: Lowest, BelowNormal, Normal, AboveNormal, Highest
- ScriptThreadPriority=BelowNormal
-
- ; How long MAX should a script event be allowed to run (per event execution)?
- ; Do not set this too low (like 50ms) as there are some time wasted in simply executing a function
- ; There is also a small speed penalty for every kill that is made
- MaxEventExecutionTimeMs=5000
-
- ; Should we enable the max script event execution thread to look for scripts that exceed their timeslice?
- EnforceMaxEventExecutionTime=true
-
- ; Should we stop the script completely when time exceeds?
- ; This is useful if you have a high and want to deactivate scripts that go wrong
- ; Note that for example physics engine can slow down the system and make scripts spend more time
- DeactivateScriptOnTimeout=false
-
- ; If no scripts have executed in this pass how long should we sleep before checking again
- ; Impact:
- ; Too low and you will waste lots of CPU
- ; Too high and people touching object or similar will have to wait up to this amount of time before script responding
- SleepTimeIfNoScriptExecutionMs=50
-
- ; AppDomains are used for two things:
- ; * Security: Scripts inside AppDomains are limited in permissions.
- ; * Script unloading: When a script is deactivated it can not be unloaded. Only whole AppDomains can be unloaded.
- ; AppDomains are therefore only unloaded once ALL active scripts inside it has been deactivated (removed from prims).
- ; Each AppDomain has some memory overhead. But leaving dead scripts in memory also has memory overhead.
- ScriptsPerAppDomain=1
-
- ; MaintenanceLoop
- ; How often to run maintenance loop
- ; Maintenance loop is doing: script compile/load, script unload, reload config, adjust running config and enforce max execution time
- MaintenanceLoopms=50
-
- ; How many maintenanceloops between each of these.
- ; (if 2 then function will be executed every MaintenanceLoopms*2 ms)
- ; Script loading/unloading
-
- ; How long load/unload thread should sleep if there is nothing to do
- ; Higher value makes it respond slower when scripts are added/removed from prims
- ; But once active it will process all in queue before sleeping again
- MaintenanceLoopTicks_ScriptLoadUnload=1
-
- ; Other tasks
- ; check if we need to reload config, adjust running config and enforce max execution time
- MaintenanceLoopTicks_Other=10
-
- ; Allow the use of os* functions (some are dangerous)
- ; Default is false
- AllowOSFunctions = false
-
- ; Threat level to allow if os functions are enabled
- ; One of None, VeryLow, Low, Moderate, High, VeryHigh, Severe
- ; Default is VeryLow
- OSFunctionThreatLevel = VeryLow
-
- ; Maximum number of items in load/unload queue before we start rejecting loads
- ; Note that we will only be rejecting load. Unloads will still be able to queue.
- LoadUnloadMaxQueueSize=100
-
- ; Maximum number of (LSL) events that can be queued before new events are ignored.
- EventExecutionMaxQueueSize=300
-
- ; Async LL command sleep
- ; If no async LL commands are waiting, how long should thread sleep before checking again
- ; Async LL commands are LSL-commands that causes an event to be fired back with result
- ; currently unused
- ; AsyncLLCommandLoopms=50
-
- ; When script is converted from LSL to C#, or just plain compiled, a copy of the script source will be put in the ScriptEngine folder
- WriteScriptSourceToDebugFile=false
-
- ; Specify default script compiler
- ; If you do not specify //cs, //vb, //js or //lsl tag as the first characters of your script then the default compiler will be chosen
- ; Valid languages are: lsl, cs, js and vb
- DefaultCompileLanguage=lsl
-
- ; Specify what compilers are allowed to be used
- ; Note vb only works on Windows for now (Mono lacks VB compile support)
- ; Valid languages are: lsl, cs, js and vb
- ; AllowedCompilers=lsl,cs,js,vb. *warning*, non lsl languages have access to static methods such as System.IO.File. Enable at your own risk.
- AllowedCompilers=lsl
-
- ; Compile scripts with debugging
- ; Probably a thousand times slower, but gives you a line number when something goes wrong.
- CompileWithDebugInformation=true
-
- ; Remove old scripts on next startup
- ; currently unused
- ;CleanUpOldScriptsOnStartup=true
-
[LL-Functions]
; Set the following to true to allow administrator owned scripts to execute console commands
--
cgit v1.1
From 27ee49f1980ddaa5edb97ea68b0c1b0f310f45c5 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 13:44:23 -0700
Subject: Updating prebuild.xml to reflect the removal of DotNetEngine
---
prebuild.xml | 285 -----------------------------------------------------------
1 file changed, 285 deletions(-)
diff --git a/prebuild.xml b/prebuild.xml
index 12e33e9..2d61b73 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -2705,46 +2705,6 @@
-
-
-
- ../../../../bin/
-
-
-
-
- ../../../../bin/
-
-
-
- ../../../../bin/
- ../../../../bin/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2846,251 +2806,6 @@
-
-
-
- ../../../../../bin/
-
-
-
-
- ../../../../../bin/
-
-
-
- ../../../../../bin/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ../../../../../bin/
-
-
-
-
- ../../../../../bin/
-
-
-
- ../../../../../bin/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ../../../../../bin/
-
-
-
-
- ../../../../../bin/
-
-
-
- ../../../../../bin/
- ../../../../../bin/ScriptEngines/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ../../../../../bin/
-
-
-
-
- ../../../../../bin/
-
-
-
- ../../../../../bin/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ../../../../../bin/
-
-
-
-
- ../../../../../bin/
-
-
-
- ../../../../../bin/
- ../../../../../bin/ScriptEngines/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ../../../../bin/
-
-
-
-
- ../../../../bin/
-
-
-
- ../../../../bin/
- ../../../../bin/ScriptEngines/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--
cgit v1.1
From d3cb1c6b33991f4ab4c2472d96c283834bfa43d9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 27 Oct 2009 20:57:17 +0000
Subject: Bump required Mono version in README up to 2.4.2
---
README.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.txt b/README.txt
index 83ac7d6..3a87fe2 100644
--- a/README.txt
+++ b/README.txt
@@ -25,7 +25,7 @@ See configuring OpenSim
== Installation on Linux ==
Prereqs:
- * Mono >= 2.0.1 (>= 2.4.2 is better)
+ * Mono >= 2.4.2
* Nant >= 0.86beta
* sqlite3 or mysql 5.x (you'll need a back end database)
--
cgit v1.1
From f89c2cac0fd3e9e1ae66552bbc2c3cc4bb17aaed Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 14:16:01 -0700
Subject: Experimental test to rate limit the incoming packet handler and try
to always leave a worker thread available for other tasks
---
OpenSim/Framework/Util.cs | 21 +++++++++++++++++++++
OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 8 ++++++++
2 files changed, 29 insertions(+)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 10f38ab..87ba5a8 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1330,6 +1330,27 @@ namespace OpenSim.Framework
m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2);
}
+ public static int FireAndForgetCount()
+ {
+ const int MAX_SYSTEM_THREADS = 200;
+
+ switch (FireAndForgetMethod)
+ {
+ case FireAndForgetMethod.UnsafeQueueUserWorkItem:
+ case FireAndForgetMethod.QueueUserWorkItem:
+ case FireAndForgetMethod.BeginInvoke:
+ int workerThreads, iocpThreads;
+ ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
+ return workerThreads;
+ case FireAndForgetMethod.SmartThreadPool:
+ return m_ThreadPool.MaxThreads - m_ThreadPool.InUseThreads;
+ case FireAndForgetMethod.Thread:
+ return MAX_SYSTEM_THREADS - System.Diagnostics.Process.GetCurrentProcess().Threads.Count;
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
{
switch (FireAndForgetMethod)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index e3233da..74d3262 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -801,6 +801,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
IncomingPacket incomingPacket = null;
+ // HACK: This is a test to try and rate limit packet handling on Mono.
+ // If it works, a more elegant solution can be devised
+ if (Util.FireAndForgetCount() < 2)
+ {
+ //m_log.Debug("[LLUDPSERVER]: Incoming packet handler is sleeping");
+ Thread.Sleep(30);
+ }
+
if (packetInbox.Dequeue(100, ref incomingPacket))
Util.FireAndForget(ProcessInPacket, incomingPacket);
}
--
cgit v1.1
From 92f752198399668204d02c299a1d4b0d546e3852 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 27 Oct 2009 20:25:54 +0000
Subject: Remove the rest of SECS. It was never used, except by an experimental
version of the DotNetEngine that was never runnable.
---
.../ScriptEngine/Shared.Script/ICommandProvider.cs | 39 ------
OpenSim/ScriptEngine/Shared.Script/IScript.cs | 38 ------
.../Shared.Script/Properties/AssemblyInfo.cs | 63 ----------
OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs | 72 -----------
OpenSim/ScriptEngine/Shared/EventParams.cs | 82 ------------
.../ScriptEngine/Shared/IScriptCommandProvider.cs | 37 ------
OpenSim/ScriptEngine/Shared/IScriptCompiler.cs | 40 ------
OpenSim/ScriptEngine/Shared/IScriptEngine.cs | 49 --------
.../ScriptEngine/Shared/IScriptEngineComponent.cs | 36 ------
.../Shared/IScriptEngineRegionComponent.cs | 34 -----
.../ScriptEngine/Shared/IScriptEventProvider.cs | 38 ------
OpenSim/ScriptEngine/Shared/IScriptExecutor.cs | 39 ------
OpenSim/ScriptEngine/Shared/IScriptLoader.cs | 36 ------
OpenSim/ScriptEngine/Shared/IScriptScheduler.cs | 41 ------
.../ScriptEngine/Shared/Properties/AssemblyInfo.cs | 63 ----------
OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs | 120 ------------------
OpenSim/ScriptEngine/Shared/ScriptMetaData.cs | 95 --------------
OpenSim/ScriptEngine/Shared/ScriptStructure.cs | 137 ---------------------
18 files changed, 1059 deletions(-)
delete mode 100644 OpenSim/ScriptEngine/Shared.Script/ICommandProvider.cs
delete mode 100644 OpenSim/ScriptEngine/Shared.Script/IScript.cs
delete mode 100644 OpenSim/ScriptEngine/Shared.Script/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/EventParams.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptCommandProvider.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptCompiler.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptEngine.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptEngineComponent.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptEngineRegionComponent.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptEventProvider.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptExecutor.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptLoader.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/IScriptScheduler.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/ScriptMetaData.cs
delete mode 100644 OpenSim/ScriptEngine/Shared/ScriptStructure.cs
diff --git a/OpenSim/ScriptEngine/Shared.Script/ICommandProvider.cs b/OpenSim/ScriptEngine/Shared.Script/ICommandProvider.cs
deleted file mode 100644
index 6a02a4a..0000000
--- a/OpenSim/ScriptEngine/Shared.Script/ICommandProvider.cs
+++ /dev/null
@@ -1,39 +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.Text;
-
-namespace ScriptAssemblies
-{
- public interface ICommandProvider
- {
- void ExecuteCommand(string functionName, params object[] args);
- string Name { get; }
- }
-}
diff --git a/OpenSim/ScriptEngine/Shared.Script/IScript.cs b/OpenSim/ScriptEngine/Shared.Script/IScript.cs
deleted file mode 100644
index 6afb4d5..0000000
--- a/OpenSim/ScriptEngine/Shared.Script/IScript.cs
+++ /dev/null
@@ -1,38 +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.Text;
-
-namespace ScriptAssemblies
-{
- public interface IScript
- {
- void ExecuteFunction(string functionName, params object[] args);
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared.Script/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Shared.Script/Properties/AssemblyInfo.cs
deleted file mode 100644
index 090cb44..0000000
--- a/OpenSim/ScriptEngine/Shared.Script/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.ScriptEngine.Shared.Script")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.ScriptEngine.Shared.Script")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs b/OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs
deleted file mode 100644
index ab7835d..0000000
--- a/OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs
+++ /dev/null
@@ -1,72 +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 System.Runtime.Remoting.Lifetime;
-using System.Text;
-
-namespace ScriptAssemblies
-{
- public class ScriptBase : MarshalByRefObject, IScript
- {
-
- #region AppDomain Serialization Keep-Alive
- //
- // Never expire this object
- //
- public override Object InitializeLifetimeService()
- {
- ILease lease = (ILease)base.InitializeLifetimeService();
-
- if (lease.CurrentState == LeaseState.Initial)
- {
- lease.InitialLeaseTime = TimeSpan.Zero;
- }
- return lease;
- }
- #endregion
-
- public delegate void ExecuteFunctionEventDelegate(string functionName, params object[] args);
- public event ExecuteFunctionEventDelegate OnExecuteFunction;
-
- //private List CommandProviders = new List();
-
- public ScriptBase()
- {
- }
-
- public void ExecuteFunction(string functionName, params object[] args)
- {
- // We got a new command, fire event
- if (OnExecuteFunction != null)
- OnExecuteFunction(functionName, args);
-
- }
- }
-}
diff --git a/OpenSim/ScriptEngine/Shared/EventParams.cs b/OpenSim/ScriptEngine/Shared/EventParams.cs
deleted file mode 100644
index 28eaa58..0000000
--- a/OpenSim/ScriptEngine/Shared/EventParams.cs
+++ /dev/null
@@ -1,82 +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.Text;
-using OpenMetaverse;
-using OpenSim.Region.ScriptEngine.Shared;
-using log4net;
-using System.Reflection;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- ///
- /// Holds all the data required to execute a scripting event.
- ///
- public class EventParams
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public string EventName;
- public Object[] Params;
- public Region.ScriptEngine.Shared.DetectParams[] DetectParams;
- public uint LocalID;
- public UUID ItemID;
-
- public EventParams(uint localID, UUID itemID, string eventName, Object[] eventParams, DetectParams[] detectParams)
- {
- LocalID = localID;
- ItemID = itemID;
- EventName = eventName;
- Params = eventParams;
- DetectParams = detectParams;
- }
- public EventParams(uint localID, string eventName, Object[] eventParams, DetectParams[] detectParams)
- {
- LocalID = localID;
- EventName = eventName;
- Params = eventParams;
- DetectParams = detectParams;
- }
- public void test(params object[] args)
- {
- string functionName = "test";
- test2(functionName, args);
- }
- public void test2(string functionName, params object[] args)
- {
- String logMessage = functionName;
- foreach (object arg in args)
- {
- logMessage +=", "+arg;
- }
- m_log.Debug(logMessage);
- }
-
-
- }
-}
diff --git a/OpenSim/ScriptEngine/Shared/IScriptCommandProvider.cs b/OpenSim/ScriptEngine/Shared/IScriptCommandProvider.cs
deleted file mode 100644
index b2498d6..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptCommandProvider.cs
+++ /dev/null
@@ -1,37 +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.Text;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptCommandProvider : ScriptAssemblies.ICommandProvider
- {
- }
-}
diff --git a/OpenSim/ScriptEngine/Shared/IScriptCompiler.cs b/OpenSim/ScriptEngine/Shared/IScriptCompiler.cs
deleted file mode 100644
index 57249fd..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptCompiler.cs
+++ /dev/null
@@ -1,40 +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 System.Text;
-using ScriptAssemblies;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptCompiler : IScriptEngineComponent
- {
- string Compile(ScriptMetaData scriptMetaData, ref string script);
- string PreProcessScript(ref string script);
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/IScriptEngine.cs b/OpenSim/ScriptEngine/Shared/IScriptEngine.cs
deleted file mode 100644
index 3acd1d5..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptEngine.cs
+++ /dev/null
@@ -1,49 +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.Text;
-using Nini.Config;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptEngine
- {
- //string[] ComponentNames { get; }
- //Dictionary Components { get; }
- //void InitializeComponents();
- void Initialise(Scene scene, IConfigSource source);
- void PostInitialise();
- void Close();
- string Name { get; }
- // string Name { get; }
- //void Initialize();
- //void Close();
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/IScriptEngineComponent.cs b/OpenSim/ScriptEngine/Shared/IScriptEngineComponent.cs
deleted file mode 100644
index 0959b53..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptEngineComponent.cs
+++ /dev/null
@@ -1,36 +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.Text;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptEngineComponent
- {
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/IScriptEngineRegionComponent.cs b/OpenSim/ScriptEngine/Shared/IScriptEngineRegionComponent.cs
deleted file mode 100644
index eeb86c1..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptEngineRegionComponent.cs
+++ /dev/null
@@ -1,34 +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.
- */
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptEngineRegionComponent
- {
- void Initialize(RegionInfoStructure currentRegion);
- }
-}
diff --git a/OpenSim/ScriptEngine/Shared/IScriptEventProvider.cs b/OpenSim/ScriptEngine/Shared/IScriptEventProvider.cs
deleted file mode 100644
index b796a4b..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptEventProvider.cs
+++ /dev/null
@@ -1,38 +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.Text;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptEventProvider : IScriptEngineComponent, IScriptEngineRegionComponent
- {
-
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/IScriptExecutor.cs b/OpenSim/ScriptEngine/Shared/IScriptExecutor.cs
deleted file mode 100644
index a48c7e5..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptExecutor.cs
+++ /dev/null
@@ -1,39 +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.Text;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptExecutor : IScriptEngineComponent, IScriptEngineRegionComponent
- {
- void ExecuteCommand(ref ScriptStructure scriptContainer, EventParams p);
- void ExecuteCommand(EventParams p);
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/IScriptLoader.cs b/OpenSim/ScriptEngine/Shared/IScriptLoader.cs
deleted file mode 100644
index 6beea17..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptLoader.cs
+++ /dev/null
@@ -1,36 +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 OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptLoader: IScriptEngineComponent
- {
- ScriptAssemblies.IScript LoadScript(ScriptStructure script);
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/IScriptScheduler.cs b/OpenSim/ScriptEngine/Shared/IScriptScheduler.cs
deleted file mode 100644
index cf1f1ab..0000000
--- a/OpenSim/ScriptEngine/Shared/IScriptScheduler.cs
+++ /dev/null
@@ -1,41 +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.Text;
-using OpenMetaverse;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public interface IScriptScheduler : IScriptEngineComponent
- {
- void AddScript(ScriptStructure script);
- void Removecript(uint id, UUID itemID);
- void Close();
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Shared/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4ce44ed..0000000
--- a/OpenSim/ScriptEngine/Shared/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.ScriptEngine.Shared")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim.ScriptEngine.Shared")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyVersion("0.6.5.*")]
-[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs b/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs
deleted file mode 100644
index 64b33d4..0000000
--- a/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs
+++ /dev/null
@@ -1,120 +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 log4net;
-using Nini.Config;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Region.ScriptEngine.Shared;
-using OpenSim.ScriptEngine.Shared;
-using EventParams = OpenSim.ScriptEngine.Shared.EventParams;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public struct RegionInfoStructure
- {
- public Scene Scene;
- public IConfigSource ConfigSource;
-
- public IScriptLoader ScriptLoader;
- public Dictionary EventProviders;
- public Dictionary Executors;
- public Dictionary Compilers;
- public Dictionary Schedulers;
- public Dictionary CommandProviders;
-
- public void Executors_Execute(EventParams p)
- {
- // Execute a command on all executors
- lock (Executors)
- {
- foreach (IScriptExecutor exec in Executors.Values)
- {
- exec.ExecuteCommand(p);
- }
- }
- }
- public void Executors_Execute(ScriptStructure scriptContainer, EventParams p)
- {
- // Execute a command on all executors
- lock (Executors)
- {
- foreach (IScriptExecutor exec in Executors.Values)
- {
- exec.ExecuteCommand(ref scriptContainer, p);
- }
- }
- }
-
- public IScriptCompiler FindCompiler(ScriptMetaData scriptMetaData)
- {
- string compiler = "Compiler_LSL";
- if (scriptMetaData.ContainsKey("Compiler"))
- compiler = scriptMetaData["Compiler"];
-
- lock (Compilers)
- {
- if (!Compilers.ContainsKey(compiler))
- throw new Exception("Requested script compiler \"" + compiler + "\" does not exist.");
-
- return Compilers[compiler];
- }
- }
-
- public IScriptScheduler FindScheduler(ScriptMetaData scriptMetaData)
- {
- string scheduler = "Scheduler";
- if (scriptMetaData.ContainsKey("Scheduler"))
- scheduler = scriptMetaData["Scheduler"];
-
- lock (Schedulers)
- {
- if (!Schedulers.ContainsKey(scheduler))
- throw new Exception("Requested script scheduler \"" + scheduler + "\" does not exist.");
-
- return Schedulers[scheduler];
- }
- }
-
- //public Assembly[] GetCommandProviderAssemblies()
- //{
- // lock (CommandProviders)
- // {
- // Assembly[] ass = new Assembly[CommandProviders.Count];
- // int i = 0;
- // foreach (string key in CommandProviders.Keys)
- // {
- // ass[i] = CommandProviders[key].GetType().Assembly;
- // i++;
- // }
- // return ass;
- // }
- //}
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/ScriptMetaData.cs b/OpenSim/ScriptEngine/Shared/ScriptMetaData.cs
deleted file mode 100644
index e351632..0000000
--- a/OpenSim/ScriptEngine/Shared/ScriptMetaData.cs
+++ /dev/null
@@ -1,95 +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.ScriptEngine.Shared
-{
- public class ScriptMetaData: Dictionary
- {
- private static readonly char[] LineSeparator = "\r\n".ToCharArray();
- private static readonly char[] Separator = { ':' };
- public static ScriptMetaData Extract(ref string Script)
- {
- ScriptMetaData ret = new ScriptMetaData();
- if (string.IsNullOrEmpty(Script))
- return ret;
-
- // Process it line by line
- string Line = "";
- for (int i = 0; i < Script.Length + 1; i++)
- {
- // Found a line separator?
- if (i < Script.Length
- && Script[i] != LineSeparator[0]
- && Script[i] != LineSeparator[1])
- {
- // No, not end of line. Add to current line
- Line += Script[i];
- }
- else
- {
- // Extract MetaData from this line. Returns False if not found.
- if (!_GetMetaFromLine(ret, Line))
- continue;
- // Empty for next round
- Line = "";
- }
- }
- return ret;
- }
-
- private static bool _GetMetaFromLine(ScriptMetaData ret, string line)
- {
- line = line.Trim();
-
- // Empty line? We may find more later
- if (line == "")
- return true;
-
- // Is this a comment? If not, then return false
- if (!line.StartsWith("//"))
- return false;
-
- // It is a comment
- string[] keyval = line.Split(Separator, 2, StringSplitOptions.None);
- keyval[0] = keyval[0].Substring(2, keyval[0].Length - 2).Trim();
- keyval[1] = keyval[1].Trim();
-
- // Add it
- if (keyval[0] != "")
- if (!ret.ContainsKey(keyval[0]))
- {
- //m_log.DebugFormat("[DotNetEngine] Script metadata: Key: \"{0}\", Value: \"{1}\".", keyval[0], keyval[1]);
- ret.Add(keyval[0], keyval[1]);
- }
-
- return true;
- }
-
- }
-}
\ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Shared/ScriptStructure.cs b/OpenSim/ScriptEngine/Shared/ScriptStructure.cs
deleted file mode 100644
index 1095a8b..0000000
--- a/OpenSim/ScriptEngine/Shared/ScriptStructure.cs
+++ /dev/null
@@ -1,137 +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 System.Text;
-using log4net;
-using OpenMetaverse;
-using OpenSim.Region.ScriptEngine.Interfaces;
-using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
-using OpenSim.ScriptEngine.Shared;
-
-namespace OpenSim.ScriptEngine.Shared
-{
- public struct ScriptStructure
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public RegionInfoStructure RegionInfo;
- public ScriptMetaData ScriptMetaData;
-
- public ScriptAssemblies.IScript ScriptObject;
- public string State;
- public bool Running;
- public bool Disabled;
- public string Source;
- public int StartParam;
- public AppDomain AppDomain;
- public Dictionary Apis;
- public Dictionary, KeyValuePair> LineMap;
- public uint LocalID;
- public UUID ItemID;
- public string AssemblyFileName;
-
- public string ScriptID { get { return LocalID.ToString() + "." + ItemID.ToString(); } }
- public string Name { get { return "Script:" + ScriptID; } }
- private bool Initialized;
- private Dictionary InternalFunctions;
- public string AssemblyName;
-
- public void ExecuteEvent(EventParams p)
- {
- ExecuteMethod(p, true);
- }
-
- public void ExecuteMethod(EventParams p)
- {
- ExecuteMethod(p, false);
- }
- private void ExecuteMethod(EventParams p, bool isEvent)
- {
- // First time initialization?
- if (!Initialized)
- {
- Initialized = true;
- CacheInternalFunctions();
- }
-
- lock (InternalFunctions)
- {
- // Make function name
- string FunctionName;
- if (isEvent)
- FunctionName = State + "_event_" + p.EventName;
- else
- FunctionName = p.EventName;
-
- // Check if this function exist
- if (!InternalFunctions.ContainsKey(FunctionName))
- {
- // TODO: Send message in-world
- m_log.ErrorFormat("[{0}] Script function \"{1}\" was not found.", Name, FunctionName);
- return;
- }
-
- // Execute script function
- try
- {
- InternalFunctions[FunctionName].DynamicInvoke(p.Params);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[{0}] Execute \"{1}\" failed: {2}", Name, FunctionName, e.ToString());
- }
- }
- }
-
- ///
- /// Cache functions into a dictionary with delegates. Should be faster than reflection.
- ///
- private void CacheInternalFunctions()
- {
- Type scriptObjectType = ScriptObject.GetType();
- InternalFunctions = new Dictionary();
-
- MethodInfo[] methods = scriptObjectType.GetMethods();
- lock (InternalFunctions)
- {
- // Read all methods into a dictionary
- foreach (MethodInfo mi in methods)
- {
- // TODO: We don't support overloading
- if (!InternalFunctions.ContainsKey(mi.Name))
- InternalFunctions.Add(mi.Name, Delegate.CreateDelegate(scriptObjectType, ScriptObject, mi));
- else
- m_log.ErrorFormat("[{0}] Error: Script function \"{1}\" is already added. We do not support overloading.",
- Name, mi.Name);
- }
- }
- }
- }
-}
--
cgit v1.1