* Patched fixed merge from trunk
parent
882566a32f
commit
ce1bbc0ae4
|
@ -95,7 +95,6 @@ namespace OpenSim.Framework
|
||||||
tryGetRet = m_clients.TryGetValue(circuitCode, out client);
|
tryGetRet = m_clients.TryGetValue(circuitCode, out client);
|
||||||
if (tryGetRet)
|
if (tryGetRet)
|
||||||
{
|
{
|
||||||
//m_log.Debug("[ClientManager]: Processing IN packet " + packet.Type.ToString());
|
|
||||||
client.InPacket(packet);
|
client.InPacket(packet);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -250,7 +250,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId);
|
#if DEBUG
|
||||||
|
//m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId);
|
||||||
|
#endif
|
||||||
|
|
||||||
NewAssetRequest req = new NewAssetRequest(assetId, callback);
|
NewAssetRequest req = new NewAssetRequest(assetId, callback);
|
||||||
|
|
||||||
|
@ -384,14 +386,17 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
|
//m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// See IAssetReceiver
|
// See IAssetReceiver
|
||||||
public void AssetReceived(AssetBase asset, bool IsTexture)
|
public void AssetReceived(AssetBase asset, bool IsTexture)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ASSET CACHE]: Recieved {0} [{1}]", IsTexture ? "texture" : "asset", asset.FullID);
|
#if DEBUG
|
||||||
|
m_log.DebugFormat("[ASSET CACHE]: Received {0} [{1}]", IsTexture ? "texture" : "asset", asset.FullID);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
|
if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
|
||||||
{
|
{
|
||||||
|
@ -405,7 +410,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
TextureImage image = new TextureImage(asset);
|
TextureImage image = new TextureImage(asset);
|
||||||
if (Textures.ContainsKey(image.FullID))
|
if (Textures.ContainsKey(image.FullID))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ASSET CACHE]: There's already an texture {0} in memory. Skipping.", asset.FullID);
|
#if DEBUG
|
||||||
|
//m_log.DebugFormat("[ASSET CACHE]: There's already an texture {0} in memory. Skipping.", asset.FullID);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -422,7 +429,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
AssetInfo assetInf = new AssetInfo(asset);
|
AssetInfo assetInf = new AssetInfo(asset);
|
||||||
if (Assets.ContainsKey(assetInf.FullID))
|
if (Assets.ContainsKey(assetInf.FullID))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ASSET CACHE]: There's already an asset {0} in memory. Skipping.", asset.FullID);
|
#if DEBUG
|
||||||
|
//m_log.DebugFormat("[ASSET CACHE]: There's already an asset {0} in memory. Skipping.", asset.FullID);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -435,7 +444,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
|
|
||||||
if (RequestedAssets.ContainsKey(assetInf.FullID))
|
if (RequestedAssets.ContainsKey(assetInf.FullID))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ASSET CACHE]: Moving {0} from RequestedAssets to AssetRequests", asset.FullID);
|
#if DEBUG
|
||||||
|
//m_log.DebugFormat("[ASSET CACHE]: Moving {0} from RequestedAssets to AssetRequests", asset.FullID);
|
||||||
|
#endif
|
||||||
|
|
||||||
AssetRequest req = RequestedAssets[assetInf.FullID];
|
AssetRequest req = RequestedAssets[assetInf.FullID];
|
||||||
req.AssetInf = assetInf;
|
req.AssetInf = assetInf;
|
||||||
|
|
|
@ -137,7 +137,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
req.IsTexture = isTexture;
|
req.IsTexture = isTexture;
|
||||||
m_assetRequests.Enqueue(req);
|
m_assetRequests.Enqueue(req);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
m_log.InfoFormat("[ASSET SERVER]: Added {0} to request queue", assetID);
|
m_log.InfoFormat("[ASSET SERVER]: Added {0} to request queue", assetID);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void UpdateAsset(AssetBase asset)
|
public virtual void UpdateAsset(AssetBase asset)
|
||||||
|
|
|
@ -52,7 +52,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
Stream s = null;
|
Stream s = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ASSETCACHE]: Querying for {0}", req.AssetID.ToString());
|
#if DEBUG
|
||||||
|
//m_log.DebugFormat("[GRID ASSET CLIENT]: Querying for {0}", req.AssetID.ToString());
|
||||||
|
#endif
|
||||||
|
|
||||||
RestClient rc = new RestClient(_assetServerUrl);
|
RestClient rc = new RestClient(_assetServerUrl);
|
||||||
rc.AddResourcePath("assets");
|
rc.AddResourcePath("assets");
|
||||||
|
@ -72,9 +74,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[ASSETCACHE]: " + e.Message);
|
m_log.Error("[GRID ASSET CLIENT]: " + e.Message);
|
||||||
m_log.DebugFormat("[ASSETCACHE]: Getting asset {0}", req.AssetID.ToString());
|
m_log.DebugFormat("[GRID ASSET CLIENT]: Getting asset {0}", req.AssetID.ToString());
|
||||||
m_log.Error("[ASSETCACHE]: " + e.StackTrace);
|
m_log.Error("[GRID ASSET CLIENT]: " + e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -95,19 +97,19 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
// XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
// XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||||
// xs.Serialize(s, asset);
|
// xs.Serialize(s, asset);
|
||||||
// RestClient rc = new RestClient(_assetServerUrl);
|
// RestClient rc = new RestClient(_assetServerUrl);
|
||||||
m_log.Info("[ASSET]: Storing asset");
|
m_log.Info("[GRID ASSET CLIENT]: Storing asset");
|
||||||
//rc.AddResourcePath("assets");
|
//rc.AddResourcePath("assets");
|
||||||
|
|
||||||
// rc.RequestMethod = "POST";
|
// rc.RequestMethod = "POST";
|
||||||
// rc.Request(s);
|
// rc.Request(s);
|
||||||
//m_log.InfoFormat("[ASSET]: Stored {0}", rc);
|
//m_log.InfoFormat("[ASSET]: Stored {0}", rc);
|
||||||
m_log.Info("[ASSET]: Sending to " + _assetServerUrl + "/assets/");
|
m_log.Info("[GRID ASSET CLIENT]: Sending to " + _assetServerUrl + "/assets/");
|
||||||
RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset);
|
RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[ASSETS]: " + e.Message);
|
m_log.Error("[GRID ASSET CLIENT]: " + e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Statistics.Interfaces;
|
||||||
|
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Statistics
|
namespace OpenSim.Framework.Statistics
|
||||||
{
|
{
|
||||||
|
@ -42,6 +49,12 @@ namespace OpenSim.Framework.Statistics
|
||||||
public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
|
public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
|
||||||
public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
|
public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retain a dictionary of all packet queues stats reporters
|
||||||
|
/// </summary>
|
||||||
|
private IDictionary<LLUUID, PacketQueueStatsReporter> packetQueueStatsReporters
|
||||||
|
= new Dictionary<LLUUID, PacketQueueStatsReporter>();
|
||||||
|
|
||||||
public void AddAsset(AssetBase asset)
|
public void AddAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
assetsInCache++;
|
assetsInCache++;
|
||||||
|
@ -58,17 +71,87 @@ namespace OpenSim.Framework.Statistics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register as a packet queue stats provider
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid">An agent LLUUID</param>
|
||||||
|
/// <param name="provider"></param>
|
||||||
|
public void RegisterPacketQueueStatsProvider(LLUUID uuid, IPullStatsProvider provider)
|
||||||
|
{
|
||||||
|
lock (packetQueueStatsReporters)
|
||||||
|
{
|
||||||
|
packetQueueStatsReporters[uuid] = new PacketQueueStatsReporter(provider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deregister a packet queue stats provider
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid">An agent LLUUID</param>
|
||||||
|
public void DeregisterPacketQueueStatsProvider(LLUUID uuid)
|
||||||
|
{
|
||||||
|
lock (packetQueueStatsReporters)
|
||||||
|
{
|
||||||
|
packetQueueStatsReporters.Remove(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Report back collected statistical information.
|
/// Report back collected statistical information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string Report()
|
public string Report()
|
||||||
{
|
{
|
||||||
return string.Format(
|
StringBuilder sb = new StringBuilder(Environment.NewLine);
|
||||||
|
sb.Append("ASSET CACHE STATISTICS");
|
||||||
|
sb.Append(Environment.NewLine);
|
||||||
|
sb.Append(
|
||||||
|
string.Format(
|
||||||
@"Asset cache contains {0,6} assets using {1,10:0.000}K
|
@"Asset cache contains {0,6} assets using {1,10:0.000}K
|
||||||
Texture cache contains {2,6} textures using {3,10:0.000}K",
|
Texture cache contains {2,6} textures using {3,10:0.000}K" + Environment.NewLine,
|
||||||
AssetsInCache, AssetCacheMemoryUsage / 1024.0,
|
AssetsInCache, AssetCacheMemoryUsage / 1024.0,
|
||||||
TexturesInCache, TextureCacheMemoryUsage / 1024.0);
|
TexturesInCache, TextureCacheMemoryUsage / 1024.0));
|
||||||
|
|
||||||
|
sb.Append(Environment.NewLine);
|
||||||
|
sb.Append("PACKET QUEUE STATISTICS");
|
||||||
|
sb.Append(Environment.NewLine);
|
||||||
|
sb.Append("Agent UUID ");
|
||||||
|
sb.Append(
|
||||||
|
string.Format(
|
||||||
|
" {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}",
|
||||||
|
"Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset"));
|
||||||
|
sb.Append(Environment.NewLine);
|
||||||
|
|
||||||
|
foreach (LLUUID key in packetQueueStatsReporters.Keys)
|
||||||
|
{
|
||||||
|
sb.Append(string.Format("{0}: ", key));
|
||||||
|
sb.Append(packetQueueStatsReporters[key].Report());
|
||||||
|
sb.Append(Environment.NewLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pull packet queue stats from packet queues and report
|
||||||
|
/// </summary>
|
||||||
|
public class PacketQueueStatsReporter
|
||||||
|
{
|
||||||
|
private IPullStatsProvider m_statsProvider;
|
||||||
|
|
||||||
|
public PacketQueueStatsReporter(IPullStatsProvider provider)
|
||||||
|
{
|
||||||
|
m_statsProvider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Report back collected statistical information.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Report()
|
||||||
|
{
|
||||||
|
return m_statsProvider.GetStats();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,6 +224,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
private UpdateVector handler089 = null; //OnUpdatePrimGroupPosition;
|
private UpdateVector handler089 = null; //OnUpdatePrimGroupPosition;
|
||||||
private UpdatePrimRotation handler090 = null; //OnUpdatePrimGroupRotation;
|
private UpdatePrimRotation handler090 = null; //OnUpdatePrimGroupRotation;
|
||||||
private UpdatePrimGroupRotation handler091 = null; //OnUpdatePrimGroupMouseRotation;
|
private UpdatePrimGroupRotation handler091 = null; //OnUpdatePrimGroupMouseRotation;
|
||||||
|
private PacketStats handler093 = null; // OnPacketStats;
|
||||||
|
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
@ -346,6 +347,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
ack_pack(usePacket);
|
ack_pack(usePacket);
|
||||||
m_log.Debug("[ClientView]: Dealing with " + PausedPackets.Count.ToString() + " packets backlogged.");
|
m_log.Debug("[ClientView]: Dealing with " + PausedPackets.Count.ToString() + " packets backlogged.");
|
||||||
ReadyForPackets = true;
|
ReadyForPackets = true;
|
||||||
|
|
||||||
// stuff the paused packets BACK into the thread queue. :)
|
// stuff the paused packets BACK into the thread queue. :)
|
||||||
while (PausedPackets.Count > 0)
|
while (PausedPackets.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -2065,7 +2067,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
SetDefaultPrimPacketValues(objupdate);
|
SetDefaultPrimPacketValues(objupdate);
|
||||||
objupdate.UpdateFlags = flags;
|
objupdate.UpdateFlags = flags;
|
||||||
SetPrimPacketShapeData(objupdate, primShape);
|
SetPrimPacketShapeData(objupdate, primShape);
|
||||||
|
if ((primShape.PCode == 111) || (primShape.PCode == 255))
|
||||||
|
{
|
||||||
|
objupdate.Data = new byte[1];
|
||||||
|
objupdate.Data[0] = primShape.State;
|
||||||
|
}
|
||||||
return objupdate;
|
return objupdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2655,7 +2661,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
PausedPackets.Enqueue(NewPack);
|
PausedPackets.Enqueue(NewPack);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_packetsReceived++;
|
||||||
// lock (m_packetQueue)
|
// lock (m_packetQueue)
|
||||||
{
|
{
|
||||||
// Handle appended ACKs
|
// Handle appended ACKs
|
||||||
|
@ -2833,9 +2839,10 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
protected void SendPacketStats()
|
protected void SendPacketStats()
|
||||||
{
|
{
|
||||||
if (OnPacketStats != null)
|
handler093 = OnPacketStats;
|
||||||
|
if (handler093 != null)
|
||||||
{
|
{
|
||||||
OnPacketStats(m_packetsReceived - m_lastPacketsReceivedSentToScene, m_packetsSent - m_lastPacketsSentSentToScene, m_unAckedBytes);
|
handler093(m_packetsReceived - m_lastPacketsReceivedSentToScene, m_packetsSent - m_lastPacketsSentSentToScene, m_unAckedBytes);
|
||||||
m_lastPacketsReceivedSentToScene = m_packetsReceived;
|
m_lastPacketsReceivedSentToScene = m_packetsReceived;
|
||||||
m_lastPacketsSentSentToScene = m_packetsSent;
|
m_lastPacketsSentSentToScene = m_packetsSent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,16 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Statistics;
|
||||||
|
using OpenSim.Framework.Statistics.Interfaces;
|
||||||
using Timer=System.Timers.Timer;
|
using Timer=System.Timers.Timer;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
public class PacketQueue
|
public class PacketQueue : IPullStatsProvider
|
||||||
{
|
{
|
||||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -129,23 +132,17 @@ namespace OpenSim.Region.ClientStack
|
||||||
// TIMERS needed for this
|
// TIMERS needed for this
|
||||||
// LastThrottle = DateTime.Now.Ticks;
|
// LastThrottle = DateTime.Now.Ticks;
|
||||||
// ThrottleInterval = (long)(throttletimems/throttleTimeDivisor);
|
// ThrottleInterval = (long)(throttletimems/throttleTimeDivisor);
|
||||||
|
|
||||||
|
if (StatsManager.SimExtraStats != null)
|
||||||
|
{
|
||||||
|
StatsManager.SimExtraStats.RegisterPacketQueueStatsProvider(client.AgentId, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STANDARD QUEUE MANIPULATION INTERFACES */
|
/* STANDARD QUEUE MANIPULATION INTERFACES */
|
||||||
|
|
||||||
|
|
||||||
public void Enqueue(QueItem item)
|
public void Enqueue(QueItem item)
|
||||||
{
|
|
||||||
|
|
||||||
// We could micro lock, but that will tend to actually
|
|
||||||
// probably be worse than just synchronizing on SendQueue
|
|
||||||
|
|
||||||
// enqueue inbound right away. forget throttle checking inbound!
|
|
||||||
if (item.Incoming)
|
|
||||||
{
|
|
||||||
SendQueue.Enqueue(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +178,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public QueItem Dequeue()
|
public QueItem Dequeue()
|
||||||
{
|
{
|
||||||
|
@ -227,6 +223,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
m_enabled = false;
|
m_enabled = false;
|
||||||
throttleTimer.Stop();
|
throttleTimer.Stop();
|
||||||
|
|
||||||
|
if (StatsManager.SimExtraStats != null)
|
||||||
|
{
|
||||||
|
StatsManager.SimExtraStats.DeregisterPacketQueueStatsProvider(Client.AgentId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetCounters()
|
private void ResetCounters()
|
||||||
|
@ -277,9 +278,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0)
|
if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = ResendOutgoingPacketQueue.Dequeue();
|
QueItem qpack = ResendOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
//SendQueue.Enqueue(qpack);
|
|
||||||
// m_log.Debug("[PacketQueue]: ThrottleCheck Sending " + qpack.Incoming.ToString() + " packet " + qpack.Packet.Type.ToString());
|
|
||||||
Client.ProcessOutPacket(qpack.Packet);
|
Client.ProcessOutPacket(qpack.Packet);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
ResendThrottle.Add(qpack.Packet.ToBytes().Length);
|
ResendThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -287,9 +285,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0)
|
if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = LandOutgoingPacketQueue.Dequeue();
|
QueItem qpack = LandOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
//SendQueue.Enqueue(qpack);
|
|
||||||
// m_log.Debug("[PacketQueue]: ThrottleCheck Sending " + qpack.Incoming.ToString() + " packet " + qpack.Packet.Type.ToString());
|
|
||||||
Client.ProcessOutPacket(qpack.Packet);
|
Client.ProcessOutPacket(qpack.Packet);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
LandThrottle.Add(qpack.Packet.ToBytes().Length);
|
LandThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -297,9 +292,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0)
|
if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = WindOutgoingPacketQueue.Dequeue();
|
QueItem qpack = WindOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
// SendQueue.Enqueue(qpack);
|
|
||||||
//m_log.Debug("[PacketQueue]: ThrottleCheck Sending " + qpack.Incoming.ToString() + " packet " + qpack.Packet.Type.ToString());
|
|
||||||
Client.ProcessOutPacket(qpack.Packet);
|
Client.ProcessOutPacket(qpack.Packet);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
WindThrottle.Add(qpack.Packet.ToBytes().Length);
|
WindThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -307,9 +299,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0)
|
if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = CloudOutgoingPacketQueue.Dequeue();
|
QueItem qpack = CloudOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
//SendQueue.Enqueue(qpack);
|
|
||||||
// m_log.Debug("[PacketQueue]: ThrottleCheck Sending " + qpack.Incoming.ToString() + " packet " + qpack.Packet.Type.ToString());
|
|
||||||
Client.ProcessOutPacket(qpack.Packet);
|
Client.ProcessOutPacket(qpack.Packet);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
CloudThrottle.Add(qpack.Packet.ToBytes().Length);
|
CloudThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -317,20 +306,13 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0)
|
if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = TaskOutgoingPacketQueue.Dequeue();
|
QueItem qpack = TaskOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
//SendQueue.Enqueue(qpack);
|
|
||||||
// m_log.Debug("[PacketQueue]: ThrottleCheck Sending " + qpack.Incoming.ToString() + " packet " + qpack.Packet.Type.ToString());
|
|
||||||
Client.ProcessOutPacket(qpack.Packet);
|
Client.ProcessOutPacket(qpack.Packet);
|
||||||
|
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
TaskThrottle.Add(qpack.Packet.ToBytes().Length);
|
TaskThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
}
|
}
|
||||||
if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0)
|
if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = TextureOutgoingPacketQueue.Dequeue();
|
QueItem qpack = TextureOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
//SendQueue.Enqueue(qpack);
|
|
||||||
// m_log.Debug("[PacketQueue]: ThrottleCheck Sending " + qpack.Incoming.ToString() + " packet " + qpack.Packet.Type.ToString());
|
|
||||||
Client.ProcessOutPacket(qpack.Packet);
|
Client.ProcessOutPacket(qpack.Packet);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
TextureThrottle.Add(qpack.Packet.ToBytes().Length);
|
TextureThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -338,9 +320,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0)
|
if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = AssetOutgoingPacketQueue.Dequeue();
|
QueItem qpack = AssetOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
//SendQueue.Enqueue(qpack);
|
|
||||||
// m_log.Debug("[PacketQueue]: ThrottleCheck Sending " + qpack.Incoming.ToString() + " packet " + qpack.Packet.Type.ToString());
|
|
||||||
Client.ProcessOutPacket(qpack.Packet);
|
Client.ProcessOutPacket(qpack.Packet);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
AssetThrottle.Add(qpack.Packet.ToBytes().Length);
|
AssetThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -512,5 +491,21 @@ namespace OpenSim.Region.ClientStack
|
||||||
// effectively wiggling the slider causes things reset
|
// effectively wiggling the slider causes things reset
|
||||||
ResetCounters();
|
ResetCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See IPullStatsProvider
|
||||||
|
public string GetStats()
|
||||||
|
{
|
||||||
|
return string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}",
|
||||||
|
SendQueue.Count(),
|
||||||
|
IncomingPacketQueue.Count,
|
||||||
|
OutgoingPacketQueue.Count,
|
||||||
|
ResendOutgoingPacketQueue.Count,
|
||||||
|
LandOutgoingPacketQueue.Count,
|
||||||
|
WindOutgoingPacketQueue.Count,
|
||||||
|
CloudOutgoingPacketQueue.Count,
|
||||||
|
TaskOutgoingPacketQueue.Count,
|
||||||
|
TextureOutgoingPacketQueue.Count,
|
||||||
|
AssetOutgoingPacketQueue.Count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
public void Enqueue(uint CircuitCode, Packet packet)
|
public void Enqueue(uint CircuitCode, Packet packet)
|
||||||
{
|
{
|
||||||
//m_log.Debug("[PacketServer]: Enquing " + packet.Type.ToString() + " from " + CircuitCode.ToString());
|
IClientAPI client;
|
||||||
//lock(PacketQueue)
|
|
||||||
PacketQueue.Enqueue(new QueuePacket(packet, CircuitCode));
|
PacketQueue.Enqueue(new QueuePacket(packet, CircuitCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -388,10 +388,10 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
Server.SendTo(buffer, size, flags, sendto);
|
Server.SendTo(buffer, size, flags, sendto);
|
||||||
}
|
}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
m_log.Debug("[UDPServer]: Failed to find person to send packet to!");
|
// m_log.Debug("[UDPServer]: Failed to find person to send packet to!");
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserTextureDownloadService
|
public class UserTextureDownloadService
|
||||||
{
|
{
|
||||||
//private static readonly log4net.ILog m_log
|
private static readonly log4net.ILog m_log
|
||||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Holds texture senders before they have received the appropriate texture from the asset cache.
|
/// Holds texture senders before they have received the appropriate texture from the asset cache.
|
||||||
|
@ -138,7 +138,6 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
// this texture could not be found
|
// this texture could not be found
|
||||||
|
|
||||||
// TODO Send packet back to the client telling it not to expect the texture
|
// TODO Send packet back to the client telling it not to expect the texture
|
||||||
// The absence of this packet doesn't appear to be causing it a problem right now
|
|
||||||
|
|
||||||
//m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Removing download stat for {0}", textureID);
|
//m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Removing download stat for {0}", textureID);
|
||||||
m_scene.AddPendingDownloads(-1);
|
m_scene.AddPendingDownloads(-1);
|
||||||
|
@ -150,7 +149,9 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Got a texture with no sender object to handle it, this shouldn't happen");
|
m_log.WarnFormat(
|
||||||
|
"Got a texture uuid {0} with no sender object to handle it, this shouldn't happen",
|
||||||
|
textureID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,11 +104,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectGroup)
|
if (ent is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (((SceneObjectGroup) ent).LocalId == primLocalID)
|
if (((SceneObjectGroup) ent).LocalId == primLocalID)
|
||||||
|
{
|
||||||
|
// A prim is only tainted if it's allowed to be edited by the person clicking it.
|
||||||
|
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
|
||||||
{
|
{
|
||||||
((SceneObjectGroup) ent).GetProperties(remoteClient);
|
((SceneObjectGroup) ent).GetProperties(remoteClient);
|
||||||
((SceneObjectGroup) ent).IsSelected = true;
|
((SceneObjectGroup) ent).IsSelected = true;
|
||||||
LandManager.setPrimsTainted();
|
LandManager.setPrimsTainted();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +134,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (ent is SceneObjectGroup)
|
if (ent is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
if (((SceneObjectGroup) ent).LocalId == primLocalID)
|
if (((SceneObjectGroup) ent).LocalId == primLocalID)
|
||||||
|
{
|
||||||
|
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
|
||||||
{
|
{
|
||||||
((SceneObjectGroup) ent).IsSelected = false;
|
((SceneObjectGroup) ent).IsSelected = false;
|
||||||
LandManager.setPrimsTainted();
|
LandManager.setPrimsTainted();
|
||||||
|
@ -137,6 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void ProcessMoneyTransferRequest(LLUUID source, LLUUID destination, int amount, int transactiontype, string description)
|
public virtual void ProcessMoneyTransferRequest(LLUUID source, LLUUID destination, int amount, int transactiontype, string description)
|
||||||
{
|
{
|
||||||
|
|
|
@ -203,6 +203,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
{
|
{
|
||||||
m_rootPart.PhysActor.Selected = value;
|
m_rootPart.PhysActor.Selected = value;
|
||||||
|
// Pass it on to the children.
|
||||||
|
foreach (SceneObjectPart child in Children.Values)
|
||||||
|
{
|
||||||
|
if (child.PhysActor != null)
|
||||||
|
{
|
||||||
|
child.PhysActor.Selected = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
|
|
@ -895,6 +895,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
|
|
@ -124,6 +124,8 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public abstract PrimitiveBaseShape Shape { set; }
|
public abstract PrimitiveBaseShape Shape { set; }
|
||||||
|
|
||||||
|
public abstract uint LocalID { set; }
|
||||||
|
|
||||||
public abstract bool Grabbed { set; }
|
public abstract bool Grabbed { set; }
|
||||||
|
|
||||||
public abstract bool Selected { set; }
|
public abstract bool Selected { set; }
|
||||||
|
@ -228,6 +230,11 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
|
|
@ -87,6 +87,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private bool m_hackSentFall = false;
|
private bool m_hackSentFall = false;
|
||||||
private bool m_hackSentFly = false;
|
private bool m_hackSentFly = false;
|
||||||
private bool m_foundDebian = false;
|
private bool m_foundDebian = false;
|
||||||
|
public uint m_localID = 0;
|
||||||
|
|
||||||
private CollisionLocker ode;
|
private CollisionLocker ode;
|
||||||
|
|
||||||
private string m_name = String.Empty;
|
private string m_name = String.Empty;
|
||||||
|
@ -94,6 +96,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private bool[] m_colliderarr = new bool[11];
|
private bool[] m_colliderarr = new bool[11];
|
||||||
private bool[] m_colliderGroundarr = new bool[11];
|
private bool[] m_colliderGroundarr = new bool[11];
|
||||||
|
|
||||||
|
// Default we're a Character
|
||||||
|
private CollisionCategories m_collisionCategories = (CollisionCategories.Character);
|
||||||
|
|
||||||
|
// Default, Collide with Other Geometries, spaces, bodies and characters.
|
||||||
|
private CollisionCategories m_collisionFlags = (CollisionCategories.Geom
|
||||||
|
| CollisionCategories.Space
|
||||||
|
| CollisionCategories.Body
|
||||||
|
| CollisionCategories.Character
|
||||||
|
| CollisionCategories.Land);
|
||||||
|
|
||||||
private bool jumping = false;
|
private bool jumping = false;
|
||||||
//private float gravityAccel;
|
//private float gravityAccel;
|
||||||
|
@ -157,6 +168,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
set { m_alwaysRun = value; }
|
set { m_alwaysRun = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { m_localID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
@ -404,6 +420,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
int dAMotorEuler = 1;
|
int dAMotorEuler = 1;
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.space);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.space);
|
||||||
Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||||
|
|
||||||
|
d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
|
||||||
|
d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
|
||||||
|
|
||||||
d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||||
Body = d.BodyCreate(_parent_scene.world);
|
Body = d.BodyCreate(_parent_scene.world);
|
||||||
d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
|
d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
|
||||||
|
|
|
@ -52,12 +52,30 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private PhysicsVector m_taintsize;
|
private PhysicsVector m_taintsize;
|
||||||
private PhysicsVector m_taintVelocity = PhysicsVector.Zero;
|
private PhysicsVector m_taintVelocity = PhysicsVector.Zero;
|
||||||
private Quaternion m_taintrot;
|
private Quaternion m_taintrot;
|
||||||
|
private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
|
||||||
|
| CollisionCategories.Space
|
||||||
|
| CollisionCategories.Body
|
||||||
|
| CollisionCategories.Character);
|
||||||
private bool m_taintshape = false;
|
private bool m_taintshape = false;
|
||||||
private bool m_taintPhysics = false;
|
private bool m_taintPhysics = false;
|
||||||
|
private bool m_collidesLand = true;
|
||||||
|
private bool m_collidesWater = false;
|
||||||
|
|
||||||
|
// Default we're a Geometry
|
||||||
|
private CollisionCategories m_collisionCategories = (CollisionCategories.Geom );
|
||||||
|
|
||||||
|
// Default, Collide with Other Geometries, spaces and Bodies
|
||||||
|
private CollisionCategories m_collisionFlags = m_default_collisionFlags;
|
||||||
|
|
||||||
public bool m_taintremove = false;
|
public bool m_taintremove = false;
|
||||||
public bool m_taintdisable = false;
|
public bool m_taintdisable = false;
|
||||||
public bool m_disabled = false;
|
public bool m_disabled = false;
|
||||||
public bool m_taintadd = false;
|
public bool m_taintadd = false;
|
||||||
|
public bool m_taintselected = false;
|
||||||
|
|
||||||
|
|
||||||
|
public uint m_localID = 0;
|
||||||
|
|
||||||
public GCHandle gc;
|
public GCHandle gc;
|
||||||
private CollisionLocker ode;
|
private CollisionLocker ode;
|
||||||
|
|
||||||
|
@ -74,6 +92,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
private bool iscolliding = false;
|
private bool iscolliding = false;
|
||||||
private bool m_isphysical = false;
|
private bool m_isphysical = false;
|
||||||
|
private bool m_isSelected = false;
|
||||||
|
|
||||||
private bool m_throttleUpdates = false;
|
private bool m_throttleUpdates = false;
|
||||||
private int throttleCounter = 0;
|
private int throttleCounter = 0;
|
||||||
public int m_interpenetrationcount = 0;
|
public int m_interpenetrationcount = 0;
|
||||||
|
@ -172,6 +192,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { m_localID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
@ -179,17 +204,59 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
public override bool Selected
|
public override bool Selected
|
||||||
{
|
{
|
||||||
set { return; }
|
set {
|
||||||
|
// This only makes the object not collidable if the object
|
||||||
|
// is physical or the object is modified somehow *IN THE FUTURE*
|
||||||
|
// without this, if an avatar selects prim, they can walk right
|
||||||
|
// through it while it's selected
|
||||||
|
|
||||||
|
if ((m_isphysical && !_zeroFlag) || !value)
|
||||||
|
{
|
||||||
|
m_taintselected = value;
|
||||||
|
_parent_scene.AddPhysicsActorTaint(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
m_taintselected = value;
|
||||||
|
m_isSelected = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGeom(IntPtr geom)
|
public void SetGeom(IntPtr geom)
|
||||||
{
|
{
|
||||||
prev_geom = prim_geom;
|
prev_geom = prim_geom;
|
||||||
prim_geom = geom;
|
prim_geom = geom;
|
||||||
|
if (prim_geom != (IntPtr)0)
|
||||||
|
{
|
||||||
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
|
}
|
||||||
//m_log.Warn("Setting Geom to: " + prim_geom);
|
//m_log.Warn("Setting Geom to: " + prim_geom);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void enableBodySoft()
|
||||||
|
{
|
||||||
|
if (m_isphysical)
|
||||||
|
if (Body != (IntPtr)0)
|
||||||
|
d.BodyEnable(Body);
|
||||||
|
|
||||||
|
m_disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disableBodySoft()
|
||||||
|
{
|
||||||
|
m_disabled = true;
|
||||||
|
|
||||||
|
if (m_isphysical)
|
||||||
|
if (Body != (IntPtr)0)
|
||||||
|
d.BodyDisable(Body);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void enableBody()
|
public void enableBody()
|
||||||
{
|
{
|
||||||
// Sets the geom to a body
|
// Sets the geom to a body
|
||||||
|
@ -204,6 +271,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
myrot.Z = _orientation.z;
|
myrot.Z = _orientation.z;
|
||||||
d.BodySetQuaternion(Body, ref myrot);
|
d.BodySetQuaternion(Body, ref myrot);
|
||||||
d.GeomSetBody(prim_geom, Body);
|
d.GeomSetBody(prim_geom, Body);
|
||||||
|
m_collisionCategories |= CollisionCategories.Body;
|
||||||
|
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
||||||
|
|
||||||
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
|
|
||||||
|
|
||||||
d.BodySetAutoDisableFlag(Body, true);
|
d.BodySetAutoDisableFlag(Body, true);
|
||||||
d.BodySetAutoDisableSteps(Body, 20);
|
d.BodySetAutoDisableSteps(Body, 20);
|
||||||
|
|
||||||
|
@ -332,6 +406,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
//this kills the body so things like 'mesh' can re-create it.
|
//this kills the body so things like 'mesh' can re-create it.
|
||||||
if (Body != (IntPtr) 0)
|
if (Body != (IntPtr) 0)
|
||||||
{
|
{
|
||||||
|
m_collisionCategories &= ~CollisionCategories.Body;
|
||||||
|
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
|
||||||
|
|
||||||
|
if (prim_geom != (IntPtr)0)
|
||||||
|
{
|
||||||
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
|
}
|
||||||
|
|
||||||
_parent_scene.remActivePrim(this);
|
_parent_scene.remActivePrim(this);
|
||||||
d.BodyDestroy(Body);
|
d.BodyDestroy(Body);
|
||||||
Body = (IntPtr) 0;
|
Body = (IntPtr) 0;
|
||||||
|
@ -425,10 +508,81 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (m_taintdisable)
|
if (m_taintdisable)
|
||||||
changedisable(timestep);
|
changedisable(timestep);
|
||||||
|
|
||||||
|
if (m_taintselected != m_isSelected)
|
||||||
|
changeSelectedStatus(timestep);
|
||||||
|
|
||||||
if (m_taintVelocity != PhysicsVector.Zero)
|
if (m_taintVelocity != PhysicsVector.Zero)
|
||||||
changevelocity(timestep);
|
changevelocity(timestep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void changeSelectedStatus(float timestep)
|
||||||
|
{
|
||||||
|
while (ode.lockquery())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
ode.dlock(_parent_scene.world);
|
||||||
|
|
||||||
|
if (m_taintselected)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
m_collisionCategories = CollisionCategories.Selected;
|
||||||
|
m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
|
||||||
|
|
||||||
|
// We do the body disable soft twice because 'in theory' a collision could have happened
|
||||||
|
// in between the disabling and the collision properties setting
|
||||||
|
// which would wake the physical body up from a soft disabling and potentially cause it to fall
|
||||||
|
// through the ground.
|
||||||
|
|
||||||
|
if (m_isphysical)
|
||||||
|
{
|
||||||
|
disableBodySoft();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prim_geom != (IntPtr)0)
|
||||||
|
{
|
||||||
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_isphysical)
|
||||||
|
{
|
||||||
|
disableBodySoft();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
m_collisionCategories = CollisionCategories.Geom;
|
||||||
|
|
||||||
|
if (m_isphysical)
|
||||||
|
m_collisionCategories |= CollisionCategories.Body;
|
||||||
|
|
||||||
|
|
||||||
|
m_collisionFlags = m_default_collisionFlags;
|
||||||
|
|
||||||
|
if (m_collidesLand)
|
||||||
|
m_collisionFlags |= CollisionCategories.Land;
|
||||||
|
if (m_collidesWater)
|
||||||
|
m_collisionFlags |= CollisionCategories.Water;
|
||||||
|
|
||||||
|
if (prim_geom != (IntPtr)0)
|
||||||
|
{
|
||||||
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
|
}
|
||||||
|
if (m_isphysical)
|
||||||
|
enableBodySoft();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ode.dunlock(_parent_scene.world);
|
||||||
|
resetCollisionAccounting();
|
||||||
|
m_isSelected = m_taintselected;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResetTaints()
|
public void ResetTaints()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -438,6 +592,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
m_taintPhysics = m_isphysical;
|
m_taintPhysics = m_isphysical;
|
||||||
|
|
||||||
|
m_taintselected = m_isSelected;
|
||||||
|
|
||||||
m_taintsize = _size;
|
m_taintsize = _size;
|
||||||
|
|
||||||
|
|
||||||
|
@ -586,6 +742,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
ode.dunlock(_parent_scene.world);
|
ode.dunlock(_parent_scene.world);
|
||||||
_parent_scene.geom_name_map[prim_geom] = this.m_primName;
|
_parent_scene.geom_name_map[prim_geom] = this.m_primName;
|
||||||
_parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this;
|
_parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this;
|
||||||
|
|
||||||
|
changeSelectedStatus(timestep);
|
||||||
|
|
||||||
m_taintadd = false;
|
m_taintadd = false;
|
||||||
|
|
||||||
|
|
||||||
|
@ -630,6 +789,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
ode.dunlock(_parent_scene.world);
|
ode.dunlock(_parent_scene.world);
|
||||||
|
|
||||||
|
changeSelectedStatus(timestep);
|
||||||
|
|
||||||
resetCollisionAccounting();
|
resetCollisionAccounting();
|
||||||
m_taintposition = _position;
|
m_taintposition = _position;
|
||||||
}
|
}
|
||||||
|
@ -682,7 +843,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_taintdisable = false;
|
m_taintdisable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changePhysicsStatus(float timestap)
|
public void changePhysicsStatus(float timestep)
|
||||||
{
|
{
|
||||||
lock (ode)
|
lock (ode)
|
||||||
{
|
{
|
||||||
|
@ -709,6 +870,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
ode.dunlock(_parent_scene.world);
|
ode.dunlock(_parent_scene.world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeSelectedStatus(timestep);
|
||||||
|
|
||||||
resetCollisionAccounting();
|
resetCollisionAccounting();
|
||||||
m_taintPhysics = m_isphysical;
|
m_taintPhysics = m_isphysical;
|
||||||
}
|
}
|
||||||
|
@ -880,6 +1043,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
ode.dunlock(_parent_scene.world);
|
ode.dunlock(_parent_scene.world);
|
||||||
|
|
||||||
|
changeSelectedStatus(timestamp);
|
||||||
|
|
||||||
resetCollisionAccounting();
|
resetCollisionAccounting();
|
||||||
m_taintsize = _size;
|
m_taintsize = _size;
|
||||||
}
|
}
|
||||||
|
@ -927,7 +1092,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// Re creates body on size.
|
// Re creates body on size.
|
||||||
// EnableBody also does setMass()
|
// EnableBody also does setMass()
|
||||||
enableBody();
|
enableBody();
|
||||||
d.BodyEnable(Body);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1032,15 +1197,21 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.BodyEnable(Body);
|
d.BodyEnable(Body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_parent_scene.geom_name_map[prim_geom] = oldname;
|
_parent_scene.geom_name_map[prim_geom] = oldname;
|
||||||
|
|
||||||
ode.dunlock(_parent_scene.world);
|
ode.dunlock(_parent_scene.world);
|
||||||
|
|
||||||
|
changeSelectedStatus(timestamp);
|
||||||
|
|
||||||
resetCollisionAccounting();
|
resetCollisionAccounting();
|
||||||
m_taintshape = false;
|
m_taintshape = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeAddForce(float timestamp)
|
public void changeAddForce(float timestamp)
|
||||||
|
{
|
||||||
|
if (!m_isSelected)
|
||||||
{
|
{
|
||||||
while (ode.lockquery())
|
while (ode.lockquery())
|
||||||
{
|
{
|
||||||
|
@ -1068,10 +1239,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
m_collisionscore = 0;
|
m_collisionscore = 0;
|
||||||
m_interpenetrationcount = 0;
|
m_interpenetrationcount = 0;
|
||||||
|
}
|
||||||
m_taintforce = false;
|
m_taintforce = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
private void changevelocity(float timestep)
|
private void changevelocity(float timestep)
|
||||||
|
{
|
||||||
|
if (!m_isSelected)
|
||||||
{
|
{
|
||||||
lock (ode)
|
lock (ode)
|
||||||
{
|
{
|
||||||
|
@ -1092,6 +1266,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
ode.dunlock(_parent_scene.world);
|
ode.dunlock(_parent_scene.world);
|
||||||
}
|
}
|
||||||
//resetCollisionAccounting();
|
//resetCollisionAccounting();
|
||||||
|
}
|
||||||
m_taintVelocity = PhysicsVector.Zero;
|
m_taintVelocity = PhysicsVector.Zero;
|
||||||
}
|
}
|
||||||
public override bool IsPhysical
|
public override bool IsPhysical
|
||||||
|
@ -1275,6 +1450,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
||||||
|
bool lastZeroFlag = _zeroFlag;
|
||||||
if (Body != (IntPtr) 0)
|
if (Body != (IntPtr) 0)
|
||||||
{
|
{
|
||||||
d.Vector3 vec = d.BodyGetPosition(Body);
|
d.Vector3 vec = d.BodyGetPosition(Body);
|
||||||
|
@ -1371,6 +1547,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (lastZeroFlag != _zeroFlag)
|
||||||
|
base.RequestPhysicsterseUpdate();
|
||||||
|
|
||||||
m_lastVelocity = _velocity;
|
m_lastVelocity = _velocity;
|
||||||
|
|
||||||
_position = l_position;
|
_position = l_position;
|
||||||
|
|
|
@ -78,6 +78,21 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum CollisionCategories : int
|
||||||
|
{
|
||||||
|
Disabled = 0,
|
||||||
|
Geom = 0x00000001,
|
||||||
|
Body = 0x00000002,
|
||||||
|
Space = 0x00000004,
|
||||||
|
Character = 0x00000008,
|
||||||
|
Land = 0x00000010,
|
||||||
|
Water = 0x00000020,
|
||||||
|
Wind = 0x00000040,
|
||||||
|
Sensor = 0x00000080,
|
||||||
|
Selected = 0x00000100
|
||||||
|
}
|
||||||
|
|
||||||
public class OdeScene : PhysicsScene
|
public class OdeScene : PhysicsScene
|
||||||
{
|
{
|
||||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -997,6 +1012,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
// creating a new space for prim and inserting it into main space.
|
// creating a new space for prim and inserting it into main space.
|
||||||
staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
|
staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
|
||||||
|
d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space);
|
||||||
waitForSpaceUnlock(space);
|
waitForSpaceUnlock(space);
|
||||||
d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
|
d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
|
||||||
return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
|
return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
|
||||||
|
@ -1656,6 +1672,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
offset, thickness, wrap);
|
offset, thickness, wrap);
|
||||||
d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight);
|
d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight);
|
||||||
LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
|
LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
|
||||||
|
if (LandGeom != (IntPtr)0)
|
||||||
|
{
|
||||||
|
d.GeomSetCategoryBits(LandGeom, (int)(CollisionCategories.Land));
|
||||||
|
d.GeomSetCollideBits(LandGeom, (int)(CollisionCategories.Space));
|
||||||
|
|
||||||
|
}
|
||||||
geom_name_map[LandGeom] = "Terrain";
|
geom_name_map[LandGeom] = "Terrain";
|
||||||
|
|
||||||
d.Matrix3 R = new d.Matrix3();
|
d.Matrix3 R = new d.Matrix3();
|
||||||
|
|
|
@ -357,6 +357,11 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
@ -645,6 +650,11 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
|
|
@ -227,6 +227,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
@ -437,6 +442,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
|
|
@ -41,8 +41,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AsyncLSLCommandManager : iScriptEngineFunctionModule
|
public class AsyncLSLCommandManager : iScriptEngineFunctionModule
|
||||||
{
|
{
|
||||||
private Thread cmdHandlerThread;
|
private static Thread cmdHandlerThread;
|
||||||
private int cmdHandlerThreadCycleSleepms;
|
private static int cmdHandlerThreadCycleSleepms;
|
||||||
|
|
||||||
private ScriptEngine m_ScriptEngine;
|
private ScriptEngine m_ScriptEngine;
|
||||||
|
|
||||||
|
@ -51,18 +51,26 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
m_ScriptEngine = _ScriptEngine;
|
m_ScriptEngine = _ScriptEngine;
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
|
|
||||||
|
StartThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartThread()
|
||||||
|
{
|
||||||
|
if (cmdHandlerThread == null)
|
||||||
|
{
|
||||||
// Start the thread that will be doing the work
|
// Start the thread that will be doing the work
|
||||||
cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
|
cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
|
||||||
cmdHandlerThread.Name = "CmdHandlerThread";
|
cmdHandlerThread.Name = "AsyncLSLCmdHandlerThread";
|
||||||
cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
|
cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
|
||||||
cmdHandlerThread.IsBackground = true;
|
cmdHandlerThread.IsBackground = true;
|
||||||
cmdHandlerThread.Start();
|
cmdHandlerThread.Start();
|
||||||
OpenSim.Framework.ThreadTracker.Add(cmdHandlerThread);
|
OpenSim.Framework.ThreadTracker.Add(cmdHandlerThread);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ReadConfig()
|
public void ReadConfig()
|
||||||
{
|
{
|
||||||
cmdHandlerThreadCycleSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("AsyncLLCommandLoopms", 50);
|
cmdHandlerThreadCycleSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("AsyncLLCommandLoopms", 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
~AsyncLSLCommandManager()
|
~AsyncLSLCommandManager()
|
||||||
|
@ -84,33 +92,49 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CmdHandlerThreadLoop()
|
private static void CmdHandlerThreadLoop()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Check timers
|
try
|
||||||
CheckTimerEvents();
|
{
|
||||||
Thread.Sleep(25);
|
while (true)
|
||||||
// Check HttpRequests
|
{
|
||||||
CheckHttpRequests();
|
Thread.Sleep(cmdHandlerThreadCycleSleepms);
|
||||||
Thread.Sleep(25);
|
//lock (ScriptEngine.ScriptEngines)
|
||||||
// Check XMLRPCRequests
|
//{
|
||||||
CheckXMLRPCRequests();
|
foreach (ScriptEngine se in new ArrayList(ScriptEngine.ScriptEngines))
|
||||||
Thread.Sleep(25);
|
{
|
||||||
// Check Listeners
|
se.m_ASYNCLSLCommandManager.DoOneCmdHandlerPass();
|
||||||
CheckListeners();
|
}
|
||||||
Thread.Sleep(25);
|
//}
|
||||||
|
|
||||||
// Sleep before next cycle
|
// Sleep before next cycle
|
||||||
//Thread.Sleep(cmdHandlerThreadCycleSleepms);
|
//Thread.Sleep(cmdHandlerThreadCycleSleepms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void DoOneCmdHandlerPass()
|
||||||
|
{
|
||||||
|
// Check timers
|
||||||
|
CheckTimerEvents();
|
||||||
|
// Check HttpRequests
|
||||||
|
CheckHttpRequests();
|
||||||
|
// Check XMLRPCRequests
|
||||||
|
CheckXMLRPCRequests();
|
||||||
|
// Check Listeners
|
||||||
|
CheckListeners();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove a specific script (and all its pending commands)
|
/// Remove a specific script (and all its pending commands)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="m_localID"></param>
|
/// <param name="localID"></param>
|
||||||
/// <param name="m_itemID"></param>
|
/// <param name="itemID"></param>
|
||||||
public void RemoveScript(uint localID, LLUUID itemID)
|
public void RemoveScript(uint localID, LLUUID itemID)
|
||||||
{
|
{
|
||||||
// Remove a specific script
|
// Remove a specific script
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
public class EventQueueManager : iScriptEngineFunctionModule
|
public class EventQueueManager : iScriptEngineFunctionModule
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine".
|
// 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":
|
// 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 "EventManager" to release its event thread immediately, thus not interrupting server execution.
|
||||||
|
@ -68,25 +68,25 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
/// List of threads (classes) processing event queue
|
/// 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.
|
/// Note that this may or may not be a reference to a static object depending on PrivateRegionThreads config setting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal List<EventQueueThreadClass> eventQueueThreads; // Thread pool that we work on
|
internal static List<EventQueueThreadClass> eventQueueThreads = new List<EventQueueThreadClass>(); // Thread pool that we work on
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads.
|
/// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// private object eventQueueThreadsLock = new object();
|
// private object eventQueueThreadsLock = new object();
|
||||||
// Static objects for referencing the objects above if we don't have private threads:
|
// Static objects for referencing the objects above if we don't have private threads:
|
||||||
internal static List<EventQueueThreadClass> staticEventQueueThreads; // A static reference used if we don't use private threads
|
//internal static List<EventQueueThreadClass> staticEventQueueThreads; // A static reference used if we don't use private threads
|
||||||
// internal static object staticEventQueueThreadsLock; // Statick lock object reference for same reason
|
// internal static object staticEventQueueThreadsLock; // Statick lock object reference for same reason
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Global static list of all threads (classes) processing event queue -- used by max enforcment thread
|
/// Global static list of all threads (classes) processing event queue -- used by max enforcment thread
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<EventQueueThreadClass> staticGlobalEventQueueThreads = new List<EventQueueThreadClass>();
|
//private List<EventQueueThreadClass> staticGlobalEventQueueThreads = new List<EventQueueThreadClass>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used internally to specify how many threads should exit gracefully
|
/// Used internally to specify how many threads should exit gracefully
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ThreadsToExit;
|
public static int ThreadsToExit;
|
||||||
public object ThreadsToExitLock = new object();
|
public static object ThreadsToExitLock = new object();
|
||||||
|
|
||||||
|
|
||||||
//public object queueLock = new object(); // Mutex lock object
|
//public object queueLock = new object(); // Mutex lock object
|
||||||
|
@ -94,14 +94,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many threads to process queue with
|
/// How many threads to process queue with
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal int numberOfThreads;
|
internal static int numberOfThreads;
|
||||||
|
|
||||||
internal static int EventExecutionMaxQueueSize;
|
internal static int EventExecutionMaxQueueSize;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum time one function can use for execution before we perform a thread kill.
|
/// Maximum time one function can use for execution before we perform a thread kill.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int maxFunctionExecutionTimems
|
private static int maxFunctionExecutionTimems
|
||||||
{
|
{
|
||||||
get { return (int)(maxFunctionExecutionTimens / 10000); }
|
get { return (int)(maxFunctionExecutionTimens / 10000); }
|
||||||
set { maxFunctionExecutionTimens = value * 10000; }
|
set { maxFunctionExecutionTimens = value * 10000; }
|
||||||
|
@ -111,15 +111,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
/// Contains nanoseconds version of maxFunctionExecutionTimems so that it matches time calculations better (performance reasons).
|
/// Contains nanoseconds version of maxFunctionExecutionTimems so that it matches time calculations better (performance reasons).
|
||||||
/// WARNING! ONLY UPDATE maxFunctionExecutionTimems, NEVER THIS DIRECTLY.
|
/// WARNING! ONLY UPDATE maxFunctionExecutionTimems, NEVER THIS DIRECTLY.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long maxFunctionExecutionTimens;
|
public static long maxFunctionExecutionTimens;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enforce max execution time
|
/// Enforce max execution time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnforceMaxExecutionTime;
|
public static bool EnforceMaxExecutionTime;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kill script (unload) when it exceeds execution time
|
/// Kill script (unload) when it exceeds execution time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool KillScriptOnMaxFunctionExecutionTime;
|
private static bool KillScriptOnMaxFunctionExecutionTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of localID locks for mutex processing of script events
|
/// List of localID locks for mutex processing of script events
|
||||||
|
@ -172,33 +172,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
{
|
{
|
||||||
m_ScriptEngine = _ScriptEngine;
|
m_ScriptEngine = _ScriptEngine;
|
||||||
|
|
||||||
// TODO: We need to move from single EventQueueManager to list of it in to share threads
|
|
||||||
bool PrivateRegionThreads = true; // m_ScriptEngine.ScriptConfigSource.GetBoolean("PrivateRegionThreads", false);
|
|
||||||
|
|
||||||
// Create thread pool list and lock object
|
|
||||||
// Determine from config if threads should be dedicated to regions or shared
|
|
||||||
if (PrivateRegionThreads)
|
|
||||||
{
|
|
||||||
// PRIVATE THREAD POOL PER REGION
|
|
||||||
eventQueueThreads = new List<EventQueueThreadClass>();
|
|
||||||
// eventQueueThreadsLock = new object();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// SHARED THREAD POOL
|
|
||||||
// Crate the static objects
|
|
||||||
if (staticEventQueueThreads == null)
|
|
||||||
staticEventQueueThreads = new List<EventQueueThreadClass>();
|
|
||||||
// if (staticEventQueueThreadsLock == null)
|
|
||||||
// staticEventQueueThreadsLock = new object();
|
|
||||||
|
|
||||||
// Now reference our locals to them
|
|
||||||
eventQueueThreads = staticEventQueueThreads;
|
|
||||||
//eventQueueThreadsLock = staticEventQueueThreadsLock;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
|
AdjustNumberOfScriptThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadConfig()
|
public void ReadConfig()
|
||||||
|
@ -230,18 +205,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
|
|
||||||
private void Stop()
|
private void Stop()
|
||||||
{
|
{
|
||||||
if (eventQueueThreads != null && eventQueueThreads != null)
|
if (eventQueueThreads != null)
|
||||||
{
|
{
|
||||||
// Kill worker threads
|
// Kill worker threads
|
||||||
//lock (eventQueueThreads)
|
lock (eventQueueThreads)
|
||||||
//{
|
{
|
||||||
foreach (EventQueueThreadClass EventQueueThread in new ArrayList(eventQueueThreads))
|
foreach (EventQueueThreadClass EventQueueThread in new ArrayList(eventQueueThreads))
|
||||||
{
|
{
|
||||||
AbortThreadClass(EventQueueThread);
|
AbortThreadClass(EventQueueThread);
|
||||||
}
|
}
|
||||||
//eventQueueThreads.Clear();
|
//eventQueueThreads.Clear();
|
||||||
//staticGlobalEventQueueThreads.Clear();
|
//staticGlobalEventQueueThreads.Clear();
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all entries from our event queue
|
// Remove all entries from our event queue
|
||||||
|
@ -256,9 +231,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
#region " Start / stop script execution threads (ThreadClasses) "
|
#region " Start / stop script execution threads (ThreadClasses) "
|
||||||
private void StartNewThreadClass()
|
private void StartNewThreadClass()
|
||||||
{
|
{
|
||||||
EventQueueThreadClass eqtc = new EventQueueThreadClass(this);
|
EventQueueThreadClass eqtc = new EventQueueThreadClass();
|
||||||
eventQueueThreads.Add(eqtc);
|
eventQueueThreads.Add(eqtc);
|
||||||
staticGlobalEventQueueThreads.Add(eqtc);
|
|
||||||
m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count);
|
m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,8 +240,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
{
|
{
|
||||||
if (eventQueueThreads.Contains(threadClass))
|
if (eventQueueThreads.Contains(threadClass))
|
||||||
eventQueueThreads.Remove(threadClass);
|
eventQueueThreads.Remove(threadClass);
|
||||||
if (staticGlobalEventQueueThreads.Contains(threadClass))
|
|
||||||
staticGlobalEventQueueThreads.Remove(threadClass);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -426,7 +398,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
// Iterate through all ScriptThreadClasses and check how long their current function has been executing
|
// Iterate through all ScriptThreadClasses and check how long their current function has been executing
|
||||||
lock (eventQueueThreads)
|
lock (eventQueueThreads)
|
||||||
{
|
{
|
||||||
foreach (EventQueueThreadClass EventQueueThread in staticGlobalEventQueueThreads)
|
foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads)
|
||||||
{
|
{
|
||||||
// Is thread currently executing anything?
|
// Is thread currently executing anything?
|
||||||
if (EventQueueThread.InExecution)
|
if (EventQueueThread.InExecution)
|
||||||
|
@ -452,14 +424,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// If set to true then threads and stuff should try to make a graceful exit
|
///// If set to true then threads and stuff should try to make a graceful exit
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool PleaseShutdown
|
//public bool PleaseShutdown
|
||||||
{
|
//{
|
||||||
get { return _PleaseShutdown; }
|
// get { return _PleaseShutdown; }
|
||||||
set { _PleaseShutdown = value; }
|
// set { _PleaseShutdown = value; }
|
||||||
}
|
//}
|
||||||
private bool _PleaseShutdown = false;
|
//private bool _PleaseShutdown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -45,22 +46,22 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many ms to sleep if queue is empty
|
/// How many ms to sleep if queue is empty
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int nothingToDoSleepms;// = 50;
|
private static int nothingToDoSleepms;// = 50;
|
||||||
private ThreadPriority MyThreadPriority;
|
private static ThreadPriority MyThreadPriority;
|
||||||
|
|
||||||
public long LastExecutionStarted;
|
public long LastExecutionStarted;
|
||||||
public bool InExecution = false;
|
public bool InExecution = false;
|
||||||
public bool KillCurrentScript = false;
|
public bool KillCurrentScript = false;
|
||||||
|
|
||||||
private EventQueueManager eventQueueManager;
|
//private EventQueueManager eventQueueManager;
|
||||||
public Thread EventQueueThread;
|
public Thread EventQueueThread;
|
||||||
private static int ThreadCount = 0;
|
private static int ThreadCount = 0;
|
||||||
|
|
||||||
private string ScriptEngineName = "ScriptEngine.Common";
|
private string ScriptEngineName = "ScriptEngine.Common";
|
||||||
|
|
||||||
public EventQueueThreadClass(EventQueueManager eqm)
|
public EventQueueThreadClass()//EventQueueManager eqm
|
||||||
{
|
{
|
||||||
eventQueueManager = eqm;
|
//eventQueueManager = eqm;
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
@ -72,11 +73,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
|
|
||||||
public void ReadConfig()
|
public void ReadConfig()
|
||||||
{
|
{
|
||||||
ScriptEngineName = eventQueueManager.m_ScriptEngine.ScriptEngineName;
|
lock (ScriptEngine.ScriptEngines)
|
||||||
nothingToDoSleepms = eventQueueManager.m_ScriptEngine.ScriptConfigSource.GetInt("SleepTimeIfNoScriptExecutionMs", 50);
|
{
|
||||||
|
foreach (ScriptEngine m_ScriptEngine in ScriptEngine.ScriptEngines)
|
||||||
|
{
|
||||||
|
ScriptEngineName = m_ScriptEngine.ScriptEngineName;
|
||||||
|
nothingToDoSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("SleepTimeIfNoScriptExecutionMs", 50);
|
||||||
|
|
||||||
// Later with ScriptServer we might want to ask OS for stuff too, so doing this a bit manually
|
// Later with ScriptServer we might want to ask OS for stuff too, so doing this a bit manually
|
||||||
string pri = eventQueueManager.m_ScriptEngine.ScriptConfigSource.GetString("ScriptThreadPriority", "BelowNormal");
|
string pri = m_ScriptEngine.ScriptConfigSource.GetString("ScriptThreadPriority", "BelowNormal");
|
||||||
switch (pri.ToLower())
|
switch (pri.ToLower())
|
||||||
{
|
{
|
||||||
case "lowest":
|
case "lowest":
|
||||||
|
@ -96,10 +101,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MyThreadPriority = ThreadPriority.BelowNormal; // Default
|
MyThreadPriority = ThreadPriority.BelowNormal; // Default
|
||||||
eventQueueManager.m_ScriptEngine.Log.Error("[ScriptEngineBase]: Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\".");
|
m_ScriptEngine.Log.Error("[ScriptEngineBase]: Unknown priority type \"" + pri +
|
||||||
|
"\" in config file. Defaulting to \"BelowNormal\".");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Now set that priority
|
// Now set that priority
|
||||||
if (EventQueueThread != null)
|
if (EventQueueThread != null)
|
||||||
if (EventQueueThread.IsAlive)
|
if (EventQueueThread.IsAlive)
|
||||||
|
@ -127,8 +134,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
PleaseShutdown = true; // Set shutdown flag
|
//PleaseShutdown = true; // Set shutdown flag
|
||||||
Thread.Sleep(100); // Wait a bit
|
//Thread.Sleep(100); // Wait a bit
|
||||||
if (EventQueueThread != null && EventQueueThread.IsAlive == true)
|
if (EventQueueThread != null && EventQueueThread.IsAlive == true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -143,6 +150,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EventQueueManager.QueueItemStruct BlankQIS = new EventQueueManager.QueueItemStruct();
|
||||||
|
private ScriptEngine lastScriptEngine;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queue processing thread loop
|
/// Queue processing thread loop
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -155,41 +164,71 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EventQueueManager.QueueItemStruct BlankQIS = new EventQueueManager.QueueItemStruct();
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
DoProcessQueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException tae)
|
||||||
|
{
|
||||||
|
if (lastScriptEngine != null)
|
||||||
|
lastScriptEngine.Log.Info("[" + ScriptEngineName + "]: ThreadAbortException while executing function.");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
if (lastScriptEngine != null)
|
||||||
|
lastScriptEngine.Log.Error("[" + ScriptEngineName + "]: Exception in EventQueueThreadLoop: " + e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException)
|
||||||
|
{
|
||||||
|
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread killed: " + tae.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoProcessQueue()
|
||||||
|
{
|
||||||
|
//lock (ScriptEngine.ScriptEngines)
|
||||||
|
//{
|
||||||
|
foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
|
||||||
|
{
|
||||||
|
lastScriptEngine = m_ScriptEngine;
|
||||||
// Every now and then check if we should shut down
|
// Every now and then check if we should shut down
|
||||||
if (PleaseShutdown || eventQueueManager.ThreadsToExit > 0)
|
//if (PleaseShutdown || EventQueueManager.ThreadsToExit > 0)
|
||||||
{
|
//{
|
||||||
// Someone should shut down, lets get exclusive lock
|
// // Someone should shut down, lets get exclusive lock
|
||||||
lock (eventQueueManager.ThreadsToExitLock)
|
// lock (EventQueueManager.ThreadsToExitLock)
|
||||||
{
|
// {
|
||||||
// Lets re-check in case someone grabbed it
|
// // Lets re-check in case someone grabbed it
|
||||||
if (eventQueueManager.ThreadsToExit > 0)
|
// if (EventQueueManager.ThreadsToExit > 0)
|
||||||
{
|
// {
|
||||||
// Its crowded here so we'll shut down
|
// // Its crowded here so we'll shut down
|
||||||
eventQueueManager.ThreadsToExit--;
|
// EventQueueManager.ThreadsToExit--;
|
||||||
Stop();
|
// Stop();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
// We have been asked to shut down
|
// // We have been asked to shut down
|
||||||
Stop();
|
// Stop();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
//try
|
//try
|
||||||
// {
|
// {
|
||||||
EventQueueManager.QueueItemStruct QIS = BlankQIS;
|
EventQueueManager.QueueItemStruct QIS = BlankQIS;
|
||||||
bool GotItem = false;
|
bool GotItem = false;
|
||||||
|
|
||||||
if (PleaseShutdown)
|
//if (PleaseShutdown)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (eventQueueManager.eventQueue.Count == 0)
|
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
|
// Nothing to do? Sleep a bit waiting for something to do
|
||||||
Thread.Sleep(nothingToDoSleepms);
|
Thread.Sleep(nothingToDoSleepms);
|
||||||
|
@ -200,19 +239,19 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
|
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
|
||||||
|
|
||||||
// OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD
|
// OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD
|
||||||
lock (eventQueueManager.eventQueue)
|
lock (m_ScriptEngine.m_EventQueueManager.eventQueue)
|
||||||
{
|
{
|
||||||
GotItem = false;
|
GotItem = false;
|
||||||
for (int qc = 0; qc < eventQueueManager.eventQueue.Count; qc++)
|
for (int qc = 0; qc < m_ScriptEngine.m_EventQueueManager.eventQueue.Count; qc++)
|
||||||
{
|
{
|
||||||
// Get queue item
|
// Get queue item
|
||||||
QIS = eventQueueManager.eventQueue.Dequeue();
|
QIS = m_ScriptEngine.m_EventQueueManager.eventQueue.Dequeue();
|
||||||
|
|
||||||
// Check if object is being processed by someone else
|
// Check if object is being processed by someone else
|
||||||
if (eventQueueManager.TryLock(QIS.localID) == false)
|
if (m_ScriptEngine.m_EventQueueManager.TryLock(QIS.localID) == false)
|
||||||
{
|
{
|
||||||
// Object is already being processed, requeue it
|
// Object is already being processed, requeue it
|
||||||
eventQueueManager.eventQueue.Enqueue(QIS);
|
m_ScriptEngine.m_EventQueueManager.eventQueue.Enqueue(QIS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -240,7 +279,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
LastExecutionStarted = DateTime.Now.Ticks;
|
LastExecutionStarted = DateTime.Now.Ticks;
|
||||||
KillCurrentScript = false;
|
KillCurrentScript = false;
|
||||||
InExecution = true;
|
InExecution = true;
|
||||||
eventQueueManager.m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID,
|
m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID,
|
||||||
QIS.itemID,
|
QIS.itemID,
|
||||||
QIS.functionName,
|
QIS.functionName,
|
||||||
QIS.llDetectParams,
|
QIS.llDetectParams,
|
||||||
|
@ -272,10 +311,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
if (text.Length > 1500)
|
if (text.Length > 1500)
|
||||||
text = text.Substring(0, 1500);
|
text = text.Substring(0, 1500);
|
||||||
IScriptHost m_host =
|
IScriptHost m_host =
|
||||||
eventQueueManager.m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
|
m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
|
||||||
//if (m_host != null)
|
//if (m_host != null)
|
||||||
//{
|
//{
|
||||||
eventQueueManager.m_ScriptEngine.World.SimChat(Helpers.StringToField(text),
|
m_ScriptEngine.World.SimChat(Helpers.StringToField(text),
|
||||||
ChatTypeEnum.Say, 0,
|
ChatTypeEnum.Say, 0,
|
||||||
m_host.AbsolutePosition,
|
m_host.AbsolutePosition,
|
||||||
m_host.Name, m_host.UUID);
|
m_host.Name, m_host.UUID);
|
||||||
|
@ -286,7 +325,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// T oconsole
|
// T oconsole
|
||||||
eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: " +
|
m_ScriptEngine.m_EventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName +
|
||||||
|
"]: " +
|
||||||
"Unable to send text in-world:\r\n" +
|
"Unable to send text in-world:\r\n" +
|
||||||
text);
|
text);
|
||||||
}
|
}
|
||||||
|
@ -295,7 +335,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
// So we are done sending message in-world
|
// So we are done sending message in-world
|
||||||
if (KillCurrentScript)
|
if (KillCurrentScript)
|
||||||
{
|
{
|
||||||
eventQueueManager.m_ScriptEngine.m_ScriptManager.StopScript(
|
m_ScriptEngine.m_EventQueueManager.m_ScriptEngine.m_ScriptManager.StopScript(
|
||||||
QIS.localID, QIS.itemID);
|
QIS.localID, QIS.itemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,36 +343,22 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
InExecution = false;
|
InExecution = false;
|
||||||
eventQueueManager.ReleaseLock(QIS.localID);
|
m_ScriptEngine.m_EventQueueManager.ReleaseLock(QIS.localID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
catch (ThreadAbortException tae)
|
|
||||||
{
|
|
||||||
eventQueueManager.m_ScriptEngine.Log.Info("[" + ScriptEngineName + "]: ThreadAbortException while executing function.");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: Exception in EventQueueThreadLoop: " + e.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ThreadAbortException)
|
|
||||||
{
|
|
||||||
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread killed: " + tae.Message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// If set to true then threads and stuff should try to make a graceful exit
|
///// If set to true then threads and stuff should try to make a graceful exit
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool PleaseShutdown
|
//public bool PleaseShutdown
|
||||||
{
|
//{
|
||||||
get { return _PleaseShutdown; }
|
// get { return _PleaseShutdown; }
|
||||||
set { _PleaseShutdown = value; }
|
// set { _PleaseShutdown = value; }
|
||||||
}
|
//}
|
||||||
private bool _PleaseShutdown = false;
|
//private bool _PleaseShutdown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -38,12 +39,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MaintenanceThread : iScriptEngineFunctionModule
|
public class MaintenanceThread : iScriptEngineFunctionModule
|
||||||
{
|
{
|
||||||
public ScriptEngine m_ScriptEngine;
|
//public ScriptEngine m_ScriptEngine;
|
||||||
private int MaintenanceLoopms;
|
private int MaintenanceLoopms;
|
||||||
|
private int MaintenanceLoopTicks_ScriptLoadUnload;
|
||||||
|
private int MaintenanceLoopTicks_Other;
|
||||||
|
|
||||||
public MaintenanceThread(ScriptEngine _ScriptEngine)
|
|
||||||
|
public MaintenanceThread()
|
||||||
{
|
{
|
||||||
m_ScriptEngine = _ScriptEngine;
|
//m_ScriptEngine = _ScriptEngine;
|
||||||
|
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
|
|
||||||
|
@ -57,8 +61,21 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadConfig()
|
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);
|
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 "
|
#region " Maintenance thread "
|
||||||
|
@ -90,7 +107,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
//m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called");
|
//m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called");
|
||||||
#endif
|
#endif
|
||||||
PleaseShutdown = true;
|
//PleaseShutdown = true;
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -105,17 +122,23 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ScriptEngine lastScriptEngine; // Keep track of what ScriptEngine instance we are at so we can give exception
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A thread should run in this loop and check all running scripts
|
/// A thread should run in this loop and check all running scripts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void MaintenanceLoop()
|
public void MaintenanceLoop()
|
||||||
{
|
{
|
||||||
if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms)
|
//if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms)
|
||||||
m_ScriptEngine.Log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " +
|
// m_ScriptEngine.Log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " +
|
||||||
"Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run.");
|
// "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_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks;
|
||||||
long Last_ReReadConfigFilens = 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)
|
while (true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -123,34 +146,56 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass
|
System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass
|
||||||
if (PleaseShutdown)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_ScriptEngine != null)
|
// 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++;
|
||||||
|
|
||||||
|
|
||||||
|
//lock (ScriptEngine.ScriptEngines)
|
||||||
|
//{
|
||||||
|
foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
|
||||||
|
{
|
||||||
|
lastScriptEngine = m_ScriptEngine;
|
||||||
// Re-reading config every x seconds
|
// Re-reading config every x seconds
|
||||||
|
if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other)
|
||||||
|
{
|
||||||
|
MaintenanceLoopTicks_Other_ResetCount = true;
|
||||||
if (m_ScriptEngine.RefreshConfigFilens > 0)
|
if (m_ScriptEngine.RefreshConfigFilens > 0)
|
||||||
{
|
{
|
||||||
// Check if its time to re-read config
|
// Check if its time to re-read config
|
||||||
if (DateTime.Now.Ticks - Last_ReReadConfigFilens > m_ScriptEngine.RefreshConfigFilens)
|
if (DateTime.Now.Ticks - Last_ReReadConfigFilens >
|
||||||
|
m_ScriptEngine.RefreshConfigFilens)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens );
|
//Console.WriteLine("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens );
|
||||||
// Its time to re-read config file
|
// Its time to re-read config file
|
||||||
m_ScriptEngine.ReadConfig();
|
m_ScriptEngine.ReadConfig();
|
||||||
Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
|
Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust number of running script threads if not correct
|
// Adjust number of running script threads if not correct
|
||||||
if (m_ScriptEngine.m_EventQueueManager != null)
|
if (m_ScriptEngine.m_EventQueueManager != null)
|
||||||
m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
|
m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
|
||||||
|
|
||||||
// Check if any script has exceeded its max execution time
|
// Check if any script has exceeded its max execution time
|
||||||
if (m_ScriptEngine.m_EventQueueManager != null && m_ScriptEngine.m_EventQueueManager.EnforceMaxExecutionTime)
|
if (EventQueueManager.EnforceMaxExecutionTime)
|
||||||
{
|
{
|
||||||
// We are enforcing execution time
|
// We are enforcing execution time
|
||||||
if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
|
if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
|
||||||
m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens)
|
EventQueueManager.maxFunctionExecutionTimens)
|
||||||
{
|
{
|
||||||
// Its time to check again
|
// Its time to check again
|
||||||
m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
|
m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
|
||||||
|
@ -159,24 +204,35 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload)
|
||||||
|
{
|
||||||
|
MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = true;
|
||||||
|
// LOAD / UNLOAD SCRIPTS
|
||||||
|
if (m_ScriptEngine.m_ScriptManager != null)
|
||||||
|
m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString());
|
if (lastScriptEngine != null)
|
||||||
|
lastScriptEngine.Log.Error("[" + lastScriptEngine.ScriptEngineName + "]: Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString());
|
||||||
Thread.Sleep(5000);
|
Thread.Sleep(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// If set to true then threads and stuff should try to make a graceful exit
|
///// If set to true then threads and stuff should try to make a graceful exit
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool PleaseShutdown
|
//public bool PleaseShutdown
|
||||||
{
|
//{
|
||||||
get { return _PleaseShutdown; }
|
// get { return _PleaseShutdown; }
|
||||||
set { _PleaseShutdown = value; }
|
// set { _PleaseShutdown = value; }
|
||||||
}
|
//}
|
||||||
private bool _PleaseShutdown = false;
|
//private bool _PleaseShutdown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
@ -44,15 +45,16 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule
|
public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule
|
||||||
{
|
{
|
||||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public static List<ScriptEngine> ScriptEngines = new List<ScriptEngine>();
|
||||||
public Scene World;
|
public Scene World;
|
||||||
public EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
public EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
||||||
public EventQueueManager m_EventQueueManager; // Executes events, handles script threads
|
public EventQueueManager m_EventQueueManager; // Executes events, handles script threads
|
||||||
public ScriptManager m_ScriptManager; // Load, unload and execute scripts
|
public ScriptManager m_ScriptManager; // Load, unload and execute scripts
|
||||||
public AppDomainManager m_AppDomainManager; // Handles loading/unloading of scripts into AppDomains
|
public AppDomainManager m_AppDomainManager; // Handles loading/unloading of scripts into AppDomains
|
||||||
public AsyncLSLCommandManager m_ASYNCLSLCommandManager; // Asyncronous LSL commands (commands that returns with an event)
|
public AsyncLSLCommandManager m_ASYNCLSLCommandManager; // Asyncronous LSL commands (commands that returns with an event)
|
||||||
public MaintenanceThread m_MaintenanceThread; // 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; // Thread that does different kinds of maintenance, for example refreshing config and killing scripts that has been running too long
|
||||||
|
|
||||||
public IConfigSource ConfigSource;
|
public IConfigSource ConfigSource;
|
||||||
public IConfig ScriptConfigSource;
|
public IConfig ScriptConfigSource;
|
||||||
|
@ -81,8 +83,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
|
|
||||||
public ScriptEngine()
|
public ScriptEngine()
|
||||||
{
|
{
|
||||||
//Common.SendToDebug("ScriptEngine Object Initialized");
|
Common.mySE = this; // For logging, just need any instance, doesn't matter
|
||||||
Common.mySE = this;
|
lock (ScriptEngines)
|
||||||
|
{
|
||||||
|
ScriptEngines.Add(this); // Keep a list of ScriptEngines for shared threads to process all instances
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager)
|
public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager)
|
||||||
|
@ -106,7 +111,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
m_ScriptManager = newScriptManager;
|
m_ScriptManager = newScriptManager;
|
||||||
m_AppDomainManager = new AppDomainManager(this);
|
m_AppDomainManager = new AppDomainManager(this);
|
||||||
m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this);
|
m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this);
|
||||||
m_MaintenanceThread = new MaintenanceThread(this);
|
if (m_MaintenanceThread == null)
|
||||||
|
m_MaintenanceThread = new MaintenanceThread();
|
||||||
|
|
||||||
m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\"");
|
m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\"");
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
|
@ -118,6 +124,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
// We are shutting down
|
// We are shutting down
|
||||||
|
lock (ScriptEngines)
|
||||||
|
{
|
||||||
|
ScriptEngines.Remove(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ScriptEngine.EventManager()
|
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ScriptEngine.EventManager()
|
||||||
|
@ -128,17 +138,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
public void ReadConfig()
|
public void ReadConfig()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
m_log.Debug("[" + ScriptEngineName + "]: Refreshing configuration for all modules");
|
//m_log.Debug("[" + ScriptEngineName + "]: Refreshing configuration for all modules");
|
||||||
#endif
|
#endif
|
||||||
RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30);
|
RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30);
|
||||||
|
|
||||||
// Reload from disk? No!
|
|
||||||
//ConfigSource.Reload();
|
|
||||||
//if (File.Exists(OpenSim.Application.iniFilePath))
|
|
||||||
//{
|
|
||||||
// //ConfigSource.Merge(new IniConfigSource(OpenSim.Application.iniFilePath));
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
// Create a new object (probably not necessary?)
|
// Create a new object (probably not necessary?)
|
||||||
// ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
|
// ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
|
||||||
|
@ -175,15 +178,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If set to true then threads and stuff should try to make a graceful exit
|
|
||||||
/// </summary>
|
|
||||||
public bool PleaseShutdown
|
|
||||||
{
|
|
||||||
get { return _PleaseShutdown; }
|
|
||||||
set { _PleaseShutdown = value; }
|
|
||||||
}
|
|
||||||
private bool _PleaseShutdown = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,14 +129,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
if (PrivateThread)
|
if (PrivateThread)
|
||||||
{
|
{
|
||||||
// Assign one thread per region
|
// Assign one thread per region
|
||||||
scriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
//scriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Shared thread - make sure one exist, then assign it to the private
|
// Shared thread - make sure one exist, then assign it to the private
|
||||||
if (staticScriptLoadUnloadThread == null)
|
if (staticScriptLoadUnloadThread == null)
|
||||||
{
|
{
|
||||||
staticScriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
//staticScriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
||||||
}
|
}
|
||||||
scriptLoadUnloadThread = staticScriptLoadUnloadThread;
|
scriptLoadUnloadThread = staticScriptLoadUnloadThread;
|
||||||
}
|
}
|
||||||
|
@ -169,15 +169,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
// Abort load/unload thread
|
// Abort load/unload thread
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PleaseShutdown = true;
|
//PleaseShutdown = true;
|
||||||
Thread.Sleep(100);
|
//Thread.Sleep(100);
|
||||||
if (scriptLoadUnloadThread != null)
|
if (scriptLoadUnloadThread != null && scriptLoadUnloadThread.IsAlive == true)
|
||||||
{
|
|
||||||
if (scriptLoadUnloadThread.IsAlive == true)
|
|
||||||
{
|
{
|
||||||
scriptLoadUnloadThread.Abort();
|
scriptLoadUnloadThread.Abort();
|
||||||
scriptLoadUnloadThread.Join();
|
//scriptLoadUnloadThread.Join();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -197,8 +194,21 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
{
|
{
|
||||||
if (LUQueue.Count == 0)
|
if (LUQueue.Count == 0)
|
||||||
Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
|
Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
|
||||||
if (PleaseShutdown)
|
//if (PleaseShutdown)
|
||||||
return;
|
// return;
|
||||||
|
DoScriptLoadUnload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException tae)
|
||||||
|
{
|
||||||
|
string a = tae.ToString();
|
||||||
|
a = String.Empty;
|
||||||
|
// Expected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoScriptLoadUnload()
|
||||||
|
{
|
||||||
if (LUQueue.Count > 0)
|
if (LUQueue.Count > 0)
|
||||||
{
|
{
|
||||||
LUStruct item = LUQueue.Dequeue();
|
LUStruct item = LUQueue.Dequeue();
|
||||||
|
@ -214,14 +224,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ThreadAbortException tae)
|
|
||||||
{
|
|
||||||
string a = tae.ToString();
|
|
||||||
a = String.Empty;
|
|
||||||
// Expected
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -418,15 +421,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// If set to true then threads and stuff should try to make a graceful exit
|
///// If set to true then threads and stuff should try to make a graceful exit
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool PleaseShutdown
|
//public bool PleaseShutdown
|
||||||
{
|
//{
|
||||||
get { return _PleaseShutdown; }
|
// get { return _PleaseShutdown; }
|
||||||
set { _PleaseShutdown = value; }
|
// set { _PleaseShutdown = value; }
|
||||||
}
|
//}
|
||||||
private bool _PleaseShutdown = false;
|
//private bool _PleaseShutdown = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
public interface iScriptEngineFunctionModule
|
public interface iScriptEngineFunctionModule
|
||||||
{
|
{
|
||||||
void ReadConfig();
|
void ReadConfig();
|
||||||
bool PleaseShutdown { get; set; }
|
// bool PleaseShutdown { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -171,8 +171,8 @@ msgformat = "PRIVMSG {0} : {3} - {1} of {2}"
|
||||||
; Refresh ScriptEngine config options (these settings) every xx seconds
|
; Refresh ScriptEngine config options (these settings) every xx seconds
|
||||||
; 0 = Do not refresh
|
; 0 = Do not refresh
|
||||||
; Set it to number of seconds between refresh, for example 30.
|
; Set it to number of seconds between refresh, for example 30.
|
||||||
; Will allow you to change ScriptEngine settings while server is running just by editing this file.
|
; 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.
|
; For example to increase or decrease number of threads: CONFIG SET NumberOfScriptThreads 10
|
||||||
; NOTE! Disabled for now. Feature does not work.
|
; NOTE! Disabled for now. Feature does not work.
|
||||||
RefreshConfig=0
|
RefreshConfig=0
|
||||||
|
|
||||||
|
@ -184,14 +184,6 @@ NumberOfScriptThreads=2
|
||||||
; Valid values: Lowest, BelowNormal, Normal, AboveNormal, Highest
|
; Valid values: Lowest, BelowNormal, Normal, AboveNormal, Highest
|
||||||
ScriptThreadPriority=BelowNormal
|
ScriptThreadPriority=BelowNormal
|
||||||
|
|
||||||
; Should the script threads be private for each region?
|
|
||||||
; true: Each region will get <NumberOfScriptThreads> dedicated to scripts within that region
|
|
||||||
; Number of threads will be <NumberOfScriptThreads>*<NumberOfRegions>
|
|
||||||
; false: All regions share <NumberOfScriptThreads> for all their scripts
|
|
||||||
; Note! If you run multiple script engines based on "OpenSim.Region.ScriptEngine.Common" then all of them will share the same threads.
|
|
||||||
; *** This setting will not work until you restart OpenSim
|
|
||||||
PrivateRegionThreads=false
|
|
||||||
|
|
||||||
; How long MAX should a script event be allowed to run (per event execution)?
|
; 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
|
; 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
|
; There is also a small speed penalty for every kill that is made
|
||||||
|
@ -218,15 +210,24 @@ SleepTimeIfNoScriptExecutionMs=50
|
||||||
; Each AppDomain has some memory overhead. But leaving dead scripts in memory also has memory overhead.
|
; Each AppDomain has some memory overhead. But leaving dead scripts in memory also has memory overhead.
|
||||||
ScriptsPerAppDomain=1
|
ScriptsPerAppDomain=1
|
||||||
|
|
||||||
; Script loading / unloading sleep
|
; 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
|
; 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
|
; 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
|
; But once active it will process all in queue before sleeping again
|
||||||
ScriptLoadUnloadLoopms=30
|
MaintenanceLoopTicks_ScriptLoadUnload=1
|
||||||
|
|
||||||
|
; Other tasks
|
||||||
|
; check if we need to reload config, adjust running config and enforce max execution time
|
||||||
|
MaintenanceLoopTicks_Other=10
|
||||||
|
|
||||||
; Loading and unloading of scripts is queued and processed by a separate thread.
|
|
||||||
; This thread can either be shared among all regions, or private (one thread per region)
|
|
||||||
PrivateScriptLoadUnloadThread=false
|
|
||||||
|
|
||||||
; Maximum number of items in load/unload queue before we start rejecting loads
|
; 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.
|
; Note that we will only be rejecting load. Unloads will still be able to queue.
|
||||||
|
|
|
@ -1,41 +1 @@
|
||||||
|
STARTUP COMPLETE
|
||||||
### ###
|
|
||||||
####### #### #######
|
|
||||||
############################
|
|
||||||
############################
|
|
||||||
###########################
|
|
||||||
#########################
|
|
||||||
#####################
|
|
||||||
###### ###### #######
|
|
||||||
##### #### ######
|
|
||||||
##### #### ######
|
|
||||||
###### ###### #######
|
|
||||||
######################
|
|
||||||
#######################
|
|
||||||
#########################
|
|
||||||
###########################
|
|
||||||
###########################
|
|
||||||
###########################
|
|
||||||
###########################
|
|
||||||
##########################
|
|
||||||
#########################
|
|
||||||
#######################
|
|
||||||
#####################
|
|
||||||
##################
|
|
||||||
#############
|
|
||||||
### ##### ### ## ### ###
|
|
||||||
####### ###### ## ### ###
|
|
||||||
### ## ## ## ## #### ####
|
|
||||||
## ### ## ### ### ## ### ## ## #### ####
|
|
||||||
### ## ####### ##### ###### #### ## #### ####
|
|
||||||
### ## ## ## ## # ## ## ###### ## ## # # ##
|
|
||||||
### ## ## ## ####### ## ## ### ## ## ### ##
|
|
||||||
## ### ## ## ## ## ## ## ## ## ## ### ##
|
|
||||||
### ### ### ## ## ## ## ## ### ### ## ## ### ##
|
|
||||||
####### ###### ##### ## ## ###### ## ## # ##
|
|
||||||
### ## ## ### ###
|
|
||||||
##
|
|
||||||
## STARTUP COMPLETE
|
|
||||||
|
|
||||||
http://opensimulator.org/wiki/FAQ
|
|
||||||
|
|
34
prebuild.xml
34
prebuild.xml
|
@ -147,6 +147,7 @@
|
||||||
|
|
||||||
<ReferencePath>../../../bin/</ReferencePath>
|
<ReferencePath>../../../bin/</ReferencePath>
|
||||||
<Reference name="System"/>
|
<Reference name="System"/>
|
||||||
|
<Reference name="libsecondlife.dll"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
|
@ -380,6 +381,7 @@
|
||||||
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
||||||
<Reference name="OpenSim.Framework" localCopy="false"/>
|
<Reference name="OpenSim.Framework" localCopy="false"/>
|
||||||
<Reference name="OpenSim.Framework.Console" localCopy="false"/>
|
<Reference name="OpenSim.Framework.Console" localCopy="false"/>
|
||||||
|
<Reference name="nunit.framework.dll" />
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
<Reference name="log4net"/>
|
<Reference name="log4net"/>
|
||||||
|
|
||||||
|
@ -478,6 +480,7 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
|
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
|
||||||
<Reference name="Ode.NET.dll" localCopy="false" />
|
<Reference name="Ode.NET.dll" localCopy="false" />
|
||||||
|
<Reference name="nunit.framework.dll" />
|
||||||
<Reference name="log4net"/>
|
<Reference name="log4net"/>
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
|
@ -752,6 +755,7 @@
|
||||||
<Reference name="OpenSim.Framework.Servers"/>
|
<Reference name="OpenSim.Framework.Servers"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
|
<Reference name="OpenSim.Framework.Statistics"/>
|
||||||
<Reference name="OpenSim.Region.Communications.Local"/>
|
<Reference name="OpenSim.Region.Communications.Local"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="XMLRPC.dll"/>
|
<Reference name="XMLRPC.dll"/>
|
||||||
|
@ -1506,36 +1510,6 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
<Project name="LaunchSLClient" path="OpenSim/Tools/LaunchSLClient" type="Exe">
|
|
||||||
<Configuration name="Debug">
|
|
||||||
<Options>
|
|
||||||
<OutputPath>../../../bin/</OutputPath>
|
|
||||||
</Options>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration name="Release">
|
|
||||||
<Options>
|
|
||||||
<OutputPath>../../../bin/</OutputPath>
|
|
||||||
</Options>
|
|
||||||
</Configuration>
|
|
||||||
|
|
||||||
<ReferencePath>../../../bin/</ReferencePath>
|
|
||||||
<Reference name="System" localCopy="false"/>
|
|
||||||
<Reference name="System.IO" localCopy="false"/>
|
|
||||||
<Reference name="System.Collections" localCopy="false"/>
|
|
||||||
<Reference name="System.Collections.Generic" localCopy="false"/>
|
|
||||||
<Reference name="System.ComponentModel" localCopy="false"/>
|
|
||||||
<Reference name="System.Data" localCopy="false"/>
|
|
||||||
<Reference name="System.Diagnostics" localCopy="false"/>
|
|
||||||
<Reference name="System.Drawing" localCopy="false"/>
|
|
||||||
<Reference name="System.Text" localCopy="false"/>
|
|
||||||
<Reference name="System.Text.RegularExpressions" localCopy="false"/>
|
|
||||||
<Reference name="System.Windows.Forms" localCopy="false"/>
|
|
||||||
<Reference name="Microsoft.Win32" localCopy="false"/>
|
|
||||||
|
|
||||||
<Files>
|
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
|
||||||
</Files>
|
|
||||||
</Project>
|
|
||||||
</Solution>
|
</Solution>
|
||||||
|
|
||||||
<!-- Prebuild tool -->
|
<!-- Prebuild tool -->
|
||||||
|
|
Loading…
Reference in New Issue