From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001
From: teravus
Date: Thu, 15 Nov 2012 10:05:16 -0500
Subject: Revert "Merge master into teravuswork", it should have been
avination, not master.
This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing
changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64.
---
OpenSim/Framework/AssetPermissions.cs | 84 -----
OpenSim/Framework/AvatarAppearance.cs | 3 -
OpenSim/Framework/Cache.cs | 83 ++---
OpenSim/Framework/Client/IClientChat.cs | 7 +-
OpenSim/Framework/Console/ConsoleUtil.cs | 228 ------------
OpenSim/Framework/Constants.cs | 1 -
OpenSim/Framework/EstateSettings.cs | 10 +-
OpenSim/Framework/GridInstantMessage.cs | 9 +-
OpenSim/Framework/IClientAPI.cs | 46 +--
OpenSim/Framework/InventoryFolderBase.cs | 18 +-
OpenSim/Framework/LandData.cs | 385 +++++++--------------
OpenSim/Framework/Monitoring/BaseStatsCollector.cs | 23 +-
OpenSim/Framework/Monitoring/MemoryWatchdog.cs | 10 +-
.../Framework/Monitoring/SimExtraStatsCollector.cs | 19 +-
OpenSim/Framework/Monitoring/StatsManager.cs | 360 -------------------
OpenSim/Framework/Monitoring/Watchdog.cs | 35 +-
OpenSim/Framework/PacketPool.cs | 247 +++++++++++++
OpenSim/Framework/Pool.cs | 91 -----
OpenSim/Framework/RegionFlags.cs | 53 ---
OpenSim/Framework/RegionInfo.cs | 72 +---
.../Framework/Serialization/ArchiveConstants.cs | 5 -
.../Serialization/External/OspResolver.cs | 14 +-
OpenSim/Framework/Servers/BaseOpenSimServer.cs | 43 ++-
.../Framework/Servers/HttpServer/BaseHttpServer.cs | 274 ++++++---------
.../Servers/HttpServer/Interfaces/IHttpServer.cs | 22 +-
OpenSim/Framework/Servers/MainServer.cs | 148 +-------
OpenSim/Framework/Servers/VersionInfo.cs | 2 +-
OpenSim/Framework/TaskInventoryDictionary.cs | 4 +-
OpenSim/Framework/TaskInventoryItem.cs | 19 +-
OpenSim/Framework/Util.cs | 51 ---
OpenSim/Framework/WebUtil.cs | 81 +----
31 files changed, 639 insertions(+), 1808 deletions(-)
delete mode 100644 OpenSim/Framework/AssetPermissions.cs
delete mode 100644 OpenSim/Framework/Console/ConsoleUtil.cs
create mode 100644 OpenSim/Framework/PacketPool.cs
delete mode 100644 OpenSim/Framework/Pool.cs
delete mode 100644 OpenSim/Framework/RegionFlags.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/AssetPermissions.cs b/OpenSim/Framework/AssetPermissions.cs
deleted file mode 100644
index 4a905c2..0000000
--- a/OpenSim/Framework/AssetPermissions.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-using Nini.Config;
-using log4net;
-
-using OpenMetaverse;
-
-namespace OpenSim.Framework
-{
- public class AssetPermissions
- {
- private static readonly ILog m_log =
- LogManager.GetLogger(
- MethodBase.GetCurrentMethod().DeclaringType);
-
- private bool[] m_DisallowExport, m_DisallowImport;
- private string[] m_AssetTypeNames;
-
- public AssetPermissions(IConfig config)
- {
- Type enumType = typeof(AssetType);
- m_AssetTypeNames = Enum.GetNames(enumType);
- for (int i = 0; i < m_AssetTypeNames.Length; i++)
- m_AssetTypeNames[i] = m_AssetTypeNames[i].ToLower();
- int n = Enum.GetValues(enumType).Length;
- m_DisallowExport = new bool[n];
- m_DisallowImport = new bool[n];
-
- LoadPermsFromConfig(config, "DisallowExport", m_DisallowExport);
- LoadPermsFromConfig(config, "DisallowImport", m_DisallowImport);
-
- }
-
- private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray)
- {
- if (assetConfig == null)
- return;
-
- string perms = assetConfig.GetString(variable, String.Empty);
- string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string s in parts)
- {
- int index = Array.IndexOf(m_AssetTypeNames, s.Trim().ToLower());
- if (index >= 0)
- bitArray[index] = true;
- else
- m_log.WarnFormat("[Asset Permissions]: Invalid AssetType {0}", s);
- }
-
- }
-
- public bool AllowedExport(sbyte type)
- {
- string assetTypeName = ((AssetType)type).ToString();
-
- int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower());
- if (index >= 0 && m_DisallowExport[index])
- {
- m_log.DebugFormat("[Asset Permissions]: Export denied: configuration does not allow export of AssetType {0}", assetTypeName);
- return false;
- }
-
- return true;
- }
-
- public bool AllowedImport(sbyte type)
- {
- string assetTypeName = ((AssetType)type).ToString();
-
- int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower());
- if (index >= 0 && m_DisallowImport[index])
- {
- m_log.DebugFormat("[Asset Permissions]: Import denied: configuration does not allow import of AssetType {0}", assetTypeName);
- return false;
- }
-
- return true;
- }
-
-
- }
-}
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 1638541..c5d9641 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -358,9 +358,6 @@ namespace OpenSim.Framework
SetVisualParams(visualParams);
}
- ///
- /// Set avatar height by a calculation based on their visual parameters.
- ///
public virtual void SetHeight()
{
// Start with shortest possible female avatar height
diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs
index 31cab4a..79e20fc 100644
--- a/OpenSim/Framework/Cache.cs
+++ b/OpenSim/Framework/Cache.cs
@@ -199,14 +199,7 @@ namespace OpenSim.Framework
//
public class Cache
{
- ///
- /// Must only be accessed under lock.
- ///
private List m_Index = new List();
-
- ///
- /// Must only be accessed under m_Index lock.
- ///
private Dictionary m_Lookup =
new Dictionary();
@@ -327,19 +320,19 @@ namespace OpenSim.Framework
{
if (m_Lookup.ContainsKey(index))
item = m_Lookup[index];
+ }
- if (item == null)
- {
- Expire(true);
- return null;
- }
-
- item.hits++;
- item.lastUsed = DateTime.Now;
-
+ if (item == null)
+ {
Expire(true);
+ return null;
}
+ item.hits++;
+ item.lastUsed = DateTime.Now;
+
+ Expire(true);
+
return item;
}
@@ -392,10 +385,7 @@ namespace OpenSim.Framework
//
public Object Find(Predicate d)
{
- CacheItemBase item;
-
- lock (m_Index)
- item = m_Index.Find(d);
+ CacheItemBase item = m_Index.Find(d);
if (item == null)
return null;
@@ -429,12 +419,12 @@ namespace OpenSim.Framework
public virtual void Store(string index, Object data, Type container,
Object[] parameters)
{
+ Expire(false);
+
CacheItemBase item;
lock (m_Index)
{
- Expire(false);
-
if (m_Index.Contains(new CacheItemBase(index)))
{
if ((m_Flags & CacheFlags.AllowUpdate) != 0)
@@ -460,17 +450,9 @@ namespace OpenSim.Framework
m_Index.Add(item);
m_Lookup[index] = item;
}
-
item.Store(data);
}
- ///
- /// Expire items as appropriate.
- ///
- ///
- /// Callers must lock m_Index.
- ///
- ///
protected virtual void Expire(bool getting)
{
if (getting && (m_Strategy == CacheStrategy.Aggressive))
@@ -493,10 +475,12 @@ namespace OpenSim.Framework
switch (m_Strategy)
{
- case CacheStrategy.Aggressive:
- if (Count < Size)
- return;
+ case CacheStrategy.Aggressive:
+ if (Count < Size)
+ return;
+ lock (m_Index)
+ {
m_Index.Sort(new SortLRU());
m_Index.Reverse();
@@ -506,7 +490,7 @@ namespace OpenSim.Framework
ExpireDelegate doExpire = OnExpire;
- if (doExpire != null)
+ if (doExpire != null)
{
List candidates =
m_Index.GetRange(target, Count - target);
@@ -529,34 +513,27 @@ namespace OpenSim.Framework
foreach (CacheItemBase item in m_Index)
m_Lookup[item.uuid] = item;
}
-
- break;
-
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
}
public void Invalidate(string uuid)
{
- lock (m_Index)
- {
- if (!m_Lookup.ContainsKey(uuid))
- return;
+ if (!m_Lookup.ContainsKey(uuid))
+ return;
- CacheItemBase item = m_Lookup[uuid];
- m_Lookup.Remove(uuid);
- m_Index.Remove(item);
- }
+ CacheItemBase item = m_Lookup[uuid];
+ m_Lookup.Remove(uuid);
+ m_Index.Remove(item);
}
public void Clear()
{
- lock (m_Index)
- {
- m_Index.Clear();
- m_Lookup.Clear();
- }
+ m_Index.Clear();
+ m_Lookup.Clear();
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/Client/IClientChat.cs b/OpenSim/Framework/Client/IClientChat.cs
index 86b1faa..078ea9b 100644
--- a/OpenSim/Framework/Client/IClientChat.cs
+++ b/OpenSim/Framework/Client/IClientChat.cs
@@ -33,8 +33,7 @@ namespace OpenSim.Framework.Client
{
event ChatMessage OnChatFromClient;
- void SendChatMessage(
- string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
- byte audible);
+ void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
+ byte audible);
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
deleted file mode 100644
index 16a63e0..0000000
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using log4net;
-using OpenMetaverse;
-
-namespace OpenSim.Framework.Console
-{
- public class ConsoleUtil
- {
- // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public const int LocalIdNotFound = 0;
-
- ///
- /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section
- /// rather than in each help summary.
- ///
- public const string CoordHelp
- = @"Each component of the coord is comma separated. There must be no spaces between the commas.
- If you don't care about the z component you can simply omit it.
- If you don't care about the x or y components then you can leave them blank (though a comma is still required)
- If you want to specify the maxmimum value of a component then you can use ~ instead of a number
- If you want to specify the minimum value of a component then you can use -~ instead of a number
- e.g.
- delete object pos 20,20,20 to 40,40,40
- delete object pos 20,20 to 40,40
- delete object pos ,20,20 to ,40,40
- delete object pos ,,30 to ,,~
- delete object pos ,,-~ to ,,30";
-
- public const string MinRawConsoleVectorValue = "-~";
- public const string MaxRawConsoleVectorValue = "~";
-
- public const string VectorSeparator = ",";
- public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
-
- ///
- /// Check if the given file path exists.
- ///
- /// If not, warning is printed to the given console.
- /// true if the file does not exist, false otherwise.
- ///
- ///
- public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
- {
- if (File.Exists(path))
- {
- console.OutputFormat("File {0} already exists. Please move or remove it.", path);
- return false;
- }
-
- return true;
- }
-
- ///
- /// Try to parse a console UUID from the console.
- ///
- ///
- /// Will complain to the console if parsing fails.
- ///
- ///
- /// If null then no complaint is printed.
- ///
- ///
- public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid)
- {
- if (!UUID.TryParse(rawUuid, out uuid))
- {
- if (console != null)
- console.OutputFormat("{0} is not a valid uuid", rawUuid);
-
- return false;
- }
-
- return true;
- }
-
- public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId)
- {
- if (!uint.TryParse(rawLocalId, out localId))
- {
- if (console != null)
- console.OutputFormat("{0} is not a valid local id", localId);
-
- return false;
- }
-
- if (localId == 0)
- {
- if (console != null)
- console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId);
-
- return false;
- }
-
- return true;
- }
-
- ///
- /// Tries to parse the input as either a UUID or a local ID.
- ///
- /// true if parsing succeeded, false otherwise.
- ///
- ///
- ///
- ///
- /// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded.
- ///
- public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId)
- {
- if (TryParseConsoleUuid(null, rawId, out uuid))
- {
- localId = LocalIdNotFound;
- return true;
- }
-
- if (TryParseConsoleLocalId(null, rawId, out localId))
- {
- return true;
- }
-
- if (console != null)
- console.OutputFormat("{0} is not a valid UUID or local id", rawId);
-
- return false;
- }
-
- ///
- /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
- ///
- /// /param>
- ///
- ///
- public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector)
- {
- return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector);
- }
-
- ///
- /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3
- ///
- /// /param>
- ///
- ///
- public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector)
- {
- return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector);
- }
-
- ///
- /// Convert a vector input from the console to an OpenMetaverse.Vector3
- ///
- ///
- /// A string in the form ,, where there is no space between values.
- /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value
- /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40)
- /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue
- /// Other than that, component values must be numeric.
- ///
- ///
- ///
- ///
- public static bool TryParseConsoleVector(
- string rawConsoleVector, Func blankComponentFunc, out Vector3 vector)
- {
- List components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
-
- if (components.Count < 1 || components.Count > 3)
- {
- vector = Vector3.Zero;
- return false;
- }
-
- for (int i = components.Count; i < 3; i++)
- components.Add("");
-
- List semiDigestedComponents
- = components.ConvertAll(
- c =>
- {
- if (c == "")
- return blankComponentFunc.Invoke(c);
- else if (c == MaxRawConsoleVectorValue)
- return float.MaxValue.ToString();
- else if (c == MinRawConsoleVectorValue)
- return float.MinValue.ToString();
- else
- return c;
- });
-
- string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray());
-
- // m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector);
-
- return Vector3.TryParse(semiDigestedConsoleVector, out vector);
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
index a2eb5ee..1b1aaf2 100644
--- a/OpenSim/Framework/Constants.cs
+++ b/OpenSim/Framework/Constants.cs
@@ -31,7 +31,6 @@ namespace OpenSim.Framework
public class Constants
{
public const uint RegionSize = 256;
- public const uint RegionHeight = 4096;
public const byte TerrainPatchSize = 16;
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index e03750b..9020761 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -419,11 +419,11 @@ namespace OpenSim.Framework
public void SetFromFlags(ulong regionFlags)
{
- ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport);
- BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell);
- AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark);
- AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges);
- AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome);
+ ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport);
+ BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell);
+ AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark);
+ AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges);
+ AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome);
}
public bool GroupAccess(UUID groupID)
diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs
index 6ae0488..a6bf6e3 100644
--- a/OpenSim/Framework/GridInstantMessage.cs
+++ b/OpenSim/Framework/GridInstantMessage.cs
@@ -44,6 +44,7 @@ namespace OpenSim.Framework
public Vector3 Position;
public byte[] binaryBucket;
+
public uint ParentEstateID;
public Guid RegionID;
public uint timestamp;
@@ -57,7 +58,7 @@ namespace OpenSim.Framework
string _fromAgentName, UUID _toAgentID,
byte _dialog, bool _fromGroup, string _message,
UUID _imSessionID, bool _offline, Vector3 _position,
- byte[] _binaryBucket, bool addTimestamp)
+ byte[] _binaryBucket)
{
fromAgentID = _fromAgentID.Guid;
fromAgentName = _fromAgentName;
@@ -78,9 +79,7 @@ namespace OpenSim.Framework
ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID;
RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid;
}
-
- if (addTimestamp)
- timestamp = (uint)Util.UnixTimeSinceEpoch();
+ timestamp = (uint)Util.UnixTimeSinceEpoch();
}
public GridInstantMessage(IScene scene, UUID _fromAgentID,
@@ -88,7 +87,7 @@ namespace OpenSim.Framework
string _message, bool _offline,
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
_toAgentID, _dialog, false, _message,
- _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true)
+ _fromAgentID ^ _toAgentID, _offline, _position, new byte[0])
{
}
}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 1c6685a..e31c7f6 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -815,23 +815,8 @@ namespace OpenSim.Framework
event Action OnRegionHandShakeReply;
event GenericCall1 OnRequestWearables;
event Action OnCompleteMovementToRegion;
-
- ///
- /// Called when an AgentUpdate message is received and before OnAgentUpdate.
- ///
- ///
- /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates.
- ///
event UpdateAgent OnPreAgentUpdate;
-
- ///
- /// Called when an AgentUpdate message is received and after OnPreAgentUpdate.
- ///
- ///
- /// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates.
- ///
event UpdateAgent OnAgentUpdate;
-
event AgentRequestSit OnAgentRequestSit;
event AgentSit OnAgentSit;
event AvatarPickerRequest OnAvatarPickerRequest;
@@ -1061,21 +1046,8 @@ namespace OpenSim.Framework
void InPacket(object NewPack);
void ProcessInPacket(Packet NewPack);
-
- ///
- /// Close this client
- ///
void Close();
-
- ///
- /// Close this client
- ///
- ///
- /// If true, attempts the close without checking active status. You do not want to try this except as a last
- /// ditch attempt where Active == false but the ScenePresence still exists.
- ///
- void Close(bool sendStop, bool force);
-
+ void Close(bool sendStop);
void Kick(string message);
///
@@ -1112,20 +1084,8 @@ namespace OpenSim.Framework
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
- ///
- /// Send chat to the viewer.
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- void SendChatMessage(
- string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
- byte audible);
+ void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
+ byte audible);
void SendInstantMessage(GridInstantMessage im);
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs
index b3457a6..a12183c 100644
--- a/OpenSim/Framework/InventoryFolderBase.cs
+++ b/OpenSim/Framework/InventoryFolderBase.cs
@@ -73,27 +73,33 @@ namespace OpenSim.Framework
{
}
- public InventoryFolderBase(UUID id) : this()
+ public InventoryFolderBase(UUID id)
{
ID = id;
}
- public InventoryFolderBase(UUID id, UUID owner) : this(id)
+ public InventoryFolderBase(UUID id, UUID owner)
{
+ ID = id;
Owner = owner;
}
- public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner)
+ public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
{
+ ID = id;
Name = name;
+ Owner = owner;
ParentID = parent;
}
- public InventoryFolderBase(
- UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent)
+ public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
{
+ ID = id;
+ Name = name;
+ Owner = owner;
Type = type;
+ ParentID = parent;
Version = version;
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 4dffd3f..dcaa46d 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Framework
// use only one serializer to give the runtime a chance to
// optimize it (it won't do that if you use a new instance
// every time)
- private static XmlSerializer serializer = new XmlSerializer(typeof(LandData));
-
+ private static XmlSerializer serializer = new XmlSerializer(typeof (LandData));
+
private Vector3 _AABBMax = new Vector3();
private Vector3 _AABBMin = new Vector3();
private int _area = 0;
@@ -65,11 +65,11 @@ namespace OpenSim.Framework
private byte[] _bitmap = new byte[512];
private string _description = String.Empty;
- private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark |
- (uint)ParcelFlags.AllowAPrimitiveEntry |
- (uint)ParcelFlags.AllowDeedToGroup |
- (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts |
- (uint)ParcelFlags.AllowVoiceChat;
+ private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
+ (uint) ParcelFlags.AllowAPrimitiveEntry |
+ (uint) ParcelFlags.AllowDeedToGroup |
+ (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
+ (uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat;
private byte _landingType = 0;
private string _name = "Your Parcel";
@@ -97,36 +97,16 @@ namespace OpenSim.Framework
private bool _mediaLoop = false;
private bool _obscureMusic = false;
private bool _obscureMedia = false;
- private float _dwell = 0;
-
- ///
- /// Traffic count of parcel
- ///
- [XmlIgnore]
- public float Dwell
- {
- get
- {
- return _dwell;
- }
- set
- {
- _dwell = value;
- }
- }
///
/// Whether to obscure parcel media URL
///
[XmlIgnore]
- public bool ObscureMedia
- {
- get
- {
+ public bool ObscureMedia {
+ get {
return _obscureMedia;
}
- set
- {
+ set {
_obscureMedia = value;
}
}
@@ -135,14 +115,11 @@ namespace OpenSim.Framework
/// Whether to obscure parcel music URL
///
[XmlIgnore]
- public bool ObscureMusic
- {
- get
- {
+ public bool ObscureMusic {
+ get {
return _obscureMusic;
}
- set
- {
+ set {
_obscureMusic = value;
}
}
@@ -151,14 +128,11 @@ namespace OpenSim.Framework
/// Whether to loop parcel media
///
[XmlIgnore]
- public bool MediaLoop
- {
- get
- {
+ public bool MediaLoop {
+ get {
return _mediaLoop;
}
- set
- {
+ set {
_mediaLoop = value;
}
}
@@ -167,14 +141,11 @@ namespace OpenSim.Framework
/// Height of parcel media render
///
[XmlIgnore]
- public int MediaHeight
- {
- get
- {
+ public int MediaHeight {
+ get {
return _mediaHeight;
}
- set
- {
+ set {
_mediaHeight = value;
}
}
@@ -183,14 +154,11 @@ namespace OpenSim.Framework
/// Width of parcel media render
///
[XmlIgnore]
- public int MediaWidth
- {
- get
- {
+ public int MediaWidth {
+ get {
return _mediaWidth;
}
- set
- {
+ set {
_mediaWidth = value;
}
}
@@ -199,14 +167,11 @@ namespace OpenSim.Framework
/// Upper corner of the AABB for the parcel
///
[XmlIgnore]
- public Vector3 AABBMax
- {
- get
- {
+ public Vector3 AABBMax {
+ get {
return _AABBMax;
}
- set
- {
+ set {
_AABBMax = value;
}
}
@@ -214,14 +179,11 @@ namespace OpenSim.Framework
/// Lower corner of the AABB for the parcel
///
[XmlIgnore]
- public Vector3 AABBMin
- {
- get
- {
+ public Vector3 AABBMin {
+ get {
return _AABBMin;
}
- set
- {
+ set {
_AABBMin = value;
}
}
@@ -229,14 +191,11 @@ namespace OpenSim.Framework
///
/// Area in meters^2 the parcel contains
///
- public int Area
- {
- get
- {
+ public int Area {
+ get {
return _area;
}
- set
- {
+ set {
_area = value;
}
}
@@ -244,14 +203,11 @@ namespace OpenSim.Framework
///
/// ID of auction (3rd Party Integration) when parcel is being auctioned
///
- public uint AuctionID
- {
- get
- {
+ public uint AuctionID {
+ get {
return _auctionID;
}
- set
- {
+ set {
_auctionID = value;
}
}
@@ -259,14 +215,11 @@ namespace OpenSim.Framework
///
/// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it.
///
- public UUID AuthBuyerID
- {
- get
- {
+ public UUID AuthBuyerID {
+ get {
return _authBuyerID;
}
- set
- {
+ set {
_authBuyerID = value;
}
}
@@ -274,14 +227,11 @@ namespace OpenSim.Framework
///
/// Category of parcel. Used for classifying the parcel in classified listings
///
- public ParcelCategory Category
- {
- get
- {
+ public ParcelCategory Category {
+ get {
return _category;
}
- set
- {
+ set {
_category = value;
}
}
@@ -289,14 +239,11 @@ namespace OpenSim.Framework
///
/// Date that the current owner purchased or claimed the parcel
///
- public int ClaimDate
- {
- get
- {
+ public int ClaimDate {
+ get {
return _claimDate;
}
- set
- {
+ set {
_claimDate = value;
}
}
@@ -304,14 +251,11 @@ namespace OpenSim.Framework
///
/// The last price that the parcel was sold at
///
- public int ClaimPrice
- {
- get
- {
+ public int ClaimPrice {
+ get {
return _claimPrice;
}
- set
- {
+ set {
_claimPrice = value;
}
}
@@ -319,14 +263,11 @@ namespace OpenSim.Framework
///
/// Global ID for the parcel. (3rd Party Integration)
///
- public UUID GlobalID
- {
- get
- {
+ public UUID GlobalID {
+ get {
return _globalID;
}
- set
- {
+ set {
_globalID = value;
}
}
@@ -334,14 +275,11 @@ namespace OpenSim.Framework
///
/// Unique ID of the Group that owns
///
- public UUID GroupID
- {
- get
- {
+ public UUID GroupID {
+ get {
return _groupID;
}
- set
- {
+ set {
_groupID = value;
}
}
@@ -349,14 +287,11 @@ namespace OpenSim.Framework
///
/// Returns true if the Land Parcel is owned by a group
///
- public bool IsGroupOwned
- {
- get
- {
+ public bool IsGroupOwned {
+ get {
return _isGroupOwned;
}
- set
- {
+ set {
_isGroupOwned = value;
}
}
@@ -364,14 +299,11 @@ namespace OpenSim.Framework
///
/// jp2 data for the image representative of the parcel in the parcel dialog
///
- public byte[] Bitmap
- {
- get
- {
+ public byte[] Bitmap {
+ get {
return _bitmap;
}
- set
- {
+ set {
_bitmap = value;
}
}
@@ -379,14 +311,11 @@ namespace OpenSim.Framework
///
/// Parcel Description
///
- public string Description
- {
- get
- {
+ public string Description {
+ get {
return _description;
}
- set
- {
+ set {
_description = value;
}
}
@@ -394,14 +323,11 @@ namespace OpenSim.Framework
///
/// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags
///
- public uint Flags
- {
- get
- {
+ public uint Flags {
+ get {
return _flags;
}
- set
- {
+ set {
_flags = value;
}
}
@@ -410,14 +336,11 @@ namespace OpenSim.Framework
/// Determines if people are able to teleport where they please on the parcel or if they
/// get constrainted to a specific point on teleport within the parcel
///
- public byte LandingType
- {
- get
- {
+ public byte LandingType {
+ get {
return _landingType;
}
- set
- {
+ set {
_landingType = value;
}
}
@@ -425,14 +348,11 @@ namespace OpenSim.Framework
///
/// Parcel Name
///
- public string Name
- {
- get
- {
+ public string Name {
+ get {
return _name;
}
- set
- {
+ set {
_name = value;
}
}
@@ -440,14 +360,11 @@ namespace OpenSim.Framework
///
/// Status of Parcel, Leased, Abandoned, For Sale
///
- public ParcelStatus Status
- {
- get
- {
+ public ParcelStatus Status {
+ get {
return _status;
}
- set
- {
+ set {
_status = value;
}
}
@@ -455,14 +372,11 @@ namespace OpenSim.Framework
///
/// Internal ID of the parcel. Sometimes the client will try to use this value
///
- public int LocalID
- {
- get
- {
+ public int LocalID {
+ get {
return _localID;
}
- set
- {
+ set {
_localID = value;
}
}
@@ -470,14 +384,11 @@ namespace OpenSim.Framework
///
/// Determines if we scale the media based on the surface it's on
///
- public byte MediaAutoScale
- {
- get
- {
+ public byte MediaAutoScale {
+ get {
return _mediaAutoScale;
}
- set
- {
+ set {
_mediaAutoScale = value;
}
}
@@ -485,14 +396,11 @@ namespace OpenSim.Framework
///
/// Texture Guid to replace with the output of the media stream
///
- public UUID MediaID
- {
- get
- {
+ public UUID MediaID {
+ get {
return _mediaID;
}
- set
- {
+ set {
_mediaID = value;
}
}
@@ -500,14 +408,11 @@ namespace OpenSim.Framework
///
/// URL to the media file to display
///
- public string MediaURL
- {
- get
- {
+ public string MediaURL {
+ get {
return _mediaURL;
}
- set
- {
+ set {
_mediaURL = value;
}
}
@@ -527,14 +432,11 @@ namespace OpenSim.Framework
///
/// URL to the shoutcast music stream to play on the parcel
///
- public string MusicURL
- {
- get
- {
+ public string MusicURL {
+ get {
return _musicURL;
}
- set
- {
+ set {
_musicURL = value;
}
}
@@ -543,14 +445,11 @@ namespace OpenSim.Framework
/// Owner Avatar or Group of the parcel. Naturally, all land masses must be
/// owned by someone
///
- public UUID OwnerID
- {
- get
- {
+ public UUID OwnerID {
+ get {
return _ownerID;
}
- set
- {
+ set {
_ownerID = value;
}
}
@@ -558,14 +457,11 @@ namespace OpenSim.Framework
///
/// List of access data for the parcel. User data, some bitflags, and a time
///
- public List ParcelAccessList
- {
- get
- {
+ public List ParcelAccessList {
+ get {
return _parcelAccessList;
}
- set
- {
+ set {
_parcelAccessList = value;
}
}
@@ -573,14 +469,11 @@ namespace OpenSim.Framework
///
/// How long in hours a Pass to the parcel is given
///
- public float PassHours
- {
- get
- {
+ public float PassHours {
+ get {
return _passHours;
}
- set
- {
+ set {
_passHours = value;
}
}
@@ -588,14 +481,11 @@ namespace OpenSim.Framework
///
/// Price to purchase a Pass to a restricted parcel
///
- public int PassPrice
- {
- get
- {
+ public int PassPrice {
+ get {
return _passPrice;
}
- set
- {
+ set {
_passPrice = value;
}
}
@@ -603,14 +493,11 @@ namespace OpenSim.Framework
///
/// When the parcel is being sold, this is the price to purchase the parcel
///
- public int SalePrice
- {
- get
- {
+ public int SalePrice {
+ get {
return _salePrice;
}
- set
- {
+ set {
_salePrice = value;
}
}
@@ -619,14 +506,11 @@ namespace OpenSim.Framework
/// Number of meters^2 in the Simulator
///
[XmlIgnore]
- public int SimwideArea
- {
- get
- {
+ public int SimwideArea {
+ get {
return _simwideArea;
}
- set
- {
+ set {
_simwideArea = value;
}
}
@@ -635,14 +519,11 @@ namespace OpenSim.Framework
/// Number of SceneObjectPart in the Simulator
///
[XmlIgnore]
- public int SimwidePrims
- {
- get
- {
+ public int SimwidePrims {
+ get {
return _simwidePrims;
}
- set
- {
+ set {
_simwidePrims = value;
}
}
@@ -650,14 +531,11 @@ namespace OpenSim.Framework
///
/// ID of the snapshot used in the client parcel dialog of the parcel
///
- public UUID SnapshotID
- {
- get
- {
+ public UUID SnapshotID {
+ get {
return _snapshotID;
}
- set
- {
+ set {
_snapshotID = value;
}
}
@@ -666,14 +544,11 @@ namespace OpenSim.Framework
/// When teleporting is restricted to a certain point, this is the location
/// that the user will be redirected to
///
- public Vector3 UserLocation
- {
- get
- {
+ public Vector3 UserLocation {
+ get {
return _userLocation;
}
- set
- {
+ set {
_userLocation = value;
}
}
@@ -682,14 +557,11 @@ namespace OpenSim.Framework
/// When teleporting is restricted to a certain point, this is the rotation
/// that the user will be positioned
///
- public Vector3 UserLookAt
- {
- get
- {
+ public Vector3 UserLookAt {
+ get {
return _userLookAt;
}
- set
- {
+ set {
_userLookAt = value;
}
}
@@ -698,14 +570,11 @@ namespace OpenSim.Framework
/// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
/// the parcel and isn't set to the same 'group' as the parcel.
///
- public int OtherCleanTime
- {
- get
- {
+ public int OtherCleanTime {
+ get {
return _otherCleanTime;
}
- set
- {
+ set {
_otherCleanTime = value;
}
}
@@ -713,14 +582,11 @@ namespace OpenSim.Framework
///
/// parcel media description
///
- public string MediaDescription
- {
- get
- {
+ public string MediaDescription {
+ get {
return _mediaDescription;
}
- set
- {
+ set {
_mediaDescription = value;
}
}
@@ -756,7 +622,7 @@ namespace OpenSim.Framework
landData._mediaURL = _mediaURL;
landData._musicURL = _musicURL;
landData._ownerID = _ownerID;
- landData._bitmap = (byte[])_bitmap.Clone();
+ landData._bitmap = (byte[]) _bitmap.Clone();
landData._description = _description;
landData._flags = _flags;
landData._name = _name;
@@ -777,7 +643,6 @@ namespace OpenSim.Framework
landData._obscureMedia = _obscureMedia;
landData._simwideArea = _simwideArea;
landData._simwidePrims = _simwidePrims;
- landData._dwell = _dwell;
landData._parcelAccessList.Clear();
foreach (LandAccessEntry entry in _parcelAccessList)
diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
index 446e3c0..9ee0876 100644
--- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
@@ -43,32 +43,27 @@ namespace OpenSim.Framework.Monitoring
StringBuilder sb = new StringBuilder(Environment.NewLine);
sb.Append("MEMORY STATISTICS");
sb.Append(Environment.NewLine);
- sb.AppendFormat(
+ sb.Append(
+ string.Format(
"Allocated to OpenSim objects: {0} MB\n",
- Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
-
- sb.AppendFormat(
- "OpenSim last object memory churn : {0} MB/s\n",
- Math.Round((MemoryWatchdog.LastMemoryChurn * 1000) / 1024.0 / 1024, 3));
-
- sb.AppendFormat(
- "OpenSim average object memory churn : {0} MB/s\n",
- Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3));
+ Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
Process myprocess = Process.GetCurrentProcess();
if (!myprocess.HasExited)
{
myprocess.Refresh();
- sb.AppendFormat(
+ sb.Append(
+ string.Format(
"Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0),
Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0),
- Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0));
- sb.AppendFormat(
+ Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0)));
+ sb.Append(
+ string.Format(
"Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0),
Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0),
- Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0));
+ Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0)));
}
else
sb.Append("Process reported as Exited \n");
diff --git a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
index c6010cd..a23cf1f 100644
--- a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
+++ b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Framework.Monitoring
private static bool m_enabled;
///
- /// Last memory churn in bytes per millisecond.
+ /// Average memory churn in bytes per millisecond.
///
public static double AverageMemoryChurn
{
@@ -68,14 +68,6 @@ namespace OpenSim.Framework.Monitoring
}
///
- /// Average memory churn in bytes per millisecond.
- ///
- public static double LastMemoryChurn
- {
- get { if (m_samples.Count > 0) return m_samples.Last(); else return 0; }
- }
-
- ///
/// Maximum number of statistical samples.
///
///
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
index aa86202..cdd7cc7 100644
--- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
@@ -355,25 +355,10 @@ Asset service request failures: {3}" + Environment.NewLine,
sb.Append(Environment.NewLine);
sb.Append(
string.Format(
- "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}\n\n",
+ "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}",
inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
-
- Dictionary> sceneStats;
-
- if (StatsManager.TryGetStats("scene", out sceneStats))
- {
- foreach (KeyValuePair> kvp in sceneStats)
- {
- foreach (Stat stat in kvp.Value.Values)
- {
- if (stat.Verbosity == StatVerbosity.Info)
- {
- sb.AppendFormat("{0} ({1}): {2}{3}\n", stat.Name, stat.Container, stat.Value, stat.UnitName);
- }
- }
- }
- }
+ sb.Append(Environment.NewLine);
/*
sb.Append(Environment.NewLine);
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 4844336..d78fa6a 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -25,9 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-using System;
-using System.Collections.Generic;
-
namespace OpenSim.Framework.Monitoring
{
///
@@ -35,24 +32,6 @@ namespace OpenSim.Framework.Monitoring
///
public class StatsManager
{
- // Subcommand used to list other stats.
- public const string AllSubCommand = "all";
-
- // Subcommand used to list other stats.
- public const string ListSubCommand = "list";
-
- // All subcommands
- public static HashSet SubCommands = new HashSet { AllSubCommand, ListSubCommand };
-
- ///
- /// Registered stats categorized by category/container/shortname
- ///
- ///
- /// Do not add or remove directly from this dictionary.
- ///
- public static Dictionary>> RegisteredStats
- = new Dictionary>>();
-
private static AssetStatsCollector assetStats;
private static UserStatsCollector userStats;
private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
@@ -61,75 +40,6 @@ namespace OpenSim.Framework.Monitoring
public static UserStatsCollector UserStats { get { return userStats; } }
public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
- public static void RegisterConsoleCommands(ICommandConsole console)
- {
- console.Commands.AddCommand(
- "General",
- false,
- "show stats",
- "show stats [list|all|]",
- "Show statistical information for this server",
- "If no final argument is specified then legacy statistics information is currently shown.\n"
- + "If list is specified then statistic categories are shown.\n"
- + "If all is specified then all registered statistics are shown.\n"
- + "If a category name is specified then only statistics from that category are shown.\n"
- + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
- HandleShowStatsCommand);
- }
-
- public static void HandleShowStatsCommand(string module, string[] cmd)
- {
- ICommandConsole con = MainConsole.Instance;
-
- if (cmd.Length > 2)
- {
- var categoryName = cmd[2];
-
- if (categoryName == AllSubCommand)
- {
- foreach (var category in RegisteredStats.Values)
- {
- OutputCategoryStatsToConsole(con, category);
- }
- }
- else if (categoryName == ListSubCommand)
- {
- con.Output("Statistic categories available are:");
- foreach (string category in RegisteredStats.Keys)
- con.OutputFormat(" {0}", category);
- }
- else
- {
- Dictionary> category;
- if (!RegisteredStats.TryGetValue(categoryName, out category))
- {
- con.OutputFormat("No such category as {0}", categoryName);
- }
- else
- {
- OutputCategoryStatsToConsole(con, category);
- }
- }
- }
- else
- {
- // Legacy
- con.Output(SimExtraStats.Report());
- }
- }
-
- private static void OutputCategoryStatsToConsole(
- ICommandConsole con, Dictionary> category)
- {
- foreach (var container in category.Values)
- {
- foreach (Stat stat in container.Values)
- {
- con.Output(stat.ToConsoleString());
- }
- }
- }
-
///
/// Start collecting statistics related to assets.
/// Should only be called once.
@@ -151,275 +61,5 @@ namespace OpenSim.Framework.Monitoring
return userStats;
}
-
- ///
- /// Registers a statistic.
- ///
- ///
- ///
- public static bool RegisterStat(Stat stat)
- {
- Dictionary> category = null, newCategory;
- Dictionary container = null, newContainer;
-
- lock (RegisteredStats)
- {
- // Stat name is not unique across category/container/shortname key.
- // XXX: For now just return false. This is to avoid problems in regression tests where all tests
- // in a class are run in the same instance of the VM.
- if (TryGetStat(stat, out category, out container))
- return false;
-
- // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
- // This means that we don't need to lock or copy them on iteration, which will be a much more
- // common operation after startup.
- if (container != null)
- newContainer = new Dictionary(container);
- else
- newContainer = new Dictionary();
-
- if (category != null)
- newCategory = new Dictionary>(category);
- else
- newCategory = new Dictionary>();
-
- newContainer[stat.ShortName] = stat;
- newCategory[stat.Container] = newContainer;
- RegisteredStats[stat.Category] = newCategory;
- }
-
- return true;
- }
-
- ///
- /// Deregister a statistic
- /// >
- ///
- /// > category = null, newCategory;
- Dictionary container = null, newContainer;
-
- lock (RegisteredStats)
- {
- if (!TryGetStat(stat, out category, out container))
- return false;
-
- newContainer = new Dictionary(container);
- newContainer.Remove(stat.ShortName);
-
- newCategory = new Dictionary>(category);
- newCategory.Remove(stat.Container);
-
- newCategory[stat.Container] = newContainer;
- RegisteredStats[stat.Category] = newCategory;
-
- return true;
- }
- }
-
- public static bool TryGetStats(string category, out Dictionary> stats)
- {
- return RegisteredStats.TryGetValue(category, out stats);
- }
-
- public static bool TryGetStat(
- Stat stat,
- out Dictionary> category,
- out Dictionary container)
- {
- category = null;
- container = null;
-
- lock (RegisteredStats)
- {
- if (RegisteredStats.TryGetValue(stat.Category, out category))
- {
- if (category.TryGetValue(stat.Container, out container))
- {
- if (container.ContainsKey(stat.ShortName))
- return true;
- }
- }
- }
-
- return false;
- }
- }
-
- ///
- /// Stat type.
- ///
- ///
- /// A push stat is one which is continually updated and so it's value can simply by read.
- /// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated.
- ///
- public enum StatType
- {
- Push,
- Pull
- }
-
- ///
- /// Verbosity of stat.
- ///
- ///
- /// Info will always be displayed.
- ///
- public enum StatVerbosity
- {
- Debug,
- Info
- }
-
- ///
- /// Holds individual static details
- ///
- public class Stat
- {
- ///
- /// Category of this stat (e.g. cache, scene, etc).
- ///
- public string Category { get; private set; }
-
- ///
- /// Containing name for this stat.
- /// FIXME: In the case of a scene, this is currently the scene name (though this leaves
- /// us with a to-be-resolved problem of non-unique region names).
- ///
- ///
- /// The container.
- ///
- public string Container { get; private set; }
-
- public StatType StatType { get; private set; }
-
- ///
- /// Action used to update this stat when the value is requested if it's a pull type.
- ///
- public Action PullAction { get; private set; }
-
- public StatVerbosity Verbosity { get; private set; }
- public string ShortName { get; private set; }
- public string Name { get; private set; }
- public string Description { get; private set; }
- public virtual string UnitName { get; private set; }
-
- public virtual double Value
- {
- get
- {
- // Asking for an update here means that the updater cannot access this value without infinite recursion.
- // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
- // called by the pull action and just return the value.
- if (StatType == StatType.Pull)
- PullAction(this);
-
- return m_value;
- }
-
- set
- {
- m_value = value;
- }
- }
-
- private double m_value;
-
- ///
- /// Constructor
- ///
- /// Short name for the stat. Must not contain spaces. e.g. "LongFrames"
- /// Human readable name for the stat. e.g. "Long frames"
- /// Description of stat
- ///
- /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
- /// e.g. " frames"
- ///
- /// Category under which this stat should appear, e.g. "scene". Do not capitalize.
- /// Entity to which this stat relates. e.g. scene name if this is a per scene stat.
- /// Push or pull
- /// Pull stats need an action to update the stat on request. Push stats should set null here.
- /// Verbosity of stat. Controls whether it will appear in short stat display or only full display.
- public Stat(
- string shortName,
- string name,
- string description,
- string unitName,
- string category,
- string container,
- StatType type,
- Action pullAction,
- StatVerbosity verbosity)
- {
- if (StatsManager.SubCommands.Contains(category))
- throw new Exception(
- string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
-
- ShortName = shortName;
- Name = name;
- Description = description;
- UnitName = unitName;
- Category = category;
- Container = container;
- StatType = type;
-
- if (StatType == StatType.Push && pullAction != null)
- throw new Exception("A push stat cannot have a pull action");
- else
- PullAction = pullAction;
-
- Verbosity = verbosity;
- }
-
- public virtual string ToConsoleString()
- {
- return string.Format(
- "{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName);
- }
- }
-
- public class PercentageStat : Stat
- {
- public int Antecedent { get; set; }
- public int Consequent { get; set; }
-
- public override double Value
- {
- get
- {
- int c = Consequent;
-
- // Avoid any chance of a multi-threaded divide-by-zero
- if (c == 0)
- return 0;
-
- return (double)Antecedent / c * 100;
- }
-
- set
- {
- throw new Exception("Cannot set value on a PercentageStat");
- }
- }
-
- public PercentageStat(
- string shortName,
- string name,
- string description,
- string category,
- string container,
- StatType type,
- Action pullAction,
- StatVerbosity verbosity)
- : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {}
-
- public override string ToConsoleString()
- {
- return string.Format(
- "{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})",
- Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
- }
}
}
\ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 28d6d5c..b709baa 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -89,17 +89,6 @@ namespace OpenSim.Framework.Monitoring
FirstTick = Environment.TickCount & Int32.MaxValue;
LastTick = FirstTick;
}
-
- public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
- {
- Thread = previousTwi.Thread;
- FirstTick = previousTwi.FirstTick;
- LastTick = previousTwi.LastTick;
- Timeout = previousTwi.Timeout;
- IsTimedOut = previousTwi.IsTimedOut;
- AlarmIfTimeout = previousTwi.AlarmIfTimeout;
- AlarmMethod = previousTwi.AlarmMethod;
- }
}
///
@@ -231,25 +220,7 @@ namespace OpenSim.Framework.Monitoring
private static bool RemoveThread(int threadID)
{
lock (m_threads)
- {
- ThreadWatchdogInfo twi;
- if (m_threads.TryGetValue(threadID, out twi))
- {
- m_log.DebugFormat(
- "[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
-
- m_threads.Remove(threadID);
-
- return true;
- }
- else
- {
- m_log.WarnFormat(
- "[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID);
-
- return false;
- }
- }
+ return m_threads.Remove(threadID);
}
public static bool AbortThread(int threadID)
@@ -364,9 +335,7 @@ namespace OpenSim.Framework.Monitoring
if (callbackInfos == null)
callbackInfos = new List();
- // Send a copy of the watchdog info to prevent race conditions where the watchdog
- // thread updates the monitoring info after an alarm has been sent out.
- callbackInfos.Add(new ThreadWatchdogInfo(threadInfo));
+ callbackInfos.Add(threadInfo);
}
}
}
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs
new file mode 100644
index 0000000..41d17c5
--- /dev/null
+++ b/OpenSim/Framework/PacketPool.cs
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using OpenMetaverse;
+using OpenMetaverse.Packets;
+using log4net;
+
+namespace OpenSim.Framework
+{
+
+ public sealed class PacketPool
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private static readonly PacketPool instance = new PacketPool();
+
+ private bool packetPoolEnabled = true;
+ private bool dataBlockPoolEnabled = true;
+
+ private readonly Dictionary> pool = new Dictionary>();
+
+ private static Dictionary> DataBlocks =
+ new Dictionary>();
+
+ static PacketPool()
+ {
+ }
+
+ public static PacketPool Instance
+ {
+ get { return instance; }
+ }
+
+ public bool RecyclePackets
+ {
+ set { packetPoolEnabled = value; }
+ get { return packetPoolEnabled; }
+ }
+
+ public bool RecycleDataBlocks
+ {
+ set { dataBlockPoolEnabled = value; }
+ get { return dataBlockPoolEnabled; }
+ }
+
+ public Packet GetPacket(PacketType type)
+ {
+ Packet packet;
+
+ if (!packetPoolEnabled)
+ return Packet.BuildPacket(type);
+
+ lock (pool)
+ {
+ if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0)
+ {
+ // Creating a new packet if we cannot reuse an old package
+ packet = Packet.BuildPacket(type);
+ }
+ else
+ {
+ // Recycle old packages
+ packet = (pool[type]).Pop();
+ }
+ }
+
+ return packet;
+ }
+
+ // private byte[] decoded_header = new byte[10];
+ private static PacketType GetType(byte[] bytes)
+ {
+ byte[] decoded_header = new byte[10 + 8];
+ ushort id;
+ PacketFrequency freq;
+
+ if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0)
+ {
+ Helpers.ZeroDecode(bytes, 16, decoded_header);
+ }
+ else
+ {
+ Buffer.BlockCopy(bytes, 0, decoded_header, 0, 10);
+ }
+
+ if (decoded_header[6] == 0xFF)
+ {
+ if (decoded_header[7] == 0xFF)
+ {
+ id = (ushort) ((decoded_header[8] << 8) + decoded_header[9]);
+ freq = PacketFrequency.Low;
+ }
+ else
+ {
+ id = decoded_header[7];
+ freq = PacketFrequency.Medium;
+ }
+ }
+ else
+ {
+ id = decoded_header[6];
+ freq = PacketFrequency.High;
+ }
+
+ return Packet.GetType(id, freq);
+ }
+
+ public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer)
+ {
+ PacketType type = GetType(bytes);
+
+ Array.Clear(zeroBuffer, 0, zeroBuffer.Length);
+
+ int i = 0;
+ Packet packet = GetPacket(type);
+ if (packet == null)
+ m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type);
+ else
+ packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer);
+
+ return packet;
+ }
+
+ ///
+ /// Return a packet to the packet pool
+ ///
+ ///
+ public void ReturnPacket(Packet packet)
+ {
+ if (dataBlockPoolEnabled)
+ {
+ switch (packet.Type)
+ {
+ case PacketType.ObjectUpdate:
+ ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
+
+ foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData)
+ ReturnDataBlock(oupod);
+
+ oup.ObjectData = null;
+ break;
+
+ case PacketType.ImprovedTerseObjectUpdate:
+ ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
+
+ foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData)
+ ReturnDataBlock(itoupod);
+
+ itoup.ObjectData = null;
+ break;
+ }
+ }
+
+ if (packetPoolEnabled)
+ {
+ switch (packet.Type)
+ {
+ // List pooling packets here
+ case PacketType.PacketAck:
+ case PacketType.ObjectUpdate:
+ case PacketType.ImprovedTerseObjectUpdate:
+ lock (pool)
+ {
+ PacketType type = packet.Type;
+
+ if (!pool.ContainsKey(type))
+ {
+ pool[type] = new Stack();
+ }
+
+ if ((pool[type]).Count < 50)
+ {
+ (pool[type]).Push(packet);
+ }
+ }
+ break;
+
+ // Other packets wont pool
+ default:
+ return;
+ }
+ }
+ }
+
+ public static T GetDataBlock() where T: new()
+ {
+ lock (DataBlocks)
+ {
+ Stack