From d1147136946daf14724183b3191119be44ff8b16 Mon Sep 17 00:00:00 2001 From: CasperW Date: Tue, 24 Nov 2009 18:02:12 +0100 Subject: Drop all locking of part.TaskInventory in favour of a ReaderWriterLockSlim lock handler. This gives us: - Faster prim inventory actions. Multiple threads can read at once. - Fixes the known prim inventory thread locks - In the event of a thread lock occurring, it will usually self heal after sixty seconds with an error message in the console --- OpenSim/Framework/TaskInventoryDictionary.cs | 111 +++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 25ae6b0..efe5f0c 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -27,9 +27,12 @@ using System; using System.Collections.Generic; +using System.Threading; +using System.Reflection; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; +using log4net; using OpenMetaverse; namespace OpenSim.Framework @@ -45,6 +48,105 @@ namespace OpenSim.Framework // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private Thread LockedByThread; + /// + /// An advanced lock for inventory data + /// + private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); + + /// + /// Are we readlocked by the calling thread? + /// + public bool IsReadLockedByMe() + { + if (m_itemLock.RecursiveReadCount > 0) + { + return true; + } + else + { + return false; + } + } + + /// + /// Lock our inventory list for reading (many can read, one can write) + /// + public void LockItemsForRead(bool locked) + { + if (locked) + { + if (m_itemLock.IsWriteLockHeld && LockedByThread != null) + { + if (!LockedByThread.IsAlive) + { + //Locked by dead thread, reset. + m_itemLock = new System.Threading.ReaderWriterLockSlim(); + } + } + + if (m_itemLock.RecursiveReadCount > 0) + { + m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); + m_itemLock.ExitReadLock(); + } + if (m_itemLock.RecursiveWriteCount > 0) + { + m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); + m_itemLock.ExitWriteLock(); + } + + while (!m_itemLock.TryEnterReadLock(60000)) + { + m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); + if (m_itemLock.IsWriteLockHeld) + { + m_itemLock = new System.Threading.ReaderWriterLockSlim(); + } + } + } + else + { + m_itemLock.ExitReadLock(); + } + } + + /// + /// Lock our inventory list for writing (many can read, one can write) + /// + public void LockItemsForWrite(bool locked) + { + if (locked) + { + //Enter a write lock, wait indefinately for one to open. + if (m_itemLock.RecursiveReadCount > 0) + { + m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); + m_itemLock.ExitReadLock(); + } + if (m_itemLock.RecursiveWriteCount > 0) + { + m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); + m_itemLock.ExitWriteLock(); + } + while (!m_itemLock.TryEnterWriteLock(60000)) + { + m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); + if (m_itemLock.IsWriteLockHeld) + { + m_itemLock = new System.Threading.ReaderWriterLockSlim(); + } + } + + LockedByThread = Thread.CurrentThread; + } + else + { + m_itemLock.ExitWriteLock(); + } + } #region ICloneable Members @@ -52,13 +154,12 @@ namespace OpenSim.Framework { TaskInventoryDictionary clone = new TaskInventoryDictionary(); - lock (this) + m_itemLock.EnterReadLock(); + foreach (UUID uuid in Keys) { - foreach (UUID uuid in Keys) - { - clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); - } + clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); } + m_itemLock.ExitReadLock(); return clone; } -- cgit v1.1 From a27d33cb634c78425eaa34cb5efd113e131baa51 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 26 Nov 2009 12:16:42 +0000 Subject: Remove the old remoting-type interregion code for prim/script crossing --- OpenSim/Framework/IRegionCommsListener.cs | 2 -- OpenSim/Framework/RegionCommsListener.cs | 25 ------------------------- 2 files changed, 27 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs index 307c6bc..cd59c63 100644 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ b/OpenSim/Framework/IRegionCommsListener.cs @@ -32,7 +32,6 @@ namespace OpenSim.Framework { public delegate void ExpectUserDelegate(AgentCircuitData agent); - public delegate bool ExpectPrimDelegate(UUID primID, string objData, int XMLMethod); public delegate void UpdateNeighbours(List neighbours); @@ -55,7 +54,6 @@ namespace OpenSim.Framework public interface IRegionCommsListener { event ExpectUserDelegate OnExpectUser; - event ExpectPrimDelegate OnExpectPrim; event GenericCall2 OnExpectChildAgent; event AgentCrossing OnAvatarCrossingIntoRegion; event PrimCrossing OnPrimCrossingIntoRegion; diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs index 90200d6..718a556 100644 --- a/OpenSim/Framework/RegionCommsListener.cs +++ b/OpenSim/Framework/RegionCommsListener.cs @@ -43,7 +43,6 @@ namespace OpenSim.Framework private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent; - private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; @@ -53,7 +52,6 @@ namespace OpenSim.Framework #region IRegionCommsListener Members public event ExpectUserDelegate OnExpectUser; - public event ExpectPrimDelegate OnExpectPrim; public event GenericCall2 OnExpectChildAgent; public event AgentCrossing OnAvatarCrossingIntoRegion; public event PrimCrossing OnPrimCrossingIntoRegion; @@ -95,17 +93,6 @@ namespace OpenSim.Framework } - public virtual bool TriggerExpectPrim(UUID primID, string objData, int XMLMethod) - { - handlerExpectPrim = OnExpectPrim; - if (handlerExpectPrim != null) - { - handlerExpectPrim(primID, objData, XMLMethod); - return true; - } - return false; - } - public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) { handlerChildAgentUpdate = OnChildAgentUpdate; @@ -128,18 +115,6 @@ namespace OpenSim.Framework return false; } - public virtual bool TriggerExpectPrimCrossing(UUID primID, Vector3 position, - bool isPhysical) - { - handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; - if (handlerPrimCrossingIntoRegion != null) - { - handlerPrimCrossingIntoRegion(primID, position, isPhysical); - return true; - } - return false; - } - public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID) { handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed; -- cgit v1.1 From bd3b9f79c2ac25c39d531c3d0c390eacab8ab958 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 26 Nov 2009 17:59:28 +0000 Subject: Update CM version --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index ec94b2d..0d4215b 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.9"; + private const string VERSION_NUMBER = "0.6.9-CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From ad2f0a1290b9260393a27291fdd8a1592222c368 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 26 Nov 2009 18:04:58 +0000 Subject: Remove OS version crap from about dialog --- OpenSim/Framework/Util.cs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 87ba5a8..c052745 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -990,19 +990,19 @@ namespace OpenSim.Framework { string os = String.Empty; - if (Environment.OSVersion.Platform != PlatformID.Unix) - { - os = Environment.OSVersion.ToString(); - } - else - { - os = ReadEtcIssue(); - } - - if (os.Length > 45) - { - os = os.Substring(0, 45); - } +// if (Environment.OSVersion.Platform != PlatformID.Unix) +// { +// os = Environment.OSVersion.ToString(); +// } +// else +// { +// os = ReadEtcIssue(); +// } +// +// if (os.Length > 45) +// { +// os = os.Substring(0, 45); +// } return os; } -- cgit v1.1 From cc8246206d5044aff0b306a4bcaf4b321fb826c9 Mon Sep 17 00:00:00 2001 From: KittoFlora Date: Sat, 5 Dec 2009 09:03:02 +0100 Subject: Secnond revision of Sit and Stand for unscripted prims; Comment out spammy debug messages in Interregion.... --- OpenSim/Framework/Servers/VersionInfo.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 0d4215b..f5be1e6 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,9 +29,8 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.9-CM"; - private const Flavour VERSION_FLAVOUR = Flavour.Dev; - + private const string VERSION_NUMBER = "112609s"; + private const Flavour VERSION_FLAVOUR = Flavour.BetaM7; public enum Flavour { Unknown, @@ -39,7 +38,8 @@ namespace OpenSim RC1, RC2, Release, - Post_Fixes + Post_Fixes, + BetaM7 } public static string Version -- cgit v1.1 From 172e2f4e7609c278d02ad83ca207fd79624db587 Mon Sep 17 00:00:00 2001 From: CasperW Date: Sun, 6 Dec 2009 17:23:07 +0100 Subject: Fix to existing ReaderWriterLockSlim implementations --- OpenSim/Framework/TaskInventoryDictionary.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index efe5f0c..4b9a509 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -109,7 +109,10 @@ namespace OpenSim.Framework } else { - m_itemLock.ExitReadLock(); + if (m_itemLock.RecursiveReadCount>0) + { + m_itemLock.ExitReadLock(); + } } } @@ -144,7 +147,10 @@ namespace OpenSim.Framework } else { - m_itemLock.ExitWriteLock(); + if (m_itemLock.RecursiveWriteCount > 0) + { + m_itemLock.ExitWriteLock(); + } } } -- cgit v1.1 From 29a740ec8c78bfc3c1ab5b41b302ae2205c6e9aa Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Dec 2009 18:03:53 +0100 Subject: Initial windlight codebase commit --- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Framework/RegionInfo.cs | 69 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 04ba9c6..cb136e2 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1077,7 +1077,7 @@ namespace OpenSim.Framework void SendInstantMessage(GridInstantMessage im); - void SendGenericMessage(string method, List message); + void SendGenericMessage(string method, List message); void SendLayerData(float[] map); void SendLayerData(int px, int py, float[] map); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 721233d..c39cc03 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -36,8 +36,59 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework.Console; + namespace OpenSim.Framework { + public class RegionMeta7WindlightData + { + public UUID regionID = UUID.Zero; + public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); + public float waterFogDensityExponent = 4.0f; + public float underwaterFogModifier = 0.25f; + public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f); + public float fresnelScale = 0.40f; + public float fresnelOffset = 0.50f; + public float refractScaleAbove = 0.03f; + public float refractScaleBelow = 0.20f; + public float blurMultiplier = 0.040f; + public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f); + public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f); + public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); + public Vector4 horizon = new Vector4(0.26f, 0.24f, 0.34f, 0.33f); + public float hazeHorizon = 0.19f; + public Vector4 blueDensity = new Vector4(0.10f, 0.93f, 0.02f, 0.93f); + public float hazeDensity = 0.70f; + public float densityMultiplier = 0.18f; + public float distanceMultiplier = 0.8f; + public UInt16 maxAltitude = 1605; + public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f); + public float sunMoonPosition = 0.335f; + public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f); + public float eastAngle = 0.0f; + public float sunGlowFocus = 0.10f; + public float sunGlowSize = 0.10f; + public float sceneGamma = 1.0f; + public float starBrightness = 0.0f; + public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f); + public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f); + public float cloudCoverage = 0.27f; + public float cloudScale = 0.42f; + public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f); + public float cloudScrollX = 0.20f; + public bool cloudScrollXLock = false; + public float cloudScrollY = 0.01f; + public bool cloudScrollYLock = false; + public bool drawClassicClouds = false; + + public delegate void SaveDelegate(RegionMeta7WindlightData wl); + public event SaveDelegate OnSave; + public void Save() + { + if (OnSave != null) + OnSave(this); + } + } + [Serializable] public class SimpleRegionInfo { @@ -304,8 +355,7 @@ namespace OpenSim.Framework private bool m_clampPrimSize = false; private int m_objectCapacity = 0; private string m_regionType = String.Empty; - - + private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData(); // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. // MT: Yes. Estates can't span trust boundaries. Therefore, it can be @@ -454,6 +504,21 @@ namespace OpenSim.Framework set { m_regionSettings = value; } } + public RegionMeta7WindlightData WindlightSettings + { + get + { + if (m_windlight == null) + { + m_windlight = new RegionMeta7WindlightData(); + } + + return m_windlight; + } + + set { m_windlight = value; } + } + public int NonphysPrimMax { get { return m_nonphysPrimMax; } -- cgit v1.1 From 0889b5aef1b93909cb7ae5c29beb5e23bd566c47 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 10 Dec 2009 18:20:40 +0000 Subject: Fix version number --- OpenSim/Framework/Servers/VersionInfo.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index f5be1e6..d348c90 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,8 +29,8 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "112609s"; - private const Flavour VERSION_FLAVOUR = Flavour.BetaM7; + private const string VERSION_NUMBER = "0.6.9CM"; + private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { Unknown, @@ -38,8 +38,7 @@ namespace OpenSim RC1, RC2, Release, - Post_Fixes, - BetaM7 + Post_Fixes } public static string Version -- cgit v1.1 From b9cd66d510f9229952aec5594d512faf7b60c899 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Dec 2009 13:33:45 +0000 Subject: test commit --- OpenSim/Framework/Servers/VersionInfo.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index d348c90..75e4a5d 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,6 +29,7 @@ namespace OpenSim { public class VersionInfo { + private const string VERSION_NUMBER = "0.6.9CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From fbafd2212402619ec5efa66797fd42d59da1333b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Dec 2009 13:43:49 +0000 Subject: Reverse text commit whitespace change --- OpenSim/Framework/Servers/VersionInfo.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 75e4a5d..d348c90 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,6 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.9CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From 794419852b793cd0be96bafb945305fadbb95b6c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Dec 2009 14:23:20 +0000 Subject: Another test --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index d348c90..714a592 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + namespace OpenSim { public class VersionInfo -- cgit v1.1 From c00158b238c863d27f1b883f2cd4e573f7036dda Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Dec 2009 14:35:12 +0000 Subject: Reverse test commit (again) --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 714a592..d348c90 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + namespace OpenSim { public class VersionInfo -- cgit v1.1 From 9904700dfdb7c6a111d9464eb23566fff73dc6b1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Dec 2009 16:00:44 +0000 Subject: Another whitespace test commit --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index d348c90..714a592 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + namespace OpenSim { public class VersionInfo -- cgit v1.1 From 30d64444a090148e5c07f27adc19ac2925533a19 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Dec 2009 16:01:53 +0000 Subject: And reverse --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 714a592..d348c90 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + namespace OpenSim { public class VersionInfo -- cgit v1.1 From 6dbe25360ec3dc3c998378da8b422751d3e032a9 Mon Sep 17 00:00:00 2001 From: CasperW Date: Thu, 17 Dec 2009 18:40:34 +0100 Subject: Add cmSetWindlightSceneTargeted. Add restrictions on windlight script use. --- OpenSim/Framework/RegionInfo.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 9e00528..1ea08f9 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -38,8 +38,8 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework -{ - public class RegionMeta7WindlightData +{ + public class RegionMeta7WindlightData : ICloneable { public UUID regionID = UUID.Zero; public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); @@ -54,19 +54,19 @@ namespace OpenSim.Framework public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f); public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f); public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); - public Vector4 horizon = new Vector4(0.26f, 0.24f, 0.34f, 0.33f); + public Vector4 horizon = new Vector4(0.25f, 0.25f, 0.32f, 0.32f); public float hazeHorizon = 0.19f; - public Vector4 blueDensity = new Vector4(0.10f, 0.93f, 0.02f, 0.93f); + public Vector4 blueDensity = new Vector4(0.12f, 0.22f, 0.38f, 0.38f); public float hazeDensity = 0.70f; public float densityMultiplier = 0.18f; public float distanceMultiplier = 0.8f; public UInt16 maxAltitude = 1605; public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f); - public float sunMoonPosition = 0.335f; + public float sunMoonPosition = 0.317f; public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f); public float eastAngle = 0.0f; public float sunGlowFocus = 0.10f; - public float sunGlowSize = 0.10f; + public float sunGlowSize = 1.75f; public float sceneGamma = 1.0f; public float starBrightness = 0.0f; public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f); @@ -78,7 +78,7 @@ namespace OpenSim.Framework public bool cloudScrollXLock = false; public float cloudScrollY = 0.01f; public bool cloudScrollYLock = false; - public bool drawClassicClouds = false; + public bool drawClassicClouds = true; public delegate void SaveDelegate(RegionMeta7WindlightData wl); public event SaveDelegate OnSave; @@ -86,7 +86,12 @@ namespace OpenSim.Framework { if (OnSave != null) OnSave(this); - } + } + public object Clone() + { + return this.MemberwiseClone(); // call clone method + } + } [Serializable] -- cgit v1.1 From e38e8ae98759e403175016260edd27772b5c9e4c Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Sat, 19 Dec 2009 19:54:44 -0500 Subject: Fix mantis #10 & #14 --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index d348c90..a7d34f5 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.9CM"; + private const string VERSION_NUMBER = "0.6.91CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { -- cgit v1.1 From b53b87166940ca0fca4ae2190649e18102c886ec Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Dec 2009 06:25:32 +0100 Subject: Add a data path for error messages --- OpenSim/Framework/Capabilities/Caps.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 1f1ac78..74c6ab0 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -46,7 +46,7 @@ namespace OpenSim.Framework.Capabilities public delegate UUID UpdateItem(UUID itemID, byte[] data); - public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data); + public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); @@ -54,7 +54,7 @@ namespace OpenSim.Framework.Capabilities public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); - public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, + public delegate ArrayList TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, bool isScriptRunning, byte[] data); public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, @@ -940,11 +940,13 @@ namespace OpenSim.Framework.Capabilities /// Prim containing item to update /// Signals whether the script to update is currently running /// New asset data - public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data) + public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors) { if (TaskScriptUpdatedCall != null) { - TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); + ArrayList e = TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); + foreach (Object item in e) + errors.Add(item); } } @@ -1174,17 +1176,20 @@ namespace OpenSim.Framework.Capabilities // data, path, param)); string res = String.Empty; - LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); + LLSDTaskScriptUploadComplete uploadComplete = new LLSDTaskScriptUploadComplete(); + ArrayList errors = new ArrayList(); handlerUpdateTaskScript = OnUpLoad; if (handlerUpdateTaskScript != null) { - handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data); + handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data, ref errors); } - uploadComplete.item_id = inventoryItemID; - uploadComplete.task_id = primID; + uploadComplete.new_asset = inventoryItemID; + uploadComplete.compiled = errors.Count > 0 ? false : true; uploadComplete.state = "complete"; + uploadComplete.errors = new OSDArray(); + uploadComplete.errors.Array = errors; res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); -- cgit v1.1 From bde26a8282cf7d3e173413a49a88f25a6bee0db1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Dec 2009 06:43:03 +0100 Subject: Add missing file --- .../Capabilities/LLSDTaskScriptUploadComplete.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 OpenSim/Framework/Capabilities/LLSDTaskScriptUploadComplete.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Capabilities/LLSDTaskScriptUploadComplete.cs b/OpenSim/Framework/Capabilities/LLSDTaskScriptUploadComplete.cs new file mode 100644 index 0000000..d308831 --- /dev/null +++ b/OpenSim/Framework/Capabilities/LLSDTaskScriptUploadComplete.cs @@ -0,0 +1,54 @@ +/* + * 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 OpenMetaverse; +using System; +using System.Collections; + +namespace OpenSim.Framework.Capabilities +{ + [OSDMap] + public class LLSDTaskScriptUploadComplete + { + /// + /// The task inventory item that was updated + /// + public UUID new_asset; + + /// + /// Was it compiled? + /// + public bool compiled; + + /// + /// State of the upload. So far have only even seen this set to "complete" + /// + public string state; + + public OSDArray errors; + } +} -- cgit v1.1 From e7439efc74a1cc0daedc51eb25ae66cd03db70b5 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Thu, 24 Dec 2009 19:19:44 -0500 Subject: Recover out-of-region objects during db load. --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index a7d34f5..7274a06 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.91CM"; + private const string VERSION_NUMBER = "0.6.92Ch"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { -- cgit v1.1 From b19e5643171d9a081426026c0e96c84c3e7f97b2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 25 Dec 2009 23:20:30 +0000 Subject: Restore version suffix. --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 7274a06..4844a66 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.92Ch"; + private const string VERSION_NUMBER = "0.6.92CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { -- cgit v1.1 From 59f683066a60a99111cc032ee122dfe709c78440 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 25 Dec 2009 23:23:49 +0000 Subject: Set version back to core version (base) and suffix CM. Please DO NOT CHANGE THIS in the repo. This is the Caremninster repo and the number follows CORE. Always. --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 4844a66..f618047 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.92CM"; + private const string VERSION_NUMBER = "0.6.8CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { -- cgit v1.1 From 393a7828584a0bf8564dd351015238365e51b984 Mon Sep 17 00:00:00 2001 From: CasperW Date: Thu, 25 Feb 2010 18:05:30 +0100 Subject: Fix the crashed session notification from the userserver. --- .../Framework/Communications/Services/LoginService.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 71b38ed..824cc57 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs @@ -88,15 +88,7 @@ namespace OpenSim.Framework.Communications.Services m_welcomeMessage = welcomeMess; } } - - /// - /// If the user is already logged in, try to notify the region that the user they've got is dead. - /// - /// - public virtual void LogOffUser(UserProfileData theUser, string message) - { - } - + /// /// Called when we receive the client's initial XMLRPC login_to_simulator request message /// @@ -1056,7 +1048,13 @@ namespace OpenSim.Framework.Communications.Services protected abstract RegionInfo RequestClosestRegion(string region); protected abstract RegionInfo GetRegionInfo(ulong homeRegionHandle); - protected abstract RegionInfo GetRegionInfo(UUID homeRegionId); + protected abstract RegionInfo GetRegionInfo(UUID homeRegionId); + + /// + /// If the user is already logged in, try to notify the region that the user they've got is dead. + /// + /// + public abstract void LogOffUser(UserProfileData theUser, string message); /// /// Prepare a login to the given region. This involves both telling the region to expect a connection -- cgit v1.1 From fce9e499e4682edf6db7b4f9c5546524b4a25197 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Mar 2010 01:19:45 -0600 Subject: - parcel blocking, region crossing blocking, teleport blocking --- OpenSim/Framework/IClientAPI.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 7219bf8..3126e57 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -881,6 +881,7 @@ namespace OpenSim.Framework event Action OnRegionHandShakeReply; event GenericCall2 OnRequestWearables; event GenericCall1 OnCompleteMovementToRegion; + event UpdateAgent OnPreAgentUpdate; event UpdateAgent OnAgentUpdate; event AgentRequestSit OnAgentRequestSit; event AgentSit OnAgentSit; -- cgit v1.1 From dd544f811a8a46b91b6101fb83b3504ef246a83c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Mar 2010 19:09:09 +0000 Subject: switch flavor to RC1 --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index ec94b2d..f8ed5ae 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -30,7 +30,7 @@ namespace OpenSim public class VersionInfo { private const string VERSION_NUMBER = "0.6.9"; - private const Flavour VERSION_FLAVOUR = Flavour.Dev; + private const Flavour VERSION_FLAVOUR = Flavour.RC1; public enum Flavour { -- cgit v1.1 From 7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Mar 2010 23:29:03 +0100 Subject: Rename Meta7Windlight to LightShare --- OpenSim/Framework/RegionInfo.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 05f9cf9..5eacd73 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework { - public class RegionMeta7WindlightData : ICloneable + public class RegionLightShareData : ICloneable { public UUID regionID = UUID.Zero; public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); @@ -80,7 +80,7 @@ namespace OpenSim.Framework public bool cloudScrollYLock = false; public bool drawClassicClouds = true; - public delegate void SaveDelegate(RegionMeta7WindlightData wl); + public delegate void SaveDelegate(RegionLightShareData wl); public event SaveDelegate OnSave; public void Save() { @@ -356,7 +356,7 @@ namespace OpenSim.Framework private bool m_clampPrimSize = false; private int m_objectCapacity = 0; private string m_regionType = String.Empty; - private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData(); + private RegionLightShareData m_windlight = new RegionLightShareData(); protected uint m_httpPort; protected string m_serverURI; protected string m_regionName = String.Empty; @@ -495,13 +495,13 @@ namespace OpenSim.Framework set { m_regionSettings = value; } } - public RegionMeta7WindlightData WindlightSettings + public RegionLightShareData WindlightSettings { get { if (m_windlight == null) { - m_windlight = new RegionMeta7WindlightData(); + m_windlight = new RegionLightShareData(); } return m_windlight; -- cgit v1.1 From 5c04d768a69814324521181f37c7da87ba2b4819 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 5 Apr 2010 22:26:18 +0200 Subject: Bump version number --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 58d65d1..d7c2ed0 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.8CM"; + private const string VERSION_NUMBER = "0.6.9CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From a573b5767b42766a6782d549b22cc53f079ecc14 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 5 Apr 2010 22:31:30 +0200 Subject: Test commit --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index d7c2ed0..cf417d7 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -33,7 +33,7 @@ namespace OpenSim private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour - { + { Unknown, Dev, RC1, -- cgit v1.1 From c4c4c3696edbe99496ad7e6db9b3eb0b339f09c5 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 8 Apr 2010 15:26:51 -0700 Subject: Backported WebUtil.cs from master to 0.6.9-postfixes to fix the build break --- OpenSim/Framework/WebUtil.cs | 361 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 361 insertions(+) create mode 100644 OpenSim/Framework/WebUtil.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs new file mode 100644 index 0000000..2843e20 --- /dev/null +++ b/OpenSim/Framework/WebUtil.cs @@ -0,0 +1,361 @@ +/* + * 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.Collections.Specialized; +using System.IO; +using System.Net; +using System.Net.Security; +using System.Reflection; +using System.Text; +using System.Web; +using log4net; +using OpenSim.Framework.Servers.HttpServer; +using OpenMetaverse.StructuredData; + +namespace OpenSim.Framework +{ + /// + /// Miscellaneous static methods and extension methods related to the web + /// + public static class WebUtil + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// Send LLSD to an HTTP client in application/llsd+json form + /// + /// HTTP response to send the data in + /// LLSD to send to the client + public static void SendJSONResponse(OSHttpResponse response, OSDMap body) + { + byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body)); + + response.ContentEncoding = Encoding.UTF8; + response.ContentLength = responseData.Length; + response.ContentType = "application/llsd+json"; + response.Body.Write(responseData, 0, responseData.Length); + } + + /// + /// Send LLSD to an HTTP client in application/llsd+xml form + /// + /// HTTP response to send the data in + /// LLSD to send to the client + public static void SendXMLResponse(OSHttpResponse response, OSDMap body) + { + byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body); + + response.ContentEncoding = Encoding.UTF8; + response.ContentLength = responseData.Length; + response.ContentType = "application/llsd+xml"; + response.Body.Write(responseData, 0, responseData.Length); + } + + /// + /// Make a GET or GET-like request to a web service that returns LLSD + /// or JSON data + /// + public static OSDMap ServiceRequest(string url, string httpVerb) + { + string errorMessage; + + try + { + HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); + request.Method = httpVerb; + + using (WebResponse response = request.GetResponse()) + { + using (Stream responseStream = response.GetResponseStream()) + { + try + { + string responseStr = responseStream.GetStreamString(); + OSD responseOSD = OSDParser.Deserialize(responseStr); + if (responseOSD.Type == OSDType.Map) + return (OSDMap)responseOSD; + else + errorMessage = "Response format was invalid."; + } + catch + { + errorMessage = "Failed to parse the response."; + } + } + } + } + catch (Exception ex) + { + m_log.Warn("GET from URL " + url + " failed: " + ex.Message); + errorMessage = ex.Message; + } + + return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } }; + } + + /// + /// POST URL-encoded form data to a web service that returns LLSD or + /// JSON data + /// + public static OSDMap PostToService(string url, NameValueCollection data) + { + string errorMessage; + + try + { + string queryString = BuildQueryString(data); + byte[] requestData = System.Text.Encoding.UTF8.GetBytes(queryString); + + HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); + request.Method = "POST"; + request.ContentLength = requestData.Length; + request.ContentType = "application/x-www-form-urlencoded"; + + using (Stream requestStream = request.GetRequestStream()) + requestStream.Write(requestData, 0, requestData.Length); + + using (WebResponse response = request.GetResponse()) + { + using (Stream responseStream = response.GetResponseStream()) + { + try + { + string responseStr = responseStream.GetStreamString(); + OSD responseOSD = OSDParser.Deserialize(responseStr); + if (responseOSD.Type == OSDType.Map) + return (OSDMap)responseOSD; + else + errorMessage = "Response format was invalid."; + } + catch + { + errorMessage = "Failed to parse the response."; + } + } + } + } + catch (Exception ex) + { + m_log.Warn("POST to URL " + url + " failed: " + ex.Message); + errorMessage = ex.Message; + } + + return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } }; + } + + #region Uri + + /// + /// Combines a Uri that can contain both a base Uri and relative path + /// with a second relative path fragment + /// + /// Starting (base) Uri + /// Relative path fragment to append to the end + /// of the Uri + /// The combined Uri + /// This is similar to the Uri constructor that takes a base + /// Uri and the relative path, except this method can append a relative + /// path fragment on to an existing relative path + public static Uri Combine(this Uri uri, string fragment) + { + string fragment1 = uri.Fragment; + string fragment2 = fragment; + + if (!fragment1.EndsWith("/")) + fragment1 = fragment1 + '/'; + if (fragment2.StartsWith("/")) + fragment2 = fragment2.Substring(1); + + return new Uri(uri, fragment1 + fragment2); + } + + /// + /// Combines a Uri that can contain both a base Uri and relative path + /// with a second relative path fragment. If the fragment is absolute, + /// it will be returned without modification + /// + /// Starting (base) Uri + /// Relative path fragment to append to the end + /// of the Uri, or an absolute Uri to return unmodified + /// The combined Uri + public static Uri Combine(this Uri uri, Uri fragment) + { + if (fragment.IsAbsoluteUri) + return fragment; + + string fragment1 = uri.Fragment; + string fragment2 = fragment.ToString(); + + if (!fragment1.EndsWith("/")) + fragment1 = fragment1 + '/'; + if (fragment2.StartsWith("/")) + fragment2 = fragment2.Substring(1); + + return new Uri(uri, fragment1 + fragment2); + } + + /// + /// Appends a query string to a Uri that may or may not have existing + /// query parameters + /// + /// Uri to append the query to + /// Query string to append. Can either start with ? + /// or just containg key/value pairs + /// String representation of the Uri with the query string + /// appended + public static string AppendQuery(this Uri uri, string query) + { + if (String.IsNullOrEmpty(query)) + return uri.ToString(); + + if (query[0] == '?' || query[0] == '&') + query = query.Substring(1); + + string uriStr = uri.ToString(); + + if (uriStr.Contains("?")) + return uriStr + '&' + query; + else + return uriStr + '?' + query; + } + + #endregion Uri + + #region NameValueCollection + + /// + /// Convert a NameValueCollection into a query string. This is the + /// inverse of HttpUtility.ParseQueryString() + /// + /// Collection of key/value pairs to convert + /// A query string with URL-escaped values + public static string BuildQueryString(NameValueCollection parameters) + { + List items = new List(parameters.Count); + + foreach (string key in parameters.Keys) + { + string[] values = parameters.GetValues(key); + if (values != null) + { + foreach (string value in values) + items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty))); + } + } + + return String.Join("&", items.ToArray()); + } + + /// + /// + /// + /// + /// + /// + public static string GetOne(this NameValueCollection collection, string key) + { + string[] values = collection.GetValues(key); + if (values != null && values.Length > 0) + return values[0]; + + return null; + } + + #endregion NameValueCollection + + #region Stream + + /// + /// Copies the contents of one stream to another, starting at the + /// current position of each stream + /// + /// The stream to copy from, at the position + /// where copying should begin + /// The stream to copy to, at the position where + /// bytes should be written + /// The maximum bytes to copy + /// The total number of bytes copied + /// + /// Copying begins at the streams' current positions. The positions are + /// NOT reset after copying is complete. + /// + public static int CopyTo(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy) + { + byte[] buffer = new byte[4096]; + int readBytes; + int totalCopiedBytes = 0; + + while ((readBytes = copyFrom.Read(buffer, 0, Math.Min(4096, maximumBytesToCopy))) > 0) + { + int writeBytes = Math.Min(maximumBytesToCopy, readBytes); + copyTo.Write(buffer, 0, writeBytes); + totalCopiedBytes += writeBytes; + maximumBytesToCopy -= writeBytes; + } + + return totalCopiedBytes; + } + + /// + /// Converts an entire stream to a string, regardless of current stream + /// position + /// + /// The stream to convert to a string + /// + /// When this method is done, the stream position will be + /// reset to its previous position before this method was called + public static string GetStreamString(this Stream stream) + { + string value = null; + + if (stream != null && stream.CanRead) + { + long rewindPos = -1; + + if (stream.CanSeek) + { + rewindPos = stream.Position; + stream.Seek(0, SeekOrigin.Begin); + } + + StreamReader reader = new StreamReader(stream); + value = reader.ReadToEnd(); + + if (rewindPos >= 0) + stream.Seek(rewindPos, SeekOrigin.Begin); + } + + return value; + } + + #endregion Stream + } +} -- cgit v1.1 From 54cedfe4320573ac302b11716e293086110a4f9b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 8 Apr 2010 15:57:00 -0700 Subject: Changed the GetTextureModule backport to work with the 0.6.9 codebase --- OpenSim/Framework/WebUtil.cs | 361 ------------------------------------------- 1 file changed, 361 deletions(-) delete mode 100644 OpenSim/Framework/WebUtil.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs deleted file mode 100644 index 2843e20..0000000 --- a/OpenSim/Framework/WebUtil.cs +++ /dev/null @@ -1,361 +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.Collections.Specialized; -using System.IO; -using System.Net; -using System.Net.Security; -using System.Reflection; -using System.Text; -using System.Web; -using log4net; -using OpenSim.Framework.Servers.HttpServer; -using OpenMetaverse.StructuredData; - -namespace OpenSim.Framework -{ - /// - /// Miscellaneous static methods and extension methods related to the web - /// - public static class WebUtil - { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// Send LLSD to an HTTP client in application/llsd+json form - /// - /// HTTP response to send the data in - /// LLSD to send to the client - public static void SendJSONResponse(OSHttpResponse response, OSDMap body) - { - byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body)); - - response.ContentEncoding = Encoding.UTF8; - response.ContentLength = responseData.Length; - response.ContentType = "application/llsd+json"; - response.Body.Write(responseData, 0, responseData.Length); - } - - /// - /// Send LLSD to an HTTP client in application/llsd+xml form - /// - /// HTTP response to send the data in - /// LLSD to send to the client - public static void SendXMLResponse(OSHttpResponse response, OSDMap body) - { - byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body); - - response.ContentEncoding = Encoding.UTF8; - response.ContentLength = responseData.Length; - response.ContentType = "application/llsd+xml"; - response.Body.Write(responseData, 0, responseData.Length); - } - - /// - /// Make a GET or GET-like request to a web service that returns LLSD - /// or JSON data - /// - public static OSDMap ServiceRequest(string url, string httpVerb) - { - string errorMessage; - - try - { - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); - request.Method = httpVerb; - - using (WebResponse response = request.GetResponse()) - { - using (Stream responseStream = response.GetResponseStream()) - { - try - { - string responseStr = responseStream.GetStreamString(); - OSD responseOSD = OSDParser.Deserialize(responseStr); - if (responseOSD.Type == OSDType.Map) - return (OSDMap)responseOSD; - else - errorMessage = "Response format was invalid."; - } - catch - { - errorMessage = "Failed to parse the response."; - } - } - } - } - catch (Exception ex) - { - m_log.Warn("GET from URL " + url + " failed: " + ex.Message); - errorMessage = ex.Message; - } - - return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } }; - } - - /// - /// POST URL-encoded form data to a web service that returns LLSD or - /// JSON data - /// - public static OSDMap PostToService(string url, NameValueCollection data) - { - string errorMessage; - - try - { - string queryString = BuildQueryString(data); - byte[] requestData = System.Text.Encoding.UTF8.GetBytes(queryString); - - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); - request.Method = "POST"; - request.ContentLength = requestData.Length; - request.ContentType = "application/x-www-form-urlencoded"; - - using (Stream requestStream = request.GetRequestStream()) - requestStream.Write(requestData, 0, requestData.Length); - - using (WebResponse response = request.GetResponse()) - { - using (Stream responseStream = response.GetResponseStream()) - { - try - { - string responseStr = responseStream.GetStreamString(); - OSD responseOSD = OSDParser.Deserialize(responseStr); - if (responseOSD.Type == OSDType.Map) - return (OSDMap)responseOSD; - else - errorMessage = "Response format was invalid."; - } - catch - { - errorMessage = "Failed to parse the response."; - } - } - } - } - catch (Exception ex) - { - m_log.Warn("POST to URL " + url + " failed: " + ex.Message); - errorMessage = ex.Message; - } - - return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } }; - } - - #region Uri - - /// - /// Combines a Uri that can contain both a base Uri and relative path - /// with a second relative path fragment - /// - /// Starting (base) Uri - /// Relative path fragment to append to the end - /// of the Uri - /// The combined Uri - /// This is similar to the Uri constructor that takes a base - /// Uri and the relative path, except this method can append a relative - /// path fragment on to an existing relative path - public static Uri Combine(this Uri uri, string fragment) - { - string fragment1 = uri.Fragment; - string fragment2 = fragment; - - if (!fragment1.EndsWith("/")) - fragment1 = fragment1 + '/'; - if (fragment2.StartsWith("/")) - fragment2 = fragment2.Substring(1); - - return new Uri(uri, fragment1 + fragment2); - } - - /// - /// Combines a Uri that can contain both a base Uri and relative path - /// with a second relative path fragment. If the fragment is absolute, - /// it will be returned without modification - /// - /// Starting (base) Uri - /// Relative path fragment to append to the end - /// of the Uri, or an absolute Uri to return unmodified - /// The combined Uri - public static Uri Combine(this Uri uri, Uri fragment) - { - if (fragment.IsAbsoluteUri) - return fragment; - - string fragment1 = uri.Fragment; - string fragment2 = fragment.ToString(); - - if (!fragment1.EndsWith("/")) - fragment1 = fragment1 + '/'; - if (fragment2.StartsWith("/")) - fragment2 = fragment2.Substring(1); - - return new Uri(uri, fragment1 + fragment2); - } - - /// - /// Appends a query string to a Uri that may or may not have existing - /// query parameters - /// - /// Uri to append the query to - /// Query string to append. Can either start with ? - /// or just containg key/value pairs - /// String representation of the Uri with the query string - /// appended - public static string AppendQuery(this Uri uri, string query) - { - if (String.IsNullOrEmpty(query)) - return uri.ToString(); - - if (query[0] == '?' || query[0] == '&') - query = query.Substring(1); - - string uriStr = uri.ToString(); - - if (uriStr.Contains("?")) - return uriStr + '&' + query; - else - return uriStr + '?' + query; - } - - #endregion Uri - - #region NameValueCollection - - /// - /// Convert a NameValueCollection into a query string. This is the - /// inverse of HttpUtility.ParseQueryString() - /// - /// Collection of key/value pairs to convert - /// A query string with URL-escaped values - public static string BuildQueryString(NameValueCollection parameters) - { - List items = new List(parameters.Count); - - foreach (string key in parameters.Keys) - { - string[] values = parameters.GetValues(key); - if (values != null) - { - foreach (string value in values) - items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty))); - } - } - - return String.Join("&", items.ToArray()); - } - - /// - /// - /// - /// - /// - /// - public static string GetOne(this NameValueCollection collection, string key) - { - string[] values = collection.GetValues(key); - if (values != null && values.Length > 0) - return values[0]; - - return null; - } - - #endregion NameValueCollection - - #region Stream - - /// - /// Copies the contents of one stream to another, starting at the - /// current position of each stream - /// - /// The stream to copy from, at the position - /// where copying should begin - /// The stream to copy to, at the position where - /// bytes should be written - /// The maximum bytes to copy - /// The total number of bytes copied - /// - /// Copying begins at the streams' current positions. The positions are - /// NOT reset after copying is complete. - /// - public static int CopyTo(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy) - { - byte[] buffer = new byte[4096]; - int readBytes; - int totalCopiedBytes = 0; - - while ((readBytes = copyFrom.Read(buffer, 0, Math.Min(4096, maximumBytesToCopy))) > 0) - { - int writeBytes = Math.Min(maximumBytesToCopy, readBytes); - copyTo.Write(buffer, 0, writeBytes); - totalCopiedBytes += writeBytes; - maximumBytesToCopy -= writeBytes; - } - - return totalCopiedBytes; - } - - /// - /// Converts an entire stream to a string, regardless of current stream - /// position - /// - /// The stream to convert to a string - /// - /// When this method is done, the stream position will be - /// reset to its previous position before this method was called - public static string GetStreamString(this Stream stream) - { - string value = null; - - if (stream != null && stream.CanRead) - { - long rewindPos = -1; - - if (stream.CanSeek) - { - rewindPos = stream.Position; - stream.Seek(0, SeekOrigin.Begin); - } - - StreamReader reader = new StreamReader(stream); - value = reader.ReadToEnd(); - - if (rewindPos >= 0) - stream.Seek(rewindPos, SeekOrigin.Begin); - } - - return value; - } - - #endregion Stream - } -} -- cgit v1.1 From c77444a8215748633812e67adea8c7ff66a5480d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Apr 2010 20:40:01 +0100 Subject: Fix http://opensimulator.org/mantis/view.php?id=4657 where OpenSim.Grid.UserServer.exe fails on startup if no previous config probably appears to occur because mono 2.4.2.3 (and possibly later) erroneously returns a value of 0 for BufferWidth and BufferHeight in some circumstances --- OpenSim/Framework/Console/LocalConsole.cs | 63 +++++++++++++++++++++++-------- OpenSim/Framework/Util.cs | 2 +- 2 files changed, 48 insertions(+), 17 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index be936b6..a3036d0 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console { /// /// A console that uses cursor control and color - /// + /// public class LocalConsole : CommandConsole { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -100,24 +100,40 @@ namespace OpenSim.Framework.Console private int SetCursorTop(int top) { // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try - // to set a cursor row position with a currently invalid column, mono will throw an exception. - // Therefore, we need to make sure that the column position is valid first. + // to set a cursor row position with a currently invalid column, mono will throw an exception. + // Therefore, we need to make sure that the column position is valid first. int left = System.Console.CursorLeft; if (left < 0) + { System.Console.CursorLeft = 0; - else if (left >= System.Console.BufferWidth) - System.Console.CursorLeft = System.Console.BufferWidth - 1; + } + else + { + int bw = System.Console.BufferWidth; + + // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) + if (bw > 0 && left >= bw) + System.Console.CursorLeft = bw - 1; + } if (top < 0) + { top = 0; - if (top >= System.Console.BufferHeight) - top = System.Console.BufferHeight - 1; + } + else + { + int bh = System.Console.BufferHeight; + + // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) + if (bh > 0 && top >= bh) + top = bh - 1; + } System.Console.CursorTop = top; return top; - } + } /// /// Set the cursor column. @@ -129,23 +145,38 @@ namespace OpenSim.Framework.Console /// /// /// The new cursor column. - /// + /// private int SetCursorLeft(int left) { // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try - // to set a cursor column position with a currently invalid row, mono will throw an exception. - // Therefore, we need to make sure that the row position is valid first. + // to set a cursor column position with a currently invalid row, mono will throw an exception. + // Therefore, we need to make sure that the row position is valid first. int top = System.Console.CursorTop; if (top < 0) + { System.Console.CursorTop = 0; - else if (top >= System.Console.BufferHeight) - System.Console.CursorTop = System.Console.BufferHeight - 1; + } + else + { + int bh = System.Console.BufferHeight; + // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) + if (bh > 0 && top >= bh) + System.Console.CursorTop = bh - 1; + } if (left < 0) + { left = 0; - if (left >= System.Console.BufferWidth) - left = System.Console.BufferWidth - 1; + } + else + { + int bw = System.Console.BufferWidth; + + // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) + if (bw > 0 && left >= bw) + left = bw - 1; + } System.Console.CursorLeft = left; @@ -183,7 +214,7 @@ namespace OpenSim.Framework.Console System.Console.Write("{0}", prompt); SetCursorTop(new_y); - SetCursorLeft(new_x); + SetCursorLeft(new_x); } } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 48435cb..ec33b5e 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1441,4 +1441,4 @@ namespace OpenSim.Framework return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); } } -} +} \ No newline at end of file -- cgit v1.1 From 04845c1898fee6a8b8563a8103b73cbe38525416 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 30 Apr 2010 11:46:50 +0100 Subject: Fix link security issue --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 222bae0..a6a081d 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -73,7 +73,7 @@ namespace OpenSim.Framework public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List children); - public delegate void DelinkObjects(List primIds); + public delegate void DelinkObjects(List primIds, IClientAPI client); public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag); -- cgit v1.1 From 733a07e061cdcb6095677758a264ba976bb94b93 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 6 May 2010 00:34:49 +0200 Subject: Plumb the viewer version string through into AgentCircuitData. Now all that is left os to figure out what black magic turns AgentCircuitData into AgentData and then copy that into the ScenePresence, where m_Viewer is already added with this commit and waits for the data. --- OpenSim/Framework/AgentCircuitData.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 353e5bf..783a833 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -108,6 +108,11 @@ namespace OpenSim.Framework public string ServiceSessionID = string.Empty; /// + /// Viewer's version string + /// + public string Viewer; + + /// /// Position the Agent's Avatar starts in the region /// public Vector3 startpos; @@ -136,6 +141,7 @@ namespace OpenSim.Framework BaseFolder = new UUID(cAgent.BaseFolder); CapsPath = cAgent.CapsPath; ChildrenCapSeeds = cAgent.ChildrenCapSeeds; + Viewer = cAgent.Viewer; } /// @@ -173,6 +179,7 @@ namespace OpenSim.Framework args["service_session_id"] = OSD.FromString(ServiceSessionID); args["start_pos"] = OSD.FromString(startpos.ToString()); args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); + args["viewer"] = OSD.FromString(Viewer); if (Appearance != null) { @@ -272,6 +279,8 @@ namespace OpenSim.Framework SessionID = args["session_id"].AsUUID(); if (args["service_session_id"] != null) ServiceSessionID = args["service_session_id"].AsString(); + if (args["viewer"] != null) + Viewer = args["viewer"].AsString(); if (args["start_pos"] != null) Vector3.TryParse(args["start_pos"].AsString(), out startpos); @@ -339,6 +348,7 @@ namespace OpenSim.Framework public float startposx; public float startposy; public float startposz; + public string Viewer; public sAgentCircuitData() { @@ -360,6 +370,7 @@ namespace OpenSim.Framework BaseFolder = cAgent.BaseFolder.Guid; CapsPath = cAgent.CapsPath; ChildrenCapSeeds = cAgent.ChildrenCapSeeds; + Viewer = cAgent.Viewer; } } } -- cgit v1.1 From 8f838c722da978da646fcef59a5af767840832bb Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 17 May 2010 14:14:19 -0700 Subject: When killing a zombie session, don't send the stop packet since it often has the effect of killing a newly connected client. --- OpenSim/Framework/IClientAPI.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 01daeb1..c597d62 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1114,6 +1114,7 @@ namespace OpenSim.Framework void InPacket(object NewPack); void ProcessInPacket(Packet NewPack); void Close(); + void Close(bool sendStop); void Kick(string message); /// -- cgit v1.1 From 91b1d17e5bd3ff6ed006744bc529b53a67af1a64 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 01:09:47 -0700 Subject: Fix for hanging on "Connecting to region".. caused by packets being processed before the presence has bound to receive events. Fixed this by adding packets to a queue and then processing them when the presence is ready. --- OpenSim/Framework/IClientAPI.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c597d62..ae2a80c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1112,6 +1112,7 @@ namespace OpenSim.Framework void SetDebugPacketLevel(int newDebug); void InPacket(object NewPack); + void ProcessPendingPackets(); void ProcessInPacket(Packet NewPack); void Close(); void Close(bool sendStop); -- cgit v1.1 From 4921d5ac2dc1f439b7820a22c89fd8239ff33bbc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 8 Jun 2010 22:03:08 +0200 Subject: Make the text mode remote console really work. It can now be used to send multi-word commands with proper quoting, handles arguments with spaces and allows interactive use, e.g. user creation. --- OpenSim/Framework/Console/RemoteConsole.cs | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 6f8348d..a46a6cb 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -106,8 +106,15 @@ namespace OpenSim.Framework.Console public override string ReadLine(string p, bool isCommand, bool e) { + if (isCommand) + Output("+++"+p); + else + Output("-++"+p); + m_DataEvent.WaitOne(); + string cmdinput; + lock (m_InputData) { if (m_InputData.Count == 0) @@ -116,29 +123,30 @@ namespace OpenSim.Framework.Console return ""; } - string cmdinput = m_InputData[0]; + cmdinput = m_InputData[0]; m_InputData.RemoveAt(0); if (m_InputData.Count == 0) m_DataEvent.Reset(); - if (isCommand) + } + + if (isCommand) + { + string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); + + if (cmd.Length != 0) { - string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); + int i; - if (cmd.Length != 0) + for (i=0 ; i < cmd.Length ; i++) { - int i; - - for (i=0 ; i < cmd.Length ; i++) - { - if (cmd[i].Contains(" ")) - cmd[i] = "\"" + cmd[i] + "\""; - } - return String.Empty; + if (cmd[i].Contains(" ")) + cmd[i] = "\"" + cmd[i] + "\""; } + return String.Empty; } - return cmdinput; } + return cmdinput; } private void DoExpire() @@ -308,7 +316,7 @@ namespace OpenSim.Framework.Console return reply; } - if (post["COMMAND"] == null || post["COMMAND"].ToString() == String.Empty) + if (post["COMMAND"] == null) return reply; lock (m_InputData) -- cgit v1.1 From 3101d530647cdf401b6078dacf6d7ceb063b049d Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Fri, 25 Jun 2010 05:25:41 -0700 Subject: Make "Allow other residents to edit terrain" default to FALSE --- OpenSim/Framework/LandData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 060e886..ef07438 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -62,7 +62,7 @@ namespace OpenSim.Framework private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | (uint) ParcelFlags.AllowAPrimitiveEntry | - (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | + (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | (uint) ParcelFlags.SoundLocal; -- cgit v1.1 From 49272657d7085471b85a4735968495bda31f599f Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 26 Jun 2010 15:30:47 -0700 Subject: Make RegionLightShareData serializable --- OpenSim/Framework/RegionInfo.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index afc4060..2a74e79 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -40,6 +40,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework { + [Serializable] public class RegionLightShareData : ICloneable { public UUID regionID = UUID.Zero; -- cgit v1.1 From 6f4d4543b94f28160d697489e591da6614f0c8fc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jun 2010 03:51:16 +0200 Subject: Make newly created prims be named "Object" and make newly created scripts have a default touch handler. Compatibility patch --- OpenSim/Framework/PrimitiveBaseShape.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 4d1de22..990c859 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1196,7 +1196,7 @@ namespace OpenSim.Framework prim.Textures = this.Textures; prim.Properties = new Primitive.ObjectProperties(); - prim.Properties.Name = "Primitive"; + prim.Properties.Name = "Object"; prim.Properties.Description = ""; prim.Properties.CreatorID = UUID.Zero; prim.Properties.GroupID = UUID.Zero; -- cgit v1.1 From 8dc7c0849eecaea09ce3571bab28b44c17bb3743 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 29 Jun 2010 23:18:48 -0700 Subject: The other half of the asset fix. Implement an exponentially incrementing retry timer for asset upload failures. Total queue time in the ballpark of 24 hours, which should be a reasonable time for any grid admin to get their asset service back online. This should stop lost assets. --- OpenSim/Framework/AssetBase.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 53d28be..98fa846 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -60,6 +60,8 @@ namespace OpenSim.Framework /// private AssetMetadata m_metadata; + private int m_uploadAttempts; + // This is needed for .NET serialization!!! // Do NOT "Optimize" away! public AssetBase() @@ -197,6 +199,12 @@ namespace OpenSim.Framework set { m_metadata.Type = value; } } + public int UploadAttempts + { + get { return m_uploadAttempts; } + set { m_uploadAttempts = value; } + } + /// /// Is this a region only asset, or does this exist on the asset server also /// -- cgit v1.1 From 3d5d44279b99e58cb4f2db3532df522ad3b5cccf Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 1 Jul 2010 17:06:29 +0200 Subject: ANother stab at LSL compatibility --- OpenSim/Framework/ParcelMediaCommandEnum.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ParcelMediaCommandEnum.cs b/OpenSim/Framework/ParcelMediaCommandEnum.cs index 93c41ec..e714382 100644 --- a/OpenSim/Framework/ParcelMediaCommandEnum.cs +++ b/OpenSim/Framework/ParcelMediaCommandEnum.cs @@ -27,7 +27,7 @@ namespace OpenSim.Framework { - public enum ParcelMediaCommandEnum + public enum ParcelMediaCommandEnum : int { Stop = 0, Pause = 1, -- cgit v1.1 From beb5259cd1ae11464e2affaa19788361979fbd0e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 2 Jul 2010 04:51:31 +0200 Subject: Remove GetEconomyData and the economy data structure (unused) --- OpenSim/Framework/IMoneyModule.cs | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 3480960..17e74a0 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -43,27 +43,6 @@ namespace OpenSim.Framework bool AmountCovered(IClientAPI client, int amount); void ApplyCharge(UUID agentID, int amount, string text); - EconomyData GetEconomyData(); - event ObjectPaid OnObjectPaid; } - - public struct EconomyData - { - public int ObjectCapacity; - public int ObjectCount; - public int PriceEnergyUnit; - public int PriceGroupCreate; - public int PriceObjectClaim; - public float PriceObjectRent; - public float PriceObjectScaleFactor; - public int PriceParcelClaim; - public float PriceParcelClaimFactor; - public int PriceParcelRent; - public int PricePublicObjectDecay; - public int PricePublicObjectDelete; - public int PriceRentLight; - public int PriceUpload; - public int TeleportMinPrice; - } } -- cgit v1.1 From c87e6a289c5ab93025bf03f486629fd5aa00aaaa Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 2 Jul 2010 06:20:36 +0200 Subject: Clean up IMoneyModule and adjust the other modules to the changes --- OpenSim/Framework/Capabilities/Caps.cs | 2 +- OpenSim/Framework/IMoneyModule.cs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 62a1e17..da953bb 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities if (mm != null) { - if (!mm.UploadCovered(client)) + if (!mm.UploadCovered(client, mm.UploadCharge)) { if (client != null) client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 17e74a0..3d4873d 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -35,13 +35,14 @@ namespace OpenSim.Framework bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount); - int GetBalance(IClientAPI client); - void ApplyUploadCharge(UUID agentID); - bool UploadCovered(IClientAPI client); - void ApplyGroupCreationCharge(UUID agentID); - bool GroupCreationCovered(IClientAPI client); + int GetBalance(UUID agentID); + bool UploadCovered(IClientAPI client, int amount); bool AmountCovered(IClientAPI client, int amount); void ApplyCharge(UUID agentID, int amount, string text); + void ApplyUploadCharge(UUID agentID, int amount, string text); + + int UploadCharge { get; } + int GroupCreationCharge { get; } event ObjectPaid OnObjectPaid; } -- cgit v1.1 From 3d495b709ec897970b24ce48d6a8495d520864d4 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 3 Jul 2010 06:08:18 -0700 Subject: Implement a timeout value in the SynchronousRestObjectRequester. Default is 100 seconds. --- .../HttpServer/SynchronousRestObjectRequester.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index eab463c..bb3b8b1 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs @@ -57,6 +57,21 @@ namespace OpenSim.Framework.Servers.HttpServer /// the request. You'll want to make sure you deal with this as they're not uncommon public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj) { + return MakeRequest(verb, requestUrl, obj, 100); + } + /// + /// Perform a synchronous REST request. + /// + /// + /// + /// + /// + /// + /// + /// Thrown if we encounter a network issue while posting + /// the request. You'll want to make sure you deal with this as they're not uncommon + public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout) + { Type type = typeof (TRequest); TResponse deserial = default(TResponse); @@ -81,7 +96,7 @@ namespace OpenSim.Framework.Servers.HttpServer int length = (int) buffer.Length; request.ContentLength = length; - + request.Timeout = pTimeout * 1000; Stream requestStream = null; try { -- cgit v1.1 From 39ae1def85fcaf56761c88ad0a000e659941162c Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 3 Jul 2010 06:10:02 -0700 Subject: Re-implement the Undo stack as a List; the old implementation was buggy --- OpenSim/Framework/UndoStack.cs | 51 +++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs index 4d800ae..3799180 100644 --- a/OpenSim/Framework/UndoStack.cs +++ b/OpenSim/Framework/UndoStack.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections.Generic; namespace OpenSim.Framework { @@ -36,33 +37,30 @@ namespace OpenSim.Framework [Serializable] public class UndoStack { - private int m_new = 1; - private int m_old = 0; - private T[] m_Undos; + private List m_undolist; + private int m_max; public UndoStack(int capacity) { - m_Undos = new T[capacity + 1]; + m_undolist = new List(); + m_max = capacity; } public bool IsFull { - get { return m_new == m_old; } + get { return m_undolist.Count >= m_max; } } public int Capacity { - get { return m_Undos.Length - 1; } + get { return m_max; } } public int Count { get { - int count = m_new - m_old - 1; - if (count < 0) - count += m_Undos.Length; - return count; + return m_undolist.Count; } } @@ -70,45 +68,32 @@ namespace OpenSim.Framework { if (IsFull) { - m_old++; - if (m_old >= m_Undos.Length) - m_old -= m_Undos.Length; + m_undolist.RemoveAt(0); } - if (++m_new >= m_Undos.Length) - m_new -= m_Undos.Length; - m_Undos[m_new] = item; + m_undolist.Add(item); } public T Pop() { - if (Count > 0) + if (m_undolist.Count > 0) { - T deleted = m_Undos[m_new]; - m_Undos[m_new--] = default(T); - if (m_new < 0) - m_new += m_Undos.Length; - return deleted; + int ind = m_undolist.Count - 1; + T item = m_undolist[ind]; + m_undolist.RemoveAt(ind); + return item; } else - throw new InvalidOperationException("Cannot pop from emtpy stack"); + throw new InvalidOperationException("Cannot pop from empty stack"); } public T Peek() { - return m_Undos[m_new]; + return m_undolist[m_undolist.Count - 1]; } public void Clear() { - if (Count > 0) - { - for (int i = 0; i < m_Undos.Length; i++) - { - m_Undos[i] = default(T); - } - m_new = 1; - m_old = 0; - } + m_undolist.Clear(); } } } -- cgit v1.1 From 7665013ad8c7ac876955dc803619405dfa2af71d Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sun, 4 Jul 2010 19:25:54 -0700 Subject: Correct positioning of timeout modifier in the SynchronousRestObjectRequester --- OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index bb3b8b1..f07f7ab 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs @@ -77,6 +77,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Timeout = pTimeout * 1000; if ((verb == "POST") || (verb == "PUT")) { @@ -96,7 +97,6 @@ namespace OpenSim.Framework.Servers.HttpServer int length = (int) buffer.Length; request.ContentLength = length; - request.Timeout = pTimeout * 1000; Stream requestStream = null; try { -- cgit v1.1 From 5b68343361cbd000a2f024b37797ec235abb7207 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sun, 4 Jul 2010 19:28:39 -0700 Subject: The majority of the Undo fix. There is still an issue with Rotation which i'll address next; however position undo and scale undo should be working just fine now. Also removed some residual debug logging. --- OpenSim/Framework/UndoStack.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs index 3799180..4cd779a 100644 --- a/OpenSim/Framework/UndoStack.cs +++ b/OpenSim/Framework/UndoStack.cs @@ -88,7 +88,14 @@ namespace OpenSim.Framework public T Peek() { - return m_undolist[m_undolist.Count - 1]; + if (m_undolist.Count > 0) + { + return m_undolist[m_undolist.Count - 1]; + } + else + { + return default(T); + } } public void Clear() -- cgit v1.1 From cecd660388e0cda34115be44955758e8221a77d1 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 10 Jul 2010 18:48:49 -0700 Subject: Fix an issue where the SynchronousRestObjectRequester will fail if a webserver does not report a content length (-1), but the content is still valid --- OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index f07f7ab..077a1e8 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs @@ -118,7 +118,7 @@ namespace OpenSim.Framework.Servers.HttpServer { using (WebResponse resp = request.GetResponse()) { - if (resp.ContentLength > 0) + if (resp.ContentLength != 0) { Stream respStream = resp.GetResponseStream(); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); -- cgit v1.1 From cea856cfc294fb546332bb86abe9f70d791013d5 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 10 Jul 2010 19:00:12 -0700 Subject: Fix the synchronousrestformsrequester so it will successfully handle a response from a server which does not provide a valid content length header --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index b0cf34d..92a6caa 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -99,7 +99,7 @@ namespace OpenSim.Framework.Servers.HttpServer { using (WebResponse resp = request.GetResponse()) { - if (resp.ContentLength > 0) + if (resp.ContentLength != 0) { Stream respStream = null; try -- cgit v1.1 From 7f0f11304f0979355d75538ab7326b687b62e76e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 11 Jul 2010 14:26:57 +0200 Subject: Add scripted controllers into agent intersim messaging --- OpenSim/Framework/ChildAgentDataUpdate.cs | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index a1ac84c..89ee39c 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -265,6 +265,46 @@ namespace OpenSim.Framework } } + public class ControllerData + { + public UUID ItemID; + public uint IgnoreControls; + public uint EventControls; + + public ControllerData(UUID item, uint ignore, uint ev) + { + ItemID = item; + IgnoreControls = ignore; + EventControls = ev; + } + + public ControllerData(OSDMap args) + { + UnpackUpdateMessage(args); + } + + public OSDMap PackUpdateMessage() + { + OSDMap controldata = new OSDMap(); + controldata["item"] = OSD.FromUUID(ItemID); + controldata["ignore"] = OSD.FromInteger(IgnoreControls); + controldata["event"] = OSD.FromInteger(EventControls); + + return controldata; + } + + + public void UnpackUpdateMessage(OSDMap args) + { + if (args["item"] != null) + ItemID = args["item"].AsUUID(); + if (args["ignore"] != null) + IgnoreControls = (uint)args["ignore"].AsInteger(); + if (args["event"] != null) + EventControls = (uint)args["event"].AsInteger(); + } + } + public class AgentData : IAgentData { private UUID m_id; @@ -313,6 +353,9 @@ namespace OpenSim.Framework public UUID[] Wearables; public AttachmentData[] Attachments; + // Scripted + public ControllerData[] Controllers; + public string CallbackURI; public virtual OSDMap Pack() @@ -403,6 +446,14 @@ namespace OpenSim.Framework args["attachments"] = attachs; } + if ((Controllers != null) && (Controllers.Length > 0)) + { + OSDArray controls = new OSDArray(Controllers.Length); + foreach (ControllerData ctl in Controllers) + controls.Add(ctl.PackUpdateMessage()); + args["controllers"] = controls; + } + if ((CallbackURI != null) && (!CallbackURI.Equals(""))) args["callback_uri"] = OSD.FromString(CallbackURI); @@ -559,6 +610,20 @@ namespace OpenSim.Framework } } + if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) + { + OSDArray controls = (OSDArray)(args["controllers"]); + Controllers = new ControllerData[controls.Count]; + int i = 0; + foreach (OSD o in controls) + { + if (o.Type == OSDType.Map) + { + Controllers[i++] = new ControllerData((OSDMap)o); + } + } + } + if (args["callback_uri"] != null) CallbackURI = args["callback_uri"].AsString(); } -- cgit v1.1 From 0c445239a68688311d6fa7405ef13ceb3e773930 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 19:21:01 +0200 Subject: Remove useless quaternion parameter from AttachObject sig --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index d85b101..100c861 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -57,7 +57,7 @@ namespace OpenSim.Framework RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects); public delegate void ObjectAttach( - IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent); + IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); public delegate void ModifyTerrain(UUID user, float height, float seconds, byte size, byte action, float north, float west, float south, float east, -- cgit v1.1 From bebbe407ee166a0aa22f0ec8d14ada780924f9af Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 14 Jul 2010 19:58:23 +0200 Subject: Major attachments cleanup. Remove unused AttachObject ClientView method Clean up use of AttachObject throughout, reduce number of overloads and number of parameters --- OpenSim/Framework/IClientAPI.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 100c861..95aec94 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1019,7 +1019,6 @@ namespace OpenSim.Framework void SendCoarseLocationUpdate(List users, List CoarseLocations); - void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID); void SetChildAgentThrottle(byte[] throttle); void SendAvatarDataImmediate(ISceneEntity avatar); -- cgit v1.1 From e06b7ee3689bdfd8d71ef3199edb2fb220ec5c21 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 17 Jul 2010 02:38:00 +0200 Subject: Make webloading more robust by addign retries --- .../RegionLoader/Web/RegionLoaderWebServer.cs | 48 ++++++++++------------ 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index 0ec4af5..dd224cd 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -48,6 +48,9 @@ namespace OpenSim.Framework.RegionLoader.Web public RegionInfo[] LoadRegions() { + int tries = 3; + int wait = 2000; + if (m_configSource == null) { m_log.Error("[WEBLOADER]: Unable to load configuration source!"); @@ -64,35 +67,28 @@ namespace OpenSim.Framework.RegionLoader.Web } else { - HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); - webRequest.Timeout = 30000; //30 Second Timeout - m_log.Debug("[WEBLOADER]: Sending Download Request..."); - HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); - m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server..."); - StreamReader reader = new StreamReader(webResponse.GetResponseStream()); - string xmlSource = String.Empty; - string tempStr = reader.ReadLine(); - while (tempStr != null) - { - xmlSource = xmlSource + tempStr; - tempStr = reader.ReadLine(); - } - m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + - xmlSource.Length); - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.LoadXml(xmlSource); - if (xmlDoc.FirstChild.Name == "Regions") + while (tries > 0) { - RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count]; - int i; - for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) + HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); + webRequest.Timeout = 30000; //30 Second Timeout + m_log.Debug("[WEBLOADER]: Sending Download Request..."); + HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); + m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server..."); + StreamReader reader = new StreamReader(webResponse.GetResponseStream()); + string xmlSource = String.Empty; + string tempStr = reader.ReadLine(); + while (tempStr != null) { - m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); - regionInfos[i] = - new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); + xmlSource = xmlSource + tempStr; + tempStr = reader.ReadLine(); + } + m_log.Debug("[WEBLOADER]: Request yielded no regions."); + tries--; + if (tries > 0) + { + m_log.Debug("[WEBLOADER]: Retrying"); + System.Threading.Thread.Sleep(wait); } - - return regionInfos; } return null; } -- cgit v1.1 From d1040c9ff9b47b143e456d06801bd6be148bb1b9 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 17 Jul 2010 02:46:04 +0200 Subject: Replace the screenful of code i deleted. --- .../RegionLoader/Web/RegionLoaderWebServer.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index dd224cd..f0ffc2c 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -82,6 +82,25 @@ namespace OpenSim.Framework.RegionLoader.Web xmlSource = xmlSource + tempStr; tempStr = reader.ReadLine(); } + m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + + xmlSource.Length); + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.LoadXml(xmlSource); + if (xmlDoc.FirstChild.Name == "Regions") + { + RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count]; + int i; + for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) + { + m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); + regionInfos[i] = + new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); + } + + if (i > 0) + return regionInfos; + } + m_log.Debug("[WEBLOADER]: Request yielded no regions."); tries--; if (tries > 0) -- cgit v1.1 From f04d51378f864d2eb522678b3fb1e239f746bd35 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 3 Aug 2010 11:06:41 -0700 Subject: Drop the RestClient timeout from 15 minutes to 30 seconds. This does not address the problem, but it will allow the regions to recover in the event that the remote server goes away. --- OpenSim/Framework/Communications/RestClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 97b3b60..42c0b18 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -363,7 +363,7 @@ namespace OpenSim.Framework.Communications _request = (HttpWebRequest) WebRequest.Create(buildUri()); _request.KeepAlive = false; _request.ContentType = "application/xml"; - _request.Timeout = 900000; + _request.Timeout = 30000; _request.Method = RequestMethod; _asyncException = null; _request.ContentLength = src.Length; -- cgit v1.1 From 6e3c79f31e4a552ef81e73156d3f84cbcfbdb2cf Mon Sep 17 00:00:00 2001 From: Mike Rieker Date: Tue, 3 Aug 2010 20:09:00 +0000 Subject: don't mask current time reads (since we don't mask the corresponding subtract) if you mask the reads you have to mask the subtract as well. simplest is just don't mask any of it. --- OpenSim/Framework/Watchdog.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 5d46905..bc19dd1 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -51,7 +51,7 @@ namespace OpenSim.Framework public ThreadWatchdogInfo(Thread thread) { Thread = thread; - LastTick = Environment.TickCount & Int32.MaxValue; + LastTick = Environment.TickCount; } } @@ -143,7 +143,7 @@ namespace OpenSim.Framework try { if (m_threads.TryGetValue(threadID, out threadInfo)) - threadInfo.LastTick = Environment.TickCount & Int32.MaxValue; + threadInfo.LastTick = Environment.TickCount; else AddThread(new ThreadWatchdogInfo(Thread.CurrentThread)); } @@ -160,7 +160,7 @@ namespace OpenSim.Framework lock (m_threads) { - int now = Environment.TickCount & Int32.MaxValue; + int now = Environment.TickCount; foreach (ThreadWatchdogInfo threadInfo in m_threads.Values) { -- cgit v1.1 From 330343505ca2d6d109e89b4767f4351ab9bec91d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Aug 2010 11:39:10 -0700 Subject: Implement CreateNewOutfitAttachments. This addresses mantis #199. --- OpenSim/Framework/IClientAPI.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 95aec94..07bded6 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -264,6 +264,9 @@ namespace OpenSim.Framework public delegate void MoveInventoryItem( IClientAPI remoteClient, List items); + public delegate void MoveItemsAndLeaveCopy( + IClientAPI remoteClient, List items, UUID destFolder); + public delegate void RemoveInventoryItem( IClientAPI remoteClient, List itemIDs); @@ -772,6 +775,7 @@ namespace OpenSim.Framework event RequestTaskInventory OnRequestTaskInventory; event UpdateInventoryItem OnUpdateInventoryItem; event CopyInventoryItem OnCopyInventoryItem; + event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; event MoveInventoryItem OnMoveInventoryItem; event RemoveInventoryFolder OnRemoveInventoryFolder; event RemoveInventoryItem OnRemoveInventoryItem; -- cgit v1.1 From c554de75010a442753cce29ee06d2b60d7b4701a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 7 Aug 2010 05:45:52 +0200 Subject: Correct display of landmark about info. Also correct region maturity rating in LM info. Maturity is NOT the parcel's setting, that is only for the image and text. Parcel maturity is governed by region maturity. --- OpenSim/Framework/Util.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index c39fb6f..af5a0ce 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1171,6 +1171,16 @@ namespace OpenSim.Framework } + public static uint ConvertAccessLevelToMaturity(byte maturity) + { + if (maturity <= 13) + return 0; + else if (maturity <= 21) + return 1; + else + return 2; + } + /// /// Produces an OSDMap from its string representation on a stream /// @@ -1486,4 +1496,4 @@ namespace OpenSim.Framework } } -} \ No newline at end of file +} -- cgit v1.1 From 1ead2ed5eea379c500d2657e7bed8908b376e336 Mon Sep 17 00:00:00 2001 From: meta7 Date: Tue, 10 Aug 2010 09:07:17 -0700 Subject: Add a stack trace to the error output on the recursive read lock warning on my RWlocks. Whilst recursive locks are safe, coupled with other issues we're experiencing with the TaskInventoryDictionary it implies that somewhere the lock is not being freed possibly due to a merge error somewhere, and thus it needs to be looked into. --- OpenSim/Framework/TaskInventoryDictionary.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 4b9a509..6b65fba 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Threading; using System.Reflection; using System.Xml; +using System.Diagnostics; using System.Xml.Schema; using System.Xml.Serialization; using log4net; @@ -90,6 +91,19 @@ namespace OpenSim.Framework if (m_itemLock.RecursiveReadCount > 0) { m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); + try + { + StackTrace stackTrace = new StackTrace(); // get call stack + StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) + + // write call stack method names + foreach (StackFrame stackFrame in stackFrames) + { + m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name); // write method name + } + } + catch + {} m_itemLock.ExitReadLock(); } if (m_itemLock.RecursiveWriteCount > 0) -- cgit v1.1 From fb14390fb0446e225bca08ec2dc25960d1441728 Mon Sep 17 00:00:00 2001 From: meta7 Date: Tue, 10 Aug 2010 09:17:30 -0700 Subject: Note to self: don't break the build --- OpenSim/Framework/TaskInventoryDictionary.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 6b65fba..a8a53f2 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -99,7 +99,7 @@ namespace OpenSim.Framework // write call stack method names foreach (StackFrame stackFrame in stackFrames) { - m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name); // write method name + m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name } } catch -- cgit v1.1 From 1bcb2e788fd895a7d8165797c29e6f2a652eff8b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 25 Aug 2010 23:04:12 +0200 Subject: Change some e.Message to e.ToString. Don't use e.Message, it doesn't carry any useful information. Error messages are useless without location information. It looks more elegant, but is totally pointless. --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 92a6caa..e9ae3a3 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -81,7 +81,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception e) { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: {1}", requestUrl, e.Message); + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); } finally { @@ -112,7 +112,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception e) { - m_log.DebugFormat("[FORMS]: exception occured on receiving reply {0}", e.Message); + m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); } finally { -- cgit v1.1 From 1096f43f0d3db628b463d4494c98ad496cf1f039 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 25 Aug 2010 23:34:39 +0200 Subject: Prevent an object disposed exception that made forms comms unreliable. After starting an asynchronous write, one should not close the channel it will be written to synchrnously, that leads to grief. --- .../Servers/HttpServer/SynchronousRestFormsRequester.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index e9ae3a3..f955df7 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -85,8 +85,13 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { - if (requestStream != null) - requestStream.Close(); + // If this is closed, it will be disposed internally, + // but the above write is asynchronous and may hit after + // we're through here. So the thread handling that will + // throw and put us back into the catch above. Isn't + // .NET great? + //if (requestStream != null) + // requestStream.Close(); // Let's not close this //buffer.Close(); -- cgit v1.1 From 0f40ec5c65f1698d2bb32cc28960b3651c1f7dac Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 16:10:44 +0200 Subject: Implement UploadBakedTexture cap --- OpenSim/Framework/Capabilities/Caps.cs | 105 +++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 0db7bb9..8a339fe 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -44,6 +44,8 @@ namespace OpenSim.Framework.Capabilities string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType); + public delegate void UploadedBakedTexture(UUID assetID, byte[] data); + public delegate UUID UpdateItem(UUID itemID, byte[] data); public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); @@ -97,6 +99,7 @@ namespace OpenSim.Framework.Capabilities // private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module. // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. + private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. //private string eventQueue = "0100/"; private IScene m_Scene; @@ -185,6 +188,8 @@ namespace OpenSim.Framework.Capabilities m_capsHandlers["UpdateScriptTaskInventory"] = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"]; + m_capsHandlers["UploadBakedTexture"] = + new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture); } catch (Exception e) @@ -742,6 +747,50 @@ namespace OpenSim.Framework.Capabilities return null; } + public string UploadBakedTexture(string request, string path, + string param, OSHttpRequest httpRequest, + OSHttpResponse httpResponse) + { + try + { + m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + + m_regionName); + + string capsBase = "/CAPS/" + m_capsObjectPath; + string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); + + BakedTextureUploader uploader = + new BakedTextureUploader( capsBase + uploaderPath, + m_httpListener); + uploader.OnUpLoad += BakedTextureUploaded; + + m_httpListener.AddStreamHandler( + new BinaryStreamHandler("POST", capsBase + uploaderPath, + uploader.uploaderCaps)); + + string protocol = "http://"; + + if (m_httpListener.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_httpListenerHostName + ":" + + m_httpListenPort.ToString() + capsBase + uploaderPath; + + LLSDAssetUploadResponse uploadResponse = + new LLSDAssetUploadResponse(); + uploadResponse.uploader = uploaderURL; + uploadResponse.state = "upload"; + + return LLSDHelpers.SerialiseLLSDReply(uploadResponse); + } + catch (Exception e) + { + m_log.Error("[CAPS]: " + e.ToString()); + } + + return null; + } + /// /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. /// @@ -925,6 +974,17 @@ namespace OpenSim.Framework.Capabilities } } + public void BakedTextureUploaded(UUID assetID, byte[] data) + { + m_log.DebugFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); + AssetBase asset; + asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); + asset.Data = data; + asset.Temporary = true; + asset.Local = true; + m_assetCache.Store(asset); + } + /// /// Called when new asset data for an agent inventory item update has been uploaded. /// @@ -1243,5 +1303,50 @@ namespace OpenSim.Framework.Capabilities fs.Close(); } } + + public class BakedTextureUploader + { + public event UploadedBakedTexture OnUpLoad; + private UploadedBakedTexture handlerUpLoad = null; + + private string uploaderPath = String.Empty; + private UUID newAssetID; + private IHttpServer httpListener; + + public BakedTextureUploader(string path, IHttpServer httpServer) + { + newAssetID = UUID.Random(); + uploaderPath = path; + httpListener = httpServer; + } + + /// + /// + /// + /// + /// + /// + /// + public string uploaderCaps(byte[] data, string path, string param) + { + string res = String.Empty; + LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); + uploadComplete.new_asset = newAssetID.ToString(); + uploadComplete.new_inventory_item = UUID.Zero; + uploadComplete.state = "complete"; + + res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); + + httpListener.RemoveStreamHandler("POST", uploaderPath); + + handlerUpLoad = OnUpLoad; + if (handlerUpLoad != null) + { + handlerUpLoad(newAssetID, data); + } + + return res; + } + } } } -- cgit v1.1 From e5936071711e35f9edf44d8393b8ad28ef4023db Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 5 Sep 2010 14:16:42 +0200 Subject: Remove "Dwell" support from core and replace it with calls to methods on IDwellModule --- OpenSim/Framework/LandData.cs | 14 --- .../Serialization/External/LandDataSerializer.cs | 5 +- .../HttpServer/SynchronousRestFormsRequester.cs | 109 ++++++++++----------- 3 files changed, 54 insertions(+), 74 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 4440c94..5bb0413 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -88,7 +88,6 @@ namespace OpenSim.Framework private UUID _snapshotID = UUID.Zero; private Vector3 _userLocation = new Vector3(); private Vector3 _userLookAt = new Vector3(); - private int _dwell = 0; private int _otherCleanTime = 0; private string _mediaType = "none/none"; private string _mediaDescription = ""; @@ -620,18 +619,6 @@ namespace OpenSim.Framework } /// - /// Deprecated idea. Number of visitors ~= free money - /// - public int Dwell { - get { - return _dwell; - } - set { - _dwell = value; - } - } - - /// /// 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. /// @@ -703,7 +690,6 @@ namespace OpenSim.Framework landData._userLocation = _userLocation; landData._userLookAt = _userLookAt; landData._otherCleanTime = _otherCleanTime; - landData._dwell = _dwell; landData._mediaType = _mediaType; landData._mediaDescription = _mediaDescription; landData._mediaWidth = _mediaWidth; diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index ff0afc8..fc0387b 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); - landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); + // No longer used here + xtr.ReadElementString("Dwell"); landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); xtr.ReadEndElement(); @@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); - xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); + xtw.WriteElementString("Dwell", "0"); xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); xtw.WriteEndElement(); diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index f955df7..41ece86 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -57,80 +57,73 @@ namespace OpenSim.Framework.Servers.HttpServer { WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + string respstring = String.Empty; - if ((verb == "POST") || (verb == "PUT")) + using (MemoryStream buffer = new MemoryStream()) { - request.ContentType = "text/www-form-urlencoded"; - - MemoryStream buffer = new MemoryStream(); - int length = 0; - using (StreamWriter writer = new StreamWriter(buffer)) + if ((verb == "POST") || (verb == "PUT")) { - writer.Write(obj); - writer.Flush(); - } + request.ContentType = "text/www-form-urlencoded"; - length = (int)obj.Length; - request.ContentLength = length; + int length = 0; + using (StreamWriter writer = new StreamWriter(buffer)) + { + writer.Write(obj); + writer.Flush(); + } - Stream requestStream = null; - try - { - requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); - } - finally - { - // If this is closed, it will be disposed internally, - // but the above write is asynchronous and may hit after - // we're through here. So the thread handling that will - // throw and put us back into the catch above. Isn't - // .NET great? - //if (requestStream != null) - // requestStream.Close(); - // Let's not close this - //buffer.Close(); + length = (int)obj.Length; + request.ContentLength = length; + Stream requestStream = null; + try + { + requestStream = request.GetRequestStream(); + requestStream.Write(buffer.ToArray(), 0, length); + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); + } + finally + { + if (requestStream != null) + requestStream.Close(); + } } - } - - string respstring = String.Empty; - try - { - using (WebResponse resp = request.GetResponse()) + try { - if (resp.ContentLength != 0) + using (WebResponse resp = request.GetResponse()) { - Stream respStream = null; - try + if (resp.ContentLength != 0) { - respStream = resp.GetResponseStream(); - using (StreamReader reader = new StreamReader(respStream)) + Stream respStream = null; + try { - respstring = reader.ReadToEnd(); + respStream = resp.GetResponseStream(); + using (StreamReader reader = new StreamReader(respStream)) + { + respstring = reader.ReadToEnd(); + } + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); + } + finally + { + if (respStream != null) + respStream.Close(); } - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); - } - finally - { - if (respStream != null) - respStream.Close(); } } } - } - catch (System.InvalidOperationException) - { - // This is what happens when there is invalid XML - m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + catch (System.InvalidOperationException) + { + // This is what happens when there is invalid XML + m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + } } return respstring; } -- cgit v1.1 From f2e343d53081dbd6956d39b1e172e171101a4900 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 14:09:46 +0200 Subject: Workaround for mono bug #312968 --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 41ece86..e481b2b 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -64,6 +64,7 @@ namespace OpenSim.Framework.Servers.HttpServer if ((verb == "POST") || (verb == "PUT")) { request.ContentType = "text/www-form-urlencoded"; + request.KeepAlive = true; int length = 0; using (StreamWriter writer = new StreamWriter(buffer)) -- cgit v1.1 From 06adbc13242c16d40f9e9a02652067131f2eb9b7 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 17:24:10 +0200 Subject: Revert "Workaround for mono bug #312968" This reverts commit f2e343d53081dbd6956d39b1e172e171101a4900. Doesn't compile with our version of Mono. Patched Mono instead. --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index e481b2b..41ece86 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -64,7 +64,6 @@ namespace OpenSim.Framework.Servers.HttpServer if ((verb == "POST") || (verb == "PUT")) { request.ContentType = "text/www-form-urlencoded"; - request.KeepAlive = true; int length = 0; using (StreamWriter writer = new StreamWriter(buffer)) -- cgit v1.1 From 9cf8795ecf1a2f34f803babf318d9c1f394ee18b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 19 Sep 2010 22:53:05 +0200 Subject: Fix a merge artefact that broke script state persistence in XAttachments --- OpenSim/Framework/TaskInventoryItem.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index df5b936..883f61a 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -120,7 +120,7 @@ namespace OpenSim.Framework private UUID _permsGranter; private int _permsMask; private int _type = 0; - private UUID _oldID; + private UUID _oldID = UUID.Zero; private bool _ownerChanged = false; @@ -227,9 +227,6 @@ namespace OpenSim.Framework get { return _oldID; } - set { - _oldID = value; - } } public UUID LastOwnerID { @@ -348,7 +345,8 @@ namespace OpenSim.Framework /// The new part ID to which this item belongs public void ResetIDs(UUID partID) { - OldItemID = ItemID; + if (_oldID == UUID.Zero) + _oldID = ItemID; ItemID = UUID.Random(); ParentPartID = partID; ParentID = partID; -- cgit v1.1 From 33bd4fe789529e339db8954b29cf49ca7f7a0268 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Sep 2010 22:00:51 +0200 Subject: When clearing the addin registry, respect a custom path --- OpenSim/Framework/PluginLoader.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index 819cb7b..cc80943 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs @@ -244,13 +244,22 @@ namespace OpenSim.Framework // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) // occasionally seems to corrupt its addin cache // Hence, as a temporary solution we'll remove it before each startup + + string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY"); + string v0 = "addin-db-000"; + string v1 = "addin-db-001"; + if (customDir != null && customDir != String.Empty) + { + v0 = Path.Combine(customDir, v0); + v1 = Path.Combine(customDir, v1); + } try { - if (Directory.Exists("addin-db-000")) - Directory.Delete("addin-db-000", true); + if (Directory.Exists(v0)) + Directory.Delete(v0, true); - if (Directory.Exists("addin-db-001")) - Directory.Delete("addin-db-001", true); + if (Directory.Exists(v1)) + Directory.Delete(v1, true); } catch (IOException) { -- cgit v1.1 From 52dd547863c0cdd22f53f0efcaef11ae096855a0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 11:31:52 +0200 Subject: Make SendKillObject send multiple localIDs in one packet. This avoids the halting visual behavior of large group deletes and eliminates the packet flood --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 9025dda..51482a1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -979,7 +979,7 @@ namespace OpenSim.Framework /// /// /// - void SendKillObject(ulong regionHandle, uint localID); + void SendKillObject(ulong regionHandle, List localID); void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); -- cgit v1.1 From 537905d81b1d1d4c573eb56f41afdc39c1eec5ef Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 13 Oct 2010 19:45:55 +0100 Subject: Add a setter to OldItemID so it can be deserialized --- OpenSim/Framework/TaskInventoryItem.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 883f61a..53237fc 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -227,6 +227,9 @@ namespace OpenSim.Framework get { return _oldID; } + set { + _oldID = value; + } } public UUID LastOwnerID { -- cgit v1.1 From e6a8d2872c3ff4992cd7e9615f69e0c6773e461f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Oct 2010 18:59:53 +0200 Subject: Preliminary work on appearance layers. No user functionality yet. --- OpenSim/Framework/AvatarAppearance.cs | 451 +++++++++++++++------------------- 1 file changed, 193 insertions(+), 258 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 5da8ba1..829ad79 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -32,6 +32,125 @@ using OpenMetaverse; namespace OpenSim.Framework { + // A special dictionary for avatar appearance + public struct LayerItem + { + public UUID ItemID; + public UUID AssetID; + + public LayerItem(UUID itemID, UUID assetID) + { + ItemID = itemID; + AssetID = assetID; + } + } + + public class Layer + { + protected int m_layerType; + protected Dictionary m_items = new Dictionary(); + protected List m_ids = new List(); + + public Layer(int type) + { + m_layerType = type; + } + + public int LayerType + { + get { return m_layerType; } + } + + public int Count + { + get { return m_ids.Count; } + } + + public void Add(UUID itemID, UUID assetID) + { + if (m_items.ContainsKey(itemID)) + return; + if (m_ids.Count >= 5) + return; + + m_ids.Add(itemID); + m_items[itemID] = assetID; + } + + public void Wear(UUID itemID, UUID assetID) + { + Clear(); + Add(itemID, assetID); + } + + public void Clear() + { + m_ids.Clear(); + m_items.Clear(); + } + + public void RemoveItem(UUID itemID) + { + if (m_items.ContainsKey(itemID)) + { + m_ids.Remove(itemID); + m_items.Remove(itemID); + } + } + + public void RemoveAsset(UUID assetID) + { + UUID itemID = UUID.Zero; + + foreach (KeyValuePair kvp in m_items) + { + if (kvp.Value == assetID) + { + itemID = kvp.Key; + break; + } + } + + if (itemID != UUID.Zero) + { + m_ids.Remove(itemID); + m_items.Remove(itemID); + } + } + + public LayerItem this [int idx] + { + get + { + if (idx >= m_ids.Count || idx < 0) + return new LayerItem(UUID.Zero, UUID.Zero); + + return new LayerItem(m_ids[idx], m_items[m_ids[idx]]); + } + } + } + + public enum AppearanceLayer + { + BODY = 0, + SKIN = 1, + HAIR = 2, + EYES = 3, + SHIRT = 4, + PANTS = 5, + SHOES = 6, + SOCKS = 7, + JACKET = 8, + GLOVES = 9, + UNDERSHIRT = 10, + UNDERPANTS = 11, + SKIRT = 12, + ALPHA = 13, + TATTOO = 14, + + MAX_WEARABLES = 15 + } + /// /// Contains the Avatar's Appearance and methods to manipulate the appearance. /// @@ -39,25 +158,6 @@ namespace OpenSim.Framework { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // these are guessed at by the list here - - // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll - // correct them over time for when were are wrong. - public readonly static int BODY = 0; - public readonly static int SKIN = 1; - public readonly static int HAIR = 2; - public readonly static int EYES = 3; - public readonly static int SHIRT = 4; - public readonly static int PANTS = 5; - public readonly static int SHOES = 6; - public readonly static int SOCKS = 7; - public readonly static int JACKET = 8; - public readonly static int GLOVES = 9; - public readonly static int UNDERSHIRT = 10; - public readonly static int UNDERPANTS = 11; - public readonly static int SKIRT = 12; - - private readonly static int MAX_WEARABLES = 13; - private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); @@ -68,6 +168,10 @@ namespace OpenSim.Framework private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); + private static UUID ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594"); + private static UUID TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007"); + private static UUID ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8"); + private static UUID TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1"); public readonly static int VISUALPARAM_COUNT = 218; @@ -103,152 +207,156 @@ namespace OpenSim.Framework } public virtual UUID BodyItem { - get { return m_wearables[BODY].ItemID; } - set { m_wearables[BODY].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.BODY].ItemID; } + set { m_wearables[(int)AppearanceLayer.BODY].ItemID = value; } } public virtual UUID BodyAsset { - get { return m_wearables[BODY].AssetID; } - set { m_wearables[BODY].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.BODY].AssetID; } + set { m_wearables[(int)AppearanceLayer.BODY].AssetID = value; } } public virtual UUID SkinItem { - get { return m_wearables[SKIN].ItemID; } - set { m_wearables[SKIN].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.SKIN].ItemID; } + set { m_wearables[(int)AppearanceLayer.SKIN].ItemID = value; } } public virtual UUID SkinAsset { - get { return m_wearables[SKIN].AssetID; } - set { m_wearables[SKIN].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.SKIN].AssetID; } + set { m_wearables[(int)AppearanceLayer.SKIN].AssetID = value; } } public virtual UUID HairItem { - get { return m_wearables[HAIR].ItemID; } - set { m_wearables[HAIR].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.HAIR].ItemID; } + set { m_wearables[(int)AppearanceLayer.HAIR].ItemID = value; } } public virtual UUID HairAsset { - get { return m_wearables[HAIR].AssetID; } - set { m_wearables[HAIR].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.HAIR].AssetID; } + set { m_wearables[(int)AppearanceLayer.HAIR].AssetID = value; } } public virtual UUID EyesItem { - get { return m_wearables[EYES].ItemID; } - set { m_wearables[EYES].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.EYES].ItemID; } + set { m_wearables[(int)AppearanceLayer.EYES].ItemID = value; } } public virtual UUID EyesAsset { - get { return m_wearables[EYES].AssetID; } - set { m_wearables[EYES].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.EYES].AssetID; } + set { m_wearables[(int)AppearanceLayer.EYES].AssetID = value; } } public virtual UUID ShirtItem { - get { return m_wearables[SHIRT].ItemID; } - set { m_wearables[SHIRT].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.SHIRT].ItemID; } + set { m_wearables[(int)AppearanceLayer.SHIRT].ItemID = value; } } public virtual UUID ShirtAsset { - get { return m_wearables[SHIRT].AssetID; } - set { m_wearables[SHIRT].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.SHIRT].AssetID; } + set { m_wearables[(int)AppearanceLayer.SHIRT].AssetID = value; } } public virtual UUID PantsItem { - get { return m_wearables[PANTS].ItemID; } - set { m_wearables[PANTS].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.PANTS].ItemID; } + set { m_wearables[(int)AppearanceLayer.PANTS].ItemID = value; } } public virtual UUID PantsAsset { - get { return m_wearables[PANTS].AssetID; } - set { m_wearables[PANTS].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.PANTS].AssetID; } + set { m_wearables[(int)AppearanceLayer.PANTS].AssetID = value; } } public virtual UUID ShoesItem { - get { return m_wearables[SHOES].ItemID; } - set { m_wearables[SHOES].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.SHOES].ItemID; } + set { m_wearables[(int)AppearanceLayer.SHOES].ItemID = value; } } public virtual UUID ShoesAsset { - get { return m_wearables[SHOES].AssetID; } - set { m_wearables[SHOES].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.SHOES].AssetID; } + set { m_wearables[(int)AppearanceLayer.SHOES].AssetID = value; } } public virtual UUID SocksItem { - get { return m_wearables[SOCKS].ItemID; } - set { m_wearables[SOCKS].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.SOCKS].ItemID; } + set { m_wearables[(int)AppearanceLayer.SOCKS].ItemID = value; } } public virtual UUID SocksAsset { - get { return m_wearables[SOCKS].AssetID; } - set { m_wearables[SOCKS].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.SOCKS].AssetID; } + set { m_wearables[(int)AppearanceLayer.SOCKS].AssetID = value; } } public virtual UUID JacketItem { - get { return m_wearables[JACKET].ItemID; } - set { m_wearables[JACKET].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.JACKET].ItemID; } + set { m_wearables[(int)AppearanceLayer.JACKET].ItemID = value; } } public virtual UUID JacketAsset { - get { return m_wearables[JACKET].AssetID; } - set { m_wearables[JACKET].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.JACKET].AssetID; } + set { m_wearables[(int)AppearanceLayer.JACKET].AssetID = value; } } public virtual UUID GlovesItem { - get { return m_wearables[GLOVES].ItemID; } - set { m_wearables[GLOVES].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.GLOVES].ItemID; } + set { m_wearables[(int)AppearanceLayer.GLOVES].ItemID = value; } } public virtual UUID GlovesAsset { - get { return m_wearables[GLOVES].AssetID; } - set { m_wearables[GLOVES].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.GLOVES].AssetID; } + set { m_wearables[(int)AppearanceLayer.GLOVES].AssetID = value; } } public virtual UUID UnderShirtItem { - get { return m_wearables[UNDERSHIRT].ItemID; } - set { m_wearables[UNDERSHIRT].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID; } + set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID = value; } } public virtual UUID UnderShirtAsset { - get { return m_wearables[UNDERSHIRT].AssetID; } - set { m_wearables[UNDERSHIRT].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID; } + set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID = value; } } public virtual UUID UnderPantsItem { - get { return m_wearables[UNDERPANTS].ItemID; } - set { m_wearables[UNDERPANTS].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID; } + set { m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID = value; } } public virtual UUID UnderPantsAsset { - get { return m_wearables[UNDERPANTS].AssetID; } - set { m_wearables[UNDERPANTS].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID; } + set { m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID = value; } } public virtual UUID SkirtItem { - get { return m_wearables[SKIRT].ItemID; } - set { m_wearables[SKIRT].ItemID = value; } + get { return m_wearables[(int)AppearanceLayer.SKIRT].ItemID; } + set { m_wearables[(int)AppearanceLayer.SKIRT].ItemID = value; } } public virtual UUID SkirtAsset { - get { return m_wearables[SKIRT].AssetID; } - set { m_wearables[SKIRT].AssetID = value; } + get { return m_wearables[(int)AppearanceLayer.SKIRT].AssetID; } + set { m_wearables[(int)AppearanceLayer.SKIRT].AssetID = value; } } public virtual void SetDefaultWearables() { - m_wearables[BODY].AssetID = BODY_ASSET; - m_wearables[BODY].ItemID = BODY_ITEM; - m_wearables[SKIN].AssetID = SKIN_ASSET; - m_wearables[SKIN].ItemID = SKIN_ITEM; - m_wearables[HAIR].AssetID = HAIR_ASSET; - m_wearables[HAIR].ItemID = HAIR_ITEM; - m_wearables[SHIRT].AssetID = SHIRT_ASSET; - m_wearables[SHIRT].ItemID = SHIRT_ITEM; - m_wearables[PANTS].AssetID = PANTS_ASSET; - m_wearables[PANTS].ItemID = PANTS_ITEM; + m_wearables[(int)AppearanceLayer.BODY].AssetID = BODY_ASSET; + m_wearables[(int)AppearanceLayer.BODY].ItemID = BODY_ITEM; + m_wearables[(int)AppearanceLayer.SKIN].AssetID = SKIN_ASSET; + m_wearables[(int)AppearanceLayer.SKIN].ItemID = SKIN_ITEM; + m_wearables[(int)AppearanceLayer.HAIR].AssetID = HAIR_ASSET; + m_wearables[(int)AppearanceLayer.HAIR].ItemID = HAIR_ITEM; + m_wearables[(int)AppearanceLayer.SHIRT].AssetID = SHIRT_ASSET; + m_wearables[(int)AppearanceLayer.SHIRT].ItemID = SHIRT_ITEM; + m_wearables[(int)AppearanceLayer.PANTS].AssetID = PANTS_ASSET; + m_wearables[(int)AppearanceLayer.PANTS].ItemID = PANTS_ITEM; + m_wearables[(int)AppearanceLayer.ALPHA].AssetID = ALPHA_ASSET; + m_wearables[(int)AppearanceLayer.ALPHA].ItemID = ALPHA_ITEM; + m_wearables[(int)AppearanceLayer.TATTOO].AssetID = TATTOO_ASSET; + m_wearables[(int)AppearanceLayer.TATTOO].ItemID = TATTOO_ITEM; } public virtual void ClearWearables() { - for (int i = 0; i < 13; i++) + for (int i = 0; i < m_wearables.Length ; i++) { m_wearables[i].AssetID = UUID.Zero; m_wearables[i].ItemID = UUID.Zero; @@ -286,70 +394,12 @@ namespace OpenSim.Framework get { return m_hipOffset; } } - //Builds the VisualParam Enum using LIBOMV's Visual Param NameValues - /* - public void BuildVisualParamEnum() - { - Dictionary IndexedParams = new Dictionary(); - int vpIndex = 0; - IndexedParams = new Dictionary(); - - System.Text.StringBuilder sb = new System.Text.StringBuilder(); - - sb.Append("public enum VPElement: int\n"); - sb.Append("{\n"); - foreach (KeyValuePair kvp in OpenMetaverse.VisualParams.Params) - { - VisualParam vp = kvp.Value; - - // Only Group-0 parameters are sent in AgentSetAppearance packets - if (kvp.Value.Group == 0) - { - - if (!IndexedParams.ContainsKey(vp.Name)) - { - - if (vp.Label.Length > 0 || vp.LabelMin.Length > 0 || vp.LabelMax.Length > 0) - { - - sb.Append("/// \n"); - if (vp.LabelMin.Length > 0 && vp.LabelMax.Length > 0) - sb.Append(string.Format("/// {0} - {1} 0--+255 {2}\n", vp.Label, vp.LabelMin, - vp.LabelMax)); - - else - sb.Append(string.Format("/// {0}\n", vp.Label)); - - sb.Append("/// \n"); - } - sb.Append(string.Format(" {0}_{1} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"),vpIndex)); - - IndexedParams.Add(vp.Name, vpIndex++); - } - else - { - sb.Append(string.Format(" {0}_{1}_{2} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"), vpIndex)); - vpIndex++; - //int i = 0; - } - } - if (vpIndex < 217) - sb.Append(",\n"); - else - sb.Append("\n"); - - } - sb.Append("}\n"); - - } - */ - public AvatarAppearance() : this(UUID.Zero) {} public AvatarAppearance(UUID owner) { - m_wearables = new AvatarWearable[MAX_WEARABLES]; - for (int i = 0; i < MAX_WEARABLES; i++) + m_wearables = new AvatarWearable[(int)AppearanceLayer.MAX_WEARABLES]; + for (int i = 0; i < (int)AppearanceLayer.MAX_WEARABLES; i++) { // this makes them all null m_wearables[i] = new AvatarWearable(); @@ -442,121 +492,6 @@ namespace OpenSim.Framework return visualParams; } - public override String ToString() - { - String s = "[Wearables] =>"; - s += " Body Item: " + BodyItem.ToString() + ";"; - s += " Skin Item: " + SkinItem.ToString() + ";"; - s += " Shirt Item: " + ShirtItem.ToString() + ";"; - s += " Pants Item: " + PantsItem.ToString() + ";"; - return s; - } - - // this is used for OGS1 - public virtual Hashtable ToHashTable() - { - Hashtable h = new Hashtable(); - h["owner"] = Owner.ToString(); - h["serial"] = Serial.ToString(); - h["visual_params"] = VisualParams; - h["texture"] = Texture.GetBytes(); - h["avatar_height"] = AvatarHeight.ToString(); - h["body_item"] = BodyItem.ToString(); - h["body_asset"] = BodyAsset.ToString(); - h["skin_item"] = SkinItem.ToString(); - h["skin_asset"] = SkinAsset.ToString(); - h["hair_item"] = HairItem.ToString(); - h["hair_asset"] = HairAsset.ToString(); - h["eyes_item"] = EyesItem.ToString(); - h["eyes_asset"] = EyesAsset.ToString(); - h["shirt_item"] = ShirtItem.ToString(); - h["shirt_asset"] = ShirtAsset.ToString(); - h["pants_item"] = PantsItem.ToString(); - h["pants_asset"] = PantsAsset.ToString(); - h["shoes_item"] = ShoesItem.ToString(); - h["shoes_asset"] = ShoesAsset.ToString(); - h["socks_item"] = SocksItem.ToString(); - h["socks_asset"] = SocksAsset.ToString(); - h["jacket_item"] = JacketItem.ToString(); - h["jacket_asset"] = JacketAsset.ToString(); - h["gloves_item"] = GlovesItem.ToString(); - h["gloves_asset"] = GlovesAsset.ToString(); - h["undershirt_item"] = UnderShirtItem.ToString(); - h["undershirt_asset"] = UnderShirtAsset.ToString(); - h["underpants_item"] = UnderPantsItem.ToString(); - h["underpants_asset"] = UnderPantsAsset.ToString(); - h["skirt_item"] = SkirtItem.ToString(); - h["skirt_asset"] = SkirtAsset.ToString(); - - string attachments = GetAttachmentsString(); - if (attachments != String.Empty) - h["attachments"] = attachments; - - return h; - } - - public AvatarAppearance(Hashtable h) - { - Owner = new UUID((string)h["owner"]); - Serial = Convert.ToInt32((string)h["serial"]); - VisualParams = (byte[])h["visual_params"]; - - if (h.Contains("texture")) - { - byte[] te = h["texture"] as byte[]; - if (te != null && te.Length > 0) - Texture = new Primitive.TextureEntry(te, 0, te.Length); - } - else - { - // We shouldn't be receiving appearance hashtables without a TextureEntry, - // but in case we do this will prevent a failure when saving to the database - Texture = GetDefaultTexture(); - } - - - AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); - - m_wearables = new AvatarWearable[MAX_WEARABLES]; - for (int i = 0; i < MAX_WEARABLES; i++) - { - // this makes them all null - m_wearables[i] = new AvatarWearable(); - } - - BodyItem = new UUID((string)h["body_item"]); - BodyAsset = new UUID((string)h["body_asset"]); - SkinItem = new UUID((string)h["skin_item"]); - SkinAsset = new UUID((string)h["skin_asset"]); - HairItem = new UUID((string)h["hair_item"]); - HairAsset = new UUID((string)h["hair_asset"]); - EyesItem = new UUID((string)h["eyes_item"]); - EyesAsset = new UUID((string)h["eyes_asset"]); - ShirtItem = new UUID((string)h["shirt_item"]); - ShirtAsset = new UUID((string)h["shirt_asset"]); - PantsItem = new UUID((string)h["pants_item"]); - PantsAsset = new UUID((string)h["pants_asset"]); - ShoesItem = new UUID((string)h["shoes_item"]); - ShoesAsset = new UUID((string)h["shoes_asset"]); - SocksItem = new UUID((string)h["socks_item"]); - SocksAsset = new UUID((string)h["socks_asset"]); - JacketItem = new UUID((string)h["jacket_item"]); - JacketAsset = new UUID((string)h["jacket_asset"]); - GlovesItem = new UUID((string)h["gloves_item"]); - GlovesAsset = new UUID((string)h["gloves_asset"]); - UnderShirtItem = new UUID((string)h["undershirt_item"]); - UnderShirtAsset = new UUID((string)h["undershirt_asset"]); - UnderPantsItem = new UUID((string)h["underpants_item"]); - UnderPantsAsset = new UUID((string)h["underpants_asset"]); - SkirtItem = new UUID((string)h["skirt_item"]); - SkirtAsset = new UUID((string)h["skirt_asset"]); - - if (h.ContainsKey("attachments")) - { - SetAttachmentsString(h["attachments"].ToString()); - } - } - private Dictionary m_attachments = new Dictionary(); public void SetAttachments(AttachmentData[] data) @@ -1489,4 +1424,4 @@ namespace OpenSim.Framework SKIRT_SKIRT_BLUE = 217 } } -} \ No newline at end of file +} -- cgit v1.1 From 3231602b885556cc5327d2a3369a1b82fb01df95 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Oct 2010 20:34:53 +0200 Subject: Revert "Preliminary work on appearance layers. No user functionality yet." This reverts commit e6a8d2872c3ff4992cd7e9615f69e0c6773e461f. --- OpenSim/Framework/AvatarAppearance.cs | 451 +++++++++++++++++++--------------- 1 file changed, 258 insertions(+), 193 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 829ad79..5da8ba1 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -32,125 +32,6 @@ using OpenMetaverse; namespace OpenSim.Framework { - // A special dictionary for avatar appearance - public struct LayerItem - { - public UUID ItemID; - public UUID AssetID; - - public LayerItem(UUID itemID, UUID assetID) - { - ItemID = itemID; - AssetID = assetID; - } - } - - public class Layer - { - protected int m_layerType; - protected Dictionary m_items = new Dictionary(); - protected List m_ids = new List(); - - public Layer(int type) - { - m_layerType = type; - } - - public int LayerType - { - get { return m_layerType; } - } - - public int Count - { - get { return m_ids.Count; } - } - - public void Add(UUID itemID, UUID assetID) - { - if (m_items.ContainsKey(itemID)) - return; - if (m_ids.Count >= 5) - return; - - m_ids.Add(itemID); - m_items[itemID] = assetID; - } - - public void Wear(UUID itemID, UUID assetID) - { - Clear(); - Add(itemID, assetID); - } - - public void Clear() - { - m_ids.Clear(); - m_items.Clear(); - } - - public void RemoveItem(UUID itemID) - { - if (m_items.ContainsKey(itemID)) - { - m_ids.Remove(itemID); - m_items.Remove(itemID); - } - } - - public void RemoveAsset(UUID assetID) - { - UUID itemID = UUID.Zero; - - foreach (KeyValuePair kvp in m_items) - { - if (kvp.Value == assetID) - { - itemID = kvp.Key; - break; - } - } - - if (itemID != UUID.Zero) - { - m_ids.Remove(itemID); - m_items.Remove(itemID); - } - } - - public LayerItem this [int idx] - { - get - { - if (idx >= m_ids.Count || idx < 0) - return new LayerItem(UUID.Zero, UUID.Zero); - - return new LayerItem(m_ids[idx], m_items[m_ids[idx]]); - } - } - } - - public enum AppearanceLayer - { - BODY = 0, - SKIN = 1, - HAIR = 2, - EYES = 3, - SHIRT = 4, - PANTS = 5, - SHOES = 6, - SOCKS = 7, - JACKET = 8, - GLOVES = 9, - UNDERSHIRT = 10, - UNDERPANTS = 11, - SKIRT = 12, - ALPHA = 13, - TATTOO = 14, - - MAX_WEARABLES = 15 - } - /// /// Contains the Avatar's Appearance and methods to manipulate the appearance. /// @@ -158,6 +39,25 @@ namespace OpenSim.Framework { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // these are guessed at by the list here - + // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll + // correct them over time for when were are wrong. + public readonly static int BODY = 0; + public readonly static int SKIN = 1; + public readonly static int HAIR = 2; + public readonly static int EYES = 3; + public readonly static int SHIRT = 4; + public readonly static int PANTS = 5; + public readonly static int SHOES = 6; + public readonly static int SOCKS = 7; + public readonly static int JACKET = 8; + public readonly static int GLOVES = 9; + public readonly static int UNDERSHIRT = 10; + public readonly static int UNDERPANTS = 11; + public readonly static int SKIRT = 12; + + private readonly static int MAX_WEARABLES = 13; + private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); @@ -168,10 +68,6 @@ namespace OpenSim.Framework private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); - private static UUID ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594"); - private static UUID TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007"); - private static UUID ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8"); - private static UUID TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1"); public readonly static int VISUALPARAM_COUNT = 218; @@ -207,156 +103,152 @@ namespace OpenSim.Framework } public virtual UUID BodyItem { - get { return m_wearables[(int)AppearanceLayer.BODY].ItemID; } - set { m_wearables[(int)AppearanceLayer.BODY].ItemID = value; } + get { return m_wearables[BODY].ItemID; } + set { m_wearables[BODY].ItemID = value; } } public virtual UUID BodyAsset { - get { return m_wearables[(int)AppearanceLayer.BODY].AssetID; } - set { m_wearables[(int)AppearanceLayer.BODY].AssetID = value; } + get { return m_wearables[BODY].AssetID; } + set { m_wearables[BODY].AssetID = value; } } public virtual UUID SkinItem { - get { return m_wearables[(int)AppearanceLayer.SKIN].ItemID; } - set { m_wearables[(int)AppearanceLayer.SKIN].ItemID = value; } + get { return m_wearables[SKIN].ItemID; } + set { m_wearables[SKIN].ItemID = value; } } public virtual UUID SkinAsset { - get { return m_wearables[(int)AppearanceLayer.SKIN].AssetID; } - set { m_wearables[(int)AppearanceLayer.SKIN].AssetID = value; } + get { return m_wearables[SKIN].AssetID; } + set { m_wearables[SKIN].AssetID = value; } } public virtual UUID HairItem { - get { return m_wearables[(int)AppearanceLayer.HAIR].ItemID; } - set { m_wearables[(int)AppearanceLayer.HAIR].ItemID = value; } + get { return m_wearables[HAIR].ItemID; } + set { m_wearables[HAIR].ItemID = value; } } public virtual UUID HairAsset { - get { return m_wearables[(int)AppearanceLayer.HAIR].AssetID; } - set { m_wearables[(int)AppearanceLayer.HAIR].AssetID = value; } + get { return m_wearables[HAIR].AssetID; } + set { m_wearables[HAIR].AssetID = value; } } public virtual UUID EyesItem { - get { return m_wearables[(int)AppearanceLayer.EYES].ItemID; } - set { m_wearables[(int)AppearanceLayer.EYES].ItemID = value; } + get { return m_wearables[EYES].ItemID; } + set { m_wearables[EYES].ItemID = value; } } public virtual UUID EyesAsset { - get { return m_wearables[(int)AppearanceLayer.EYES].AssetID; } - set { m_wearables[(int)AppearanceLayer.EYES].AssetID = value; } + get { return m_wearables[EYES].AssetID; } + set { m_wearables[EYES].AssetID = value; } } public virtual UUID ShirtItem { - get { return m_wearables[(int)AppearanceLayer.SHIRT].ItemID; } - set { m_wearables[(int)AppearanceLayer.SHIRT].ItemID = value; } + get { return m_wearables[SHIRT].ItemID; } + set { m_wearables[SHIRT].ItemID = value; } } public virtual UUID ShirtAsset { - get { return m_wearables[(int)AppearanceLayer.SHIRT].AssetID; } - set { m_wearables[(int)AppearanceLayer.SHIRT].AssetID = value; } + get { return m_wearables[SHIRT].AssetID; } + set { m_wearables[SHIRT].AssetID = value; } } public virtual UUID PantsItem { - get { return m_wearables[(int)AppearanceLayer.PANTS].ItemID; } - set { m_wearables[(int)AppearanceLayer.PANTS].ItemID = value; } + get { return m_wearables[PANTS].ItemID; } + set { m_wearables[PANTS].ItemID = value; } } public virtual UUID PantsAsset { - get { return m_wearables[(int)AppearanceLayer.PANTS].AssetID; } - set { m_wearables[(int)AppearanceLayer.PANTS].AssetID = value; } + get { return m_wearables[PANTS].AssetID; } + set { m_wearables[PANTS].AssetID = value; } } public virtual UUID ShoesItem { - get { return m_wearables[(int)AppearanceLayer.SHOES].ItemID; } - set { m_wearables[(int)AppearanceLayer.SHOES].ItemID = value; } + get { return m_wearables[SHOES].ItemID; } + set { m_wearables[SHOES].ItemID = value; } } public virtual UUID ShoesAsset { - get { return m_wearables[(int)AppearanceLayer.SHOES].AssetID; } - set { m_wearables[(int)AppearanceLayer.SHOES].AssetID = value; } + get { return m_wearables[SHOES].AssetID; } + set { m_wearables[SHOES].AssetID = value; } } public virtual UUID SocksItem { - get { return m_wearables[(int)AppearanceLayer.SOCKS].ItemID; } - set { m_wearables[(int)AppearanceLayer.SOCKS].ItemID = value; } + get { return m_wearables[SOCKS].ItemID; } + set { m_wearables[SOCKS].ItemID = value; } } public virtual UUID SocksAsset { - get { return m_wearables[(int)AppearanceLayer.SOCKS].AssetID; } - set { m_wearables[(int)AppearanceLayer.SOCKS].AssetID = value; } + get { return m_wearables[SOCKS].AssetID; } + set { m_wearables[SOCKS].AssetID = value; } } public virtual UUID JacketItem { - get { return m_wearables[(int)AppearanceLayer.JACKET].ItemID; } - set { m_wearables[(int)AppearanceLayer.JACKET].ItemID = value; } + get { return m_wearables[JACKET].ItemID; } + set { m_wearables[JACKET].ItemID = value; } } public virtual UUID JacketAsset { - get { return m_wearables[(int)AppearanceLayer.JACKET].AssetID; } - set { m_wearables[(int)AppearanceLayer.JACKET].AssetID = value; } + get { return m_wearables[JACKET].AssetID; } + set { m_wearables[JACKET].AssetID = value; } } public virtual UUID GlovesItem { - get { return m_wearables[(int)AppearanceLayer.GLOVES].ItemID; } - set { m_wearables[(int)AppearanceLayer.GLOVES].ItemID = value; } + get { return m_wearables[GLOVES].ItemID; } + set { m_wearables[GLOVES].ItemID = value; } } public virtual UUID GlovesAsset { - get { return m_wearables[(int)AppearanceLayer.GLOVES].AssetID; } - set { m_wearables[(int)AppearanceLayer.GLOVES].AssetID = value; } + get { return m_wearables[GLOVES].AssetID; } + set { m_wearables[GLOVES].AssetID = value; } } public virtual UUID UnderShirtItem { - get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID; } - set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID = value; } + get { return m_wearables[UNDERSHIRT].ItemID; } + set { m_wearables[UNDERSHIRT].ItemID = value; } } public virtual UUID UnderShirtAsset { - get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID; } - set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID = value; } + get { return m_wearables[UNDERSHIRT].AssetID; } + set { m_wearables[UNDERSHIRT].AssetID = value; } } public virtual UUID UnderPantsItem { - get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID; } - set { m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID = value; } + get { return m_wearables[UNDERPANTS].ItemID; } + set { m_wearables[UNDERPANTS].ItemID = value; } } public virtual UUID UnderPantsAsset { - get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID; } - set { m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID = value; } + get { return m_wearables[UNDERPANTS].AssetID; } + set { m_wearables[UNDERPANTS].AssetID = value; } } public virtual UUID SkirtItem { - get { return m_wearables[(int)AppearanceLayer.SKIRT].ItemID; } - set { m_wearables[(int)AppearanceLayer.SKIRT].ItemID = value; } + get { return m_wearables[SKIRT].ItemID; } + set { m_wearables[SKIRT].ItemID = value; } } public virtual UUID SkirtAsset { - get { return m_wearables[(int)AppearanceLayer.SKIRT].AssetID; } - set { m_wearables[(int)AppearanceLayer.SKIRT].AssetID = value; } + get { return m_wearables[SKIRT].AssetID; } + set { m_wearables[SKIRT].AssetID = value; } } public virtual void SetDefaultWearables() { - m_wearables[(int)AppearanceLayer.BODY].AssetID = BODY_ASSET; - m_wearables[(int)AppearanceLayer.BODY].ItemID = BODY_ITEM; - m_wearables[(int)AppearanceLayer.SKIN].AssetID = SKIN_ASSET; - m_wearables[(int)AppearanceLayer.SKIN].ItemID = SKIN_ITEM; - m_wearables[(int)AppearanceLayer.HAIR].AssetID = HAIR_ASSET; - m_wearables[(int)AppearanceLayer.HAIR].ItemID = HAIR_ITEM; - m_wearables[(int)AppearanceLayer.SHIRT].AssetID = SHIRT_ASSET; - m_wearables[(int)AppearanceLayer.SHIRT].ItemID = SHIRT_ITEM; - m_wearables[(int)AppearanceLayer.PANTS].AssetID = PANTS_ASSET; - m_wearables[(int)AppearanceLayer.PANTS].ItemID = PANTS_ITEM; - m_wearables[(int)AppearanceLayer.ALPHA].AssetID = ALPHA_ASSET; - m_wearables[(int)AppearanceLayer.ALPHA].ItemID = ALPHA_ITEM; - m_wearables[(int)AppearanceLayer.TATTOO].AssetID = TATTOO_ASSET; - m_wearables[(int)AppearanceLayer.TATTOO].ItemID = TATTOO_ITEM; + m_wearables[BODY].AssetID = BODY_ASSET; + m_wearables[BODY].ItemID = BODY_ITEM; + m_wearables[SKIN].AssetID = SKIN_ASSET; + m_wearables[SKIN].ItemID = SKIN_ITEM; + m_wearables[HAIR].AssetID = HAIR_ASSET; + m_wearables[HAIR].ItemID = HAIR_ITEM; + m_wearables[SHIRT].AssetID = SHIRT_ASSET; + m_wearables[SHIRT].ItemID = SHIRT_ITEM; + m_wearables[PANTS].AssetID = PANTS_ASSET; + m_wearables[PANTS].ItemID = PANTS_ITEM; } public virtual void ClearWearables() { - for (int i = 0; i < m_wearables.Length ; i++) + for (int i = 0; i < 13; i++) { m_wearables[i].AssetID = UUID.Zero; m_wearables[i].ItemID = UUID.Zero; @@ -394,12 +286,70 @@ namespace OpenSim.Framework get { return m_hipOffset; } } + //Builds the VisualParam Enum using LIBOMV's Visual Param NameValues + /* + public void BuildVisualParamEnum() + { + Dictionary IndexedParams = new Dictionary(); + int vpIndex = 0; + IndexedParams = new Dictionary(); + + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + + sb.Append("public enum VPElement: int\n"); + sb.Append("{\n"); + foreach (KeyValuePair kvp in OpenMetaverse.VisualParams.Params) + { + VisualParam vp = kvp.Value; + + // Only Group-0 parameters are sent in AgentSetAppearance packets + if (kvp.Value.Group == 0) + { + + if (!IndexedParams.ContainsKey(vp.Name)) + { + + if (vp.Label.Length > 0 || vp.LabelMin.Length > 0 || vp.LabelMax.Length > 0) + { + + sb.Append("/// \n"); + if (vp.LabelMin.Length > 0 && vp.LabelMax.Length > 0) + sb.Append(string.Format("/// {0} - {1} 0--+255 {2}\n", vp.Label, vp.LabelMin, + vp.LabelMax)); + + else + sb.Append(string.Format("/// {0}\n", vp.Label)); + + sb.Append("/// \n"); + } + sb.Append(string.Format(" {0}_{1} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"),vpIndex)); + + IndexedParams.Add(vp.Name, vpIndex++); + } + else + { + sb.Append(string.Format(" {0}_{1}_{2} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"), vpIndex)); + vpIndex++; + //int i = 0; + } + } + if (vpIndex < 217) + sb.Append(",\n"); + else + sb.Append("\n"); + + } + sb.Append("}\n"); + + } + */ + public AvatarAppearance() : this(UUID.Zero) {} public AvatarAppearance(UUID owner) { - m_wearables = new AvatarWearable[(int)AppearanceLayer.MAX_WEARABLES]; - for (int i = 0; i < (int)AppearanceLayer.MAX_WEARABLES; i++) + m_wearables = new AvatarWearable[MAX_WEARABLES]; + for (int i = 0; i < MAX_WEARABLES; i++) { // this makes them all null m_wearables[i] = new AvatarWearable(); @@ -492,6 +442,121 @@ namespace OpenSim.Framework return visualParams; } + public override String ToString() + { + String s = "[Wearables] =>"; + s += " Body Item: " + BodyItem.ToString() + ";"; + s += " Skin Item: " + SkinItem.ToString() + ";"; + s += " Shirt Item: " + ShirtItem.ToString() + ";"; + s += " Pants Item: " + PantsItem.ToString() + ";"; + return s; + } + + // this is used for OGS1 + public virtual Hashtable ToHashTable() + { + Hashtable h = new Hashtable(); + h["owner"] = Owner.ToString(); + h["serial"] = Serial.ToString(); + h["visual_params"] = VisualParams; + h["texture"] = Texture.GetBytes(); + h["avatar_height"] = AvatarHeight.ToString(); + h["body_item"] = BodyItem.ToString(); + h["body_asset"] = BodyAsset.ToString(); + h["skin_item"] = SkinItem.ToString(); + h["skin_asset"] = SkinAsset.ToString(); + h["hair_item"] = HairItem.ToString(); + h["hair_asset"] = HairAsset.ToString(); + h["eyes_item"] = EyesItem.ToString(); + h["eyes_asset"] = EyesAsset.ToString(); + h["shirt_item"] = ShirtItem.ToString(); + h["shirt_asset"] = ShirtAsset.ToString(); + h["pants_item"] = PantsItem.ToString(); + h["pants_asset"] = PantsAsset.ToString(); + h["shoes_item"] = ShoesItem.ToString(); + h["shoes_asset"] = ShoesAsset.ToString(); + h["socks_item"] = SocksItem.ToString(); + h["socks_asset"] = SocksAsset.ToString(); + h["jacket_item"] = JacketItem.ToString(); + h["jacket_asset"] = JacketAsset.ToString(); + h["gloves_item"] = GlovesItem.ToString(); + h["gloves_asset"] = GlovesAsset.ToString(); + h["undershirt_item"] = UnderShirtItem.ToString(); + h["undershirt_asset"] = UnderShirtAsset.ToString(); + h["underpants_item"] = UnderPantsItem.ToString(); + h["underpants_asset"] = UnderPantsAsset.ToString(); + h["skirt_item"] = SkirtItem.ToString(); + h["skirt_asset"] = SkirtAsset.ToString(); + + string attachments = GetAttachmentsString(); + if (attachments != String.Empty) + h["attachments"] = attachments; + + return h; + } + + public AvatarAppearance(Hashtable h) + { + Owner = new UUID((string)h["owner"]); + Serial = Convert.ToInt32((string)h["serial"]); + VisualParams = (byte[])h["visual_params"]; + + if (h.Contains("texture")) + { + byte[] te = h["texture"] as byte[]; + if (te != null && te.Length > 0) + Texture = new Primitive.TextureEntry(te, 0, te.Length); + } + else + { + // We shouldn't be receiving appearance hashtables without a TextureEntry, + // but in case we do this will prevent a failure when saving to the database + Texture = GetDefaultTexture(); + } + + + AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); + + m_wearables = new AvatarWearable[MAX_WEARABLES]; + for (int i = 0; i < MAX_WEARABLES; i++) + { + // this makes them all null + m_wearables[i] = new AvatarWearable(); + } + + BodyItem = new UUID((string)h["body_item"]); + BodyAsset = new UUID((string)h["body_asset"]); + SkinItem = new UUID((string)h["skin_item"]); + SkinAsset = new UUID((string)h["skin_asset"]); + HairItem = new UUID((string)h["hair_item"]); + HairAsset = new UUID((string)h["hair_asset"]); + EyesItem = new UUID((string)h["eyes_item"]); + EyesAsset = new UUID((string)h["eyes_asset"]); + ShirtItem = new UUID((string)h["shirt_item"]); + ShirtAsset = new UUID((string)h["shirt_asset"]); + PantsItem = new UUID((string)h["pants_item"]); + PantsAsset = new UUID((string)h["pants_asset"]); + ShoesItem = new UUID((string)h["shoes_item"]); + ShoesAsset = new UUID((string)h["shoes_asset"]); + SocksItem = new UUID((string)h["socks_item"]); + SocksAsset = new UUID((string)h["socks_asset"]); + JacketItem = new UUID((string)h["jacket_item"]); + JacketAsset = new UUID((string)h["jacket_asset"]); + GlovesItem = new UUID((string)h["gloves_item"]); + GlovesAsset = new UUID((string)h["gloves_asset"]); + UnderShirtItem = new UUID((string)h["undershirt_item"]); + UnderShirtAsset = new UUID((string)h["undershirt_asset"]); + UnderPantsItem = new UUID((string)h["underpants_item"]); + UnderPantsAsset = new UUID((string)h["underpants_asset"]); + SkirtItem = new UUID((string)h["skirt_item"]); + SkirtAsset = new UUID((string)h["skirt_asset"]); + + if (h.ContainsKey("attachments")) + { + SetAttachmentsString(h["attachments"].ToString()); + } + } + private Dictionary m_attachments = new Dictionary(); public void SetAttachments(AttachmentData[] data) @@ -1424,4 +1489,4 @@ namespace OpenSim.Framework SKIRT_SKIRT_BLUE = 217 } } -} +} \ No newline at end of file -- cgit v1.1 From 840b75ca9b9af2f98109a54b442669221014b854 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Oct 2010 20:48:37 +0200 Subject: Add my work on top of cmickeyb's --- OpenSim/Framework/AvatarAppearance.cs | 100 +++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 55646dd..4738d88 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -35,6 +35,104 @@ using log4net; namespace OpenSim.Framework { + // A special dictionary for avatar appearance + public struct LayerItem + { + public UUID ItemID; + public UUID AssetID; + + public LayerItem(UUID itemID, UUID assetID) + { + ItemID = itemID; + AssetID = assetID; + } + } + + public class Layer + { + protected int m_layerType; + protected Dictionary m_items = new Dictionary(); + protected List m_ids = new List(); + + public Layer(int type) + { + m_layerType = type; + } + + public int LayerType + { + get { return m_layerType; } + } + + public int Count + { + get { return m_ids.Count; } + } + + public void Add(UUID itemID, UUID assetID) + { + if (m_items.ContainsKey(itemID)) + return; + if (m_ids.Count >= 5) + return; + + m_ids.Add(itemID); + m_items[itemID] = assetID; + } + + public void Wear(UUID itemID, UUID assetID) + { + Clear(); + Add(itemID, assetID); + } + + public void Clear() + { + m_ids.Clear(); + m_items.Clear(); + } + + public void RemoveItem(UUID itemID) + { + if (m_items.ContainsKey(itemID)) + { + m_ids.Remove(itemID); + m_items.Remove(itemID); + } + } + + public void RemoveAsset(UUID assetID) + { + UUID itemID = UUID.Zero; + + foreach (KeyValuePair kvp in m_items) + { + if (kvp.Value == assetID) + { + itemID = kvp.Key; + break; + } + } + + if (itemID != UUID.Zero) + { + m_ids.Remove(itemID); + m_items.Remove(itemID); + } + } + + public LayerItem this [int idx] + { + get + { + if (idx >= m_ids.Count || idx < 0) + return new LayerItem(UUID.Zero, UUID.Zero); + + return new LayerItem(m_ids[idx], m_items[m_ids[idx]]); + } + } + } + /// /// Contains the Avatar's Appearance and methods to manipulate the appearance. /// @@ -1456,4 +1554,4 @@ namespace OpenSim.Framework SKIRT_SKIRT_BLUE = 217 } } -} \ No newline at end of file +} -- cgit v1.1 From d5d0e81df2415203711fc418ac901b007f1e6607 Mon Sep 17 00:00:00 2001 From: mores Date: Tue, 2 Nov 2010 21:46:45 -0400 Subject: Admin Server can now bind to a private ip address Signed-off-by: Melanie --- OpenSim/Framework/MainServer.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 1f5f208..8ccabec 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Reflection; +using System.Net; using log4net; using OpenSim.Framework.Servers.HttpServer; @@ -48,6 +49,11 @@ namespace OpenSim.Framework public static IHttpServer GetHttpServer(uint port) { + return GetHttpServer(port,null); + } + + public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) + { if (port == 0) return Instance; if (instance != null && port == Instance.Port) @@ -58,6 +64,9 @@ namespace OpenSim.Framework m_Servers[port] = new BaseHttpServer(port); + if (ipaddr != null ) + m_Servers[port].ListenIPAddress = ipaddr; + m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); m_Servers[port].Start(); -- cgit v1.1 From f985775962ae8da0010cc5ef5f903a53b550f5d2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Nov 2010 14:27:14 +0100 Subject: Revert "Fix for hanging on "Connecting to region".. caused by packets being processed before the presence has bound to receive events. Fixed this by adding packets to a queue and then processing them when the presence is ready." This reverts commit 91b1d17e5bd3ff6ed006744bc529b53a67af1a64. Conflicts: OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs --- OpenSim/Framework/IClientAPI.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 1e1dfa8..f8be9ad 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -944,7 +944,6 @@ namespace OpenSim.Framework void SetDebugPacketLevel(int newDebug); void InPacket(object NewPack); - void ProcessPendingPackets(); void ProcessInPacket(Packet NewPack); void Close(); void Close(bool sendStop); -- cgit v1.1 From 09ea73f7cc859978de7ae6dd30eb8dc943d71162 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Nov 2010 15:33:03 +0100 Subject: Change "OpenSim" to "Careminster" and remove CM suffix. --- OpenSim/Framework/Servers/VersionInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index f852e54..ce6ecf8 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.7.1CM"; + private const string VERSION_NUMBER = "0.7.1"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour @@ -49,7 +49,7 @@ namespace OpenSim public static string GetVersionString(string versionNumber, Flavour flavour) { - string versionString = "OpenSim " + versionNumber + " " + flavour; + string versionString = "Careminster " + versionNumber + " " + flavour; return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); } -- cgit v1.1 From ccfbce3176b429b0e590a8fedbf32185a6014c55 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Nov 2010 16:07:43 +0100 Subject: Remove "OpenSimulator" from startup message --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index cbab2db..8ff27c8 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -280,7 +280,7 @@ namespace OpenSim.Framework.Servers EnhanceVersionInformation(); - m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine); + m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine); // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and // the clr version number doesn't match the project version number under Mono. //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); -- cgit v1.1 From 4f15b8d4e6be1e1fe88ad32aa43595861d1005ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 20:44:39 +0100 Subject: Change the way attachments are persisted. Editing a worn attachment will now save properly, as will the results of a resizer script working. Attachment positions are no longer saved on each move, but instead are saved once on logout. Attachment script states are saved as part of the attachment now when detaching. --- OpenSim/Framework/ISceneObject.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs index 5147901..18631f1 100644 --- a/OpenSim/Framework/ISceneObject.cs +++ b/OpenSim/Framework/ISceneObject.cs @@ -39,5 +39,6 @@ namespace OpenSim.Framework void ExtraFromXmlString(string xmlstr); string GetStateSnapshot(); void SetState(string xmlstr, IScene s); + bool HasGroupChanged { get; set; } } } -- cgit v1.1 From 571becefb652869fa844188cadf8aca1fea774ab Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Nov 2010 23:31:29 +0100 Subject: Fix some crashes caused by the addition of the CreatorData column --- OpenSim/Framework/Capabilities/Caps.cs | 1 + OpenSim/Framework/TaskInventoryDictionary.cs | 1 + 2 files changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 7b0e053..e7f2e13 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -967,6 +967,7 @@ namespace OpenSim.Framework.Capabilities InventoryItemBase item = new InventoryItemBase(); item.Owner = m_agentID; item.CreatorId = m_agentID.ToString(); + item.CreatorData = String.Empty; item.ID = inventoryItem; item.AssetID = asset.FullID; item.Description = assetDescription; diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index a8a53f2..940e567 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -151,6 +151,7 @@ namespace OpenSim.Framework while (!m_itemLock.TryEnterWriteLock(60000)) { m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); + System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); if (m_itemLock.IsWriteLockHeld) { m_itemLock = new System.Threading.ReaderWriterLockSlim(); -- cgit v1.1 From b3a71c6df1538c61247f7d4711aba4c840508db8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 24 Nov 2010 18:56:25 +0100 Subject: Prevent an overlength button label from producing a debug dump and aborting the script. --- OpenSim/Framework/AgentCircuitData.cs | 35 +++++++++++++------------------ OpenSim/Framework/ChildAgentDataUpdate.cs | 10 ++------- 2 files changed, 17 insertions(+), 28 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index cc9fcea..1600bdc 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -302,31 +302,26 @@ namespace OpenSim.Framework if (args["start_pos"] != null) Vector3.TryParse(args["start_pos"].AsString(), out startpos); -// DEBUG ON - m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); -// DEBUG OFF + m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); try { - // Unpack various appearance elements - Appearance = new AvatarAppearance(AgentID); + // Unpack various appearance elements + Appearance = new AvatarAppearance(AgentID); - // Eventually this code should be deprecated, use full appearance - // packing in packed_appearance - if (args["appearance_serial"] != null) - Appearance.Serial = args["appearance_serial"].AsInteger(); + // Eventually this code should be deprecated, use full appearance + // packing in packed_appearance + if (args["appearance_serial"] != null) + Appearance.Serial = args["appearance_serial"].AsInteger(); - if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) - { - Appearance.Unpack((OSDMap)args["packed_appearance"]); -// DEBUG ON - m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); -// DEBUG OFF + if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) + { + Appearance.Unpack((OSDMap)args["packed_appearance"]); + m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); + } + else + m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); } -// DEBUG ON - else - m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); -// DEBUG OFF - } catch (Exception e) + catch (Exception e) { m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); } diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index a227338..ce0b2fb 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -331,9 +331,7 @@ namespace OpenSim.Framework public virtual OSDMap Pack() { -// DEBUG ON - m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data"); -// DEBUG OFF + m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); OSDMap args = new OSDMap(); args["message_type"] = OSD.FromString("AgentData"); @@ -454,9 +452,7 @@ namespace OpenSim.Framework /// public virtual void Unpack(OSDMap args) { -// DEBUG ON - m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Unpack data"); -// DEBUG OFF + m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); if (args.ContainsKey("region_id")) UUID.TryParse(args["region_id"].AsString(), out RegionID); @@ -613,10 +609,8 @@ namespace OpenSim.Framework if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); -// DEBUG ON else m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); -// DEBUG OFF if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) { -- cgit v1.1 From 0b41606e7348d84348ef6eb4a4eb4ab1e64ed629 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 27 Nov 2010 13:02:51 +0100 Subject: Instrument TI Dictionary to finally find that pesky script-caused deadlock --- OpenSim/Framework/TaskInventoryDictionary.cs | 36 +++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 940e567..814758a 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -52,6 +52,11 @@ namespace OpenSim.Framework private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Thread LockedByThread; + private string WriterStack; + + private Dictionary ReadLockers = + new Dictionary(); + /// /// An advanced lock for inventory data /// @@ -118,6 +123,13 @@ namespace OpenSim.Framework if (m_itemLock.IsWriteLockHeld) { m_itemLock = new System.Threading.ReaderWriterLockSlim(); + System.Console.WriteLine("------------------------------------------"); + System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); + System.Console.WriteLine("------------------------------------------"); + System.Console.WriteLine("Locker's call stack:\n" + WriterStack); + System.Console.WriteLine("------------------------------------------"); + LockedByThread = null; + ReadLockers.Clear(); } } } @@ -150,15 +162,33 @@ namespace OpenSim.Framework } while (!m_itemLock.TryEnterWriteLock(60000)) { - m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); if (m_itemLock.IsWriteLockHeld) { - m_itemLock = new System.Threading.ReaderWriterLockSlim(); + m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); + System.Console.WriteLine("------------------------------------------"); + System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); + System.Console.WriteLine("------------------------------------------"); + System.Console.WriteLine("Locker's call stack:\n" + WriterStack); + System.Console.WriteLine("------------------------------------------"); + } + else + { + m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by a reader. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); + System.Console.WriteLine("------------------------------------------"); + System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); + System.Console.WriteLine("------------------------------------------"); + foreach (KeyValuePair kvp in ReadLockers) + { + System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); + System.Console.WriteLine("------------------------------------------"); + } } + m_itemLock = new System.Threading.ReaderWriterLockSlim(); + ReadLockers.Clear(); } LockedByThread = Thread.CurrentThread; + WriterStack = Environment.StackTrace; } else { -- cgit v1.1 From ab2adaf3418e5a64c7d94305d45489310eaa2ab0 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 29 Nov 2010 16:24:16 -0800 Subject: Various bug fixes for appearance handling --- OpenSim/Framework/AvatarAppearance.cs | 23 ++++++++++++++++++----- OpenSim/Framework/Capabilities/Caps.cs | 4 ++++ 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 2906af8..aaf441c 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -238,11 +238,27 @@ namespace OpenSim.Framework // } } + /// + /// Invalidate all of the baked textures in the appearance, useful + /// if you know that none are valid + /// + public virtual void ResetBakedTextures() + { + SetDefaultTexture(); + + //for (int i = 0; i < BAKE_INDICES.Length; i++) + // { + // int idx = BAKE_INDICES[i]; + // m_texture.FaceTextures[idx].TextureID = UUID.Zero; + // } + } + protected virtual void SetDefaultTexture() { m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); - for (uint i = 0; i < TEXTURE_COUNT; i++) - m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE); + + // for (uint i = 0; i < TEXTURE_COUNT; i++) + // m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE); } /// @@ -274,9 +290,6 @@ namespace OpenSim.Framework } changed = true; - -// if (newface != null) -// m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID); } m_texture = textureEntry; diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index e7f2e13..b7f9a05 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -990,6 +990,7 @@ namespace OpenSim.Framework.Capabilities public void BakedTextureUploaded(UUID assetID, byte[] data) { // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); + AssetBase asset; asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); asset.Data = data; @@ -1331,6 +1332,7 @@ namespace OpenSim.Framework.Capabilities newAssetID = UUID.Random(); uploaderPath = path; httpListener = httpServer; + // m_log.WarnFormat("[CAPS] baked texture upload starting for {0}",newAssetID); } /// @@ -1342,6 +1344,8 @@ namespace OpenSim.Framework.Capabilities /// public string uploaderCaps(byte[] data, string path, string param) { + m_log.WarnFormat("[CAPS] baked texture upload completed for {0}",newAssetID); + string res = String.Empty; LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); uploadComplete.new_asset = newAssetID.ToString(); -- cgit v1.1 From 9b9ce8fb27f45009406e088284e4488749f3902e Mon Sep 17 00:00:00 2001 From: sacha Date: Sat, 4 Dec 2010 21:40:18 +0000 Subject: add more detail to the log in case of FORM Timeout cause nothing relevant are in the services logs --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 41ece86..d5646d0 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception e) { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: with {1} " + e.ToString(), requestUrl,obj); } finally { -- cgit v1.1 From b1a5c0398551e4051f84d8bf3acf46b18fbe739d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 6 Dec 2010 17:40:07 +0100 Subject: Lock the attachments dict so it doesn't get out of sync when iterating --- OpenSim/Framework/AvatarAppearance.cs | 94 ++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 35 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index d0c8b73..be15e1b 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -414,27 +414,36 @@ namespace OpenSim.Framework /// public List GetAttachments() { - List alist = new List(); - foreach (KeyValuePair> kvp in m_attachments) + lock (m_attachments) { - foreach (AvatarAttachment attach in kvp.Value) - alist.Add(new AvatarAttachment(attach)); - } + List alist = new List(); + foreach (KeyValuePair> kvp in m_attachments) + { + foreach (AvatarAttachment attach in kvp.Value) + alist.Add(new AvatarAttachment(attach)); + } - return alist; + return alist; + } } internal void AppendAttachment(AvatarAttachment attach) { - if (! m_attachments.ContainsKey(attach.AttachPoint)) - m_attachments[attach.AttachPoint] = new List(); - m_attachments[attach.AttachPoint].Add(attach); + lock (m_attachments) + { + if (!m_attachments.ContainsKey(attach.AttachPoint)) + m_attachments[attach.AttachPoint] = new List(); + m_attachments[attach.AttachPoint].Add(attach); + } } internal void ReplaceAttachment(AvatarAttachment attach) { - m_attachments[attach.AttachPoint] = new List(); - m_attachments[attach.AttachPoint].Add(attach); + lock (m_attachments) + { + m_attachments[attach.AttachPoint] = new List(); + m_attachments[attach.AttachPoint].Add(attach); + } } /// @@ -450,9 +459,12 @@ namespace OpenSim.Framework if (item == UUID.Zero) { - if (m_attachments.ContainsKey(attachpoint)) - m_attachments.Remove(attachpoint); - return; + lock (m_attachments) + { + if (m_attachments.ContainsKey(attachpoint)) + m_attachments.Remove(attachpoint); + return; + } } // check if this is an append or a replace, 0x80 marks it as an append @@ -470,37 +482,46 @@ namespace OpenSim.Framework public int GetAttachpoint(UUID itemID) { - foreach (KeyValuePair> kvp in m_attachments) + lock (m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); - if (index >= 0) - return kvp.Key; - } + foreach (KeyValuePair> kvp in m_attachments) + { + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) + return kvp.Key; + } - return 0; + return 0; + } } public void DetachAttachment(UUID itemID) { - foreach (KeyValuePair> kvp in m_attachments) + lock (m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); - if (index >= 0) + foreach (KeyValuePair> kvp in m_attachments) { - // Remove it from the list of attachments at that attach point - m_attachments[kvp.Key].RemoveAt(index); + int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); + if (index >= 0) + { + // Remove it from the list of attachments at that attach point + m_attachments[kvp.Key].RemoveAt(index); - // And remove the list if there are no more attachments here - if (m_attachments[kvp.Key].Count == 0) - m_attachments.Remove(kvp.Key); - return; + // And remove the list if there are no more attachments here + if (m_attachments[kvp.Key].Count == 0) + m_attachments.Remove(kvp.Key); + return; + } } } } public void ClearAttachments() { - m_attachments.Clear(); + lock (m_attachments) + { + m_attachments.Clear(); + } } #region Packing Functions @@ -537,11 +558,14 @@ namespace OpenSim.Framework OSDBinary visualparams = new OSDBinary(m_visualparams); data["visualparams"] = visualparams; - // Attachments - OSDArray attachs = new OSDArray(m_attachments.Count); - foreach (AvatarAttachment attach in GetAttachments()) - attachs.Add(attach.Pack()); - data["attachments"] = attachs; + lock (m_attachments) + { + // Attachments + OSDArray attachs = new OSDArray(m_attachments.Count); + foreach (AvatarAttachment attach in GetAttachments()) + attachs.Add(attach.Pack()); + data["attachments"] = attachs; + } return data; } -- cgit v1.1 From a4f7937eb338df588c02ce44200876210d0d58c3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 7 Dec 2010 03:08:48 +0100 Subject: Add the interface needed to revive calling cards --- OpenSim/Framework/ICallingCardModule.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 OpenSim/Framework/ICallingCardModule.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ICallingCardModule.cs b/OpenSim/Framework/ICallingCardModule.cs new file mode 100644 index 0000000..6e343bb --- /dev/null +++ b/OpenSim/Framework/ICallingCardModule.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Framework +{ + public interface ICallingCardModule + { + void CreateCallingCard(UUID userID, UUID creatorID, UUID folderID); + } +} -- cgit v1.1 From 549f90c5b51939fa40439a65baa15f8664529958 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 7 Dec 2010 04:45:28 +0100 Subject: Update calling card interface --- OpenSim/Framework/ICallingCardModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ICallingCardModule.cs b/OpenSim/Framework/ICallingCardModule.cs index 6e343bb..17e6de35 100644 --- a/OpenSim/Framework/ICallingCardModule.cs +++ b/OpenSim/Framework/ICallingCardModule.cs @@ -8,6 +8,6 @@ namespace OpenSim.Framework { public interface ICallingCardModule { - void CreateCallingCard(UUID userID, UUID creatorID, UUID folderID); + UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID); } } -- cgit v1.1 From 6b374fa54767a22c1d236470c8a19ee59b44d937 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 13 Dec 2010 20:19:52 +0100 Subject: Revamp the viewer -> banlist packet processing so fix a number of bugs. Remove the too coarse CanEditParcel method in favor of a CanEditParcelProperties method that takes a GroupPowers argument to specify what action is to be taken. Also, make the method to set parcel data much more granular. Permissions in a deeded setting should now work. --- OpenSim/Framework/IClientAPI.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index f8be9ad..1a59cf4 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -174,9 +174,10 @@ namespace OpenSim.Framework public delegate void ParcelAccessListRequest( UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client); - public delegate void ParcelAccessListUpdateRequest( - UUID agentID, UUID sessionID, uint flags, int landLocalID, List entries, - IClientAPI remote_client); + public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags, + int landLocalID, UUID transactionID, int sequenceID, + int sections, List entries, + IClientAPI remote_client); public delegate void ParcelPropertiesRequest( int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); -- cgit v1.1 From d7622cbedc3a4423ce5192f959851ba360c46fde Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 16 Dec 2010 21:01:38 +0100 Subject: Fix notecards that end with an embedded object causing an exception --- OpenSim/Framework/SLUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index 9941a7f..b337e03 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs @@ -340,7 +340,7 @@ namespace OpenSim.Framework int count = -1; - while (count < len) + while (count < len && idx < input.Length) { // int l = input[idx].Length; string ln = input[idx]; @@ -375,4 +375,4 @@ namespace OpenSim.Framework return output; } } -} \ No newline at end of file +} -- cgit v1.1 From cf37b3b9434ca940fa635c0e951fa9ac7c07175a Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 22 Dec 2010 03:25:30 +0100 Subject: Prevent a null ref when an avatar login doesn't go as planned --- OpenSim/Framework/Watchdog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 9baf3a0..3389ecb 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -127,7 +127,7 @@ namespace OpenSim.Framework m_threads.Add(threadInfo.Thread.ManagedThreadId, threadInfo); } - private static bool RemoveThread(int threadID) + public static bool RemoveThread(int threadID) { lock (m_threads) return m_threads.Remove(threadID); -- cgit v1.1 From 42d44c00f38d6c7f5a67920ff375ab20ceb24fe9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Dec 2010 03:46:57 +0100 Subject: Change the mute list parts of the client interface so that all data is provided to the module --- OpenSim/Framework/IClientAPI.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index da893b6..ea081e2 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -463,9 +463,9 @@ namespace OpenSim.Framework public delegate void AgentFOV(IClientAPI client, float verticalAngle); - public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID); + public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int type, uint flags); - public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name, UUID AgentID); + public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name); public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); -- cgit v1.1 From 2cb2bff9b2ab68c325b0142da0b37730be9a12a3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 30 Dec 2010 00:31:59 +0100 Subject: Implement SendPlacesReply --- OpenSim/Framework/IClientAPI.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index ea081e2..3f77092 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -587,6 +587,23 @@ namespace OpenSim.Framework } } + public class PlacesReplyData + { + public UUID OwnerID; + public string Name; + public string Desc; + public int ActualArea; + public int BillableArea; + public byte Flags; + public uint GlobalX; + public uint GlobalY; + public uint GlobalZ; + public string SimName; + public UUID SnapshotID; + public uint Dwell; + public int Price; + } + /// /// Specifies the fields that have been changed when sending a prim or /// avatar update @@ -1321,5 +1338,7 @@ namespace OpenSim.Framework void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId); void StopFlying(ISceneEntity presence); + + void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data); } } -- cgit v1.1 From c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 8 Jan 2011 16:44:28 +0100 Subject: Preserve the script running flag when copying an object. --- OpenSim/Framework/TaskInventoryItem.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 248502e..be2b8c8 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -124,6 +124,9 @@ namespace OpenSim.Framework private UUID _oldID = UUID.Zero; private bool _ownerChanged = false; + + // This used ONLY during copy. It can't be relied on at other times! + private bool _scriptRunning = true; public UUID AssetID { get { @@ -387,6 +390,15 @@ namespace OpenSim.Framework } } + public bool ScriptRunning { + get { + return _scriptRunning; + } + set { + _scriptRunning = value; + } + } + // See ICloneable #region ICloneable Members -- cgit v1.1 From e4bb8dc3859c49811c0a7b70ada5dcce79094923 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 13 Jan 2011 00:19:39 +0100 Subject: Guard against invalid light color specifiers from the database --- OpenSim/Framework/PrimitiveBaseShape.cs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 20b9cf1..9a38f23 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -708,7 +708,12 @@ namespace OpenSim.Framework return _lightColorR; } set { - _lightColorR = value; + if (value < 0) + _lightColorR = 0; + else if (value > 1.0f) + _lightColorR = 1.0f; + else + _lightColorR = value; } } @@ -717,7 +722,12 @@ namespace OpenSim.Framework return _lightColorG; } set { - _lightColorG = value; + if (value < 0) + _lightColorG = 0; + else if (value > 1.0f) + _lightColorG = 1.0f; + else + _lightColorG = value; } } @@ -726,7 +736,12 @@ namespace OpenSim.Framework return _lightColorB; } set { - _lightColorB = value; + if (value < 0) + _lightColorB = 0; + else if (value > 1.0f) + _lightColorB = 1.0f; + else + _lightColorB = value; } } @@ -735,7 +750,12 @@ namespace OpenSim.Framework return _lightColorA; } set { - _lightColorA = value; + if (value < 0) + _lightColorA = 0; + else if (value > 1.0f) + _lightColorA = 1.0f; + else + _lightColorA = value; } } -- cgit v1.1 From 63dcd44e8727a4e264feaf2d981c70bbfa209811 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 12:47:43 -0800 Subject: Provide an SL compatible llMD5String function across all platforms --- OpenSim/Framework/Util.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index cef756c..9227708 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -409,19 +409,25 @@ namespace OpenSim.Framework /// /// /// + public static string Md5Hash(string data) { - byte[] dataMd5 = ComputeMD5Hash(data); + return Md5Hash(data, Encoding.Default); + } + + public static string Md5Hash(string data, Encoding encoding) + { + byte[] dataMd5 = ComputeMD5Hash(data, encoding); StringBuilder sb = new StringBuilder(); for (int i = 0; i < dataMd5.Length; i++) sb.AppendFormat("{0:x2}", dataMd5[i]); return sb.ToString(); } - private static byte[] ComputeMD5Hash(string data) + private static byte[] ComputeMD5Hash(string data, Encoding encoding) { MD5 md5 = MD5.Create(); - return md5.ComputeHash(Encoding.Default.GetBytes(data)); + return md5.ComputeHash(encoding.GetBytes(data)); } /// @@ -1161,7 +1167,7 @@ namespace OpenSim.Framework public static Guid GetHashGuid(string data, string salt) { - byte[] hash = ComputeMD5Hash(data + salt); + byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default); //string s = BitConverter.ToString(hash); -- cgit v1.1 From 04c62c4959d99ed3a8d350464db64aac6db1ec5f Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 12:54:12 -0800 Subject: Revert my previous SHA1 commit in favour of a better implementation --- OpenSim/Framework/Util.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 9227708..96292ff 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -435,16 +435,22 @@ namespace OpenSim.Framework /// /// /// + public static string SHA1Hash(string data) { - byte[] hash = ComputeSHA1Hash(data); + return SHA1Hash(data, Encoding.Default); + } + + public static string SHA1Hash(string data, Encoding encoding) + { + byte[] hash = ComputeSHA1Hash(data, encoding); return BitConverter.ToString(hash).Replace("-", String.Empty); } - private static byte[] ComputeSHA1Hash(string src) + private static byte[] ComputeSHA1Hash(string src, Encoding encoding) { SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); - return SHA1.ComputeHash(Encoding.Default.GetBytes(src)); + return SHA1.ComputeHash(encoding.GetBytes(src)); } public static int fast_distance2d(int x, int y) -- cgit v1.1 From 3ecf712e4dd5318442e7c853eb43299840594ce5 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 14:20:39 -0800 Subject: Add userFlags check to isBanned. This checks bans against DenyAnonymous and DenyMinors. Note that the ban doesn't actually work yet due to some stuff mel's working on . --- OpenSim/Framework/EstateSettings.cs | 23 +++++++++++++++++++++-- OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 6 +++--- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 2a495b0..f9c13f3 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -338,11 +338,30 @@ namespace OpenSim.Framework return false; } - public bool IsBanned(UUID avatarID) + public bool IsBanned(UUID avatarID, int userFlags) { foreach (EstateBan ban in l_EstateBans) if (ban.BannedUserID == avatarID) return true; + + if (!IsEstateManager(avatarID) && !HasAccess(avatarID)) + { + if (DenyMinors) + { + if ((userFlags & 32) == 0) + { + return true; + } + } + if (DenyAnonymous) + { + if ((userFlags & 4) == 0) + { + return true; + } + } + } + return false; } @@ -350,7 +369,7 @@ namespace OpenSim.Framework { if (ban == null) return; - if (!IsBanned(ban.BannedUserID)) + if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans l_EstateBans.Add(ban); } diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index e7f8bfc..e131260 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs @@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests BannedHostNameMask = string.Empty, BannedUserID = bannedUserId} ); - Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); - Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); + Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not."); + Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is."); es.RemoveBan(bannedUserId); - Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); + Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is."); es.AddEstateManager(UUID.Zero); -- cgit v1.1 From 4a56038d11a82cb9b6a0e11cfe935e6c52948bd2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 2 Feb 2011 03:28:47 +0100 Subject: Change the timeout on WebUtil to 20s to help make more tps succeed --- OpenSim/Framework/WebUtil.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index d731ac5..0593341 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -138,17 +138,17 @@ namespace OpenSim.Framework /// public static OSDMap PutToService(string url, OSDMap data) { - return ServiceOSDRequest(url,data,"PUT",10000); + return ServiceOSDRequest(url,data,"PUT",20000); } public static OSDMap PostToService(string url, OSDMap data) { - return ServiceOSDRequest(url,data,"POST",10000); + return ServiceOSDRequest(url,data,"POST",20000); } public static OSDMap GetFromService(string url) { - return ServiceOSDRequest(url,null,"GET",10000); + return ServiceOSDRequest(url,null,"GET",20000); } public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) @@ -275,7 +275,7 @@ namespace OpenSim.Framework /// public static OSDMap PostToService(string url, NameValueCollection data) { - return ServiceFormRequest(url,data,10000); + return ServiceFormRequest(url,data,20000); } public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) -- cgit v1.1 From c79f79fc8487ed2c4a7e1b77679f6e0d7b8fa17d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 17 Feb 2011 18:49:03 +0100 Subject: Add needed dummy to sample money --- OpenSim/Framework/IMoneyModule.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 3d4873d..ea6ed4b 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -40,6 +40,7 @@ namespace OpenSim.Framework bool AmountCovered(IClientAPI client, int amount); void ApplyCharge(UUID agentID, int amount, string text); void ApplyUploadCharge(UUID agentID, int amount, string text); + void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); int UploadCharge { get; } int GroupCreationCharge { get; } -- cgit v1.1 From f54ddd88a2d615a7d577671cd38e66e60994451d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 14 Mar 2011 12:56:50 +0100 Subject: Up the timeout on slow requests to 3000 to stop console spam. Make sure request method and target are reported correctly and drop the txn id as it's empty 99% of the time. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 1d05b02..953ed85 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -378,6 +378,22 @@ namespace OpenSim.Framework.Servers.HttpServer /// public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) { + if (request.HttpMethod == String.Empty) // Can't handle empty requests, not wasting a thread + { + try + { + SendHTML500(response); + } + catch + { + } + + return; + } + + string requestMethod = request.HttpMethod; + string uriString = request.RawUrl; + string reqnum = "unknown"; int tickstart = Environment.TickCount; @@ -495,7 +511,7 @@ namespace OpenSim.Framework.Servers.HttpServer request.InputStream.Close(); - // HTTP IN support. The script engine taes it from here + // HTTP IN support. The script engine takes it from here // Nothing to worry about for us. // if (buffer == null) @@ -609,9 +625,9 @@ namespace OpenSim.Framework.Servers.HttpServer { m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); } - catch (InvalidOperationException e) + catch (Exception e) { - m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); + m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString()); SendHTML500(response); } finally @@ -619,9 +635,9 @@ namespace OpenSim.Framework.Servers.HttpServer // Every month or so this will wrap and give bad numbers, not really a problem // since its just for reporting, 200ms limit can be adjusted int tickdiff = Environment.TickCount - tickstart; - if (tickdiff > 500) + if (tickdiff > 3000) m_log.InfoFormat( - "[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms", reqnum, request.RawUrl, tickdiff); + "[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff); } } -- cgit v1.1 From 3cfaf4c2251a4f10ecfd37377f2254b4032ffd10 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Mar 2011 09:29:40 +0100 Subject: Adding a helper function lifted from Aurora. Not for core. --- OpenSim/Framework/EstateSettings.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index f9c13f3..37f6ed7 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -392,5 +392,14 @@ namespace OpenSim.Framework return l_EstateAccess.Contains(user); } + + public void SetFromFlags(ulong regionFlags) + { + 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); + } } } -- cgit v1.1 From c330f89fb1954ba2a784cd5bc421965b7594d60c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Mar 2011 10:43:43 +0100 Subject: Add some more fields to Estate settings and make them work. Run alter table estate_settings add column AllowLandmark tinyint not null default 1, add column AllowParcelChanges tinyint not null default 1, add column AllowSetHome tinyint not null default 1; to make this work. --- OpenSim/Framework/EstateSettings.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 37f6ed7..afbdd49 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -58,6 +58,30 @@ namespace OpenSim.Framework set { m_EstateName = value; } } + private bool m_AllowLandmark = true; + + public bool AllowLandmark + { + get { return m_AllowLandmark; } + set { m_AllowLandmark = value; } + } + + private bool m_AllowParcelChanges = true; + + public bool AllowParcelChanges + { + get { return m_AllowParcelChanges; } + set { m_AllowParcelChanges = value; } + } + + private bool m_AllowSetHome = true; + + public bool AllowSetHome + { + get { return m_AllowSetHome; } + set { m_AllowSetHome = value; } + } + private uint m_ParentEstateID = 1; public uint ParentEstateID -- cgit v1.1 From 83c78029e39848113939d5c2c386db42876136d7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 31 Mar 2011 15:48:42 +0200 Subject: Make the login service's call to the sim time out quicker so we have a chance to try fallback before the client quits --- OpenSim/Framework/WebUtil.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 4f5add9..f59c8f8 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -139,17 +139,22 @@ namespace OpenSim.Framework /// public static OSDMap PutToService(string url, OSDMap data) { - return ServiceOSDRequest(url,data,"PUT",20000); + return ServiceOSDRequest(url,data,"PUT", 20000); } public static OSDMap PostToService(string url, OSDMap data) { - return ServiceOSDRequest(url,data,"POST",20000); + return PostToService(url, data, 20000); + } + + public static OSDMap PostToService(string url, OSDMap data, int timeout) + { + return ServiceOSDRequest(url,data,"POST", timeout); } public static OSDMap GetFromService(string url) { - return ServiceOSDRequest(url,null,"GET",20000); + return ServiceOSDRequest(url,null,"GET", 20000); } public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) @@ -276,7 +281,7 @@ namespace OpenSim.Framework /// public static OSDMap PostToService(string url, NameValueCollection data) { - return ServiceFormRequest(url,data,20000); + return ServiceFormRequest(url,data, 20000); } public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) -- cgit v1.1 From dbf52b8cd1690e9df3501295c8c99d35988781d3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 17 Apr 2011 22:54:23 +0100 Subject: Correct the delegate for classified deletes --- OpenSim/Framework/IClientAPI.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 6ec69d3..2f35a6c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -441,6 +441,7 @@ namespace OpenSim.Framework public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client); public delegate void ClassifiedInfoUpdate(UUID classifiedID, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, Vector3 globalPos, byte classifiedFlags, int price, IClientAPI client); public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client); + public delegate void ClassifiedGodDelete(UUID classifiedID, UUID queryID, IClientAPI client); public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client); public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client); @@ -914,7 +915,7 @@ namespace OpenSim.Framework event ClassifiedInfoRequest OnClassifiedInfoRequest; event ClassifiedInfoUpdate OnClassifiedInfoUpdate; event ClassifiedDelete OnClassifiedDelete; - event ClassifiedDelete OnClassifiedGodDelete; + event ClassifiedGodDelete OnClassifiedGodDelete; event EventNotificationAddRequest OnEventNotificationAddRequest; event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; -- cgit v1.1 From 98fe37051a6844851245d4cd5460326873eb9759 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 30 Apr 2011 14:22:46 +0200 Subject: Set the attachment data on scripted rez to allow toasters to work. --- OpenSim/Framework/RegionInfo.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index f4437e0..f05e2e6 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -1016,6 +1016,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", "0", true); + configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, + "Max agents this sim will hold", "0", true); + configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, "Scope ID for this region", UUID.Zero.ToString(), true); -- cgit v1.1 From 763666e2d6e82dac4ae1514df8dcbe376c6f4cac Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 19:50:35 +0200 Subject: Enable compressed (gzip) fatpack transfers. --- OpenSim/Framework/WebUtil.cs | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index e77b88b..4d486e6 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; using System.IO; +using System.IO.Compression; using System.Net; using System.Net.Security; using System.Reflection; @@ -142,20 +143,25 @@ namespace OpenSim.Framework /// public static OSDMap PutToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url,data, "PUT", timeout); + return ServiceOSDRequest(url,data, "PUT", timeout, false); } public static OSDMap PostToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url, data, "POST", timeout); + return ServiceOSDRequest(url, data, "POST", timeout, false); + } + + public static OSDMap PostToServiceCompressed(string url, OSDMap data, int timeout) + { + return ServiceOSDRequest(url, data, "POST", timeout, true); } public static OSDMap GetFromService(string url, int timeout) { - return ServiceOSDRequest(url, null, "GET", timeout); + return ServiceOSDRequest(url, null, "GET", timeout, false); } - public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) + public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed) { int reqnum = m_requestNumber++; // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); @@ -180,10 +186,31 @@ namespace OpenSim.Framework string strBuffer = OSDParser.SerializeJsonString(data); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); - request.ContentType = "application/json"; - request.ContentLength = buffer.Length; //Count bytes to send - using (Stream requestStream = request.GetRequestStream()) - requestStream.Write(buffer, 0, buffer.Length); //Send it + if (compressed) + { + request.ContentType = "application/x-gzip"; + using (MemoryStream ms = new MemoryStream()) + { + using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) + { + comp.Write(buffer, 0, buffer.Length); + comp.Flush(); + + ms.Seek(0, SeekOrigin.Begin); + + request.ContentLength = ms.Length; //Count bytes to send + using (Stream requestStream = request.GetRequestStream()) + requestStream.Write(ms.ToArray(), 0, (int)ms.Length); + } + } + } + else + { + request.ContentType = "application/json"; + request.ContentLength = buffer.Length; //Count bytes to send + using (Stream requestStream = request.GetRequestStream()) + requestStream.Write(buffer, 0, buffer.Length); //Send it + } } // capture how much time was spent writing, this may seem silly -- cgit v1.1 From ade09d0fa1e4c1331bedcf2a5f99402436d8f187 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 23:23:33 +0200 Subject: Also compress the actual fatpacks --- OpenSim/Framework/WebUtil.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 4d486e6..41d7f03 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -141,6 +141,11 @@ namespace OpenSim.Framework /// PUT JSON-encoded data to a web service that returns LLSD or /// JSON data /// + public static OSDMap PutToServiceCompressed(string url, OSDMap data, int timeout) + { + return ServiceOSDRequest(url,data, "PUT", timeout, true); + } + public static OSDMap PutToService(string url, OSDMap data, int timeout) { return ServiceOSDRequest(url,data, "PUT", timeout, false); -- cgit v1.1 From 74dd619575c2e260ba680312a87249e284f3d2c9 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 17 May 2011 19:12:37 -0700 Subject: If a response cannot be obtained (the script has no handler) return a more friendly 500 error instead of crashing out with a null reference and letting the connection hang --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 598e5d1..36c6c75 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1510,11 +1510,25 @@ namespace OpenSim.Framework.Servers.HttpServer internal void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) { - //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); - int responsecode = (int)responsedata["int_response_code"]; - string responseString = (string)responsedata["str_response_string"]; - string contentType = (string)responsedata["content_type"]; + int responsecode; + string responseString; + string contentType; + if (responsedata == null) + { + responsecode = 500; + responseString = "No response could be obtained"; + contentType = "text/plain"; + responsedata = new Hashtable(); + } + else + { + + //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); + responsecode = (int)responsedata["int_response_code"]; + responseString = (string)responsedata["str_response_string"]; + contentType = (string)responsedata["content_type"]; + } if (responsedata.ContainsKey("error_status_text")) { -- cgit v1.1 From b000d9ba724ae12ae27c49dd94e36d4592bd6c26 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 26 May 2011 03:42:01 -0700 Subject: Some additional protection, it seems that responsedata needs to be locked, but I can't immediately see where it's being accessed from another thread. For now, this will protect the server --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 36c6c75..c12d666 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1523,11 +1523,20 @@ namespace OpenSim.Framework.Servers.HttpServer } else { - - //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); - responsecode = (int)responsedata["int_response_code"]; - responseString = (string)responsedata["str_response_string"]; - contentType = (string)responsedata["content_type"]; + try + { + //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); + responsecode = (int)responsedata["int_response_code"]; + responseString = (string)responsedata["str_response_string"]; + contentType = (string)responsedata["content_type"]; + } + catch + { + responsecode = 500; + responseString = "No response could be obtained"; + contentType = "text/plain"; + responsedata = new Hashtable(); + } } if (responsedata.ContainsKey("error_status_text")) -- cgit v1.1 From 163ee8216873f963efd3ea42dd007b095214bce0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 20 Jun 2011 02:29:09 +0200 Subject: Add some flags to control content in search better --- OpenSim/Framework/RegionSettings.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 673cf20..f0786fc 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -397,5 +397,18 @@ namespace OpenSim.Framework set { m_LoadedCreationID = value; } } + private bool m_GodBlockSearch = false; + public bool GodBlockSearch + { + get { return m_GodBlockSearch; } + set { m_GodBlockSearch = value; } + } + + private bool m_Casino = false; + public bool Casino + { + get { return m_Casino; } + set { m_Casino = value; } + } } } -- cgit v1.1 From 9c9b3e3976cbbac9330292bb3abd5935093a4849 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jul 2011 17:27:20 +0200 Subject: Dammit, loggin the type of an exception without providing the FULL DUMP is NOT going to help squash bugs! --- OpenSim/Framework/WebUtil.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index f176485..90ab982 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -245,6 +245,7 @@ namespace OpenSim.Framework catch (Exception ex) { errorMessage = ex.Message; + m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString()); } finally { -- cgit v1.1 From 0e52010c0eafff64207649d3f53ccf734a072e88 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 22 Jul 2011 12:36:05 +0100 Subject: Thank you, Michelle Argus, for a patch that adds reading the agent limit from XML properly. --- OpenSim/Framework/RegionInfo.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 17184d6..04cfa93 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -769,7 +769,10 @@ namespace OpenSim.Framework "Clamp prims to max size", "false", true); configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, - "Max objects this sim will hold", "0", true); + "Max objects this sim will hold", "15000", true); + + configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, + "Max avatars this sim will hold", "100", true); configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max agents this sim will hold", "0", true); -- cgit v1.1 From 705f70064e74b92a77deed9ad769af22e4923448 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 22 Jul 2011 12:38:08 +0100 Subject: Fix merge artefact --- OpenSim/Framework/RegionInfo.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 04cfa93..b0202fb 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -774,9 +774,6 @@ namespace OpenSim.Framework configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max avatars this sim will hold", "100", true); - configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, - "Max agents this sim will hold", "0", true); - configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, "Scope ID for this region", UUID.Zero.ToString(), true); -- cgit v1.1 From 96174595da269f50d37c88c213ad00b79a7c7c83 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 23 Jul 2011 11:39:32 +0100 Subject: Fix LLTextBox to work with the updated libOMV --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0a4dcac..80171b4 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1401,7 +1401,7 @@ namespace OpenSim.Framework void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt); void SendChangeUserRights(UUID agentID, UUID friendID, int rights); - void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId); + void SendTextBoxRequest(string message, int chatChannel, string objectname, UUID ownerID, string ownerFirstName, string ownerLastName, UUID objectId); void StopFlying(ISceneEntity presence); -- cgit v1.1 From 2f6cc771542e5ce6fb39c16f8d69f3f15f611b6c Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Oct 2011 07:08:23 +0100 Subject: Adjust CM version tag --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 2a142be..b2bb962 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.7.3"; + private const string VERSION_NUMBER = "0.7.3CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From ec8c93aa5e1d0af2c0adf38156b05e85421f4a81 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 4 Dec 2011 12:35:01 +0100 Subject: Implement ChangeInventoryItemFlagsPacket handling --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 925998f..cda8a1b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -503,6 +503,7 @@ namespace OpenSim.Framework public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID); public delegate void SendPostcard(IClientAPI client); + public delegate void ChangeInventoryItemFlags(IClientAPI client, UUID itemID, uint flags); #endregion @@ -1007,6 +1008,7 @@ namespace OpenSim.Framework event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; event SimWideDeletesDelegate OnSimWideDeletes; event SendPostcard OnSendPostcard; + event ChangeInventoryItemFlags OnChangeInventoryItemFlags; event MuteListEntryUpdate OnUpdateMuteListEntry; event MuteListEntryRemove OnRemoveMuteListEntry; event GodlikeMessage onGodlikeMessage; -- cgit v1.1 From 090bf7acca33996786d4a1245c7954d7f9784105 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 01:17:41 +0000 Subject: Correct a coordinate to make the viewer like it --- OpenSim/Framework/RegionSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 7cdfc1c..f392889 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -58,7 +58,7 @@ namespace OpenSim.Framework Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y)); } - public Vector3 GetLocation(Vector3 pos, Quaternion rot) + public Vector3 GetLocation(Quaternion rot) { Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw); Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0); @@ -69,7 +69,7 @@ namespace OpenSim.Framework rot.W = -rot.W; offset *= rot; - return pos + offset; + return offset; } } -- cgit v1.1 From 696fbdfa24595fef5c26f5d3a297465ff765058b Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 01:29:50 +0000 Subject: Reverse the spawn point distance vector --- OpenSim/Framework/RegionSettings.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index f392889..8322cd6 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -42,7 +42,7 @@ namespace OpenSim.Framework { // The point is an absolute position, so we need the relative // location to the spawn point - Vector3 offset = pos - point; + Vector3 offset = point - pos; Distance = Vector3.Mag(offset); // Next we need to rotate this vector into the spawn point's @@ -58,7 +58,7 @@ namespace OpenSim.Framework Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y)); } - public Vector3 GetLocation(Quaternion rot) + public Vector3 GetLocation(Vector3 pos, Quaternion rot) { Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw); Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0); @@ -69,7 +69,7 @@ namespace OpenSim.Framework rot.W = -rot.W; offset *= rot; - return offset; + return pos + offset; } } -- cgit v1.1 From cc02f78d4e8f0cae4168e6d634f86d0ea9d0b537 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 01:48:38 +0100 Subject: Simplify and streamline telehub editing code. Verify rotations and fix spwan point positioning on rotated telehubs. --- OpenSim/Framework/RegionSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 8322cd6..786638e 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -47,6 +47,7 @@ namespace OpenSim.Framework // Next we need to rotate this vector into the spawn point's // coordinate system + rot.W = -rot.W; offset = offset * rot; Vector3 dir = Vector3.Normalize(offset); @@ -66,7 +67,6 @@ namespace OpenSim.Framework Vector3 dir = new Vector3(1, 0, 0) * p * y; Vector3 offset = dir * (float)Distance; - rot.W = -rot.W; offset *= rot; return pos + offset; -- cgit v1.1 From 45ad9e39a668fc283b392746572729659fb9539d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Feb 2012 01:05:14 +0100 Subject: Improve reliability of script state saving by covering various saving and loading scenarios which resulted in loss of continuity on item ids --- OpenSim/Framework/TaskInventoryItem.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index fa514f0..5d8b8be 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -65,6 +65,7 @@ namespace OpenSim.Framework private int _permsMask; private int _type = 0; private UUID _oldID = UUID.Zero; + private UUID _loadedID = UUID.Zero; private bool _ownerChanged = false; @@ -234,6 +235,15 @@ namespace OpenSim.Framework } } + public UUID LoadedItemID { + get { + return _loadedID; + } + set { + _loadedID = value; + } + } + public UUID LastOwnerID { get { return _lastOwnerID; @@ -359,8 +369,8 @@ namespace OpenSim.Framework /// The new part ID to which this item belongs public void ResetIDs(UUID partID) { - if (_oldID == UUID.Zero) - _oldID = ItemID; + _loadedID = _oldID; + _oldID = ItemID; ItemID = UUID.Random(); ParentPartID = partID; ParentID = partID; -- cgit v1.1 From 07c487a28f6ce6d85cf32fba0c2ded724f7b5af7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Feb 2012 21:36:45 +0100 Subject: Make ban, eject, freeze and the scripted versions of those work. --- OpenSim/Framework/IClientAPI.cs | 4 ++-- OpenSim/Framework/ILandObject.cs | 4 ++-- OpenSim/Framework/LandData.cs | 19 +++++++++++++------ .../Serialization/External/LandDataSerializer.cs | 12 +++++++----- .../Serialization/Tests/LandDataSerializerTests.cs | 12 ++++++------ 5 files changed, 30 insertions(+), 21 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0e0c218..c4c61ff 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -177,7 +177,7 @@ namespace OpenSim.Framework public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags, int landLocalID, UUID transactionID, int sequenceID, - int sections, List entries, + int sections, List entries, IClientAPI remote_client); public delegate void ParcelPropertiesRequest( @@ -1259,7 +1259,7 @@ namespace OpenSim.Framework float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags); - void SendLandAccessListData(List avatars, uint accessFlag, int localLandID); + void SendLandAccessListData(List accessList, uint accessFlag, int localLandID); void SendForceClientSelectObjects(List objectIDs); void SendCameraConstraint(Vector4 ConstraintPlane); void SendLandObjectOwners(LandData land, List groups, Dictionary ownersAndCount); diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index f75a990..dd73b3f 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -73,9 +73,9 @@ namespace OpenSim.Framework bool IsRestrictedFromLand(UUID avatar); void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); - List CreateAccessListArrayByFlag(AccessList flag); + List CreateAccessListArrayByFlag(AccessList flag); void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); - void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List entries, IClientAPI remote_client); + void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List entries, IClientAPI remote_client); void UpdateLandBitmapByteArray(); void SetLandBitmapFromByteArray(); bool[,] GetLandBitmap(); diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 282a128..27fadfa 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -34,6 +34,13 @@ using OpenMetaverse; namespace OpenSim.Framework { + public struct LandAccessEntry + { + public UUID AgentID; + public int Expires; + public AccessList Flags; + } + /// /// Details of a Parcel of land /// @@ -73,7 +80,7 @@ namespace OpenSim.Framework private string _mediaURL = String.Empty; private string _musicURL = String.Empty; private UUID _ownerID = UUID.Zero; - private List _parcelAccessList = new List(); + private List _parcelAccessList = new List(); private float _passHours = 0; private int _passPrice = 0; private int _salePrice = 0; //Unemeplemented. Parcels price. @@ -450,7 +457,7 @@ namespace OpenSim.Framework /// /// List of access data for the parcel. User data, some bitflags, and a time /// - public List ParcelAccessList { + public List ParcelAccessList { get { return _parcelAccessList; } @@ -638,12 +645,12 @@ namespace OpenSim.Framework landData._simwidePrims = _simwidePrims; landData._parcelAccessList.Clear(); - foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) + foreach (LandAccessEntry entry in _parcelAccessList) { - ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry newEntry = new LandAccessEntry(); newEntry.AgentID = entry.AgentID; newEntry.Flags = entry.Flags; - newEntry.Time = entry.Time; + newEntry.Expires = entry.Expires; landData._parcelAccessList.Add(newEntry); } @@ -668,4 +675,4 @@ namespace OpenSim.Framework return land; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index fc0387b..c61b9e8 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -90,7 +90,7 @@ namespace OpenSim.Framework.Serialization.External landData.MusicURL = xtr.ReadElementString("MusicURL"); landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID")); - landData.ParcelAccessList = new List(); + landData.ParcelAccessList = new List(); xtr.Read(); if (xtr.Name != "ParcelAccessList") throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name)); @@ -99,11 +99,13 @@ namespace OpenSim.Framework.Serialization.External { while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) { - ParcelManager.ParcelAccessEntry pae = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry pae = new LandAccessEntry(); xtr.ReadStartElement("ParcelAccessEntry"); pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID")); - pae.Time = Convert.ToDateTime( xtr.ReadElementString("Time")); + // We really don't care about temp vs perm here and this + // would break on old oars. Assume all bans are perm + pae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time")); pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList")); xtr.ReadEndElement(); @@ -162,11 +164,11 @@ namespace OpenSim.Framework.Serialization.External xtw.WriteElementString("OwnerID", landData.OwnerID.ToString()); xtw.WriteStartElement("ParcelAccessList"); - foreach (ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList) + foreach (LandAccessEntry pal in landData.ParcelAccessList) { xtw.WriteStartElement("ParcelAccessEntry"); xtw.WriteElementString("AgentID", pal.AgentID.ToString()); - xtw.WriteElementString("Time", pal.Time.ToString("s")); + xtw.WriteElementString("Time", pal.Expires.ToString()); xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags)); xtw.WriteEndElement(); } diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index c69c89d..3607ce8 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs @@ -42,7 +42,7 @@ namespace OpenSim.Framework.Serialization.Tests private LandData landWithParcelAccessList; private static string preSerialized = "\n\n 128\n 0\n 00000000-0000-0000-0000-000000000000\n 10\n 0\n 0\n 54ff9641-dd40-4a2c-b1f1-47dd3af24e50\n d740204e-bbbf-44aa-949d-02c7d739f6a5\n False\n AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n land data to test LandDataSerializer\n 536870944\n 2\n LandDataSerializerTest Land\n 0\n 0\n 1\n d4452578-2f25-4b97-a81b-819af559cfd7\n http://videos.opensimulator.org/bumblebee.mp4\n \n 1b8eedf9-6d15-448b-8015-24286f1756bf\n \n 0\n 0\n 0\n 00000000-0000-0000-0000-000000000000\n <0, 0, 0>\n <0, 0, 0>\n 0\n 0\n"; - private static string preSerializedWithParcelAccessList = "\n\n 128\n 0\n 00000000-0000-0000-0000-000000000000\n 10\n 0\n 0\n 54ff9641-dd40-4a2c-b1f1-47dd3af24e50\n d740204e-bbbf-44aa-949d-02c7d739f6a5\n False\n AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n land data to test LandDataSerializer\n 536870944\n 2\n LandDataSerializerTest Land\n 0\n 0\n 1\n d4452578-2f25-4b97-a81b-819af559cfd7\n http://videos.opensimulator.org/bumblebee.mp4\n \n 1b8eedf9-6d15-448b-8015-24286f1756bf\n \n \n 62d65d45-c91a-4f77-862c-46557d978b6c\n \n 2\n \n \n ec2a8d18-2378-4fe0-8b68-2a31b57c481e\n \n 1\n \n \n 0\n 0\n 0\n 00000000-0000-0000-0000-000000000000\n <0, 0, 0>\n <0, 0, 0>\n 0\n 0\n"; + private static string preSerializedWithParcelAccessList = "\n\n 128\n 0\n 00000000-0000-0000-0000-000000000000\n 10\n 0\n 0\n 54ff9641-dd40-4a2c-b1f1-47dd3af24e50\n d740204e-bbbf-44aa-949d-02c7d739f6a5\n False\n AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n land data to test LandDataSerializer\n 536870944\n 2\n LandDataSerializerTest Land\n 0\n 0\n 1\n d4452578-2f25-4b97-a81b-819af559cfd7\n http://videos.opensimulator.org/bumblebee.mp4\n \n 1b8eedf9-6d15-448b-8015-24286f1756bf\n \n \n 62d65d45-c91a-4f77-862c-46557d978b6c\n \n 2\n \n \n ec2a8d18-2378-4fe0-8b68-2a31b57c481e\n \n 1\n \n \n 0\n 0\n 0\n 00000000-0000-0000-0000-000000000000\n <0, 0, 0>\n <0, 0, 0>\n 0\n 0\n"; [SetUp] public void setup() @@ -73,16 +73,16 @@ namespace OpenSim.Framework.Serialization.Tests this.landWithParcelAccessList = this.land.Copy(); this.landWithParcelAccessList.ParcelAccessList.Clear(); - ParcelManager.ParcelAccessEntry pae0 = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry pae0 = new LandAccessEntry(); pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c"); pae0.Flags = AccessList.Ban; - pae0.Time = new DateTime(2009, 10, 01); + pae0.Expires = 0; this.landWithParcelAccessList.ParcelAccessList.Add(pae0); - ParcelManager.ParcelAccessEntry pae1 = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry pae1 = new LandAccessEntry(); pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e"); pae1.Flags = AccessList.Access; - pae1.Time = new DateTime(2010, 10, 20); + pae1.Expires = 0; this.landWithParcelAccessList.ParcelAccessList.Add(pae1); } @@ -128,4 +128,4 @@ namespace OpenSim.Framework.Serialization.Tests "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); } } -} \ No newline at end of file +} -- cgit v1.1 From 4455140f3040d6d2a14057e963619aa461b51c50 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 10 Feb 2012 23:52:06 +0000 Subject: Change parser to leave embedded quotes alone if the pattern is recognized as an OptionSet long option --- OpenSim/Framework/Console/CommandConsole.cs | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index a0d3541..0d6288b 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using System.Threading; using log4net; using OpenSim.Framework; @@ -531,6 +532,11 @@ namespace OpenSim.Framework.Console public class Parser { + // If an unquoted portion ends with an element matching this regex + // and the next element contains a space, then we have stripped + // embedded quotes that should not have been stripped + private static Regex optionRegex = new Regex("^--[a-zA-Z0-9-]+=$"); + public static string[] Parse(string text) { List result = new List(); @@ -544,10 +550,38 @@ namespace OpenSim.Framework.Console if (index % 2 == 0) { string[] words = unquoted[index].Split(new char[] {' '}); + + bool option = false; foreach (string w in words) { if (w != String.Empty) + { + if (optionRegex.Match(w) == Match.Empty) + option = false; + else + option = true; result.Add(w); + } + } + // The last item matched the regex, put the quotes back + if (option) + { + // If the line ended with it, don't do anything + if (index < (unquoted.Length - 1)) + { + // Get and remove the option name + string optionText = result[result.Count - 1]; + result.RemoveAt(result.Count - 1); + + // Add the quoted value back + optionText += "\"" + unquoted[index + 1] + "\""; + + // Push the result into our return array + result.Add(optionText); + + // Skip the already used value + index++; + } } } else -- cgit v1.1 From 2d3381b795611a8857077d1effb41323c2cb8658 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 14 Feb 2012 23:16:20 +0100 Subject: Implement region crossing of sitting avatars. Edit mode and llSetPos work but unscripted default sit anim is lost. Still some Gfx glitching. Physical crossing doesn't work yet. --- OpenSim/Framework/ChildAgentDataUpdate.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 6d048f4..fe12874 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -308,6 +308,8 @@ namespace OpenSim.Framework public Animation[] Anims; public UUID GranterID; + public UUID ParentPart; + public Vector3 SitOffset; // Appearance public AvatarAppearance Appearance; @@ -468,6 +470,10 @@ namespace OpenSim.Framework } args["attach_objects"] = attObjs; } + + args["parent_part"] = OSD.FromUUID(ParentPart); + args["sit_offset"] = OSD.FromString(SitOffset.ToString()); + return args; } @@ -675,6 +681,11 @@ namespace OpenSim.Framework } } } + + if (args["parent_part"] != null) + ParentPart = args["parent_part"].AsUUID(); + if (args["sit_offset"] != null) + Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset); } public AgentData() -- cgit v1.1 From 908abb1c3dded307e769abac71f660b835875975 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 10 Mar 2012 20:32:19 +0000 Subject: BIG MESS. changed Iclient interface so only one event is used to inform scene about position scale or rotation change by client (others can be added). Its served at SceneGraph that does permition checks, undostore and sends down to SOG. changed values are stored in a class (ObjectChangeData) and what is changed as a enum (ObjectChangeWhat) with bit fields and 'macros' of this for better readability (at top of scenegraph.cs lasy to find better place for now) this can be extended for other things clients changes and need undo/redo. SOG process acording to what is changed. Changed UNDO/redo to use this also (warning is only storing what is changed, previus stored all, this must be checked for side efects. to save all PRS change commented line in scenegraph). Still have excessive calls to ScheduleGroupForTerseUpdate. **** UNTESTED **** --- OpenSim/Framework/IClientAPI.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5e156f1..1bd4749 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -130,6 +130,8 @@ namespace OpenSim.Framework public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient); + public delegate void ClientChangeObject(uint localID, object data ,IClientAPI remoteClient); + public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient); public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient); @@ -838,6 +840,7 @@ namespace OpenSim.Framework event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; event UpdatePrimFlags OnUpdatePrimFlags; event UpdatePrimTexture OnUpdatePrimTexture; + event ClientChangeObject onClientChangeObject; event UpdateVector OnUpdatePrimGroupPosition; event UpdateVector OnUpdatePrimSinglePosition; event UpdatePrimRotation OnUpdatePrimGroupRotation; -- cgit v1.1 From ebcd4910a21726c830796cfe14c0792007b766b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 13:08:32 +0100 Subject: Refactor, move OjectChangeData into it's own file and rename ObjectChnageWhat what into ObjectChangeType change. What is no name for a variable or type! --- OpenSim/Framework/ObjectChangeData.cs | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 OpenSim/Framework/ObjectChangeData.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ObjectChangeData.cs b/OpenSim/Framework/ObjectChangeData.cs new file mode 100644 index 0000000..8d56291 --- /dev/null +++ b/OpenSim/Framework/ObjectChangeData.cs @@ -0,0 +1,80 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework +{ + public enum ObjectChangeType : uint + { + // bits definitions + Position = 0x01, + Rotation = 0x02, + Scale = 0x04, + Group = 0x08, + UniformScale = 0x10, + + // macros from above + // single prim + primP = 0x01, + primR = 0x02, + primPR = 0x03, + primS = 0x04, + primPS = 0x05, + primRS = 0x06, + primPSR = 0x07, + + primUS = 0x14, + primPUS = 0x15, + primRUS = 0x16, + primPUSR = 0x17, + + // group + groupP = 0x09, + groupR = 0x0A, + groupPR = 0x0B, + groupS = 0x0C, + groupPS = 0x0D, + groupRS = 0x0E, + groupPSR = 0x0F, + + groupUS = 0x1C, + groupPUS = 0x1D, + groupRUS = 0x1E, + groupPUSR = 0x1F, + + PRSmask = 0x07 + } + + public struct ObjectChangeData + { + public Quaternion rotation; + public Vector3 position; + public Vector3 scale; + public ObjectChangeType change; + } +} -- cgit v1.1 From 3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Mar 2012 17:56:32 +0000 Subject: initial suport for ExtraPhysical parts parameters. Reading from llclientView to SOP including SOPserialization (not to databases). No action on physics still. No send to viewer, etc --- OpenSim/Framework/ExtraPhysicsData.cs | 50 +++++++++++++++++++++++++++++++++++ OpenSim/Framework/IClientAPI.cs | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Framework/ExtraPhysicsData.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ExtraPhysicsData.cs b/OpenSim/Framework/ExtraPhysicsData.cs new file mode 100644 index 0000000..9e7334f --- /dev/null +++ b/OpenSim/Framework/ExtraPhysicsData.cs @@ -0,0 +1,50 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework +{ + public enum PhysShapeType : byte + { + prim = 0, + none = 1, + convex = 2, + + invalid = 255 // use to mark invalid data in ExtraPhysicsData + } + + public struct ExtraPhysicsData + { + public float Density; + public float GravitationModifier; + public float Friction; + public float Bounce; + public PhysShapeType PhysShapeType; + + } +} diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 1bd4749..c70b2a0 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -124,7 +124,7 @@ namespace OpenSim.Framework public delegate void ObjectDrop(uint localID, IClientAPI remoteClient); public delegate void UpdatePrimFlags( - uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient); + uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom,ExtraPhysicsData PhysData, IClientAPI remoteClient); public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); -- cgit v1.1 From 84ca09f7c5cec051014181853083e52691bb7e07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Mar 2012 02:24:13 +0000 Subject: added ObjectPhysicsProperties http event message to send viewer that data. For now on caps/EventQueue, and still only used on a material change... --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c70b2a0..94acdba 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1320,6 +1320,8 @@ namespace OpenSim.Framework void SendObjectPropertiesReply(ISceneEntity Entity); + void SendPartPhysicsProprieties(ISceneEntity Entity); + void SendAgentOffline(UUID[] agentIDs); void SendAgentOnline(UUID[] agentIDs); -- cgit v1.1 From 2e41294da969cd124a013070aaf6ce5dd9f01a5c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Mar 2012 01:24:30 +0000 Subject: add convex state to mesh key, so a change is detected. --- OpenSim/Framework/PrimitiveBaseShape.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 9cfc7ed..c6ccc9e 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -881,6 +881,11 @@ namespace OpenSim.Framework public ulong GetMeshKey(Vector3 size, float lod) { + return GetMeshKey(size, lod, false); + } + + public ulong GetMeshKey(Vector3 size, float lod, bool convex) + { ulong hash = 5381; hash = djb2(hash, this.PathCurve); @@ -926,6 +931,9 @@ namespace OpenSim.Framework hash = djb2(hash, scaleBytes[i]); } + if(convex) + hash = djb2(hash, 0xa5); + return hash; } -- cgit v1.1 From 68981d01f024f8a46949127e1cc23c81282f5220 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Mar 2012 21:19:29 +0000 Subject: Stop messing order of updates, destroing the defined order of the selected priority (by distance being the one that makes sense(?). So called fairness serves no usefull purpose. If a region is lagged or user has bad comms, and far objects updates don't arrive, at least nearby thinks do have a chance to keep ticking. Just test on a big region and observe rez order on arrival. lower viewer bandwith helps seeing the diference. No use to put in core since cmic loves the priority scrambling code i comented out. --- OpenSim/Framework/PriorityQueue.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index e7a7f7f..fe2a351 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -139,7 +139,12 @@ namespace OpenSim.Framework { // If there is anything in priority queue 0, return it first no // matter what else. Breaks fairness. But very useful. - for (int iq = 0; iq < NumberOfImmediateQueues; iq++) +// for (int iq = 0; iq < NumberOfImmediateQueues; iq++) + + + // keep original order + + for (int iq = 0; iq < NumberOfQueues; iq++) { if (m_heaps[iq].Count > 0) { @@ -151,7 +156,7 @@ namespace OpenSim.Framework return true; } } - +/* // To get the fair queing, we cycle through each of the // queues when finding an element to dequeue. // We pull (NumberOfQueues - QueueIndex) items from each queue in order @@ -193,7 +198,7 @@ namespace OpenSim.Framework return true; } } - +*/ timeinqueue = 0; value = default(IEntityUpdate); return false; -- cgit v1.1 From 8652f277df5b5de1a61bfccf5386eb23913369e9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 21 Mar 2012 22:45:34 +0100 Subject: Revert "Stop messing order of updates, destroing the defined order of the selected priority (by distance being the one that makes sense(?). So called fairness serves no usefull purpose. If a region is lagged or user has bad comms, and far objects updates don't arrive, at least nearby thinks do have a chance to keep ticking. Just test on a big region and observe rez order on arrival. lower viewer bandwith helps seeing the diference. No use to put in core since cmic loves the priority scrambling code i comented out." This reverts commit 68981d01f024f8a46949127e1cc23c81282f5220. --- OpenSim/Framework/PriorityQueue.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index fe2a351..e7a7f7f 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -139,12 +139,7 @@ namespace OpenSim.Framework { // If there is anything in priority queue 0, return it first no // matter what else. Breaks fairness. But very useful. -// for (int iq = 0; iq < NumberOfImmediateQueues; iq++) - - - // keep original order - - for (int iq = 0; iq < NumberOfQueues; iq++) + for (int iq = 0; iq < NumberOfImmediateQueues; iq++) { if (m_heaps[iq].Count > 0) { @@ -156,7 +151,7 @@ namespace OpenSim.Framework return true; } } -/* + // To get the fair queing, we cycle through each of the // queues when finding an element to dequeue. // We pull (NumberOfQueues - QueueIndex) items from each queue in order @@ -198,7 +193,7 @@ namespace OpenSim.Framework return true; } } -*/ + timeinqueue = 0; value = default(IEntityUpdate); return false; -- cgit v1.1 From 2a8b9a47b2bcb7ca1c4f96ee81c8d2ae0b4930eb Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 01:15:56 +0200 Subject: Add SendRemoveInventoryFolders which allows to remove one or more folders from the viewer's inventory view. For HG v2.0. More to come --- OpenSim/Framework/Client/IClientInventory.cs | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 OpenSim/Framework/Client/IClientInventory.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Client/IClientInventory.cs b/OpenSim/Framework/Client/IClientInventory.cs new file mode 100644 index 0000000..00651e0 --- /dev/null +++ b/OpenSim/Framework/Client/IClientInventory.cs @@ -0,0 +1,37 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework.Client +{ + public interface IClientInventory + { + void SendRemoveInventoryFolders(UUID[] folders); + } +} -- cgit v1.1 From c2be894330385ac55d3c62349ba9af4b2c9e86b4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 18 Apr 2012 23:23:01 +0100 Subject: Fx up estate settings --- OpenSim/Framework/EstateSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 1caf04a..9020761 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -368,7 +368,7 @@ namespace OpenSim.Framework if (ban.BannedUserID == avatarID) return true; - if (!IsEstateManager(avatarID) && !HasAccess(avatarID)) + if (!IsEstateManagerOrOwner(avatarID) && !HasAccess(avatarID)) { if (DenyMinors) { -- cgit v1.1 From fd19601c6ba3b474201e2dde514c7d7c94e74e82 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 26 Apr 2012 16:17:46 +0100 Subject: Help big boobies to dance (avatar visualParams). May not persist and need more lobe ? --- OpenSim/Framework/AvatarAppearance.cs | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3a0b861..c5d9641 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -42,6 +42,8 @@ namespace OpenSim.Framework { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // this is viewer capabilities and weared things dependent + // should be only used as initial default value ( V1 viewers ) public readonly static int VISUALPARAM_COUNT = 218; public readonly static int TEXTURE_COUNT = 21; @@ -319,19 +321,30 @@ namespace OpenSim.Framework // made. We determine if any of the visual parameters actually // changed to know if the appearance should be saved later bool changed = false; - for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) + + int newsize = visualParams.Length; + + if (newsize != m_visualparams.Length) + { + changed = true; + m_visualparams = (byte[])visualParams.Clone(); + } + else { - if (visualParams[i] != m_visualparams[i]) + + for (int i = 0; i < newsize; i++) { -// DEBUG ON -// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", -// i,m_visualparams[i],visualParams[i]); -// DEBUG OFF - m_visualparams[i] = visualParams[i]; - changed = true; + if (visualParams[i] != m_visualparams[i]) + { + // DEBUG ON + // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", + // i,m_visualparams[i],visualParams[i]); + // DEBUG OFF + m_visualparams[i] = visualParams[i]; + changed = true; + } } } - // Reset the height if the visual parameters actually changed if (changed) SetHeight(); @@ -389,7 +402,8 @@ namespace OpenSim.Framework } s += "Visual Params: "; - for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) + // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) + for (uint j = 0; j < m_visualparams.Length; j++) s += String.Format("{0},",m_visualparams[j]); s += "\n"; -- cgit v1.1 From f194c48cd3f403f95752d62206ea8046afff7c10 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 26 Apr 2012 17:42:11 +0100 Subject: add wearable type PHYSICS --- OpenSim/Framework/AvatarWearable.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 8e27596..382fc6c 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -62,10 +62,14 @@ namespace OpenSim.Framework public static readonly int UNDERSHIRT = 10; public static readonly int UNDERPANTS = 11; public static readonly int SKIRT = 12; + + public static readonly int MAX_BASICWEARABLES = 13; + public static readonly int ALPHA = 13; public static readonly int TATTOO = 14; + public static readonly int PHYSICS = 15; - public static readonly int MAX_WEARABLES = 15; + public static readonly int MAX_WEARABLES = 16; public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); @@ -219,7 +223,7 @@ namespace OpenSim.Framework { get { - AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these + AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; for (int i = 0; i < MAX_WEARABLES; i++) { defaultWearables[i] = new AvatarWearable(); @@ -242,10 +246,13 @@ namespace OpenSim.Framework // // Alpha // defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); - -// // Tattoo -// defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); - + + // // Tattoo + // defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); + + // // Physics + // defaultWearables[PHYSICS].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); + return defaultWearables; } } -- cgit v1.1 From fc576df273e41b47ff66b4bb503b9f86ded96cdb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 26 Apr 2012 18:24:36 +0100 Subject: revert last add commit --- OpenSim/Framework/AvatarWearable.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 382fc6c..aee295a 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -67,9 +67,10 @@ namespace OpenSim.Framework public static readonly int ALPHA = 13; public static readonly int TATTOO = 14; - public static readonly int PHYSICS = 15; +// public static readonly int PHYSICS = 15; - public static readonly int MAX_WEARABLES = 16; + // public static readonly int MAX_WEARABLES = 16; + public static readonly int MAX_WEARABLES = 15; public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); -- cgit v1.1 From 9f9693dab825c7753af49c6838a484653047d4ae Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 3 May 2012 01:18:51 +0200 Subject: Clear permissions given to the object we stand up from --- OpenSim/Framework/ChildAgentDataUpdate.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index fe12874..abff44a 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -229,12 +229,14 @@ namespace OpenSim.Framework public class ControllerData { + public UUID ObjectID; public UUID ItemID; public uint IgnoreControls; public uint EventControls; - public ControllerData(UUID item, uint ignore, uint ev) + public ControllerData(UUID obj, UUID item, uint ignore, uint ev) { + ObjectID = obj; ItemID = item; IgnoreControls = ignore; EventControls = ev; @@ -248,6 +250,7 @@ namespace OpenSim.Framework public OSDMap PackUpdateMessage() { OSDMap controldata = new OSDMap(); + controldata["object"] = OSD.FromUUID(ObjectID); controldata["item"] = OSD.FromUUID(ItemID); controldata["ignore"] = OSD.FromInteger(IgnoreControls); controldata["event"] = OSD.FromInteger(EventControls); @@ -258,6 +261,8 @@ namespace OpenSim.Framework public void UnpackUpdateMessage(OSDMap args) { + if (args["object"] != null) + ObjectID = args["object"].AsUUID(); if (args["item"] != null) ItemID = args["item"].AsUUID(); if (args["ignore"] != null) -- cgit v1.1 From 333d013b5c34d7ed8c016251e50b80b62500aa3f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 May 2012 20:33:48 +0200 Subject: Add the default animation to the child agent data update --- OpenSim/Framework/ChildAgentDataUpdate.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index abff44a..7962ff4 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -311,6 +311,7 @@ namespace OpenSim.Framework public AgentGroupData[] Groups; public Animation[] Anims; + public Animation DefaultAnim = null; public UUID GranterID; public UUID ParentPart; @@ -397,6 +398,11 @@ namespace OpenSim.Framework args["animations"] = anims; } + if (DefaultAnim != null) + { + args["default_animation"] = DefaultAnim.PackUpdateMessage(); + } + if (Appearance != null) args["packed_appearance"] = Appearance.Pack(); @@ -594,6 +600,11 @@ namespace OpenSim.Framework } } + if (args["default_animation"] != null) + { + DefaultAnim = new Animation((OSDMap)args["default_animation"]); + } + //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) //{ // OSDArray textures = (OSDArray)(args["agent_textures"]); -- cgit v1.1 From 197163e12a265af66a9393bc6753c7a50520c5b1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 May 2012 21:00:41 +0200 Subject: Fix teleporting from older to newer regions --- OpenSim/Framework/ChildAgentDataUpdate.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 7962ff4..e718aa6 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -602,7 +602,14 @@ namespace OpenSim.Framework if (args["default_animation"] != null) { - DefaultAnim = new Animation((OSDMap)args["default_animation"]); + try + { + DefaultAnim = new Animation((OSDMap)args["default_animation"]); + } + catch + { + DefaultAnim = null; + } } //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) -- cgit v1.1 From 7461fe4554f8104212071e3e01b07786f8eb546f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 12 May 2012 15:27:37 +0100 Subject: ªTEST MESS* reduce animation packets send. Added onchangeanim event with parameters to define if to add or remove, and if to send anims pack on that evocation, etc --- OpenSim/Framework/IClientAPI.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 2be78da..c1bd078 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -70,6 +70,8 @@ namespace OpenSim.Framework public delegate void StopAnim(IClientAPI remoteClient, UUID animID); + public delegate void ChangeAnim(UUID animID, bool addOrRemove, bool sendPack); + public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List children); public delegate void DelinkObjects(List primIds, IClientAPI client); @@ -791,6 +793,7 @@ namespace OpenSim.Framework event ObjectDrop OnObjectDrop; event StartAnim OnStartAnim; event StopAnim OnStopAnim; + event ChangeAnim OnChangeAnim; event LinkObjects OnLinkObjects; event DelinkObjects OnDelinkObjects; event RequestMapBlocks OnRequestMapBlocks; -- cgit v1.1 From a12336390feda38cad0814ee62c1bfae43250030 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jun 2012 20:37:29 +0200 Subject: Remove useless logging of a bare-names stack trace. It's meaningless to a non-programmer and insufficient for a programmer. Add commented debug output and data collection to troubleshoot future locking issues. --- OpenSim/Framework/TaskInventoryDictionary.cs | 89 ++++++++++++++++++---------- 1 file changed, 57 insertions(+), 32 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 814758a..4d07746 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -52,10 +52,10 @@ namespace OpenSim.Framework private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Thread LockedByThread; - private string WriterStack; +// private string WriterStack; - private Dictionary ReadLockers = - new Dictionary(); +// private Dictionary ReadLockers = +// new Dictionary(); /// /// An advanced lock for inventory data @@ -98,14 +98,25 @@ namespace OpenSim.Framework m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); try { - StackTrace stackTrace = new StackTrace(); // get call stack - StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) + // That call stack is useful for end users only. RealProgrammers need a full dump. Commented. + // StackTrace stackTrace = new StackTrace(); // get call stack + // StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) + // + // // write call stack method names + // foreach (StackFrame stackFrame in stackFrames) + // { + // m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name + // } - // write call stack method names - foreach (StackFrame stackFrame in stackFrames) - { - m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name - } + // The below is far more useful +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); +// System.Console.WriteLine("------------------------------------------"); +// foreach (KeyValuePair kvp in ReadLockers) +// { +// System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); +// System.Console.WriteLine("------------------------------------------"); +// } } catch {} @@ -114,6 +125,16 @@ namespace OpenSim.Framework if (m_itemLock.RecursiveWriteCount > 0) { m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); +// try +// { +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("Locker's call stack:\n" + WriterStack); +// System.Console.WriteLine("------------------------------------------"); +// } +// catch +// {} m_itemLock.ExitWriteLock(); } @@ -123,15 +144,16 @@ namespace OpenSim.Framework if (m_itemLock.IsWriteLockHeld) { m_itemLock = new System.Threading.ReaderWriterLockSlim(); - System.Console.WriteLine("------------------------------------------"); - System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); - System.Console.WriteLine("------------------------------------------"); - System.Console.WriteLine("Locker's call stack:\n" + WriterStack); - System.Console.WriteLine("------------------------------------------"); - LockedByThread = null; - ReadLockers.Clear(); +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("Locker's call stack:\n" + WriterStack); +// System.Console.WriteLine("------------------------------------------"); +// LockedByThread = null; +// ReadLockers.Clear(); } } +// ReadLockers[Thread.CurrentThread] = Environment.StackTrace; } else { @@ -139,6 +161,8 @@ namespace OpenSim.Framework { m_itemLock.ExitReadLock(); } +// if (m_itemLock.RecursiveReadCount == 0) +// ReadLockers.Remove(Thread.CurrentThread); } } @@ -158,6 +182,7 @@ namespace OpenSim.Framework if (m_itemLock.RecursiveWriteCount > 0) { m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); + m_itemLock.ExitWriteLock(); } while (!m_itemLock.TryEnterWriteLock(60000)) @@ -165,30 +190,30 @@ namespace OpenSim.Framework if (m_itemLock.IsWriteLockHeld) { m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - System.Console.WriteLine("------------------------------------------"); - System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); - System.Console.WriteLine("------------------------------------------"); - System.Console.WriteLine("Locker's call stack:\n" + WriterStack); - System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("Locker's call stack:\n" + WriterStack); +// System.Console.WriteLine("------------------------------------------"); } else { m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by a reader. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - System.Console.WriteLine("------------------------------------------"); - System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); - System.Console.WriteLine("------------------------------------------"); - foreach (KeyValuePair kvp in ReadLockers) - { - System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); - System.Console.WriteLine("------------------------------------------"); - } +// System.Console.WriteLine("------------------------------------------"); +// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); +// System.Console.WriteLine("------------------------------------------"); +// foreach (KeyValuePair kvp in ReadLockers) +// { +// System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); +// System.Console.WriteLine("------------------------------------------"); +// } } m_itemLock = new System.Threading.ReaderWriterLockSlim(); - ReadLockers.Clear(); +// ReadLockers.Clear(); } LockedByThread = Thread.CurrentThread; - WriterStack = Environment.StackTrace; +// WriterStack = Environment.StackTrace; } else { -- cgit v1.1 From 9a8de52940ea6d9ce430d8d51094a353eca7d3c5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 26 Jun 2012 10:49:37 +0200 Subject: Add an event to the poll service manager thread to allow starting it when needed rather than once per second. That is just too slow! --- .../Framework/Servers/HttpServer/PollServiceRequestManager.cs | 7 +++++-- .../Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 0062d4e..c3e1a79 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -41,6 +41,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; private static Queue m_requests = Queue.Synchronized(new Queue()); + private static ManualResetEvent m_ev = new ManualResetEvent(false); private uint m_WorkerThreadCount = 0; private Thread[] m_workerThreads; private PollServiceWorkerThread[] m_PollServiceWorkerThreads; @@ -88,15 +89,17 @@ namespace OpenSim.Framework.Servers.HttpServer { lock (m_requests) m_requests.Enqueue(req); + m_ev.Set(); } public void ThreadStart() { while (m_running) { + m_ev.WaitOne(1000); + m_ev.Reset(); Watchdog.UpdateThread(); ProcessQueuedRequests(); - Thread.Sleep(1000); } } @@ -152,4 +155,4 @@ namespace OpenSim.Framework.Servers.HttpServer m_running = false; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 5e171f0..b39185f 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -89,9 +89,16 @@ namespace OpenSim.Framework.Servers.HttpServer continue; } - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); - m_server.DoHTTPGruntWork(responsedata, + try + { + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); + m_server.DoHTTPGruntWork(responsedata, new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); + } + catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + { + // Ignore it, no need to reply + } } else { -- cgit v1.1 From c87f0ac2261d1aa5226957aff63bfc8ac0efaffd Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 28 Jun 2012 21:23:42 +0200 Subject: Fix llRegionSayTo the right way --- OpenSim/Framework/OSChatMessage.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs index 54fa275..7450be2 100644 --- a/OpenSim/Framework/OSChatMessage.cs +++ b/OpenSim/Framework/OSChatMessage.cs @@ -51,6 +51,7 @@ namespace OpenSim.Framework protected object m_senderObject; protected ChatTypeEnum m_type; protected UUID m_fromID; + protected UUID m_destination = UUID.Zero; public OSChatMessage() { @@ -131,6 +132,12 @@ namespace OpenSim.Framework set { m_fromID = value; } } + public UUID Destination + { + get { return m_destination; } + set { m_destination = value; } + } + /// /// /// -- cgit v1.1 From a1a22a2f1034a1feb67b141abf4b138248cdb356 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 28 Jun 2012 22:02:20 +0100 Subject: Revert "Mantis 5977 Corrections to llRegionSayTo" This reverts commit 679da63da617d031e5e7ae3f2d2a29db1a23ace3. Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs --- OpenSim/Framework/OSChatMessage.cs | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs index 455756d..54fa275 100644 --- a/OpenSim/Framework/OSChatMessage.cs +++ b/OpenSim/Framework/OSChatMessage.cs @@ -51,12 +51,10 @@ namespace OpenSim.Framework protected object m_senderObject; protected ChatTypeEnum m_type; protected UUID m_fromID; - protected UUID m_toID; public OSChatMessage() { m_position = new Vector3(); - m_toID = UUID.Zero; } /// @@ -104,15 +102,6 @@ namespace OpenSim.Framework set { m_from = value; } } - /// - /// The name of the sender (needed for scripts) - /// - public string To - { - get { return m_from; } - set { m_from = value; } - } - #region IEventArgs Members /// TODO: Sender and SenderObject should just be Sender and of @@ -143,15 +132,6 @@ namespace OpenSim.Framework } /// - /// The single recipient or all if not set. - /// - public UUID TargetUUID - { - get { return m_toID; } - set { m_toID = value; } - } - - /// /// /// public IScene Scene -- cgit v1.1 From d3f1fc79e50edb9ef851bdedfa83e9f5c13b4519 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 1 Jul 2012 01:33:20 +0100 Subject: *TO CHECK/REVIEW/REVERT/TEST whatever* pollService new requests get enqueued to unified requests queue directly. Retries get into that every 100ms. 3 working threads as before plus another that only does retries timming. --- .../HttpServer/PollServiceRequestManager.cs | 203 +++++++++++++++++++++ .../Servers/HttpServer/PollServiceWorkerThread.cs | 3 + 2 files changed, 206 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index c3e1a79..e488b38 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -33,8 +33,11 @@ using log4net; using HttpServer; using OpenSim.Framework; + +/* namespace OpenSim.Framework.Servers.HttpServer { + public class PollServiceRequestManager { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -156,3 +159,203 @@ namespace OpenSim.Framework.Servers.HttpServer } } } + */ + +using System.IO; +using System.Text; +using System.Collections.Generic; + +namespace OpenSim.Framework.Servers.HttpServer +{ + public class PollServiceRequestManager + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private readonly BaseHttpServer m_server; + + private BlockingQueue m_requests = new BlockingQueue(); + private static Queue m_retry_requests = new Queue(); + + private uint m_WorkerThreadCount = 0; + private Thread[] m_workerThreads; + private Thread m_retrysThread; + + private bool m_running = true; + + private int m_timeout = 250; + + public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) + { + m_server = pSrv; + m_WorkerThreadCount = pWorkerThreadCount; + m_workerThreads = new Thread[m_WorkerThreadCount]; + + //startup worker threads + for (uint i = 0; i < m_WorkerThreadCount; i++) + { + m_workerThreads[i] + = Watchdog.StartThread( + poolWorkerJob, + String.Format("PollServiceWorkerThread{0}", i), + ThreadPriority.Normal, + false, + true, + int.MaxValue); + } + + m_retrysThread = Watchdog.StartThread( + this.CheckRetries, + "PollServiceWatcherThread", + ThreadPriority.Normal, + false, + true, + 1000 * 60 * 10); + } + + + private void ReQueueEvent(PollServiceHttpRequest req) + { + if (m_running) + { + lock (m_retry_requests) + m_retry_requests.Enqueue(req); + } + } + + public void Enqueue(PollServiceHttpRequest req) + { + if (m_running) + m_requests.Enqueue(req); + } + + private void CheckRetries() + { + while (m_running) + { + Thread.Sleep(100); // let the world move + Watchdog.UpdateThread(); + lock (m_retry_requests) + { + while (m_retry_requests.Count > 0 && m_running) + Enqueue(m_retry_requests.Dequeue()); + } + } + } + + ~PollServiceRequestManager() + { + m_running = false; + m_timeout = -10000; // cause all to expire + Thread.Sleep(1000); // let the world move + + foreach (Thread t in m_workerThreads) + { + try + { + t.Abort(); + } + catch + { + } + } + + try + { + foreach (PollServiceHttpRequest req in m_retry_requests) + { + m_server.DoHTTPGruntWork( + req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), + new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + } + } + catch + { + } + + PollServiceHttpRequest wreq; + m_retry_requests.Clear(); + + while (m_requests.Count() > 0) + { + try + { + wreq = m_requests.Dequeue(0); + m_server.DoHTTPGruntWork( + wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id), + new OSHttpResponse(new HttpResponse(wreq.HttpContext, wreq.Request), wreq.HttpContext)); + } + catch + { + } + } + + m_requests.Clear(); + } + + // work threads + + private void poolWorkerJob() + { + PollServiceHttpRequest req; + StreamReader str; + + while (true) + { + req = m_requests.Dequeue(5000); + + Watchdog.UpdateThread(); + if (req != null) + { + try + { + if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) + { + try + { + str = new StreamReader(req.Request.Body); + } + catch (System.ArgumentException) + { + // Stream was not readable means a child agent + // was closed due to logout, leaving the + // Event Queue request orphaned. + continue; + } + + try + { + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); + m_server.DoHTTPGruntWork(responsedata, + new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + } + catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + { + // Ignore it, no need to reply + } + + str.Close(); + + } + else + { + if ((Environment.TickCount - req.RequestTime) > m_timeout) + { + m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), + new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + } + else + { + ReQueueEvent(req); + } + } + } + catch (Exception e) + { + m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); + } + } + } + } + } +} + diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index b39185f..7cd27e5 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -25,6 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* Ubit work moved to PollServiceRequestManager + using System; using System.Collections; using System.Collections.Generic; @@ -128,3 +130,4 @@ namespace OpenSim.Framework.Servers.HttpServer } } } +*/ \ No newline at end of file -- cgit v1.1 From b2fa20001f8af9d62b0caa3612d8f1ab6f2caa87 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Jul 2012 06:14:47 +0100 Subject: *test* slow http retries pool rate to original 1s --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index e488b38..36f2b9b 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -232,7 +232,7 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - Thread.Sleep(100); // let the world move + Thread.Sleep(1000); // let the world move slow it to original polling rate Watchdog.UpdateThread(); lock (m_retry_requests) { -- cgit v1.1 From e533eef962fe05ea7ca156fa3420cb2a1d679297 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Jul 2012 15:07:10 +0100 Subject: *test2* http poll: increased again the pool rate do 10/s but increased timeout to 1s. So data there is less delay when there is new data, but enought waiting time for it to be avaiable --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 36f2b9b..125d9c2 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer private bool m_running = true; - private int m_timeout = 250; + private int m_timeout = 1000; // increase timeout 250; public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) { @@ -232,7 +232,7 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - Thread.Sleep(1000); // let the world move slow it to original polling rate + Thread.Sleep(100); // let the world move .. back to faster rate Watchdog.UpdateThread(); lock (m_retry_requests) { -- cgit v1.1 From 02cb0bf80a0b67eb0316ac74e1ea9741bfce1385 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Jul 2012 17:40:02 +0100 Subject: added a timeout paramenter to PollServiceEventArgs, so each type can define it's timeout --- OpenSim/Framework/Console/RemoteConsole.cs | 2 +- OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index eabb62d..e04ca1e 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -233,7 +233,7 @@ namespace OpenSim.Framework.Console string uri = "/ReadResponses/" + sessionID.ToString() + "/"; m_Server.AddPollServiceHTTPHandler( - uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID)); + uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout XmlDocument xmldoc = new XmlDocument(); XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 9d512c6..2407533 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -44,13 +44,16 @@ namespace OpenSim.Framework.Servers.HttpServer public NoEventsMethod NoEvents; public RequestMethod Request; public UUID Id; - public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId) + public int TimeOutms; + + public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, UUID pId, int pTimeOutms) { Request = pRequest; HasEvents = pHasEvents; GetEvents = pGetEvents; NoEvents = pNoEvents; Id = pId; + TimeOutms = pTimeOutms; } } } -- cgit v1.1 From bc5d554f548e973221f8a18cdcb5a5883ed6039f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Jul 2012 17:58:32 +0100 Subject: use the pollEvent timeout paramenter on pooling --- .../Framework/Servers/HttpServer/PollServiceRequestManager.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 125d9c2..45b1375 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer private bool m_running = true; - private int m_timeout = 1000; // increase timeout 250; +// private int m_timeout = 1000; // increase timeout 250; now use the event one public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) { @@ -245,7 +245,7 @@ namespace OpenSim.Framework.Servers.HttpServer ~PollServiceRequestManager() { m_running = false; - m_timeout = -10000; // cause all to expire +// m_timeout = -10000; // cause all to expire Thread.Sleep(1000); // let the world move foreach (Thread t in m_workerThreads) @@ -299,7 +299,8 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest req; StreamReader str; - while (true) +// while (true) + while (m_running) { req = m_requests.Dequeue(5000); @@ -338,7 +339,9 @@ namespace OpenSim.Framework.Servers.HttpServer } else { - if ((Environment.TickCount - req.RequestTime) > m_timeout) +// if ((Environment.TickCount - req.RequestTime) > m_timeout) + + if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); -- cgit v1.1 From 4854d779041e987ae13de4f30a37e4fab1b7a3d7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 5 Jul 2012 23:09:20 +0200 Subject: Add an EventType enum and Type field to the poll service event args. This allows the manager to tell what type of event it is. All events except for lsl http in go to the "slow queue" which is run once per second as before. --- .../Servers/HttpServer/PollServiceEventArgs.cs | 8 +++++ .../HttpServer/PollServiceRequestManager.cs | 37 +++++++++++++++------- 2 files changed, 34 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 2407533..7c92a50 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -45,6 +45,13 @@ namespace OpenSim.Framework.Servers.HttpServer public RequestMethod Request; public UUID Id; public int TimeOutms; + public EventType Type; + + public enum EventType : int + { + Normal = 0, + LslHttp = 1 + } public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, UUID pId, int pTimeOutms) { @@ -54,6 +61,7 @@ namespace OpenSim.Framework.Servers.HttpServer NoEvents = pNoEvents; Id = pId; TimeOutms = pTimeOutms; + Type = EventType.Normal; } } } diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 45b1375..c7c7c13 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -174,13 +174,15 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; private BlockingQueue m_requests = new BlockingQueue(); - private static Queue m_retry_requests = new Queue(); + private BlockingQueue m_slowRequests = new BlockingQueue(); + private static Queue m_retryRequests = new Queue(); private uint m_WorkerThreadCount = 0; private Thread[] m_workerThreads; private Thread m_retrysThread; private bool m_running = true; + private int slowCount = 0; // private int m_timeout = 1000; // increase timeout 250; now use the event one @@ -195,7 +197,7 @@ namespace OpenSim.Framework.Servers.HttpServer { m_workerThreads[i] = Watchdog.StartThread( - poolWorkerJob, + PoolWorkerJob, String.Format("PollServiceWorkerThread{0}", i), ThreadPriority.Normal, false, @@ -217,15 +219,20 @@ namespace OpenSim.Framework.Servers.HttpServer { if (m_running) { - lock (m_retry_requests) - m_retry_requests.Enqueue(req); + lock (m_retryRequests) + m_retryRequests.Enqueue(req); } } public void Enqueue(PollServiceHttpRequest req) { if (m_running) - m_requests.Enqueue(req); + { + if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp) + m_slowRequests.Enqueue(req); + else + m_requests.Enqueue(req); + } } private void CheckRetries() @@ -234,10 +241,18 @@ namespace OpenSim.Framework.Servers.HttpServer { Thread.Sleep(100); // let the world move .. back to faster rate Watchdog.UpdateThread(); - lock (m_retry_requests) + lock (m_retryRequests) { - while (m_retry_requests.Count > 0 && m_running) - Enqueue(m_retry_requests.Dequeue()); + while (m_retryRequests.Count > 0 && m_running) + m_requests.Enqueue(m_retryRequests.Dequeue()); + } + slowCount++; + if (slowCount >= 10) + { + slowCount = 0; + + while (m_slowRequests.Count() > 0 && m_running) + m_requests.Enqueue(m_retryRequests.Dequeue()); } } } @@ -261,7 +276,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { - foreach (PollServiceHttpRequest req in m_retry_requests) + foreach (PollServiceHttpRequest req in m_retryRequests) { m_server.DoHTTPGruntWork( req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), @@ -273,7 +288,7 @@ namespace OpenSim.Framework.Servers.HttpServer } PollServiceHttpRequest wreq; - m_retry_requests.Clear(); + m_retryRequests.Clear(); while (m_requests.Count() > 0) { @@ -294,7 +309,7 @@ namespace OpenSim.Framework.Servers.HttpServer // work threads - private void poolWorkerJob() + private void PoolWorkerJob() { PollServiceHttpRequest req; StreamReader str; -- cgit v1.1 From bf292ce26f5742eaf1ae534320506b28f3a5492c Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 5 Jul 2012 23:24:15 +0200 Subject: Fix the boo-boo --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index c7c7c13..06745f9 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -229,9 +229,9 @@ namespace OpenSim.Framework.Servers.HttpServer if (m_running) { if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp) - m_slowRequests.Enqueue(req); - else m_requests.Enqueue(req); + else + m_slowRequests.Enqueue(req); } } @@ -252,7 +252,7 @@ namespace OpenSim.Framework.Servers.HttpServer slowCount = 0; while (m_slowRequests.Count() > 0 && m_running) - m_requests.Enqueue(m_retryRequests.Dequeue()); + m_requests.Enqueue(m_slowRequests.Dequeue()); } } } -- cgit v1.1 From b8c2efa49c35d623a6a2969322536fde67cb86dc Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jul 2012 00:23:05 +0200 Subject: Convert the slow request queue into a regular queue and add some cleanup and locking. --- .../HttpServer/PollServiceRequestManager.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 06745f9..6f87c85 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -174,7 +174,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; private BlockingQueue m_requests = new BlockingQueue(); - private BlockingQueue m_slowRequests = new BlockingQueue(); + private static Queue m_slowRequests = new Queue(); private static Queue m_retryRequests = new Queue(); private uint m_WorkerThreadCount = 0; @@ -229,9 +229,14 @@ namespace OpenSim.Framework.Servers.HttpServer if (m_running) { if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp) + { m_requests.Enqueue(req); + } else - m_slowRequests.Enqueue(req); + { + lock (m_slowRequests) + m_slowRequests.Enqueue(req); + } } } @@ -251,8 +256,11 @@ namespace OpenSim.Framework.Servers.HttpServer { slowCount = 0; - while (m_slowRequests.Count() > 0 && m_running) - m_requests.Enqueue(m_slowRequests.Dequeue()); + lock (m_slowRequests) + { + while (m_slowRequests.Count > 0 && m_running) + m_requests.Enqueue(m_slowRequests.Dequeue()); + } } } } @@ -290,6 +298,12 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest wreq; m_retryRequests.Clear(); + lock (m_slowRequests) + { + while (m_slowRequests.Count > 0 && m_running) + m_requests.Enqueue(m_slowRequests.Dequeue()); + } + while (m_requests.Count() > 0) { try -- cgit v1.1 From b5b763f7e1a7c77239bf9fa9bfaabd0f8daa8a81 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 10 Jul 2012 19:13:24 +0100 Subject: add some more memory information to StatsCollector --- OpenSim/Framework/Statistics/BaseStatsCollector.cs | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs index c9e57ce..3f918f3 100644 --- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs +++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs @@ -48,10 +48,26 @@ namespace OpenSim.Framework.Statistics string.Format( "Allocated to OpenSim objects: {0} MB\n", Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); - sb.Append( - string.Format( - "Process memory : {0} MB\n", - Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0))); + + Process myprocess = Process.GetCurrentProcess(); + if (!myprocess.HasExited) + { + myprocess.Refresh(); + 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.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))); + } + else + sb.Append("Process reported as Exited \n"); return sb.ToString(); } -- cgit v1.1 From 7676ae6f744379c69f169d372c8688f49684ea6c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 11 Jul 2012 03:56:39 +0100 Subject: clear released minheap items so they don't keep holding references to objects. --- OpenSim/Framework/MinHeap.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs index 33d0364..f2218c9 100644 --- a/OpenSim/Framework/MinHeap.cs +++ b/OpenSim/Framework/MinHeap.cs @@ -285,6 +285,7 @@ namespace OpenSim.Framework if (--this.size > 0 && index != this.size) { Set(this.items[this.size], index); + this.items[this.size].Clear(); if (!BubbleUp(index)) BubbleDown(index); } -- cgit v1.1 From ac3a2296fa6de7ad07f862fbe073e9e3495677f1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 11 Jul 2012 04:01:20 +0200 Subject: Make sure handles stay intact when removing from the MinHeap --- OpenSim/Framework/MinHeap.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs index f2218c9..99ac25d 100644 --- a/OpenSim/Framework/MinHeap.cs +++ b/OpenSim/Framework/MinHeap.cs @@ -63,12 +63,15 @@ namespace OpenSim.Framework internal void Clear() { - this.value = default(T); if (this.handle != null) - { this.handle.Clear(); - this.handle = null; - } + ClearRef(); + } + + internal void ClearRef() + { + this.value = default(T); + this.handle = null; } } @@ -285,7 +288,7 @@ namespace OpenSim.Framework if (--this.size > 0 && index != this.size) { Set(this.items[this.size], index); - this.items[this.size].Clear(); + this.items[this.size].ClearRef(); if (!BubbleUp(index)) BubbleDown(index); } -- cgit v1.1 From bb78b327c0c36b515f0e60e2783961e9325062da Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 11 Jul 2012 06:43:03 +0100 Subject: stop keeping references to objects on released items --- OpenSim/Framework/LocklessQueue.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LocklessQueue.cs b/OpenSim/Framework/LocklessQueue.cs index dd3d201..84f887c 100644 --- a/OpenSim/Framework/LocklessQueue.cs +++ b/OpenSim/Framework/LocklessQueue.cs @@ -99,8 +99,13 @@ namespace OpenSim.Framework } else { - item = oldHeadNext.Item; + item = oldHeadNext.Item; haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext); + if (haveAdvancedHead) + { + oldHeadNext.Item = default(T); + oldHead.Next = null; + } } } } @@ -111,6 +116,10 @@ namespace OpenSim.Framework public void Clear() { + // ugly + T item; + while(count > 0) + Dequeue(out item); Init(); } -- cgit v1.1 From ad75a4b50b77dee08614dba9e57261d8b08c6860 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 12:28:58 +0200 Subject: Eliminate a spurious exception report when a https url is accessed with a wrong CN --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ad5af1f..a3a5029 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1809,6 +1809,8 @@ namespace OpenSim.Framework.Servers.HttpServer public void httpServerException(object source, Exception exception) { + if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException")) + return; m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); /* if (HTTPDRunning)// && NotSocketErrors > 5) -- cgit v1.1 From b35f97db4658f0dd4af0ad1f56a6303d6d45d51e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 17 Jul 2012 10:21:12 +0200 Subject: Replace PollServiceRequestManager with older version, add extra logging to event exceptions to see call path leading up to it. --- .../Servers/HttpServer/PollServiceRequestManager.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 3a14b6f..af40185 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -70,7 +70,6 @@ namespace OpenSim.Framework.Servers.HttpServer ThreadPriority.Normal, false, true, - null, int.MaxValue); } @@ -80,7 +79,6 @@ namespace OpenSim.Framework.Servers.HttpServer ThreadPriority.Normal, false, true, - null, 1000 * 60 * 10); } @@ -146,8 +144,9 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (object o in m_requests) { PollServiceHttpRequest req = (PollServiceHttpRequest) o; - PollServiceWorkerThread.DoHTTPGruntWork( - m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); + m_server.DoHTTPGruntWork( + req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), + new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); } m_requests.Clear(); @@ -156,7 +155,6 @@ namespace OpenSim.Framework.Servers.HttpServer { t.Abort(); } - m_running = false; } } @@ -186,7 +184,7 @@ namespace OpenSim.Framework.Servers.HttpServer private bool m_running = true; private int slowCount = 0; - // private int m_timeout = 250; // increase timeout 250; now use the event one +// private int m_timeout = 1000; // increase timeout 250; now use the event one public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) { @@ -372,7 +370,8 @@ namespace OpenSim.Framework.Servers.HttpServer } else { - // if ((Environment.TickCount - req.RequestTime) > m_timeout) +// if ((Environment.TickCount - req.RequestTime) > m_timeout) + if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), -- cgit v1.1 From 5874dfd3422d3ff7e35e8eb7e424f5f003f2d1a2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 17 Jul 2012 09:47:20 +0100 Subject: fix PollServiceRequestManager --- .../HttpServer/PollServiceRequestManager.cs | 57 ++++++++++++++++++---- 1 file changed, 47 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 3a14b6f..4fe783d 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -290,9 +290,8 @@ namespace OpenSim.Framework.Servers.HttpServer { foreach (PollServiceHttpRequest req in m_retryRequests) { - m_server.DoHTTPGruntWork( - req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), - new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + DoHTTPGruntWork(m_server,req, + req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); } } catch @@ -313,9 +312,8 @@ namespace OpenSim.Framework.Servers.HttpServer try { wreq = m_requests.Dequeue(0); - m_server.DoHTTPGruntWork( - wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id), - new OSHttpResponse(new HttpResponse(wreq.HttpContext, wreq.Request), wreq.HttpContext)); + DoHTTPGruntWork(m_server,wreq, + wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); } catch { @@ -359,8 +357,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); - m_server.DoHTTPGruntWork(responsedata, - new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + DoHTTPGruntWork(m_server, req, responsedata); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { @@ -375,8 +372,8 @@ namespace OpenSim.Framework.Servers.HttpServer // if ((Environment.TickCount - req.RequestTime) > m_timeout) if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { - m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), - new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); + DoHTTPGruntWork(m_server, req, + req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); } else { @@ -391,6 +388,46 @@ namespace OpenSim.Framework.Servers.HttpServer } } } + + // DoHTTPGruntWork changed, not sending response + // do the same work around as core + + internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) + { + OSHttpResponse response + = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); + + byte[] buffer = server.DoHTTPGruntWork(responsedata, response); + + response.SendChunked = false; + response.ContentLength64 = buffer.Length; + response.ContentEncoding = Encoding.UTF8; + + try + { + response.OutputStream.Write(buffer, 0, buffer.Length); + } + catch (Exception ex) + { + m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); + } + finally + { + //response.OutputStream.Close(); + try + { + response.OutputStream.Flush(); + response.Send(); + + //if (!response.KeepAlive && response.ReuseContext) + // response.FreeContext(); + } + catch (Exception e) + { + m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); + } + } + } } } -- cgit v1.1 From ce8b9e6c570f73a5c70dfc2b52bbb595637b717d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 19 Jul 2012 12:27:36 +0200 Subject: Fix slow loading of task inventory --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 58a65de..b1f41b8 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1177,7 +1177,7 @@ namespace OpenSim.Framework /// void SendBulkUpdateInventory(InventoryNodeBase node); - void SendXferPacket(ulong xferID, uint packet, byte[] data); + void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory); void SendAbortXferPacket(ulong xferID); -- cgit v1.1 From 195b69d1ea90a123ce1a61536dffa33276c1e76a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 14 Aug 2012 21:54:47 +0200 Subject: Allow the use of the region debug console found in recent viewers. This console will be available to estate owners and managers. If the user using the console had god privs, they can use "set console on" and "set console off" to switch on the actual region console. This allows console access from within the viewer. The region debug console can coexist with any other main console. --- OpenSim/Framework/Console/CommandConsole.cs | 9 +++++++++ OpenSim/Framework/Console/LocalConsole.cs | 4 +++- OpenSim/Framework/Console/MockConsole.cs | 4 +++- OpenSim/Framework/Console/RemoteConsole.cs | 1 + OpenSim/Framework/ICommandConsole.cs | 6 +++++- 5 files changed, 21 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 87bdacd..bd23d1c 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -678,6 +678,8 @@ namespace OpenSim.Framework.Console { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event OnOutputDelegate OnOutput; + public ICommands Commands { get; private set; } public CommandConsole(string defaultPrompt) : base(defaultPrompt) @@ -697,6 +699,13 @@ namespace OpenSim.Framework.Console Output(s); } + protected void FireOnOutput(string text) + { + OnOutputDelegate onOutput = OnOutput; + if (onOutput != null) + onOutput(text); + } + /// /// Display a command prompt on the console and wait for user input /// diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index f65813b..d41481f 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -319,6 +319,8 @@ namespace OpenSim.Framework.Console public override void Output(string text, string level) { + FireOnOutput(text); + lock (m_commandLine) { if (m_cursorYPosition == -1) @@ -509,4 +511,4 @@ namespace OpenSim.Framework.Console } } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs index 4d8751f..b489f93 100644 --- a/OpenSim/Framework/Console/MockConsole.cs +++ b/OpenSim/Framework/Console/MockConsole.cs @@ -40,6 +40,8 @@ namespace OpenSim.Framework.Console /// public class MockConsole : ICommandConsole { + public event OnOutputDelegate OnOutput; + private MockCommands m_commands = new MockCommands(); public ICommands Commands { get { return m_commands; } } @@ -76,4 +78,4 @@ namespace OpenSim.Framework.Console public string[] Resolve(string[] cmd) { return null; } public XmlElement GetXml(XmlDocument doc) { return null; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index e04ca1e..50eb173 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -100,6 +100,7 @@ namespace OpenSim.Framework.Console m_LineNumber++; m_Scrollback.Add(String.Format("{0}", m_LineNumber)+":"+level+":"+text); } + FireOnOutput(text.Trim()); System.Console.WriteLine(text.Trim()); } diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs index ca0ff93..8cd20da 100644 --- a/OpenSim/Framework/ICommandConsole.cs +++ b/OpenSim/Framework/ICommandConsole.cs @@ -74,8 +74,12 @@ namespace OpenSim.Framework XmlElement GetXml(XmlDocument doc); } + public delegate void OnOutputDelegate(string message); + public interface ICommandConsole : IConsole { + event OnOutputDelegate OnOutput; + ICommands Commands { get; } /// @@ -87,4 +91,4 @@ namespace OpenSim.Framework string ReadLine(string p, bool isCommand, bool e); } -} \ No newline at end of file +} -- cgit v1.1 From 8cd4042f9e87a483de396dba5fa842f17028cb95 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 15 Aug 2012 21:14:39 +0100 Subject: Implementing PRIM_LINK_TARGET in a non-recursive fashion --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index b1f41b8..6be2bd7 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -126,7 +126,7 @@ namespace OpenSim.Framework public delegate void ObjectDrop(uint localID, IClientAPI remoteClient); public delegate void UpdatePrimFlags( - uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom,ExtraPhysicsData PhysData, IClientAPI remoteClient); + uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient); public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); -- cgit v1.1 From 7e17f4296e91129990c15cdaaa1689922a57f9aa Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Aug 2012 23:48:01 +0200 Subject: Fix background inventory loading (Viewer 3) so it won't lag out the sim --- OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 3 ++- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index bb43cd2..c24a000 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -51,7 +51,8 @@ namespace OpenSim.Framework.Servers.HttpServer public enum EventType : int { Normal = 0, - LslHttp = 1 + LslHttp = 1, + Inventory = 2 } public PollServiceEventArgs( diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index a385110..a1dee4e 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -231,7 +231,8 @@ namespace OpenSim.Framework.Servers.HttpServer { if (m_running) { - if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp) + if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp || + req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Inventory) { m_requests.Enqueue(req); } -- cgit v1.1 From a7250c6ea16971327f28296bdef9a264cf61efc0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Sep 2012 01:23:20 +0100 Subject: add a extra httppool thread to compensate for webfetchinventory --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index e45cb89..7384e39 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1618,7 +1618,8 @@ namespace OpenSim.Framework.Servers.HttpServer m_httpListener2.Start(64); // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events - m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); +// m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); + m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); HTTPDRunning = true; //HttpListenerContext context; -- cgit v1.1 From 52d74cf274fbf002e7ec6ad82fe1a38dc2c02d59 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:11:23 +0200 Subject: Allow setting max connections for an endpoint --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 7384e39..57c9d7c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -640,7 +640,7 @@ namespace OpenSim.Framework.Servers.HttpServer // Every month or so this will wrap and give bad numbers, not really a problem // since its just for reporting int tickdiff = requestEndTick - requestStartTick; - if (tickdiff > 3000) + if (tickdiff > 3000 && requestHandler.Name != "GetTexture") { m_log.InfoFormat( "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", -- cgit v1.1 From 9f93bef1110e4f0152713e0ff0472bc55890d962 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:15:10 +0200 Subject: Allow setting connection limits, part 2 --- OpenSim/Framework/WebUtil.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 6a40cd5..8094b6d 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -695,6 +695,13 @@ namespace OpenSim.Framework public static void MakeRequest(string verb, string requestUrl, TRequest obj, Action action) { + MakeRequest(verb, requestUrl, obj, action, 0); + } + + public static void MakeRequest(string verb, + string requestUrl, TRequest obj, Action action, + int maxConnections) + { int reqnum = WebUtil.RequestNumber++; // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); @@ -706,6 +713,10 @@ namespace OpenSim.Framework Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); + HttpWebRequest ht = (HttpWebRequest)request; + if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) + ht.ServicePoint.ConnectionLimit = maxConnections; + WebResponse response = null; TResponse deserial = default(TResponse); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); @@ -1003,6 +1014,11 @@ namespace OpenSim.Framework public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout) { + return MakeRequest(verb, requestUrl, obj, pTimeout, 0); + } + + public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) + { int reqnum = WebUtil.RequestNumber++; // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); @@ -1013,6 +1029,10 @@ namespace OpenSim.Framework TResponse deserial = default(TResponse); WebRequest request = WebRequest.Create(requestUrl); + HttpWebRequest ht = (HttpWebRequest)request; + if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) + ht.ServicePoint.ConnectionLimit = maxConnections; + request.Method = verb; if (pTimeout != 0) request.Timeout = pTimeout * 1000; -- cgit v1.1 From 387e59ff7f60f2b12526eaacd93581f76abe26e1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 21:24:25 +0200 Subject: Revamp the HTTP textures handler to allow a maximum of four fetches at any time and to drop requests for avatars n longer in the scene --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 47 +++++++++++++++------- .../Servers/HttpServer/PollServiceEventArgs.cs | 3 +- .../HttpServer/PollServiceRequestManager.cs | 3 +- 3 files changed, 36 insertions(+), 17 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 57c9d7c..6121371 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1449,7 +1449,8 @@ namespace OpenSim.Framework.Servers.HttpServer internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) { int responsecode; - string responseString; + string responseString = String.Empty; + byte[] responseData = null; string contentType; if (responsedata == null) @@ -1465,7 +1466,10 @@ namespace OpenSim.Framework.Servers.HttpServer { //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); responsecode = (int)responsedata["int_response_code"]; - responseString = (string)responsedata["str_response_string"]; + if (responsedata["bin_response_data"] != null) + responseData = (byte[])responsedata["bin_response_data"]; + else + responseString = (string)responsedata["str_response_string"]; contentType = (string)responsedata["content_type"]; } catch @@ -1520,25 +1524,40 @@ namespace OpenSim.Framework.Servers.HttpServer response.AddHeader("Content-Type", contentType); + if (responsedata.ContainsKey("headers")) + { + Hashtable headerdata = (Hashtable)responsedata["headers"]; + + foreach (string header in headerdata.Keys) + response.AddHeader(header, (string)headerdata[header]); + } + byte[] buffer; - if (!(contentType.Contains("image") - || contentType.Contains("x-shockwave-flash") - || contentType.Contains("application/x-oar") - || contentType.Contains("application/vnd.ll.mesh"))) + if (responseData != null) { - // Text - buffer = Encoding.UTF8.GetBytes(responseString); + buffer = responseData; } else { - // Binary! - buffer = Convert.FromBase64String(responseString); - } + if (!(contentType.Contains("image") + || contentType.Contains("x-shockwave-flash") + || contentType.Contains("application/x-oar") + || contentType.Contains("application/vnd.ll.mesh"))) + { + // Text + buffer = Encoding.UTF8.GetBytes(responseString); + } + else + { + // Binary! + buffer = Convert.FromBase64String(responseString); + } - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; + response.SendChunked = false; + response.ContentLength64 = buffer.Length; + response.ContentEncoding = Encoding.UTF8; + } return buffer; } diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index c24a000..a80b1d7 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -52,7 +52,8 @@ namespace OpenSim.Framework.Servers.HttpServer { Normal = 0, LslHttp = 1, - Inventory = 2 + Inventory = 2, + Texture = 3 } public PollServiceEventArgs( diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index a1dee4e..db088e7 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -231,8 +231,7 @@ namespace OpenSim.Framework.Servers.HttpServer { if (m_running) { - if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp || - req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Inventory) + if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.Normal) { m_requests.Enqueue(req); } -- cgit v1.1 From 2aa7a22129e2b5c226d3937c31bdcbdbc65a20f8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 23:09:07 +0200 Subject: Sequence/throttle asset retrievals. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 6121371..11852eb 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1471,6 +1471,8 @@ namespace OpenSim.Framework.Servers.HttpServer else responseString = (string)responsedata["str_response_string"]; contentType = (string)responsedata["content_type"]; + if (responseString == null) + responseString = String.Empty; } catch { -- cgit v1.1 From a97436f2f16c2ef217963545349149cdbf9c21b8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 16 Sep 2012 16:42:30 +0200 Subject: Catch a nullref in the code to suppress GetTexture warnign spam we can't do a thing about anyway. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 11852eb..2582b7b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -640,7 +640,7 @@ namespace OpenSim.Framework.Servers.HttpServer // Every month or so this will wrap and give bad numbers, not really a problem // since its just for reporting int tickdiff = requestEndTick - requestStartTick; - if (tickdiff > 3000 && requestHandler.Name != "GetTexture") + if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) { m_log.InfoFormat( "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", -- cgit v1.1 From 2d02405186841d5aeea30b608d106212f5fee1c3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 23 Sep 2012 23:16:25 +0200 Subject: Change the poll service to use a thread pool for replies to make sure the event queues aren't blocked by other traffic. --- .../HttpServer/PollServiceRequestManager.cs | 45 ++++++++++++++++++---- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index db088e7..c13c65b 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -33,6 +33,7 @@ using log4net; using HttpServer; using OpenSim.Framework; using OpenSim.Framework.Monitoring; +using Amib.Threading; /* @@ -185,6 +186,8 @@ namespace OpenSim.Framework.Servers.HttpServer private bool m_running = true; private int slowCount = 0; + private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); + // private int m_timeout = 1000; // increase timeout 250; now use the event one public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) @@ -353,18 +356,46 @@ namespace OpenSim.Framework.Servers.HttpServer continue; } - try + // "Normal" means the viewer evebt queue. We need to push these out fast. + // Process them inline. The rest go to the thread pool. + if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); - DoHTTPGruntWork(m_server, req, responsedata); + try + { + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); + DoHTTPGruntWork(m_server, req, responsedata); + } + catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + { + // Ignore it, no need to reply + } + finally + { + str.Close(); + } } - catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + else { - // Ignore it, no need to reply + m_threadPool.QueueWorkItem(x => + { + try + { + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); + DoHTTPGruntWork(m_server, req, responsedata); + } + catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + { + // Ignore it, no need to reply + } + finally + { + str.Close(); + } + + return null; + }, null); } - str.Close(); - } else { -- cgit v1.1 From ca67ee60ac0e0c26d6d32fc68d48ef63570f034d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 24 Sep 2012 21:22:08 +0100 Subject: add missing transactionID in SendInventoryItemCreateUpdate. and make use of it on inventoryAccessModule, etc. Most likelly it's needs where there is a transactionID not zero --- OpenSim/Framework/IClientAPI.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 6be2bd7..5909ce1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1158,6 +1158,7 @@ namespace OpenSim.Framework /// /// void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); + void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId); void SendRemoveInventoryItem(UUID itemID); -- cgit v1.1 From 5d986002fdb6d91426529f14344d7b2d133c6633 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 00:17:54 +0100 Subject: fix priorityQueue to correctly use the fairness counts starting at 8 for nonimediate queues. Imediate queues where not taken into account so it was unused. --- OpenSim/Framework/PriorityQueue.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index e7a7f7f..e4f1111 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -45,7 +45,8 @@ namespace OpenSim.Framework /// /// Total number of queues (priorities) available /// - public const uint NumberOfQueues = 12; + + public const uint NumberOfQueues = 12; // includes immediate queues, m_queueCounts need to be set acording /// /// Number of queuest (priorities) that are processed immediately @@ -60,7 +61,8 @@ namespace OpenSim.Framework // each pass. weighted towards the higher priority queues private uint m_nextQueue = 0; private uint m_countFromQueue = 0; - private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 }; + // first queues are imediate, so no counts + private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1}; // next request is a counter of the number of updates queued, it provides // a total ordering on the updates coming through the queue and is more @@ -137,7 +139,7 @@ namespace OpenSim.Framework /// public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) { - // If there is anything in priority queue 0, return it first no + // If there is anything in imediate queues, return it first no // matter what else. Breaks fairness. But very useful. for (int iq = 0; iq < NumberOfImmediateQueues; iq++) { @@ -172,14 +174,13 @@ namespace OpenSim.Framework } // Find the next non-immediate queue with updates in it - for (int i = 0; i < NumberOfQueues; ++i) + for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i) { - m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues); - m_countFromQueue = m_queueCounts[m_nextQueue]; + m_nextQueue++; + if(m_nextQueue >= NumberOfQueues) + m_nextQueue = NumberOfImmediateQueues; - // if this is one of the immediate queues, just skip it - if (m_nextQueue < NumberOfImmediateQueues) - continue; + m_countFromQueue = m_queueCounts[m_nextQueue]; if (m_heaps[m_nextQueue].Count > 0) { @@ -189,7 +190,6 @@ namespace OpenSim.Framework m_lookupTable.Remove(item.Value.Entity.LocalId); timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); value = item.Value; - return true; } } -- cgit v1.1 From 654dd289f263a4eef4f2aa70a1cb8d289ec7e04c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 03:05:27 +0100 Subject: more changes to PollService --- .../Servers/HttpServer/PollServiceEventArgs.cs | 1 + .../HttpServer/PollServiceRequestManager.cs | 41 +++++++++------------- 2 files changed, 18 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index a80b1d7..9b27a6e 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -47,6 +47,7 @@ namespace OpenSim.Framework.Servers.HttpServer public UUID Id; public int TimeOutms; public EventType Type; + public bool GetEventsNeedsRequest = true; public enum EventType : int { diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index c13c65b..c234537 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -205,7 +205,7 @@ namespace OpenSim.Framework.Servers.HttpServer String.Format("PollServiceWorkerThread{0}", i), ThreadPriority.Normal, false, - true, + false, null, int.MaxValue); } @@ -344,35 +344,36 @@ namespace OpenSim.Framework.Servers.HttpServer { if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { - try + string strreq = ""; + if (req.PollServiceArgs.GetEventsNeedsRequest) { - str = new StreamReader(req.Request.Body); + try + { + str = new StreamReader(req.Request.Body); + strreq = str.ReadToEnd(); + str.Close(); + } + catch + { + continue; + } } - catch (System.ArgumentException) - { - // Stream was not readable means a child agent - // was closed due to logout, leaving the - // Event Queue request orphaned. + + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, strreq); + + if (responsedata == null) continue; - } - // "Normal" means the viewer evebt queue. We need to push these out fast. - // Process them inline. The rest go to the thread pool. if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) { try { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); DoHTTPGruntWork(m_server, req, responsedata); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { // Ignore it, no need to reply } - finally - { - str.Close(); - } } else { @@ -380,27 +381,19 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); DoHTTPGruntWork(m_server, req, responsedata); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { // Ignore it, no need to reply } - finally - { - str.Close(); - } return null; }, null); } - } else { -// if ((Environment.TickCount - req.RequestTime) > m_timeout) - if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { DoHTTPGruntWork(m_server, req, -- cgit v1.1 From 67fa6577461bf1e2a39c501f73d8bfc9045ee69e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 04:52:19 +0100 Subject: keep watchdog happy using it to kill his threads --- .../Framework/Servers/HttpServer/PollServiceRequestManager.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index c234537..cc9ddc2 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -278,15 +278,7 @@ namespace OpenSim.Framework.Servers.HttpServer Thread.Sleep(1000); // let the world move foreach (Thread t in m_workerThreads) - { - try - { - t.Abort(); - } - catch - { - } - } + Watchdog.AbortThread(t.ManagedThreadId); try { -- cgit v1.1 From 7e3eba1064197024690c5b3cae4c2cf87319e48c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 15:41:57 +0100 Subject: Seems nothing actually need the request body for getevents. so change control flag to false --- OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 10 ++++++++-- .../Framework/Servers/HttpServer/PollServiceRequestManager.cs | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 9b27a6e..f85509a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -46,8 +46,14 @@ namespace OpenSim.Framework.Servers.HttpServer public RequestMethod Request; public UUID Id; public int TimeOutms; - public EventType Type; - public bool GetEventsNeedsRequest = true; + public EventType Type; + // must be set true for cases where GetEvents needs to access the request body + // at each pool. http can start processing before having the full body + // but not sure if this is active for poll events + // if original coder thinked its needed i keep it + // if the Event has a Request method this seems to smoke for now + // seems for now nothing actually uses this so default to false + public bool GetEventsNeedsRequestBody = false; public enum EventType : int { diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index cc9ddc2..c379747 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -337,10 +337,11 @@ namespace OpenSim.Framework.Servers.HttpServer if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { string strreq = ""; - if (req.PollServiceArgs.GetEventsNeedsRequest) + if (req.PollServiceArgs.GetEventsNeedsRequestBody) { try { + // should we try to seek back? fear we can't str = new StreamReader(req.Request.Body); strreq = str.ReadToEnd(); str.Close(); -- cgit v1.1 From 617f1b9223375a2dda925e26c395901810d37697 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 16:17:49 +0100 Subject: just remove the damm thing --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 1 + .../Servers/HttpServer/PollServiceEventArgs.cs | 9 +-------- .../Servers/HttpServer/PollServiceRequestManager.cs | 18 +----------------- 3 files changed, 3 insertions(+), 25 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 2582b7b..788a0b9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -317,6 +317,7 @@ namespace OpenSim.Framework.Servers.HttpServer StreamReader reader = new StreamReader(requestStream, encoding); string requestBody = reader.ReadToEnd(); + reader.Close(); Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index f85509a..d0a37d0 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -34,7 +34,7 @@ namespace OpenSim.Framework.Servers.HttpServer public delegate void RequestMethod(UUID requestID, Hashtable request); public delegate bool HasEventsMethod(UUID requestID, UUID pId); - public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request); + public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId); public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); @@ -47,13 +47,6 @@ namespace OpenSim.Framework.Servers.HttpServer public UUID Id; public int TimeOutms; public EventType Type; - // must be set true for cases where GetEvents needs to access the request body - // at each pool. http can start processing before having the full body - // but not sure if this is active for poll events - // if original coder thinked its needed i keep it - // if the Event has a Request method this seems to smoke for now - // seems for now nothing actually uses this so default to false - public bool GetEventsNeedsRequestBody = false; public enum EventType : int { diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index c379747..c09bf14 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -336,23 +336,7 @@ namespace OpenSim.Framework.Servers.HttpServer { if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { - string strreq = ""; - if (req.PollServiceArgs.GetEventsNeedsRequestBody) - { - try - { - // should we try to seek back? fear we can't - str = new StreamReader(req.Request.Body); - strreq = str.ReadToEnd(); - str.Close(); - } - catch - { - continue; - } - } - - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, strreq); + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); if (responsedata == null) continue; -- cgit v1.1 From be9cef8682cddf9589976f543e98e886d16098a1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 16:20:26 +0100 Subject: missing file --- OpenSim/Framework/Console/RemoteConsole.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 50eb173..3e3c2b3 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -425,7 +425,7 @@ namespace OpenSim.Framework.Console return false; } - private Hashtable GetEvents(UUID RequestID, UUID sessionID, string request) + private Hashtable GetEvents(UUID RequestID, UUID sessionID) { ConsoleConnection c = null; -- cgit v1.1 From c3ea00f16e8582ec547f4fb927119a1e5f1b16f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 20:31:34 +0100 Subject: add assettype mesh to list of binary assets --- OpenSim/Framework/AssetBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index ff240be..5da8e11 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -150,7 +150,8 @@ namespace OpenSim.Framework Type == (sbyte)AssetType.SnapshotFolder || Type == (sbyte)AssetType.TrashFolder || Type == (sbyte)AssetType.ImageJPEG || - Type == (sbyte) AssetType.ImageTGA || + Type == (sbyte)AssetType.ImageTGA || + Type == (sbyte)AssetType.Mesh || Type == (sbyte) AssetType.LSLBytecode); } } -- cgit v1.1 From a0065ad61611b1a078116327f826b109bd90dba4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 27 Sep 2012 00:14:50 +0100 Subject: create a new PollServiceHttpRequest req per loop since they can be sent to another working thread --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index c09bf14..4be8bf4 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -321,13 +321,9 @@ namespace OpenSim.Framework.Servers.HttpServer private void PoolWorkerJob() { - PollServiceHttpRequest req; - StreamReader str; - -// while (true) while (m_running) { - req = m_requests.Dequeue(5000); + PollServiceHttpRequest req = m_requests.Dequeue(5000); Watchdog.UpdateThread(); if (req != null) -- cgit v1.1 From 285039949c8a0c0b13da8b74d2ce560805932ad9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 27 Sep 2012 18:27:49 +0100 Subject: Update the Http server with a few additional properties. Adapt the test server code to match. --- OpenSim/Framework/Servers/Tests/OSHttpTests.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index dc4eb8f..4c2f586 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs @@ -75,6 +75,10 @@ namespace OpenSim.Framework.Servers.Tests /// public event EventHandler RequestReceived = delegate { }; + public bool CanSend { get { return true; } } + public string RemoteEndPoint { get { return ""; } } + public string RemoteEndPointAddress { get { return ""; } } + public string RemoteEndPointPort { get { return ""; } } } public class TestHttpRequest: IHttpRequest -- cgit v1.1 From db00402fa86db6c3d945a48df13e266506e61486 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Oct 2012 00:14:49 +0100 Subject: make sure a buffer is closed, and changed a misleading log msg --- OpenSim/Framework/WebUtil.cs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 8094b6d..30a8c28 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -706,9 +706,10 @@ namespace OpenSim.Framework // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); int tickstart = Util.EnvironmentTickCount(); - int tickdata = 0; +// int tickdata = 0; + int tickdiff = 0; - // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); +// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); Type type = typeof(TRequest); @@ -751,8 +752,8 @@ namespace OpenSim.Framework requestStream.Close(); // capture how much time was spent writing - tickdata = Util.EnvironmentTickCountSubtract(tickstart); - + // useless in this async +// tickdata = Util.EnvironmentTickCountSubtract(tickstart); request.BeginGetResponse(delegate(IAsyncResult ar) { response = request.EndGetResponse(ar); @@ -769,7 +770,8 @@ namespace OpenSim.Framework finally { // Let's not close this - //buffer.Close(); + // yes do close it + buffer.Close(); respStream.Close(); response.Close(); } @@ -837,7 +839,6 @@ namespace OpenSim.Framework } // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); - try { action(deserial); @@ -852,9 +853,10 @@ namespace OpenSim.Framework }, null); } - int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); + tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > WebUtil.LongCallTime) { +/* string originalRequest = null; if (buffer != null) @@ -873,6 +875,13 @@ namespace OpenSim.Framework tickdiff, tickdata, originalRequest); +*/ + m_log.InfoFormat( + "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms", + reqnum, + verb, + requestUrl, + tickdiff); } } } @@ -903,6 +912,8 @@ namespace OpenSim.Framework request.Method = verb; string respstring = String.Empty; + int tickset = Util.EnvironmentTickCountSubtract(tickstart); + using (MemoryStream buffer = new MemoryStream()) { if ((verb == "POST") || (verb == "PUT")) @@ -979,11 +990,12 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > WebUtil.LongCallTime) m_log.InfoFormat( - "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}", reqnum, verb, requestUrl, tickdiff, + tickset, tickdata, obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); -- cgit v1.1 From 950192539761a6fff2c27734e3090cd8aee2df1b Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 12 Oct 2012 19:23:35 +0100 Subject: Fix a merge issue --- OpenSim/Framework/EstateSettings.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 9020761..e03750b 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)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); + 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); } public bool GroupAccess(UUID groupID) -- cgit v1.1 From ff61d59e60cf40ed65e01b2788c875509a5aaaa4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Oct 2012 21:45:39 +0100 Subject: Add AnimState to CADU --- OpenSim/Framework/ChildAgentDataUpdate.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index e718aa6..8c32734 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -312,6 +312,7 @@ namespace OpenSim.Framework public AgentGroupData[] Groups; public Animation[] Anims; public Animation DefaultAnim = null; + public Animation AnimState = null; public UUID GranterID; public UUID ParentPart; @@ -403,6 +404,11 @@ namespace OpenSim.Framework args["default_animation"] = DefaultAnim.PackUpdateMessage(); } + if (AnimState != null) + { + args["animation_state"] = AnimState.PackUpdateMessage(); + } + if (Appearance != null) args["packed_appearance"] = Appearance.Pack(); @@ -612,6 +618,18 @@ namespace OpenSim.Framework } } + if (args["animation_state"] != null) + { + try + { + AnimState = new Animation((OSDMap)args["animation_state"]); + } + catch + { + AnimState = null; + } + } + //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) //{ // OSDArray textures = (OSDArray)(args["agent_textures"]); -- cgit v1.1 From 4fa088bafb4c78ad3177b0e944a4312bd6abdea7 Mon Sep 17 00:00:00 2001 From: teravus Date: Sun, 4 Nov 2012 22:57:24 -0500 Subject: Pipe Throttle Update Event to EventManager, client --> ScenePresence --> EventManager, so that modules can know when throttles are updated. The event contains no client specific data to preserve the possibility of 'multiple clients' and you must still call ControllingClient.GetThrottlesPacked(f) to see what the throttles actually are once the event fires. Hook EventManager.OnUpdateThrottle to GetTextureModule. --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5909ce1..e31c7f6 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1038,7 +1038,7 @@ namespace OpenSim.Framework event MuteListEntryRemove OnRemoveMuteListEntry; event GodlikeMessage onGodlikeMessage; event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; - + event GenericCall2 OnUpdateThrottles; /// /// Set the debug level at which packet output should be printed to console. /// -- cgit v1.1 From cda127e30f0049cda21137363e4d759fd7fd4959 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 9 Nov 2012 23:55:30 -0500 Subject: * Prep work switching the GetMeshModule over to a poll service. * This still has the image throttler in it.. as is... so it's not suitable for live yet.... The throttler keeps track of the task throttle but doesn't balance the UDP throttle yet. --- OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index d0a37d0..c19ac32 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -53,7 +53,8 @@ namespace OpenSim.Framework.Servers.HttpServer Normal = 0, LslHttp = 1, Inventory = 2, - Texture = 3 + Texture = 3, + Mesh = 4 } public PollServiceEventArgs( -- cgit v1.1 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 s; + + if (DataBlocks.TryGetValue(typeof(T), out s)) + { + if (s.Count > 0) + return (T)s.Pop(); + } + else + { + DataBlocks[typeof(T)] = new Stack(); + } + + return new T(); + } + } + + public static void ReturnDataBlock(T block) where T: new() + { + if (block == null) + return; + + lock (DataBlocks) + { + if (!DataBlocks.ContainsKey(typeof(T))) + DataBlocks[typeof(T)] = new Stack(); + + if (DataBlocks[typeof(T)].Count < 50) + DataBlocks[typeof(T)].Push(block); + } + } + } +} diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs deleted file mode 100644 index 5484f5c..0000000 --- a/OpenSim/Framework/Pool.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; - -namespace OpenSim.Framework -{ - /// - /// Naive pool implementation. - /// - /// - /// Currently assumes that objects are in a useable state when returned. - /// - public class Pool - { - /// - /// Number of objects in the pool. - /// - public int Count - { - get - { - lock (m_pool) - return m_pool.Count; - } - } - - private Stack m_pool; - - /// - /// Maximum pool size. Beyond this, any returned objects are not pooled. - /// - private int m_maxPoolSize; - - private Func m_createFunction; - - public Pool(Func createFunction, int maxSize) - { - m_maxPoolSize = maxSize; - m_createFunction = createFunction; - m_pool = new Stack(m_maxPoolSize); - } - - public T GetObject() - { - lock (m_pool) - { - if (m_pool.Count > 0) - return m_pool.Pop(); - else - return m_createFunction(); - } - } - - public void ReturnObject(T obj) - { - lock (m_pool) - { - if (m_pool.Count >= m_maxPoolSize) - return; - else - m_pool.Push(obj); - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/RegionFlags.cs b/OpenSim/Framework/RegionFlags.cs deleted file mode 100644 index a3089b0..0000000 --- a/OpenSim/Framework/RegionFlags.cs +++ /dev/null @@ -1,53 +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; - -namespace OpenSim.Framework -{ - /// - /// Region flags used internally by OpenSimulator to store installation specific information about regions. - /// - /// - /// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire). - /// Returned by IGridService.GetRegionFlags() - /// - [Flags] - public enum RegionFlags : int - { - DefaultRegion = 1, // Used for new Rez. Random if multiple defined - FallbackRegion = 2, // Regions we redirect to when the destination is down - RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false - NoDirectLogin = 8, // Region unavailable for direct logins (by name) - Persistent = 16, // Don't remove on unregister - LockedOut = 32, // Don't allow registration - NoMove = 64, // Don't allow moving this region - Reservation = 128, // This is an inactive reservation - Authenticate = 256, // Require authentication - Hyperlink = 512 // Record represents a HG link - } -} \ No newline at end of file diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index e7bed6a..4bde7be 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -122,13 +122,10 @@ namespace OpenSim.Framework public UUID lastMapUUID = UUID.Zero; public string lastMapRefresh = "0"; - private float m_nonphysPrimMin = 0; private int m_nonphysPrimMax = 0; - private float m_physPrimMin = 0; private int m_physPrimMax = 0; private bool m_clampPrimSize = false; private int m_objectCapacity = 0; - private int m_linksetCapacity = 0; private int m_agentCapacity = 0; private string m_regionType = String.Empty; private RegionLightShareData m_windlight = new RegionLightShareData(); @@ -290,21 +287,11 @@ namespace OpenSim.Framework set { m_windlight = value; } } - public float NonphysPrimMin - { - get { return m_nonphysPrimMin; } - } - public int NonphysPrimMax { get { return m_nonphysPrimMax; } } - public float PhysPrimMin - { - get { return m_physPrimMin; } - } - public int PhysPrimMax { get { return m_physPrimMax; } @@ -320,11 +307,6 @@ namespace OpenSim.Framework get { return m_objectCapacity; } } - public int LinksetCapacity - { - get { return m_linksetCapacity; } - } - public int AgentCapacity { get { return m_agentCapacity; } @@ -643,31 +625,16 @@ namespace OpenSim.Framework m_regionType = config.GetString("RegionType", String.Empty); allKeys.Remove("RegionType"); - #region Prim stuff - - m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); - allKeys.Remove("NonPhysicalPrimMin"); - - m_nonphysPrimMax = config.GetInt("NonPhysicalPrimMax", 0); - allKeys.Remove("NonPhysicalPrimMax"); - - m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0); - allKeys.Remove("PhysicalPrimMin"); - + // Prim stuff + // + m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0); + allKeys.Remove("NonphysicalPrimMax"); m_physPrimMax = config.GetInt("PhysicalPrimMax", 0); allKeys.Remove("PhysicalPrimMax"); - m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); allKeys.Remove("ClampPrimSize"); - m_objectCapacity = config.GetInt("MaxPrims", 15000); allKeys.Remove("MaxPrims"); - - m_linksetCapacity = config.GetInt("LinksetPrims", 0); - allKeys.Remove("LinksetPrims"); - - #endregion - m_agentCapacity = config.GetInt("MaxAgents", 100); allKeys.Remove("MaxAgents"); @@ -706,27 +673,16 @@ namespace OpenSim.Framework config.Set("ExternalHostName", m_externalHostName); - if (m_nonphysPrimMin > 0) - config.Set("NonphysicalPrimMax", m_nonphysPrimMin); - - if (m_nonphysPrimMax > 0) + if (m_nonphysPrimMax != 0) config.Set("NonphysicalPrimMax", m_nonphysPrimMax); - - if (m_physPrimMin > 0) - config.Set("PhysicalPrimMax", m_physPrimMin); - - if (m_physPrimMax > 0) + if (m_physPrimMax != 0) config.Set("PhysicalPrimMax", m_physPrimMax); - config.Set("ClampPrimSize", m_clampPrimSize.ToString()); - if (m_objectCapacity > 0) + if (m_objectCapacity != 0) config.Set("MaxPrims", m_objectCapacity); - if (m_linksetCapacity > 0) - config.Set("LinksetPrims", m_linksetCapacity); - - if (m_agentCapacity > 0) + if (m_agentCapacity != 0) config.Set("MaxAgents", m_agentCapacity); if (ScopeID != UUID.Zero) @@ -803,15 +759,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); - configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true); - configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); - configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true); - configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for physical prims", m_physPrimMax.ToString(), true); @@ -821,9 +771,6 @@ namespace OpenSim.Framework configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", m_objectCapacity.ToString(), true); - configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, - "Max prims an object will hold", m_linksetCapacity.ToString(), true); - configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max avatars this sim will hold", m_agentCapacity.ToString(), true); @@ -945,9 +892,6 @@ namespace OpenSim.Framework case "object_capacity": m_objectCapacity = (int)configuration_result; break; - case "linkset_capacity": - m_linksetCapacity = (int)configuration_result; - break; case "agent_capacity": m_agentCapacity = (int)configuration_result; break; diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 48f1c4f..2c5e001 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -53,11 +53,6 @@ namespace OpenSim.Framework.Serialization public const string INVENTORY_PATH = "inventory/"; /// - /// Path for regions in a multi-region archive - /// - public const string REGIONS_PATH = "regions/"; - - /// /// Path for the prims file /// public const string OBJECTS_PATH = "objects/"; diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs index fa7160f..d31d27c 100644 --- a/OpenSim/Framework/Serialization/External/OspResolver.cs +++ b/OpenSim/Framework/Serialization/External/OspResolver.cs @@ -65,14 +65,9 @@ namespace OpenSim.Framework.Serialization UserAccount account = userService.GetUserAccount(UUID.Zero, userId); if (account != null) - { return MakeOspa(account.FirstName, account.LastName); - } // else -// { // m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId); -// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId); -// } return null; } @@ -84,13 +79,10 @@ namespace OpenSim.Framework.Serialization /// public static string MakeOspa(string firstName, string lastName) { - string ospa - = OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; - -// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); -// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); +// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName); - return ospa; + return + OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; } /// diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 605909d..cf19002 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -96,6 +96,11 @@ namespace OpenSim.Framework.Servers get { return m_httpServer; } } + /// + /// Holds the non-viewer statistics collection object for this service/server + /// + protected IStatsCollector m_stats; + public BaseOpenSimServer() { m_startuptime = DateTime.Now; @@ -172,6 +177,10 @@ namespace OpenSim.Framework.Servers "show info", "Show general information about the server", HandleShow); + m_console.Commands.AddCommand("General", false, "show stats", + "show stats", + "Show statistics", HandleShow); + m_console.Commands.AddCommand("General", false, "show threads", "show threads", "Show thread status", HandleShow); @@ -192,19 +201,8 @@ namespace OpenSim.Framework.Servers "threads show", "Show thread status. Synonym for \"show threads\"", (string module, string[] args) => Notice(GetThreadsReport())); - - m_console.Commands.AddCommand("General", false, "force gc", - "force gc", - "Manually invoke runtime garbage collection. For debugging purposes", - HandleForceGc); } } - - private void HandleForceGc(string module, string[] args) - { - MainConsole.Instance.Output("Manually invoking runtime garbage collection"); - GC.Collect(); - } /// /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing @@ -228,7 +226,12 @@ namespace OpenSim.Framework.Servers { StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); sb.Append(GetUptimeReport()); - sb.Append(StatsManager.SimExtraStats.Report()); + + if (m_stats != null) + { + sb.Append(m_stats.Report()); + } + sb.Append(Environment.NewLine); sb.Append(GetThreadsReport()); @@ -379,6 +382,10 @@ namespace OpenSim.Framework.Servers { Notice("set log level [level] - change the console logging level only. For example, off or debug."); Notice("show info - show server information (e.g. startup path)."); + + if (m_stats != null) + Notice("show stats - show statistical information for this server"); + Notice("show threads - list tracked threads"); Notice("show uptime - show server startup time and uptime."); Notice("show version - show server version."); @@ -402,6 +409,11 @@ namespace OpenSim.Framework.Servers ShowInfo(); break; + case "stats": + if (m_stats != null) + Notice(m_stats.Report()); + break; + case "threads": Notice(GetThreadsReport()); break; @@ -592,7 +604,8 @@ namespace OpenSim.Framework.Servers public string osSecret { // Secret uuid for the simulator - get { return m_osSecret; } + get { return m_osSecret; } + } public string StatReport(IOSHttpRequest httpRequest) @@ -600,11 +613,11 @@ namespace OpenSim.Framework.Servers // If we catch a request for "callback", wrap the response in the value for jsonp if (httpRequest.Query.ContainsKey("callback")) { - return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; + return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; } else { - return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); + return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); } } diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 3198891..788a0b9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -54,23 +54,8 @@ namespace OpenSim.Framework.Servers.HttpServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); - /// - /// Gets or sets the debug level. - /// - /// - /// See MainServer.DebugLevel. - /// public int DebugLevel { get; set; } - /// - /// Request number for diagnostic purposes. - /// - /// - /// This is an internal number. In some debug situations an external number may also be supplied in the - /// opensim-request-id header but we are not currently logging this. - /// - public int RequestNumber { get; private set; } - private volatile int NotSocketErrors = 0; public volatile bool HTTPDRunning = false; @@ -82,7 +67,7 @@ namespace OpenSim.Framework.Servers.HttpServer protected Dictionary m_llsdHandlers = new Dictionary(); protected Dictionary m_streamHandlers = new Dictionary(); protected Dictionary m_HTTPHandlers = new Dictionary(); -// protected Dictionary m_agentHandlers = new Dictionary(); + protected Dictionary m_agentHandlers = new Dictionary(); protected Dictionary m_pollHandlers = new Dictionary(); @@ -260,29 +245,29 @@ namespace OpenSim.Framework.Servers.HttpServer return new List(m_pollHandlers.Keys); } -// // Note that the agent string is provided simply to differentiate -// // the handlers - it is NOT required to be an actual agent header -// // value. -// public bool AddAgentHandler(string agent, IHttpAgentHandler handler) -// { -// lock (m_agentHandlers) -// { -// if (!m_agentHandlers.ContainsKey(agent)) -// { -// m_agentHandlers.Add(agent, handler); -// return true; -// } -// } -// -// //must already have a handler for that path so return false -// return false; -// } -// -// public List GetAgentHandlerKeys() -// { -// lock (m_agentHandlers) -// return new List(m_agentHandlers.Keys); -// } + // Note that the agent string is provided simply to differentiate + // the handlers - it is NOT required to be an actual agent header + // value. + public bool AddAgentHandler(string agent, IHttpAgentHandler handler) + { + lock (m_agentHandlers) + { + if (!m_agentHandlers.ContainsKey(agent)) + { + m_agentHandlers.Add(agent, handler); + return true; + } + } + + //must already have a handler for that path so return false + return false; + } + + public List GetAgentHandlerKeys() + { + lock (m_agentHandlers) + return new List(m_agentHandlers.Keys); + } public bool AddLLSDHandler(string path, LLSDMethod handler) { @@ -311,8 +296,6 @@ namespace OpenSim.Framework.Servers.HttpServer private void OnRequest(object source, RequestEventArgs args) { - RequestNumber++; - try { IHttpClientContext context = (IHttpClientContext)source; @@ -423,6 +406,7 @@ namespace OpenSim.Framework.Servers.HttpServer string requestMethod = request.HttpMethod; string uriString = request.RawUrl; +// string reqnum = "unknown"; int requestStartTick = Environment.TickCount; // Will be adjusted later on. @@ -439,22 +423,22 @@ namespace OpenSim.Framework.Servers.HttpServer Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); -// // This is the REST agent interface. We require an agent to properly identify -// // itself. If the REST handler recognizes the prefix it will attempt to -// // satisfy the request. If it is not recognizable, and no damage has occurred -// // the request can be passed through to the other handlers. This is a low -// // probability event; if a request is matched it is normally expected to be -// // handled -// IHttpAgentHandler agentHandler; -// -// if (TryGetAgentHandler(request, response, out agentHandler)) -// { -// if (HandleAgentRequest(agentHandler, request, response)) -// { -// requestEndTick = Environment.TickCount; -// return; -// } -// } + // This is the REST agent interface. We require an agent to properly identify + // itself. If the REST handler recognizes the prefix it will attempt to + // satisfy the request. If it is not recognizable, and no damage has occurred + // the request can be passed through to the other handlers. This is a low + // probability event; if a request is matched it is normally expected to be + // handled + IHttpAgentHandler agentHandler; + + if (TryGetAgentHandler(request, response, out agentHandler)) + { + if (HandleAgentRequest(agentHandler, request, response)) + { + requestEndTick = Environment.TickCount; + return; + } + } //response.KeepAlive = true; response.SendChunked = false; @@ -466,7 +450,9 @@ namespace OpenSim.Framework.Servers.HttpServer if (TryGetStreamHandler(handlerKey, out requestHandler)) { if (DebugLevel >= 3) - LogIncomingToStreamHandler(request, requestHandler); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", + request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. @@ -543,8 +529,11 @@ namespace OpenSim.Framework.Servers.HttpServer { case null: case "text/html": + if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleHTTPRequest(request, response); break; @@ -552,8 +541,11 @@ namespace OpenSim.Framework.Servers.HttpServer case "application/llsd+xml": case "application/xml+llsd": case "application/llsd+json": + if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleLLSDRequests(request, response); break; @@ -572,7 +564,9 @@ namespace OpenSim.Framework.Servers.HttpServer if (DoWeHaveALLSDHandler(request.RawUrl)) { if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleLLSDRequests(request, response); } @@ -580,14 +574,18 @@ namespace OpenSim.Framework.Servers.HttpServer else if (DoWeHaveAHTTPHandler(request.RawUrl)) { if (DebugLevel >= 3) - LogIncomingToContentTypeHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", + request.ContentType, request.HttpMethod, request.Url.PathAndQuery); buffer = HandleHTTPRequest(request, response); } else { if (DebugLevel >= 3) - LogIncomingToXmlRpcHandler(request); + m_log.DebugFormat( + "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", + request.HttpMethod, request.Url.PathAndQuery); // generic login request. buffer = HandleXmlRpcRequests(request, response); @@ -631,11 +629,11 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (IOException e) { - m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); + m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); } catch (Exception e) { - m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); + m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); SendHTML500(response); } finally @@ -646,93 +644,17 @@ namespace OpenSim.Framework.Servers.HttpServer if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) { m_log.InfoFormat( - "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", - RequestNumber, + "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", requestMethod, uriString, requestHandler != null ? requestHandler.Name : "", requestHandler != null ? requestHandler.Description : "", - request.RemoteIPEndPoint, - tickdiff); - } - else if (DebugLevel >= 4) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms", - RequestNumber, - Port, + request.RemoteIPEndPoint.ToString(), tickdiff); } } } - private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}", - RequestNumber, - Port, - request.HttpMethod, - request.Url.PathAndQuery, - requestHandler.Name, - requestHandler.Description, - request.RemoteIPEndPoint); - - if (DebugLevel >= 5) - LogIncomingInDetail(request); - } - - private void LogIncomingToContentTypeHandler(OSHttpRequest request) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", - RequestNumber, - Port, - (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType, - request.HttpMethod, - request.Url.PathAndQuery, - request.RemoteIPEndPoint); - - if (DebugLevel >= 5) - LogIncomingInDetail(request); - } - - private void LogIncomingToXmlRpcHandler(OSHttpRequest request) - { - m_log.DebugFormat( - "[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}", - RequestNumber, - Port, - request.HttpMethod, - request.Url.PathAndQuery, - request.RemoteIPEndPoint); - - if (DebugLevel >= 5) - LogIncomingInDetail(request); - } - - private void LogIncomingInDetail(OSHttpRequest request) - { - using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8)) - { - string output; - - if (DebugLevel == 5) - { - const int sampleLength = 80; - char[] sampleChars = new char[sampleLength]; - reader.Read(sampleChars, 0, sampleLength); - output = new string(sampleChars); - } - else - { - output = reader.ReadToEnd(); - } - - m_log.DebugFormat("[BASE HTTP SERVER]: {0}...", output.Replace("\n", @"\n")); - } - } - private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler) { string bestMatch = null; @@ -825,24 +747,24 @@ namespace OpenSim.Framework.Servers.HttpServer } } -// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) -// { -// agentHandler = null; -// -// lock (m_agentHandlers) -// { -// foreach (IHttpAgentHandler handler in m_agentHandlers.Values) -// { -// if (handler.Match(request, response)) -// { -// agentHandler = handler; -// return true; -// } -// } -// } -// -// return false; -// } + private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) + { + agentHandler = null; + + lock (m_agentHandlers) + { + foreach (IHttpAgentHandler handler in m_agentHandlers.Values) + { + if (handler.Match(request, response)) + { + agentHandler = handler; + return true; + } + } + } + + return false; + } /// /// Try all the registered xmlrpc handlers when an xmlrpc request is received. @@ -1815,21 +1737,21 @@ namespace OpenSim.Framework.Servers.HttpServer m_pollHandlers.Remove(path); } -// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) -// { -// lock (m_agentHandlers) -// { -// IHttpAgentHandler foundHandler; -// -// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) -// { -// m_agentHandlers.Remove(agent); -// return true; -// } -// } -// -// return false; -// } + public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) + { + lock (m_agentHandlers) + { + IHttpAgentHandler foundHandler; + + if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) + { + m_agentHandlers.Remove(agent); + return true; + } + } + + return false; + } public void RemoveXmlRPCHandler(string method) { diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs index 0bd3aae..db58f6f 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs @@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer uint Port { get; } bool UseSSL { get; } -// // Note that the agent string is provided simply to differentiate -// // the handlers - it is NOT required to be an actual agent header -// // value. -// bool AddAgentHandler(string agent, IHttpAgentHandler handler); + // Note that the agent string is provided simply to differentiate + // the handlers - it is NOT required to be an actual agent header + // value. + bool AddAgentHandler(string agent, IHttpAgentHandler handler); /// /// Add a handler for an HTTP request. @@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); -// /// -// /// Remove the agent if it is registered. -// /// -// /// -// /// -// /// -// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); + /// + /// Remove the agent if it is registered. + /// + /// + /// + /// + bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); /// /// Remove an HTTP handler diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index ae7d515..8dc0e3a 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Net; -using System.Text; using log4net; using OpenSim.Framework; using OpenSim.Framework.Console; @@ -48,12 +47,9 @@ namespace OpenSim.Framework.Servers /// Control the printing of certain debug messages. /// /// - /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data. - /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data. - /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged. - /// If DebugLevel >= 4 then the time taken to fulfill the request is logged. - /// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged. - /// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged. + /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data. + /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data. + /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged. /// public static int DebugLevel { @@ -105,28 +101,17 @@ namespace OpenSim.Framework.Servers get { return new Dictionary(m_Servers); } } + public static void RegisterHttpConsoleCommands(ICommandConsole console) { console.Commands.AddCommand( - "Comms", false, "show http-handlers", - "show http-handlers", - "Show all registered http handlers", HandleShowHttpHandlersCommand); - - console.Commands.AddCommand( - "Debug", false, "debug http", "debug http []", - "Turn on http request logging.", - "If in or all and\n" - + " level <= 0 then no extra logging is done.\n" - + " level >= 1 then short warnings are logged when receiving bad input data.\n" - + " level >= 2 then long warnings are logged when receiving bad input data.\n" - + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n" - + " level >= 4 then the time taken to fulfill the request is logged.\n" - + " level >= 5 then a sample from the beginning of the incoming data is logged.\n" - + " level >= 6 then the entire incoming data is logged.\n" - + " no level is specified then the current level is returned.\n\n" - + "If out or all and\n" - + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n" - + " level >= 4 then the time taken to fulfill the request is logged.\n", + "Debug", false, "debug http", "debug http []", + "Turn on inbound non-poll http request debugging.", + "If level <= 0, then no extra logging is done.\n" + + "If level >= 1, then short warnings are logged when receiving bad input data.\n" + + "If level >= 2, then long warnings are logged when receiving bad input data.\n" + + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" + + "If no level is specified then the current level is returned.", HandleDebugHttpCommand); } @@ -134,120 +119,25 @@ namespace OpenSim.Framework.Servers /// Turn on some debugging values for OpenSim. /// /// - private static void HandleDebugHttpCommand(string module, string[] cmdparams) + private static void HandleDebugHttpCommand(string module, string[] args) { - if (cmdparams.Length < 3) - { - MainConsole.Instance.Output("Usage: debug http 0..6"); - return; - } - - bool inReqs = false; - bool outReqs = false; - bool allReqs = false; - - string subCommand = cmdparams[2]; - - if (subCommand.ToLower() == "in") - { - inReqs = true; - } - else if (subCommand.ToLower() == "out") - { - outReqs = true; - } - else if (subCommand.ToLower() == "all") - { - allReqs = true; - } - else + if (args.Length == 3) { - MainConsole.Instance.Output("You must specify in, out or all"); - return; - } - - if (cmdparams.Length >= 4) - { - string rawNewDebug = cmdparams[3]; int newDebug; - - if (!int.TryParse(rawNewDebug, out newDebug)) - { - MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug); - return; - } - - if (newDebug < 0 || newDebug > 6) - { - MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..6", newDebug); - return; - } - - if (allReqs || inReqs) + if (int.TryParse(args[2], out newDebug)) { MainServer.DebugLevel = newDebug; - MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug); - } - - if (allReqs || outReqs) - { - WebUtil.DebugLevel = newDebug; - MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug); + MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug); } } - else + else if (args.Length == 2) { - if (allReqs || inReqs) - MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel); - - if (allReqs || outReqs) - MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel); + MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel); } - } - - private static void HandleShowHttpHandlersCommand(string module, string[] args) - { - if (args.Length != 2) - { - MainConsole.Instance.Output("Usage: show http-handlers"); - return; - } - - StringBuilder handlers = new StringBuilder(); - - lock (m_Servers) + else { - foreach (BaseHttpServer httpServer in m_Servers.Values) - { - handlers.AppendFormat( - "Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port); - - handlers.AppendFormat("* XMLRPC:\n"); - foreach (String s in httpServer.GetXmlRpcHandlerKeys()) - handlers.AppendFormat("\t{0}\n", s); - - handlers.AppendFormat("* HTTP:\n"); - List poll = httpServer.GetPollServiceHandlerKeys(); - foreach (String s in httpServer.GetHTTPHandlerKeys()) - handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); - -// handlers.AppendFormat("* Agent:\n"); -// foreach (String s in httpServer.GetAgentHandlerKeys()) -// handlers.AppendFormat("\t{0}\n", s); - - handlers.AppendFormat("* LLSD:\n"); - foreach (String s in httpServer.GetLLSDHandlerKeys()) - handlers.AppendFormat("\t{0}\n", s); - - handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count); - foreach (String s in httpServer.GetStreamHandlerKeys()) - handlers.AppendFormat("\t{0}\n", s); - - handlers.Append("\n"); - } + MainConsole.Instance.Output("Usage: debug http 0..3"); } - - MainConsole.Instance.Output(handlers.ToString()); } /// diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index bb094ed..016a174 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.7.5CM"; + private const string VERSION_NUMBER = "0.7.4CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 62ecbd1..4d07746 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -39,12 +39,10 @@ using OpenMetaverse; namespace OpenSim.Framework { /// - /// A dictionary containing task inventory items. Indexed by item UUID. + /// A dictionary for task inventory. /// - /// /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before /// iterating over it. - /// public class TaskInventoryDictionary : Dictionary, ICloneable, IXmlSerializable { diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 574ee56..fb818ee 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -73,6 +73,9 @@ namespace OpenSim.Framework private bool _ownerChanged = false; + // This used ONLY during copy. It can't be relied on at other times! + private bool _scriptRunning = true; + public UUID AssetID { get { return _assetID; @@ -350,13 +353,14 @@ namespace OpenSim.Framework } } - /// - /// This used ONLY during copy. It can't be relied on at other times! - /// - /// - /// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now. - /// - public bool ScriptRunning { get; set; } + public bool ScriptRunning { + get { + return _scriptRunning; + } + set { + _scriptRunning = value; + } + } // See ICloneable @@ -384,7 +388,6 @@ namespace OpenSim.Framework public TaskInventoryItem() { - ScriptRunning = true; CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; } } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e76a37b..384f716 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -546,19 +546,6 @@ namespace OpenSim.Framework } /// - /// Determines whether a point is inside a bounding box. - /// - /// - /// - /// - /// - public static bool IsInsideBox(Vector3 v, Vector3 min, Vector3 max) - { - return v.X >= min.X & v.Y >= min.Y && v.Z >= min.Z - && v.X <= max.X && v.Y <= max.Y && v.Z <= max.Z; - } - - /// /// Are the co-ordinates of the new region visible from the old region? /// /// Old region x-coord @@ -875,12 +862,6 @@ namespace OpenSim.Framework return Math.Min(Math.Max(x, min), max); } - public static Vector3 Clip(Vector3 vec, float min, float max) - { - return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max), - Clip(vec.Z, min, max)); - } - /// /// Convert an UUID to a raw uuid string. Right now this is a string without hyphens. /// @@ -1032,38 +1013,6 @@ namespace OpenSim.Framework } } - /// - /// Copy data from one stream to another, leaving the read position of both streams at the beginning. - /// - /// - /// Input stream. Must be seekable. - /// - /// - /// Thrown if the input stream is not seekable. - /// - public static Stream Copy(Stream inputStream) - { - if (!inputStream.CanSeek) - throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek"); - - const int readSize = 256; - byte[] buffer = new byte[readSize]; - MemoryStream ms = new MemoryStream(); - - int count = inputStream.Read(buffer, 0, readSize); - - while (count > 0) - { - ms.Write(buffer, 0, count); - count = inputStream.Read(buffer, 0, readSize); - } - - ms.Position = 0; - inputStream.Position = 0; - - return ms; - } - public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) { return SendXmlRpcCommand(url, methodName, args); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index b85d93d..30a8c28 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -54,17 +54,9 @@ namespace OpenSim.Framework MethodBase.GetCurrentMethod().DeclaringType); /// - /// Control the printing of certain debug messages. - /// - /// - /// If DebugLevel >= 3 then short notices about outgoing HTTP requests are logged. - /// - public static int DebugLevel { get; set; } - - /// /// Request number for diagnostic purposes. /// - public static int RequestNumber { get; internal set; } + public static int RequestNumber = 0; /// /// this is the header field used to communicate the local request id @@ -154,11 +146,7 @@ namespace OpenSim.Framework private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) { int reqnum = RequestNumber++; - - if (DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})", - reqnum, method, url, timeout, compressed); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); @@ -242,7 +230,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, method, url, @@ -251,14 +239,10 @@ namespace OpenSim.Framework strBuffer != null ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) : ""); - else if (DebugLevel >= 4) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); } m_log.DebugFormat( - "[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage); + "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); return ErrorResponseMap(errorMessage); } @@ -334,11 +318,7 @@ namespace OpenSim.Framework { int reqnum = RequestNumber++; string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; - - if (DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})", - reqnum, method, url, timeout); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); @@ -401,7 +381,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, method, url, @@ -410,13 +390,9 @@ namespace OpenSim.Framework queryString != null ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString : ""); - else if (DebugLevel >= 4) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); } - m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage); + m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); return ErrorResponseMap(errorMessage); } @@ -668,6 +644,7 @@ namespace OpenSim.Framework /// public static string[] GetPreferredImageTypes(string accept) { + if (accept == null || accept == string.Empty) return new string[0]; @@ -726,16 +703,14 @@ namespace OpenSim.Framework int maxConnections) { int reqnum = WebUtil.RequestNumber++; - - if (WebUtil.DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}", - reqnum, verb, requestUrl); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); int tickstart = Util.EnvironmentTickCount(); // int tickdata = 0; int tickdiff = 0; +// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); + Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); @@ -893,7 +868,7 @@ namespace OpenSim.Framework } m_log.InfoFormat( - "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, @@ -908,12 +883,6 @@ namespace OpenSim.Framework requestUrl, tickdiff); } - else if (WebUtil.DebugLevel >= 4) - { - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms", - reqnum, tickdiff); - } } } @@ -934,11 +903,7 @@ namespace OpenSim.Framework public static string MakeRequest(string verb, string requestUrl, string obj) { int reqnum = WebUtil.RequestNumber++; - - if (WebUtil.DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}", - reqnum, verb, requestUrl); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; @@ -1025,7 +990,7 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > WebUtil.LongCallTime) m_log.InfoFormat( - "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}", reqnum, verb, requestUrl, @@ -1033,10 +998,6 @@ namespace OpenSim.Framework tickset, tickdata, obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); - else if (WebUtil.DebugLevel >= 4) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); return respstring; } @@ -1071,11 +1032,7 @@ namespace OpenSim.Framework public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) { int reqnum = WebUtil.RequestNumber++; - - if (WebUtil.DebugLevel >= 3) - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}", - reqnum, verb, requestUrl); + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; @@ -1194,7 +1151,7 @@ namespace OpenSim.Framework } m_log.InfoFormat( - "[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, @@ -1202,12 +1159,6 @@ namespace OpenSim.Framework tickdata, originalRequest); } - else if (WebUtil.DebugLevel >= 4) - { - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); - } return deserial; } -- cgit v1.1 From 5e0294815f7e3ec83b7e568e1468948ac0ff7331 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 17 Nov 2012 03:47:09 -0500 Subject: * Plumbing and basic setting of the GetMesh Cap Throttler. * Last step is to flip the throttle distribution. --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index e31c7f6..6559638 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1135,6 +1135,8 @@ namespace OpenSim.Framework void SetChildAgentThrottle(byte[] throttle); + void SetAgentThrottleSilent(int throttle, int setting); + void SendAvatarDataImmediate(ISceneEntity avatar); /// -- cgit v1.1 From 2e7b72d3dad42288237f85d02a9769ce31109309 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 23 Nov 2012 02:04:24 +0000 Subject: Revert help to display a full command list. Leave the help categories in as "help categories" in case it turns out useful in the future. May not work. --- OpenSim/Framework/Console/CommandConsole.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index de30414..f160404 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -83,7 +83,7 @@ namespace OpenSim.Framework.Console = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n"; public const string ItemHelpText -= @"For more information, type 'help all' to get a list of all commands, += @"For more information, type 'help' to get a list of all commands, or type help ' where is one of the following:"; /// @@ -113,15 +113,16 @@ namespace OpenSim.Framework.Console // General help if (helpParts.Count == 0) { + help.Add(GeneralHelpText); + help.AddRange(CollectAllCommandsHelp()); + } + else if (helpParts.Count == 1 && helpParts[0] == "categories") + { help.Add(""); // Will become a newline. help.Add(GeneralHelpText); help.Add(ItemHelpText); help.AddRange(CollectModulesHelp(tree)); } - else if (helpParts.Count == 1 && helpParts[0] == "all") - { - help.AddRange(CollectAllCommandsHelp()); - } else { help.AddRange(CollectHelp(helpParts)); -- cgit v1.1 From c96729b55dbb9d0025700c84b03aae35b9f42780 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 23 Nov 2012 02:06:05 +0000 Subject: Add a newline before the constant help text --- OpenSim/Framework/Console/CommandConsole.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index f160404..106b406 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -113,6 +113,7 @@ namespace OpenSim.Framework.Console // General help if (helpParts.Count == 0) { + help.Add(""); // Will become a newline. help.Add(GeneralHelpText); help.AddRange(CollectAllCommandsHelp()); } -- cgit v1.1 From 658109700125f74b72dc1d1990e5713f06ee538e Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 23 Nov 2012 03:20:15 +0100 Subject: Fix new command console code to match the output of the original while keeping the new features --- OpenSim/Framework/Console/CommandConsole.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 106b406..d703d78 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -144,8 +144,11 @@ namespace OpenSim.Framework.Console { foreach (List commands in m_modulesCommands.Values) { - var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help)); - help.AddRange(ourHelpText); + foreach (CommandInfo c in commands) + { + if (c.long_help != String.Empty) + help.Add(string.Format("{0} - {1}", c.help_text, c.long_help)); + } } } -- cgit v1.1 From d3904ff48464fcde5266aac08b5c95227acbbcb1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Dec 2012 19:34:22 +0100 Subject: Add a transaction ID to the money module path for llTransferLindenDollars --- OpenSim/Framework/IMoneyModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 71de93a..7378d2e 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -33,7 +33,7 @@ namespace OpenSim.Framework public interface IMoneyModule { bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, - int amount); + int amount, UUID txn); int GetBalance(UUID agentID); bool UploadCovered(UUID agentID, int amount); -- cgit v1.1 From 135e0ea853203cbad5790ac9f0b21d67f8828af8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 13:47:58 +0000 Subject: *TEST* add some avatar skeleton information and use it to calculate avatar height and bounding box. Change LSL acording. --- OpenSim/Framework/AvatarAppearance.cs | 30 ++++ OpenSim/Framework/AvatarSkeleton.cs | 281 ++++++++++++++++++++++++++++++++++ 2 files changed, 311 insertions(+) create mode 100644 OpenSim/Framework/AvatarSkeleton.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 1638541..ad783c8 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -55,6 +55,13 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; protected Dictionary> m_attachments; protected float m_avatarHeight = 0; + protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); + protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); + protected float m_avatarFeetOffset = 0; + protected float m_avatarAnimOffset = 0; + + + private AvatarSkeleton skeleton = new AvatarSkeleton(); public virtual int Serial { @@ -68,6 +75,21 @@ namespace OpenSim.Framework set { m_visualparams = value; } } + public virtual Vector3 AvatarSize + { + get { return m_avatarSize; } + } + + public virtual Vector3 AvatarBoxSize + { + get { return m_avatarBoxSize; } + } + + public virtual float AvatarFeetOffset + { + get { return m_avatarFeetOffset + m_avatarAnimOffset; } + } + public virtual Primitive.TextureEntry Texture { get { return m_texture; } @@ -363,6 +385,7 @@ namespace OpenSim.Framework /// public virtual void SetHeight() { +/* // Start with shortest possible female avatar height m_avatarHeight = 1.14597f; // Add offset for male avatars @@ -375,6 +398,13 @@ namespace OpenSim.Framework + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; +*/ + + skeleton.ApplyVisualParameters(m_visualparams); + m_avatarSize = skeleton.StandSize; + m_avatarBoxSize = skeleton.StandBoxSize; + m_avatarFeetOffset = skeleton.FeetOffset; + m_avatarHeight = m_avatarSize.Z; } public virtual void SetWearable(int wearableId, AvatarWearable wearable) diff --git a/OpenSim/Framework/AvatarSkeleton.cs b/OpenSim/Framework/AvatarSkeleton.cs new file mode 100644 index 0000000..269099b --- /dev/null +++ b/OpenSim/Framework/AvatarSkeleton.cs @@ -0,0 +1,281 @@ +/* + * 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. + */ +// Ubit 2012 +using System; +using System.Collections; +using System.Collections.Generic; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using log4net; +using VPElement = OpenSim.Framework.AvatarAppearance.VPElement; + + + +namespace OpenSim.Framework +{ + /// + /// Contains the Avatar's Skeleton + /// + public class AvatarSkeleton + { + const int NBONES = 26; + const float BOXAJUST = 0.2f; + + public enum Bones : int + { + EyeLeft, + Eyeright, + Skull, + Head, + Neck, + CollarRight, + CollarLeft, + Shoulderright, + ShoulderLeft, + ElbowRight, + ElbowLeft, + WristRight, + WristLeft, + Chest, + Torso, + Pelvis, + Hipright, + HipLeft, + KneeRight, + KneeLeft, + AnkleRight, + AnkleLeft, + FootRight, + FootLeft, + ToeRight, + ToeLeft + } + + public struct bone + { + public Vector3 Offset; + public Vector3 Scale; + public bone(float x, float y, float z) + { + Offset = new Vector3(x, y, z); + Scale = new Vector3(1f, 1f, 1f); + } + + public void addScale(float x, float y, float z, float factor) + { + Scale.X += x * factor; + Scale.Y += y * factor; + Scale.Y += z * factor; + } + + public void addOffset(float x, float y, float z, float factor) + { + Offset.X += x * factor; + Offset.Y += y * factor; + Offset.Y += z * factor; + } + } + + private bone[] DefaultBones = new bone[] + { + new bone(0.098f, 0.036f, 0.079f), // EyeLeft + new bone(0.098f, -0.036f, 0.079f), // Eyeright + new bone(0.0f, 0.0f, 0.079f), // Skull + new bone(0.0f, 0.0f, 0.076f), // Head + new bone(-0.1f, 0.0f, 0.251f), // Neck + new bone(-0.021f, -0.085f, 0.165f), // CollarRight + new bone(-0.021f, 0.085f, 0.165f), // CollarLeft + new bone(0.0f, -0.79f, 0.0f), // Shoulderright + new bone(0.0f, 0.79f, 0.0f), // ShoulderLeft + new bone(0.0f, -0.248f, 0.0f), // ElbowRight + new bone(0.0f, 0.248f, 0.0f), // ElbowLeft + new bone(0.0f, -0.205f, 0.0f), // WristRight + new bone(0.0f, 0.205f, 0.0f), // WristLeft + new bone(-0.015f, 0.000f, 0.205f), // Chest + new bone(0.0f, 0.0f, 0.084f), // Torso + new bone(0.0f, 0.0f, 1.067f), // Pelvis + new bone(0.034f, -0.129f, -0.041f), // Hipright + new bone(0.034f, 0.127f, -0.041f), // HipLeft + new bone(-0.001f, 0.049f, -0.491f), // KneeRight + new bone(-0.001f, -0.046f, -0.491f), // KneeLeft + new bone(-0.029f, 0.0f, -0.468f), // AnkleRight + new bone(-0.029f, 0.001f, -0.468f), // AnkleLeft + new bone(0.112f, 0.0f, -0.061f), // FootRight + new bone(0.112f, 0.0f, -0.061f), // FootLeft + new bone(0.109f, 0.0f, 0.0f), // ToeRight + new bone(0.109f, 0.0f, 0.0f) // ToeLeft + }; + + private bone[] m_bones = null; + private byte[] m_visualParams = null; + + const float bytescale = 1.0f / 255.0f; + + private float convertVP(AvatarAppearance.VPElement vp) + { + return (float)m_visualParams[(int)vp] * bytescale; + } + + private Vector3 m_standSize; + private float m_feetOffset = 0f; + + public Vector3 StandSize + { + get + { + if (m_bones == null || m_visualParams == null) + return new Vector3(0.45f, 0.6f, 1.9f); + else + return m_standSize; + } + } + + public Vector3 StandBoxSize + { + get + { + if (m_bones == null || m_visualParams == null) + return new Vector3(0.45f, 0.6f, 1.9f + BOXAJUST); + else + { + Vector3 r = m_standSize; + r.Z += BOXAJUST; + return r; + } + } + } + + public float FeetOffset + { + get + { + if (m_bones == null || m_visualParams == null) + return 0.0f; + else + { + return m_feetOffset; + } + } + } + + /// + /// Set avatar height by a calculation based on their visual parameters. + /// + + public void ApplyVisualParameters(byte[] vPs) + { + m_visualParams = vPs; + + if (m_bones == null) + { + m_bones = new bone[NBONES]; + for (int i = 0; i < NBONES; i++) + m_bones[i] = DefaultBones[i]; + } + + float bone_skull = m_bones[(int)Bones.Skull].Offset.Z; + float bone_head = m_bones[(int)Bones.Head].Offset.Z; + float bone_neck = m_bones[(int)Bones.Neck].Offset.Z; + float bone_chest = m_bones[(int)Bones.Chest].Offset.Z; + float bone_torso = m_bones[(int)Bones.Torso].Offset.Z; + float bone_hip = m_bones[(int)Bones.Hipright].Offset.Z; + float bone_knee = m_bones[(int)Bones.KneeRight].Offset.Z; + float bone_ank = m_bones[(int)Bones.AnkleRight].Offset.Z; + float bone_foot = m_bones[(int)Bones.FootRight].Offset.Z; + + float sbone_skull = m_bones[(int)Bones.Skull].Scale.Z; + float sbone_head = m_bones[(int)Bones.Head].Scale.Z; + float sbone_neck = m_bones[(int)Bones.Neck].Scale.Z; + float sbone_chest = m_bones[(int)Bones.Chest].Scale.Z; + float sbone_torso = m_bones[(int)Bones.Torso].Scale.Z; + float sbone_pelvis = m_bones[(int)Bones.Pelvis].Scale.Z; + float sbone_hip = m_bones[(int)Bones.Hipright].Scale.Z; + float sbone_knee = m_bones[(int)Bones.KneeRight].Scale.Z; + float sbone_ank = m_bones[(int)Bones.AnkleRight].Scale.Z; + float sbone_foot = m_bones[(int)Bones.FootRight].Scale.Z; + + float v_male = (m_visualParams[(int)VPElement.SHAPE_MALE] == 0) ? 0.0f : 1.0f; + sbone_neck += v_male * 0.2f; + sbone_chest += v_male * 0.05f; + sbone_torso += v_male * 0.05f; + sbone_knee += v_male * 0.1f; + + float v_height = convertVP(VPElement.SHAPE_HEIGHT) * 4.3f - 2.3f; + sbone_neck += v_height * 0.02f; + sbone_chest += v_height * 0.05f; + sbone_torso += v_height * 0.05f; + sbone_hip += v_height * 0.1f; + sbone_knee += v_height * 0.1f; + + float v_hip_len = convertVP(VPElement.SHAPE_HIP_LENGTH) * 2f - 1f; + sbone_pelvis += v_hip_len * 0.3f; + + float v_torso_len = convertVP(VPElement.SHAPE_TORSO_LENGTH) * 2f - 1f; + sbone_torso += v_torso_len * 0.3f; + sbone_pelvis += v_torso_len * 0.1f; + sbone_hip += v_torso_len * -0.1f; + sbone_knee += v_torso_len * -0.05f; + + float v_head_size = convertVP(VPElement.SHAPE_HEAD_SIZE) * 0.35f - 0.25f; + bone_skull += v_head_size * 0.1f; + sbone_skull += v_head_size; + sbone_head += v_head_size; + + float v_shoes_heel = convertVP(VPElement.SHOES_HEEL_HEIGHT); + bone_foot += v_shoes_heel * -0.08f; + + float v_shoes_plat = convertVP(VPElement.SHOES_PLATFORM_HEIGHT); + bone_foot += v_shoes_plat * -0.07f; + + float v_leg_lenght = convertVP(VPElement.SHAPE_LEG_LENGTH) * 2f - 1f; + sbone_hip += v_leg_lenght * 0.2f; + sbone_knee += v_leg_lenght * 0.2f; + + float v_neck_len = convertVP(VPElement.SHAPE_NECK_LENGTH) * 2f - 1f; + sbone_neck += v_neck_len * 0.5f; + + float hipmess = bone_hip * sbone_pelvis; + + float pelvisToFoot = hipmess - + bone_knee * sbone_hip - + bone_ank * sbone_knee - + bone_foot * sbone_ank; + + + float size = 1.4142f * bone_skull * sbone_head + + bone_head * sbone_neck + + bone_neck * sbone_chest + + bone_chest * sbone_torso + + bone_torso * sbone_pelvis; + + size += pelvisToFoot; + + m_standSize = new Vector3(0.45f, 0.6f, size); + m_feetOffset = 0.5f * size - pelvisToFoot; + } + } +} -- cgit v1.1 From d2499c4c314b290c42f454913305d97c6eec92d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 15:54:46 +0000 Subject: *TEST* Use new avatar size in ubitODE. --- OpenSim/Framework/AvatarSkeleton.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarSkeleton.cs b/OpenSim/Framework/AvatarSkeleton.cs index 269099b..7a49f22 100644 --- a/OpenSim/Framework/AvatarSkeleton.cs +++ b/OpenSim/Framework/AvatarSkeleton.cs @@ -275,7 +275,8 @@ namespace OpenSim.Framework size += pelvisToFoot; m_standSize = new Vector3(0.45f, 0.6f, size); - m_feetOffset = 0.5f * size - pelvisToFoot; + // m_feetOffset = 0.5f * size - pelvisToFoot; + m_feetOffset = 0.0f; } } } -- cgit v1.1 From b2f3516b68d6333d70e8758e93d37197863f9a05 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 17:28:07 +0000 Subject: calculate avatar size on tps --- OpenSim/Framework/AvatarAppearance.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ad783c8..9e912de 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -678,8 +678,8 @@ namespace OpenSim.Framework { if ((data != null) && (data["serial"] != null)) m_serial = data["serial"].AsInteger(); - if ((data != null) && (data["height"] != null)) - m_avatarHeight = (float)data["height"].AsReal(); +// if ((data != null) && (data["height"] != null)) +// m_avatarHeight = (float)data["height"].AsReal(); try { @@ -741,6 +741,7 @@ namespace OpenSim.Framework // att.ItemID, att.AssetID, att.AttachPoint); } } + SetHeight(); } catch (Exception e) { -- cgit v1.1 From 93bede4e6aa0838e14f39f5e641b028267d2683c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:26:58 +0000 Subject: revert the use of avatar skeleton and use avatar size provided by viewers, since at least for now seems good enought --- OpenSim/Framework/AvatarAppearance.cs | 47 ++++-- OpenSim/Framework/AvatarSkeleton.cs | 282 ---------------------------------- OpenSim/Framework/IClientAPI.cs | 2 +- 3 files changed, 31 insertions(+), 300 deletions(-) delete mode 100644 OpenSim/Framework/AvatarSkeleton.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 9e912de..b01b8da 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -40,6 +40,11 @@ namespace OpenSim.Framework /// public class AvatarAppearance { + const float AVBOXAJUST = 0.2f; + const float AVBOXMINX = 0.2f; + const float AVBOXMINY = 0.3f; + const float AVBOXMINZ = 0.5f; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // this is viewer capabilities and weared things dependent @@ -60,9 +65,6 @@ namespace OpenSim.Framework protected float m_avatarFeetOffset = 0; protected float m_avatarAnimOffset = 0; - - private AvatarSkeleton skeleton = new AvatarSkeleton(); - public virtual int Serial { get { return m_serial; } @@ -120,7 +122,8 @@ namespace OpenSim.Framework SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); - SetHeight(); +// SetHeight(); + SetSize(new Vector3(0.45f,0.6f,1.9f)); m_attachments = new Dictionary>(); } @@ -129,7 +132,7 @@ namespace OpenSim.Framework // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); Unpack(map); - SetHeight(); +// SetHeight(); done in Unpack } public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) @@ -153,7 +156,7 @@ namespace OpenSim.Framework else SetDefaultParams(); - SetHeight(); +// SetHeight(); m_attachments = new Dictionary>(); } @@ -172,7 +175,8 @@ namespace OpenSim.Framework SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); - SetHeight(); +// SetHeight(); + SetSize(new Vector3(0.45f, 0.6f, 1.9f)); m_attachments = new Dictionary>(); return; @@ -201,7 +205,8 @@ namespace OpenSim.Framework if (appearance.VisualParams != null) m_visualparams = (byte[])appearance.VisualParams.Clone(); - m_avatarHeight = appearance.m_avatarHeight; +// m_avatarHeight = appearance.m_avatarHeight; + SetSize(appearance.AvatarSize); // Copy the attachment, force append mode since that ensures consistency m_attachments = new Dictionary>(); @@ -368,8 +373,8 @@ namespace OpenSim.Framework } } // Reset the height if the visual parameters actually changed - if (changed) - SetHeight(); +// if (changed) +// SetHeight(); return changed; } @@ -399,11 +404,19 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; */ - - skeleton.ApplyVisualParameters(m_visualparams); - m_avatarSize = skeleton.StandSize; - m_avatarBoxSize = skeleton.StandBoxSize; - m_avatarFeetOffset = skeleton.FeetOffset; + } + + public void SetSize(Vector3 avSize) + { + m_avatarSize = avSize; + m_avatarBoxSize = avSize; + m_avatarBoxSize.Z += AVBOXAJUST; + if (m_avatarBoxSize.X < AVBOXMINX) + m_avatarBoxSize.X = AVBOXMINX; + if (m_avatarBoxSize.Y < AVBOXMINY) + m_avatarBoxSize.Y = AVBOXMINY; + if (m_avatarBoxSize.Z < AVBOXMINZ) + m_avatarBoxSize.Z = AVBOXMINZ; m_avatarHeight = m_avatarSize.Z; } @@ -678,8 +691,9 @@ namespace OpenSim.Framework { if ((data != null) && (data["serial"] != null)) m_serial = data["serial"].AsInteger(); -// if ((data != null) && (data["height"] != null)) + if ((data != null) && (data["height"] != null)) // m_avatarHeight = (float)data["height"].AsReal(); + SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal())); try { @@ -741,7 +755,6 @@ namespace OpenSim.Framework // att.ItemID, att.AssetID, att.AttachPoint); } } - SetHeight(); } catch (Exception e) { diff --git a/OpenSim/Framework/AvatarSkeleton.cs b/OpenSim/Framework/AvatarSkeleton.cs deleted file mode 100644 index 7a49f22..0000000 --- a/OpenSim/Framework/AvatarSkeleton.cs +++ /dev/null @@ -1,282 +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. - */ -// Ubit 2012 -using System; -using System.Collections; -using System.Collections.Generic; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using log4net; -using VPElement = OpenSim.Framework.AvatarAppearance.VPElement; - - - -namespace OpenSim.Framework -{ - /// - /// Contains the Avatar's Skeleton - /// - public class AvatarSkeleton - { - const int NBONES = 26; - const float BOXAJUST = 0.2f; - - public enum Bones : int - { - EyeLeft, - Eyeright, - Skull, - Head, - Neck, - CollarRight, - CollarLeft, - Shoulderright, - ShoulderLeft, - ElbowRight, - ElbowLeft, - WristRight, - WristLeft, - Chest, - Torso, - Pelvis, - Hipright, - HipLeft, - KneeRight, - KneeLeft, - AnkleRight, - AnkleLeft, - FootRight, - FootLeft, - ToeRight, - ToeLeft - } - - public struct bone - { - public Vector3 Offset; - public Vector3 Scale; - public bone(float x, float y, float z) - { - Offset = new Vector3(x, y, z); - Scale = new Vector3(1f, 1f, 1f); - } - - public void addScale(float x, float y, float z, float factor) - { - Scale.X += x * factor; - Scale.Y += y * factor; - Scale.Y += z * factor; - } - - public void addOffset(float x, float y, float z, float factor) - { - Offset.X += x * factor; - Offset.Y += y * factor; - Offset.Y += z * factor; - } - } - - private bone[] DefaultBones = new bone[] - { - new bone(0.098f, 0.036f, 0.079f), // EyeLeft - new bone(0.098f, -0.036f, 0.079f), // Eyeright - new bone(0.0f, 0.0f, 0.079f), // Skull - new bone(0.0f, 0.0f, 0.076f), // Head - new bone(-0.1f, 0.0f, 0.251f), // Neck - new bone(-0.021f, -0.085f, 0.165f), // CollarRight - new bone(-0.021f, 0.085f, 0.165f), // CollarLeft - new bone(0.0f, -0.79f, 0.0f), // Shoulderright - new bone(0.0f, 0.79f, 0.0f), // ShoulderLeft - new bone(0.0f, -0.248f, 0.0f), // ElbowRight - new bone(0.0f, 0.248f, 0.0f), // ElbowLeft - new bone(0.0f, -0.205f, 0.0f), // WristRight - new bone(0.0f, 0.205f, 0.0f), // WristLeft - new bone(-0.015f, 0.000f, 0.205f), // Chest - new bone(0.0f, 0.0f, 0.084f), // Torso - new bone(0.0f, 0.0f, 1.067f), // Pelvis - new bone(0.034f, -0.129f, -0.041f), // Hipright - new bone(0.034f, 0.127f, -0.041f), // HipLeft - new bone(-0.001f, 0.049f, -0.491f), // KneeRight - new bone(-0.001f, -0.046f, -0.491f), // KneeLeft - new bone(-0.029f, 0.0f, -0.468f), // AnkleRight - new bone(-0.029f, 0.001f, -0.468f), // AnkleLeft - new bone(0.112f, 0.0f, -0.061f), // FootRight - new bone(0.112f, 0.0f, -0.061f), // FootLeft - new bone(0.109f, 0.0f, 0.0f), // ToeRight - new bone(0.109f, 0.0f, 0.0f) // ToeLeft - }; - - private bone[] m_bones = null; - private byte[] m_visualParams = null; - - const float bytescale = 1.0f / 255.0f; - - private float convertVP(AvatarAppearance.VPElement vp) - { - return (float)m_visualParams[(int)vp] * bytescale; - } - - private Vector3 m_standSize; - private float m_feetOffset = 0f; - - public Vector3 StandSize - { - get - { - if (m_bones == null || m_visualParams == null) - return new Vector3(0.45f, 0.6f, 1.9f); - else - return m_standSize; - } - } - - public Vector3 StandBoxSize - { - get - { - if (m_bones == null || m_visualParams == null) - return new Vector3(0.45f, 0.6f, 1.9f + BOXAJUST); - else - { - Vector3 r = m_standSize; - r.Z += BOXAJUST; - return r; - } - } - } - - public float FeetOffset - { - get - { - if (m_bones == null || m_visualParams == null) - return 0.0f; - else - { - return m_feetOffset; - } - } - } - - /// - /// Set avatar height by a calculation based on their visual parameters. - /// - - public void ApplyVisualParameters(byte[] vPs) - { - m_visualParams = vPs; - - if (m_bones == null) - { - m_bones = new bone[NBONES]; - for (int i = 0; i < NBONES; i++) - m_bones[i] = DefaultBones[i]; - } - - float bone_skull = m_bones[(int)Bones.Skull].Offset.Z; - float bone_head = m_bones[(int)Bones.Head].Offset.Z; - float bone_neck = m_bones[(int)Bones.Neck].Offset.Z; - float bone_chest = m_bones[(int)Bones.Chest].Offset.Z; - float bone_torso = m_bones[(int)Bones.Torso].Offset.Z; - float bone_hip = m_bones[(int)Bones.Hipright].Offset.Z; - float bone_knee = m_bones[(int)Bones.KneeRight].Offset.Z; - float bone_ank = m_bones[(int)Bones.AnkleRight].Offset.Z; - float bone_foot = m_bones[(int)Bones.FootRight].Offset.Z; - - float sbone_skull = m_bones[(int)Bones.Skull].Scale.Z; - float sbone_head = m_bones[(int)Bones.Head].Scale.Z; - float sbone_neck = m_bones[(int)Bones.Neck].Scale.Z; - float sbone_chest = m_bones[(int)Bones.Chest].Scale.Z; - float sbone_torso = m_bones[(int)Bones.Torso].Scale.Z; - float sbone_pelvis = m_bones[(int)Bones.Pelvis].Scale.Z; - float sbone_hip = m_bones[(int)Bones.Hipright].Scale.Z; - float sbone_knee = m_bones[(int)Bones.KneeRight].Scale.Z; - float sbone_ank = m_bones[(int)Bones.AnkleRight].Scale.Z; - float sbone_foot = m_bones[(int)Bones.FootRight].Scale.Z; - - float v_male = (m_visualParams[(int)VPElement.SHAPE_MALE] == 0) ? 0.0f : 1.0f; - sbone_neck += v_male * 0.2f; - sbone_chest += v_male * 0.05f; - sbone_torso += v_male * 0.05f; - sbone_knee += v_male * 0.1f; - - float v_height = convertVP(VPElement.SHAPE_HEIGHT) * 4.3f - 2.3f; - sbone_neck += v_height * 0.02f; - sbone_chest += v_height * 0.05f; - sbone_torso += v_height * 0.05f; - sbone_hip += v_height * 0.1f; - sbone_knee += v_height * 0.1f; - - float v_hip_len = convertVP(VPElement.SHAPE_HIP_LENGTH) * 2f - 1f; - sbone_pelvis += v_hip_len * 0.3f; - - float v_torso_len = convertVP(VPElement.SHAPE_TORSO_LENGTH) * 2f - 1f; - sbone_torso += v_torso_len * 0.3f; - sbone_pelvis += v_torso_len * 0.1f; - sbone_hip += v_torso_len * -0.1f; - sbone_knee += v_torso_len * -0.05f; - - float v_head_size = convertVP(VPElement.SHAPE_HEAD_SIZE) * 0.35f - 0.25f; - bone_skull += v_head_size * 0.1f; - sbone_skull += v_head_size; - sbone_head += v_head_size; - - float v_shoes_heel = convertVP(VPElement.SHOES_HEEL_HEIGHT); - bone_foot += v_shoes_heel * -0.08f; - - float v_shoes_plat = convertVP(VPElement.SHOES_PLATFORM_HEIGHT); - bone_foot += v_shoes_plat * -0.07f; - - float v_leg_lenght = convertVP(VPElement.SHAPE_LEG_LENGTH) * 2f - 1f; - sbone_hip += v_leg_lenght * 0.2f; - sbone_knee += v_leg_lenght * 0.2f; - - float v_neck_len = convertVP(VPElement.SHAPE_NECK_LENGTH) * 2f - 1f; - sbone_neck += v_neck_len * 0.5f; - - float hipmess = bone_hip * sbone_pelvis; - - float pelvisToFoot = hipmess - - bone_knee * sbone_hip - - bone_ank * sbone_knee - - bone_foot * sbone_ank; - - - float size = 1.4142f * bone_skull * sbone_head + - bone_head * sbone_neck + - bone_neck * sbone_chest + - bone_chest * sbone_torso + - bone_torso * sbone_pelvis; - - size += pelvisToFoot; - - m_standSize = new Vector3(0.45f, 0.6f, size); - // m_feetOffset = 0.5f * size - pelvisToFoot; - m_feetOffset = 0.0f; - } - } -} diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index f686c60..c9b67de 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -64,7 +64,7 @@ namespace OpenSim.Framework public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); - public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams); + public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize); public delegate void StartAnim(IClientAPI remoteClient, UUID animID); -- cgit v1.1 From c73c2fb0707ee4dc78a354d932293f3e7e83ac50 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:53:33 +0000 Subject: add some default size setting and checks --- OpenSim/Framework/AvatarAppearance.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index b01b8da..2183fb6 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -40,10 +40,12 @@ namespace OpenSim.Framework /// public class AvatarAppearance { + // SL box diferent to size const float AVBOXAJUST = 0.2f; + // constrains for ubitode physics const float AVBOXMINX = 0.2f; const float AVBOXMINY = 0.3f; - const float AVBOXMINZ = 0.5f; + const float AVBOXMINZ = 1.2f; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -60,7 +62,7 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; protected Dictionary> m_attachments; protected float m_avatarHeight = 0; - protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); + protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); protected float m_avatarFeetOffset = 0; protected float m_avatarAnimOffset = 0; @@ -157,6 +159,8 @@ namespace OpenSim.Framework SetDefaultParams(); // SetHeight(); + if(m_avatarHeight == 0) + SetSize(new Vector3(0.45f,0.6f,1.9f)); m_attachments = new Dictionary>(); } @@ -408,6 +412,20 @@ namespace OpenSim.Framework public void SetSize(Vector3 avSize) { + if (avSize.X > 32f) + avSize.X = 32f; + else if (avSize.X < 0.1f) + avSize.X = 0.1f; + + if (avSize.Y > 32f) + avSize.Y = 32f; + else if (avSize.Y < 0.1f) + avSize.Y = 0.1f; + if (avSize.Z > 32f) + avSize.Z = 32f; + else if (avSize.Z < 0.1f) + avSize.Z = 0.1f; + m_avatarSize = avSize; m_avatarBoxSize = avSize; m_avatarBoxSize.Z += AVBOXAJUST; -- cgit v1.1 From 20773dcfccc04d8af14e27f87746711bfaba07b1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 02:55:36 +0000 Subject: add a Check method to flotsamAssetCache, so to check if a asset is in cache without actually loading it. Make use limited use of it in avatarfactory textures check. Also on llclientview HandleAgentTextureCached that now should work. Other asset cache modules for now will return false, so are broken. baked textures logic still unchanged. *UNTESTED* --- OpenSim/Framework/IImprovedAssetCache.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IImprovedAssetCache.cs b/OpenSim/Framework/IImprovedAssetCache.cs index 251215a..a0b8b55 100644 --- a/OpenSim/Framework/IImprovedAssetCache.cs +++ b/OpenSim/Framework/IImprovedAssetCache.cs @@ -33,6 +33,7 @@ namespace OpenSim.Framework { void Cache(AssetBase asset); AssetBase Get(string id); + bool Check(string id); void Expire(string id); void Clear(); } -- cgit v1.1 From 77cc7ce399d1b1a710f3b3f4337932febdef66c8 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 21 Dec 2012 19:12:30 -0500 Subject: * Partial Commit for Avatar Appearance to include the functionality of Cached Bakes. --- OpenSim/Framework/AvatarAppearance.cs | 8 ++++++- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Framework/WearableCacheItem.cs | 39 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 OpenSim/Framework/WearableCacheItem.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 2183fb6..4df4fb6 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -66,7 +66,7 @@ namespace OpenSim.Framework protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); protected float m_avatarFeetOffset = 0; protected float m_avatarAnimOffset = 0; - + protected WearableCacheItem[] cacheitems; public virtual int Serial { get { return m_serial; } @@ -115,6 +115,12 @@ namespace OpenSim.Framework get { return m_avatarHeight; } set { m_avatarHeight = value; } } + + public virtual WearableCacheItem[] WearableCacheItems + { + get { return cacheitems; } + set { cacheitems = value; } + } public AvatarAppearance() { diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c9b67de..0465042 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -64,7 +64,7 @@ namespace OpenSim.Framework public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); - public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize); + public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems); public delegate void StartAnim(IClientAPI remoteClient, UUID animID); diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs new file mode 100644 index 0000000..83b1346 --- /dev/null +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -0,0 +1,39 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework +{ + public class WearableCacheItem + { + public uint TextureIndex { get; set; } + public UUID CacheId { get; set; } + public UUID TextureID { get; set; } + } +} -- cgit v1.1 From 6797ac14741851efa5ba60a00891e18cf7755c80 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 29 Dec 2012 08:53:58 -0500 Subject: * This finishes the implementation of AgentCachedTexture. Requires the XBakes Module and service for full functionality. Previous no-cache functionality works without the service and module. In some ways, I would have been happier not putting an AssetBase in WearableCacheItem.. but turns out it was probably unavoidable. No additional locks, yay. --- OpenSim/Framework/AvatarAppearance.cs | 14 +++- OpenSim/Framework/WearableCacheItem.cs | 118 +++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 4df4fb6..ffc3527 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -66,7 +66,9 @@ namespace OpenSim.Framework protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); protected float m_avatarFeetOffset = 0; protected float m_avatarAnimOffset = 0; - protected WearableCacheItem[] cacheitems; + protected WearableCacheItem[] m_cacheitems; + protected bool m_cacheItemsDirty = true; + public virtual int Serial { get { return m_serial; } @@ -118,8 +120,14 @@ namespace OpenSim.Framework public virtual WearableCacheItem[] WearableCacheItems { - get { return cacheitems; } - set { cacheitems = value; } + get { return m_cacheitems; } + set { m_cacheitems = value; } + } + + public virtual bool WearableCacheItemsDirty + { + get { return m_cacheItemsDirty; } + set { m_cacheItemsDirty = value; } } public AvatarAppearance() diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index 83b1346..1aecf79 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -26,14 +26,132 @@ */ using System; +using System.Collections.Generic; using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace OpenSim.Framework { + [Serializable] public class WearableCacheItem { public uint TextureIndex { get; set; } public UUID CacheId { get; set; } public UUID TextureID { get; set; } + public AssetBase TextureAsset { get; set; } + + + public static WearableCacheItem[] GetDefaultCacheItem() + { + int itemmax = 21; + WearableCacheItem[] retitems = new WearableCacheItem[itemmax]; + for (uint i=0;i ret = new List(); + if (pInput.Type == OSDType.Array) + { + OSDArray itemarray = (OSDArray) pInput; + foreach (OSDMap item in itemarray) + { + ret.Add(new WearableCacheItem() + { + TextureIndex = item["textureindex"].AsUInteger(), + CacheId = item["cacheid"].AsUUID(), + TextureID = item["textureid"].AsUUID() + }); + + if (dataCache != null && item.ContainsKey("assetdata")) + { + AssetBase asset = new AssetBase(item["textureid"].AsUUID(),"BakedTexture",(sbyte)AssetType.Texture,UUID.Zero.ToString()); + asset.Temporary = true; + asset.Data = item["assetdata"].AsBinary(); + dataCache.Cache(asset); + } + } + } + else if (pInput.Type == OSDType.Map) + { + OSDMap item = (OSDMap) pInput; + ret.Add(new WearableCacheItem(){ + TextureIndex = item["textureindex"].AsUInteger(), + CacheId = item["cacheid"].AsUUID(), + TextureID = item["textureid"].AsUUID() + }); + if (dataCache != null && item.ContainsKey("assetdata")) + { + string assetCreator = item["assetcreator"].AsString(); + string assetName = item["assetname"].AsString(); + AssetBase asset = new AssetBase(item["textureid"].AsUUID(), assetName, (sbyte)AssetType.Texture, assetCreator); + asset.Temporary = true; + asset.Data = item["assetdata"].AsBinary(); + dataCache.Cache(asset); + } + } + else + { + return new WearableCacheItem[0]; + } + return ret.ToArray(); + + } + public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache) + { + OSDArray arr = new OSDArray(); + foreach (WearableCacheItem item in pcacheItems) + { + OSDMap itemmap = new OSDMap(); + itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); + itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); + itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); + if (dataCache != null) + { + if (dataCache.Check(item.TextureID.ToString())) + { + AssetBase assetItem = dataCache.Get(item.TextureID.ToString()); + if (assetItem != null) + { + itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); + itemmap.Add("assetcreator", OSD.FromString(assetItem.CreatorID)); + itemmap.Add("assetname", OSD.FromString(assetItem.Name)); + } + } + } + arr.Add(itemmap); + } + return arr; + } + public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems) + { + for (int i = 0; i < pcacheItems.Length; i++) + { + if (pcacheItems[i].TextureIndex == pTextureIndex) + return pcacheItems[i]; + } + return null; + } + public static WearableCacheItem SearchTextureCacheId(UUID pCacheId, WearableCacheItem[] pcacheItems) + { + for (int i = 0; i < pcacheItems.Length; i++) + { + if (pcacheItems[i].CacheId == pCacheId) + return pcacheItems[i]; + } + return null; + } + public static WearableCacheItem SearchTextureTextureId(UUID pTextureId, WearableCacheItem[] pcacheItems) + { + for (int i = 0; i < pcacheItems.Length; i++) + { + if (pcacheItems[i].TextureID == pTextureId) + return pcacheItems[i]; + } + return null; + } } + + } -- cgit v1.1 From a285ff7e6942f9b55b18b00a765a5b4491fba011 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 3 Jan 2013 14:27:21 +0000 Subject: check land permitions on sit target for unscripted sits --- OpenSim/Framework/ILandObject.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 4f98d7b..7a24d1e 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -70,6 +70,7 @@ namespace OpenSim.Framework void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); bool IsEitherBannedOrRestricted(UUID avatar); bool IsBannedFromLand(UUID avatar); + bool CanBeOnThisLand(UUID avatar, float posHeight); bool IsRestrictedFromLand(UUID avatar); bool IsInLandAccessList(UUID avatar); void SendLandUpdateToClient(IClientAPI remote_client); -- cgit v1.1 From 1c79e8a779a94317670e90e99215311fe90caa9a Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 14 Jan 2013 19:37:44 -0500 Subject: * Document the additional Visual Params of newer browsers in AvatarAppearance.VPElement so it can be easily looked up in code/module --- OpenSim/Framework/AvatarAppearance.cs | 53 ++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ffc3527..041fb94 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -1558,7 +1558,58 @@ namespace OpenSim.Framework SHAPE_EYELID_INNER_CORNER_UP = 214, SKIRT_SKIRT_RED = 215, SKIRT_SKIRT_GREEN = 216, - SKIRT_SKIRT_BLUE = 217 + SKIRT_SKIRT_BLUE = 217, + + /// + /// Avatar Physics section. These are 0 type visual params which get transmitted. + /// + + /// + /// Breast Part 1 + /// + BREAST_PHYSICS_MASS = 218, + BREAST_PHYSICS_GRAVITY = 219, + BREAST_PHYSICS_DRAG = 220, + BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221, + BREAST_PHYSICS_UPDOWN_SPRING = 222, + BREAST_PHYSICS_UPDOWN_GAIN = 223, + BREAST_PHYSICS_UPDOWN_DAMPING = 224, + BREAST_PHYSICS_INOUT_MAX_EFFECT = 225, + BREAST_PHYSICS_INOUT_SPRING = 226, + BREAST_PHYSICS_INOUT_GAIN = 227, + BREAST_PHYSICS_INOUT_DAMPING = 228, + /// + /// Belly + /// + BELLY_PHYISCS_MASS = 229, + BELLY_PHYSICS_GRAVITY = 230, + BELLY_PHYSICS_DRAG = 231, + BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232, + BELLY_PHYSICS_UPDOWN_SPRING = 233, + BELLY_PHYSICS_UPDOWN_GAIN = 234, + BELLY_PHYSICS_UPDOWN_DAMPING = 235, + + /// + /// Butt + /// + BUTT_PHYSICS_MASS = 236, + BUTT_PHYSICS_GRAVITY = 237, + BUTT_PHYSICS_DRAG = 238, + BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239, + BUTT_PHYSICS_UPDOWN_SPRING = 240, + BUTT_PHYSICS_UPDOWN_GAIN = 241, + BUTT_PHYSICS_UPDOWN_DAMPING = 242, + BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243, + BUTT_PHYSICS_LEFTRIGHT_SPRING = 244, + BUTT_PHYSICS_LEFTRIGHT_GAIN = 245, + BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246, + /// + /// Breast Part 2 + /// + BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, + BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, + BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, + BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 } #endregion } -- cgit v1.1 From 85aa1804dfc9edbf41f16c312d06746eecd59bc9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 16:45:18 +0000 Subject: Complete removal of the now unused state queue --- OpenSim/Framework/ThrottleOutPacketType.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ThrottleOutPacketType.cs b/OpenSim/Framework/ThrottleOutPacketType.cs index d56231a..ca4b126 100644 --- a/OpenSim/Framework/ThrottleOutPacketType.cs +++ b/OpenSim/Framework/ThrottleOutPacketType.cs @@ -47,9 +47,6 @@ namespace OpenSim.Framework Texture = 5, /// Non-texture assets Asset = 6, - /// Avatar and primitive data - /// This is a sub-category of Task - State = 7, } [Flags] @@ -61,6 +58,5 @@ namespace OpenSim.Framework Task = 1 << 3, Texture = 1 << 4, Asset = 1 << 5, - State = 1 << 6, } } -- cgit v1.1 From 582cb89beb597247ceb6d82cdfc8fc983ffe8496 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 19:29:27 +0100 Subject: Add a way to put things at the front of the queue for any throttle group. Adds a DoubleLocklessQueue and uses it for the outgoing buckets. Added a flag value to the Throttle Type (again) because although it's hacky, it's the best of a bad bunch to get the message through the UDP stack to where it's needed. --- OpenSim/Framework/LocklessQueue.cs | 8 ++++---- OpenSim/Framework/ThrottleOutPacketType.cs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LocklessQueue.cs b/OpenSim/Framework/LocklessQueue.cs index 84f887c..9bd9baf 100644 --- a/OpenSim/Framework/LocklessQueue.cs +++ b/OpenSim/Framework/LocklessQueue.cs @@ -29,7 +29,7 @@ using System.Threading; namespace OpenSim.Framework { - public sealed class LocklessQueue + public class LocklessQueue { private sealed class SingleLinkNode { @@ -41,7 +41,7 @@ namespace OpenSim.Framework SingleLinkNode tail; int count; - public int Count { get { return count; } } + public virtual int Count { get { return count; } } public LocklessQueue() { @@ -76,7 +76,7 @@ namespace OpenSim.Framework Interlocked.Increment(ref count); } - public bool Dequeue(out T item) + public virtual bool Dequeue(out T item) { item = default(T); SingleLinkNode oldHead = null; @@ -136,4 +136,4 @@ namespace OpenSim.Framework (object)Interlocked.CompareExchange(ref location, newValue, comparand); } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/ThrottleOutPacketType.cs b/OpenSim/Framework/ThrottleOutPacketType.cs index ca4b126..87899f0 100644 --- a/OpenSim/Framework/ThrottleOutPacketType.cs +++ b/OpenSim/Framework/ThrottleOutPacketType.cs @@ -47,6 +47,8 @@ namespace OpenSim.Framework Texture = 5, /// Non-texture assets Asset = 6, + + HighPriority = 128, } [Flags] -- cgit v1.1 From 8c6984eac140ed48f10ac3f3db533d0c9b1d084a Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 23 Jan 2013 23:12:48 +0100 Subject: Implement get version RemoteAdmin call --- OpenSim/Framework/Servers/ServerBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index c182a3a..9eb2281 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -531,7 +531,7 @@ namespace OpenSim.Framework.Servers } } - protected string GetVersionText() + public string GetVersionText() { return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); } @@ -563,4 +563,4 @@ namespace OpenSim.Framework.Servers m_console.OutputFormat(format, components); } } -} \ No newline at end of file +} -- cgit v1.1 From 598f891d703593bde4b96472b5d1b1ce6aaf4c74 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Feb 2013 04:03:32 +0100 Subject: Move SoubleQueu to Util. Change HTTP inv to prioritize COF. Determine COF for SP --- OpenSim/Framework/Util.cs | 108 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e76a37b..48f3f8b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2097,4 +2097,112 @@ namespace OpenSim.Framework } #endregion } + + public class DoubleQueue where T:class + { + private Queue m_lowQueue = new Queue(); + private Queue m_highQueue = new Queue(); + + private object m_syncRoot = new object(); + private Semaphore m_s = new Semaphore(0, 1); + + public DoubleQueue() + { + } + + public virtual int Count + { + get { return m_highQueue.Count + m_lowQueue.Count; } + } + + public virtual void Enqueue(T data) + { + Enqueue(m_lowQueue, data); + } + + public virtual void EnqueueLow(T data) + { + Enqueue(m_lowQueue, data); + } + + public virtual void EnqueueHigh(T data) + { + Enqueue(m_highQueue, data); + } + + private void Enqueue(Queue q, T data) + { + lock (m_syncRoot) + { + m_lowQueue.Enqueue(data); + m_s.WaitOne(0); + m_s.Release(); + } + } + + public virtual T Dequeue() + { + return Dequeue(Timeout.Infinite); + } + + public virtual T Dequeue(int tmo) + { + return Dequeue(TimeSpan.FromMilliseconds(tmo)); + } + + public virtual T Dequeue(TimeSpan wait) + { + T res = null; + + if (!Dequeue(wait, ref res)) + return null; + + return res; + } + + public bool Dequeue(int timeout, ref T res) + { + return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); + } + + public bool Dequeue(TimeSpan wait, ref T res) + { + if (!m_s.WaitOne(wait)) + return false; + + lock (m_syncRoot) + { + if (m_highQueue.Count > 0) + res = m_highQueue.Dequeue(); + else + res = m_lowQueue.Dequeue(); + + if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) + return true; + + try + { + m_s.Release(); + } + catch + { + } + + return true; + } + } + + public virtual void Clear() + { + + lock (m_syncRoot) + { + // Make sure sem count is 0 + m_s.WaitOne(0); + + m_lowQueue.Clear(); + m_highQueue.Clear(); + } + } + } } -- cgit v1.1 From 04235e58e87ae42617111cad2884e42785914d4e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 01:02:16 +0100 Subject: Push updates from keyframe directly to the front of the output queue rather than through the update system. --- OpenSim/Framework/IClientAPI.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0465042..96d2735 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -698,7 +698,8 @@ namespace OpenSim.Framework ExtraData = 1 << 20, Sound = 1 << 21, Joint = 1 << 22, - FullUpdate = UInt32.MaxValue + Immediate = 1 << 23, + FullUpdate = UInt32.MaxValue & (uint)~((uint)1<<23) } public static class PrimUpdateFlagsExtensions -- cgit v1.1 From 14c064c65da3d9cce045664f83daaeb7a79edcdd Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 03:15:40 +0100 Subject: Revert "Push updates from keyframe directly to the front of the output queue rather" This reverts commit 04235e58e87ae42617111cad2884e42785914d4e. --- OpenSim/Framework/IClientAPI.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 96d2735..0465042 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -698,8 +698,7 @@ namespace OpenSim.Framework ExtraData = 1 << 20, Sound = 1 << 21, Joint = 1 << 22, - Immediate = 1 << 23, - FullUpdate = UInt32.MaxValue & (uint)~((uint)1<<23) + FullUpdate = UInt32.MaxValue } public static class PrimUpdateFlagsExtensions -- cgit v1.1 From 797bfbfcfaf5485db755ad6a5b19a064210505fd Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 5 Mar 2013 12:02:22 +0100 Subject: Multiattach, part 1 --- OpenSim/Framework/AvatarAppearance.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 041fb94..ba6d87d 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -497,8 +497,6 @@ namespace OpenSim.Framework /// public List GetAttachments() { - - lock (m_attachments) { List alist = new List(); @@ -508,7 +506,8 @@ namespace OpenSim.Framework alist.Add(new AvatarAttachment(attach)); } return alist; - } } + } + } internal void AppendAttachment(AvatarAttachment attach) { -- cgit v1.1 From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Mar 2013 18:56:28 +0100 Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions" --- OpenSim/Framework/Util.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e4d7e19..557f38e 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -54,6 +54,21 @@ using Amib.Threading; namespace OpenSim.Framework { + [Flags] + public enum PermissionMask : uint + { + None = 0, + Transfer = 1 << 13, + Modify = 1 << 14, + Copy = 1 << 15, + Export = 1 << 16, + Move = 1 << 19, + Damage = 1 << 20, + // All does not contain Export, which is special and must be + // explicitly given + All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19) + } + /// /// The method used by Util.FireAndForget for asynchronously firing events /// -- cgit v1.1 From 6571e7ead276027e5ed86cb1fc9d1b47ddae2e6e Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Apr 2013 22:24:41 +0200 Subject: Allow callers to set the invoice parameter for GenericMessage --- OpenSim/Framework/IClientAPI.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0465042..655ba8a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1129,8 +1129,8 @@ namespace OpenSim.Framework void SendInstantMessage(GridInstantMessage im); - void SendGenericMessage(string method, List message); - void SendGenericMessage(string method, List message); + void SendGenericMessage(string method, UUID invoice, List message); + void SendGenericMessage(string method, UUID invoice, List message); void SendLayerData(float[] map); void SendLayerData(int px, int py, float[] map); -- cgit v1.1 From e39156c6569b10d48b0005b271f103387e16f527 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Apr 2013 01:38:21 +0200 Subject: Send 503 when throttling textures --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 07bd48a..7628e23 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -345,7 +345,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (responsedata == null) continue; - if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) + if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) // This is the event queue { try { -- cgit v1.1 From 40036ca05f3a34ef7f0728ed52878068a66bc502 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Apr 2013 21:35:18 +0100 Subject: Change EconomyDataRequest signature to use an IClientAPI rather than UUID. This is needed because recent LL viewer codebases call this earlier in login when the client is not yet established in the sim and can't be found by UUID. Sending the reply requires having the IClientAPI. --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 655ba8a..c88828b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -320,7 +320,7 @@ namespace OpenSim.Framework public delegate void ObjectPermissions( IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set); - public delegate void EconomyDataRequest(UUID agentID); + public delegate void EconomyDataRequest(IClientAPI client); public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID); -- cgit v1.1 From 0086c3b5fb24f4a25fe2e28f9cedcaa41c70b36c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 May 2013 01:58:50 +0200 Subject: Update the money framework to allow sending the new style linden "serverside is now viewerside" messages regarding currency This will require all money modules to be refactored! --- OpenSim/Framework/IClientAPI.cs | 5 ++--- OpenSim/Framework/IMoneyModule.cs | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c88828b..ad3471a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1168,7 +1168,8 @@ namespace OpenSim.Framework void SendTeleportStart(uint flags); void SendTeleportProgress(uint flags, string message); - void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance); + void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item); + void SendPayPrice(UUID objectID, int[] payPrice); void SendCoarseLocationUpdate(List users, List CoarseLocations); @@ -1266,8 +1267,6 @@ namespace OpenSim.Framework void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels); - bool AddMoney(int debit); - /// /// Update the client as to where the sun is currently located. /// diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 7378d2e..415b7df 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -38,7 +38,8 @@ namespace OpenSim.Framework int GetBalance(UUID agentID); bool UploadCovered(UUID agentID, int amount); bool AmountCovered(UUID agentID, int amount); - void ApplyCharge(UUID agentID, int amount, string text); + void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type); + void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData); void ApplyUploadCharge(UUID agentID, int amount, string text); void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); -- cgit v1.1 From 17a902fed44ec3c28ee71dc686faeb00162bad73 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 7 Jun 2013 22:39:27 +0200 Subject: Clean up poll service --- .../HttpServer/PollServiceRequestManager.cs | 144 ----------------- .../Servers/HttpServer/PollServiceWorkerThread.cs | 175 --------------------- 2 files changed, 319 deletions(-) delete mode 100644 OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 7628e23..5406f00 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -34,143 +34,6 @@ using HttpServer; using OpenSim.Framework; using OpenSim.Framework.Monitoring; using Amib.Threading; - - -/* -namespace OpenSim.Framework.Servers.HttpServer -{ - - public class PollServiceRequestManager - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private readonly BaseHttpServer m_server; - private static Queue m_requests = Queue.Synchronized(new Queue()); - private static ManualResetEvent m_ev = new ManualResetEvent(false); - private uint m_WorkerThreadCount = 0; - private Thread[] m_workerThreads; - private PollServiceWorkerThread[] m_PollServiceWorkerThreads; - private volatile bool m_running = true; - private int m_pollTimeout; - - public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) - { - m_server = pSrv; - m_WorkerThreadCount = pWorkerThreadCount; - m_pollTimeout = pTimeout; - } - - public void Start() - { - m_running = true; - m_workerThreads = new Thread[m_WorkerThreadCount]; - m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; - - //startup worker threads - for (uint i = 0; i < m_WorkerThreadCount; i++) - { - m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout); - m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent; - - m_workerThreads[i] - = Watchdog.StartThread( - m_PollServiceWorkerThreads[i].ThreadStart, - String.Format("PollServiceWorkerThread{0}", i), - ThreadPriority.Normal, - false, - true, - int.MaxValue); - } - - Watchdog.StartThread( - this.ThreadStart, - "PollServiceWatcherThread", - ThreadPriority.Normal, - false, - true, - 1000 * 60 * 10); - } - - internal void ReQueueEvent(PollServiceHttpRequest req) - { - // Do accounting stuff here - Enqueue(req); - } - - public void Enqueue(PollServiceHttpRequest req) - { - lock (m_requests) - m_requests.Enqueue(req); - m_ev.Set(); - } - - public void ThreadStart() - { - while (m_running) - { - m_ev.WaitOne(1000); - m_ev.Reset(); - Watchdog.UpdateThread(); - ProcessQueuedRequests(); - } - } - - private void ProcessQueuedRequests() - { - lock (m_requests) - { - if (m_requests.Count == 0) - return; - -// m_log.DebugFormat("[POLL SERVICE REQUEST MANAGER]: Processing {0} requests", m_requests.Count); - - int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1; - - // For Each WorkerThread - for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++) - { - //Loop over number of requests each thread handles. - for (int i = 0; i < reqperthread && m_requests.Count > 0; i++) - { - try - { - m_PollServiceWorkerThreads[tc].Enqueue((PollServiceHttpRequest)m_requests.Dequeue()); - } - catch (InvalidOperationException) - { - // The queue is empty, we did our calculations wrong! - return; - } - - } - } - } - - } - - public void Stop() - { - m_running = false; - - foreach (object o in m_requests) - { - PollServiceHttpRequest req = (PollServiceHttpRequest) o; - m_server.DoHTTPGruntWork( - req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), - new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); - } - - m_requests.Clear(); - - foreach (Thread t in m_workerThreads) - { - t.Abort(); - } - } - } -} - */ - using System.IO; using System.Text; using System.Collections.Generic; @@ -196,8 +59,6 @@ namespace OpenSim.Framework.Servers.HttpServer private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); -// private int m_timeout = 1000; // increase timeout 250; now use the event one - public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) { m_server = pSrv; @@ -282,7 +143,6 @@ namespace OpenSim.Framework.Servers.HttpServer ~PollServiceRequestManager() { m_running = false; -// m_timeout = -10000; // cause all to expire Thread.Sleep(1000); // let the world move foreach (Thread t in m_workerThreads) @@ -418,14 +278,10 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { - //response.OutputStream.Close(); try { response.OutputStream.Flush(); response.Send(); - - //if (!response.KeepAlive && response.ReuseContext) - // response.FreeContext(); } catch (Exception e) { diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs deleted file mode 100644 index 1c529b6..0000000 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ /dev/null @@ -1,175 +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. - */ - -/* Ubit work moved to PollServiceRequestManager - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Text; -using HttpServer; -using OpenMetaverse; -using System.Reflection; -using log4net; -using OpenSim.Framework.Monitoring; - -namespace OpenSim.Framework.Servers.HttpServer -{ - public delegate void ReQueuePollServiceItem(PollServiceHttpRequest req); - - public class PollServiceWorkerThread - { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - public event ReQueuePollServiceItem ReQueue; - - private readonly BaseHttpServer m_server; - private BlockingQueue m_request; - private bool m_running = true; - private int m_timeout = 250; - - public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout) - { - m_request = new BlockingQueue(); - m_server = pSrv; - m_timeout = pTimeout; - } - - public void ThreadStart() - { - Run(); - } - - public void Run() - { - while (m_running) - { - PollServiceHttpRequest req = m_request.Dequeue(); - - Watchdog.UpdateThread(); - - try - { - if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) - { - StreamReader str; - try - { - str = new StreamReader(req.Request.Body); - } - catch (System.ArgumentException) - { - // Stream was not readable means a child agent - // was closed due to logout, leaving the - // Event Queue request orphaned. - continue; - } - - try - { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); - DoHTTPGruntWork(m_server, req, responsedata); - } - catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream - { - // Ignore it, no need to reply - } - } - else - { - if ((Environment.TickCount - req.RequestTime) > m_timeout) - { - DoHTTPGruntWork( - m_server, - req, - req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); - } - else - { - ReQueuePollServiceItem reQueueItem = ReQueue; - if (reQueueItem != null) - reQueueItem(req); - } - } - } - catch (Exception e) - { - m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); - } - } - } - - internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest) - { - m_request.Enqueue(pPollServiceHttpRequest); - } - - /// - /// FIXME: This should be part of BaseHttpServer - /// - internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) - { - OSHttpResponse response - = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); - - byte[] buffer = server.DoHTTPGruntWork(responsedata, response); - - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); - } - finally - { - //response.OutputStream.Close(); - try - { - response.OutputStream.Flush(); - response.Send(); - - //if (!response.KeepAlive && response.ReuseContext) - // response.FreeContext(); - } - catch (Exception e) - { - m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); - } - } - } - } -} -*/ \ No newline at end of file -- cgit v1.1 From ed7fe6239cf53a0a8cacb2ef05e93750a9e22d2b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Jun 2013 23:18:48 +0100 Subject: add indexes for new visual parameters shape_hover and APPEARANCEMESSAGE_VERSION. For reference only, this aren't used in sim for now --- OpenSim/Framework/AvatarAppearance.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index b7a0adf..a34c85f 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -1626,7 +1626,12 @@ namespace OpenSim.Framework BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, - BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 + BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250, + + // Ubit: 07/96/2013 new parameters + _APPEARANCEMESSAGE_VERSION = 251, //ID 11000 + + SHAPE_HOVER = 252, //ID 11001 } #endregion } -- cgit v1.1 From 62c277ff9f7a335e0091bba0c891e5b739c656d6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 13 Jun 2013 02:52:11 +0200 Subject: Add a result param to te money module interface --- OpenSim/Framework/IMoneyModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 415b7df..55c9613 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -33,7 +33,7 @@ namespace OpenSim.Framework public interface IMoneyModule { bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, - int amount, UUID txn); + int amount, UUID txn, out string reason); int GetBalance(UUID agentID); bool UploadCovered(UUID agentID, int amount); -- cgit v1.1 From 66715a69a73d78c2da9b68b8776a02195bb2e953 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 7 Sep 2013 17:57:53 +0200 Subject: Add two argument constructor to GridInstantMessage --- OpenSim/Framework/GridInstantMessage.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs index 6ae0488..da3690c 100644 --- a/OpenSim/Framework/GridInstantMessage.cs +++ b/OpenSim/Framework/GridInstantMessage.cs @@ -53,6 +53,24 @@ namespace OpenSim.Framework binaryBucket = new byte[0]; } + public GridInstantMessage(GridInstantMessage im, bool addTimestamp) + { + fromAgentID = im.fromAgentID; + fromAgentName = im.fromAgentName; + toAgentID = im.toAgentID; + dialog = im.dialog; + fromGroup = im.fromGroup; + message = im.message; + imSessionID = im.imSessionID; + offline = im.offline; + Position = im.Position; + binaryBucket = im.binaryBucket; + RegionID = im.RegionID; + + if (addTimestamp) + timestamp = (uint)Util.UnixTimeSinceEpoch(); + } + public GridInstantMessage(IScene scene, UUID _fromAgentID, string _fromAgentName, UUID _toAgentID, byte _dialog, bool _fromGroup, string _message, -- cgit v1.1 From ece2d24077cacba677de5cebdd3a9da463306ecd Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 5 Oct 2013 17:36:58 -0500 Subject: * Fixes cases where Last Attachment Point gets overwritten with 0 when it shouldn't * Fixes cases where Last Attachment Point doesn't get written when it should. * Fixes Null Reference in BaseHttpServer when shutting down, null path provided. * Drop then Wear retains Last Attachment Point --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ed733cf..5681ece 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1967,6 +1967,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void RemoveHTTPHandler(string httpMethod, string path) { + if (path == null) return; // Caps module isn't loaded, tries to remove handler where path = null lock (m_HTTPHandlers) { if (httpMethod != null && httpMethod.Length == 0) -- cgit v1.1 From 958a8f274b8a25703935ab4092f190e9d54b8559 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Dec 2013 01:29:15 +0000 Subject: Revert "Add support for user preferences (im via email)" This reverts commit 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b. --- OpenSim/Framework/UserProfiles.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs index 492f6b9..6133591 100644 --- a/OpenSim/Framework/UserProfiles.cs +++ b/OpenSim/Framework/UserProfiles.cs @@ -90,14 +90,6 @@ namespace OpenSim.Framework public UUID TargetId; public string Notes; } - - public class UserPreferences - { - public UUID UserId; - public bool IMViaEmail = false; - public bool Visible = false; - public string EMail = string.Empty; - } public class UserAccountProperties { -- cgit v1.1 From 5c661baf6c197caef73e6a8fe5a2223d00a2a6ba Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 26 Apr 2014 02:42:30 +0200 Subject: Allow opening a https port using only http so that nginx can be used for ssl --- OpenSim/Framework/NetworkServersInfo.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index 4b7d4c7..dfe9695 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs @@ -41,6 +41,7 @@ namespace OpenSim.Framework // "Out of band" managemnt https public bool ssl_listener = false; + public bool ssl_external = false; public uint https_port = 0; public string cert_path = String.Empty; public string cert_pass = String.Empty; @@ -64,6 +65,7 @@ namespace OpenSim.Framework // "Out of band management https" ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); + ssl_external = config.Configs["Network"].GetBoolean("https_external",false); if( ssl_listener) { cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); -- cgit v1.1 From 1d1e444aed5f9eb3a77092f01f1f4d4ed3e18d11 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 26 Apr 2014 02:43:13 +0200 Subject: Convert region loading to new format --- OpenSim/Framework/RegionInfo.cs | 10 ++++++---- OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 6dde62f..24ec181 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -224,10 +224,12 @@ namespace OpenSim.Framework // public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) { - // m_configSource = configSource; - configMember = - new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); - configMember.performConfigurationRetrieve(); + XmlElement elem = (XmlElement)xmlNode; + string name = elem.GetAttribute("Name"); + string xmlstr = "" + xmlNode.OuterXml + ""; + XmlConfigSource source = new XmlConfigSource(XmlReader.Create(new StringReader(xmlstr))); + ReadNiniConfig(source, name); + m_serverURI = string.Empty; } diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index c7caf6f..65de563 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -93,8 +93,8 @@ namespace OpenSim.Framework.RegionLoader.Web xmlSource.Length); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlSource); - if (xmlDoc.FirstChild.Name == "Regions") - { + if (xmlDoc.FirstChild.Name == "Nini") + { regionCount = xmlDoc.FirstChild.ChildNodes.Count; if (regionCount > 0) -- cgit v1.1 From f236b2e5d3f8ba02d3db8ec35d74887723d1ee7b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Jul 2014 02:14:15 +0100 Subject: request.DoHTTPGruntWork(..) is now identical to our version, so use those again, getting code closer to os again --- .../HttpServer/PollServiceRequestManager.cs | 45 +++------------------- 1 file changed, 5 insertions(+), 40 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 44f7045..21e52ca 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -154,7 +154,7 @@ namespace OpenSim.Framework.Servers.HttpServer { foreach (PollServiceHttpRequest req in m_retryRequests) { - DoHTTPGruntWork(m_server,req, + req.DoHTTPGruntWork(m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); } } @@ -176,7 +176,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { wreq = m_requests.Dequeue(0); - DoHTTPGruntWork(m_server,wreq, + wreq.DoHTTPGruntWork(m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); } catch @@ -211,7 +211,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - DoHTTPGruntWork(m_server, req, responsedata); + req.DoHTTPGruntWork(m_server, responsedata); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { @@ -224,7 +224,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - DoHTTPGruntWork(m_server, req, responsedata); + req.DoHTTPGruntWork(m_server, responsedata); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { @@ -239,7 +239,7 @@ namespace OpenSim.Framework.Servers.HttpServer { if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { - DoHTTPGruntWork(m_server, req, + req.DoHTTPGruntWork(m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); } else @@ -256,41 +256,6 @@ namespace OpenSim.Framework.Servers.HttpServer } } - // DoHTTPGruntWork changed, not sending response - // do the same work around as core - - internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) - { - OSHttpResponse response - = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); - - byte[] buffer = server.DoHTTPGruntWork(responsedata, response); - - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); - } - finally - { - try - { - response.OutputStream.Flush(); - response.Send(); - } - catch (Exception e) - { - m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); - } - } - } } } -- cgit v1.1 From 05d071a4308219fe4e69744418ee8299efdfe1f2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Jul 2014 05:37:56 +0100 Subject: let BlockingQueue timeout work as its suposed to and not wait for ever --- OpenSim/Framework/BlockingQueue.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index 3e90fac..aef1192 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs @@ -76,10 +76,9 @@ namespace OpenSim.Framework { lock (m_queueSync) { - bool success = true; - while (m_queue.Count < 1 && m_pqueue.Count < 1 && success) + if (m_queue.Count < 1 && m_pqueue.Count < 1) { - success = Monitor.Wait(m_queueSync, msTimeout); + Monitor.Wait(m_queueSync, msTimeout); } if (m_pqueue.Count > 0) -- cgit v1.1 From 86a9710e77b76fb8a37faf9dacd22a0973628d92 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Jul 2014 23:32:39 +0100 Subject: change previus code, send a NoEvents response back to http server, even if we know there is no one there, so that the server finishes handling it. --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 21e52ca..4058229 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -204,9 +204,6 @@ namespace OpenSim.Framework.Servers.HttpServer { Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); - if (responsedata == null) - continue; - if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) // This is the event queue { try -- cgit v1.1 From dfa9780c8c09c795bdd0dec6174ee8680c534e47 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jul 2014 04:19:01 +0200 Subject: Send new parcel permissions to activate viewer options - done right this time --- OpenSim/Framework/LandData.cs | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 4dffd3f..4fbbbc1 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -99,6 +99,10 @@ namespace OpenSim.Framework private bool _obscureMedia = false; private float _dwell = 0; + public bool SeeAVs { get; set; } + public bool AnyAVSounds { get; set; } + public bool GroupAVSounds { get; set; } + /// /// Traffic count of parcel /// @@ -728,6 +732,9 @@ namespace OpenSim.Framework public LandData() { _globalID = UUID.Random(); + SeeAVs = true; + AnyAVSounds = true; + GroupAVSounds = true; } /// @@ -778,6 +785,9 @@ namespace OpenSim.Framework landData._simwideArea = _simwideArea; landData._simwidePrims = _simwidePrims; landData._dwell = _dwell; + landData.SeeAVs = SeeAVs; + landData.AnyAVSounds = AnyAVSounds; + landData.GroupAVSounds = GroupAVSounds; landData._parcelAccessList.Clear(); foreach (LandAccessEntry entry in _parcelAccessList) @@ -793,21 +803,21 @@ namespace OpenSim.Framework return landData; } - public void ToXml(XmlWriter xmlWriter) - { - serializer.Serialize(xmlWriter, this); - } +// public void ToXml(XmlWriter xmlWriter) +// { +// serializer.Serialize(xmlWriter, this); +// } /// /// Restore a LandData object from the serialized xml representation. /// /// /// - public static LandData FromXml(XmlReader xmlReader) - { - LandData land = (LandData)serializer.Deserialize(xmlReader); - - return land; - } +// public static LandData FromXml(XmlReader xmlReader) +// { +// LandData land = (LandData)serializer.Deserialize(xmlReader); +// +// return land; +// } } } -- cgit v1.1 From 0c2537bb2418f3c66fd060b3852e90df43adbd27 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jul 2014 04:41:38 +0200 Subject: Try to plumb the other half --- OpenSim/Framework/LandUpdateArgs.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs index 7d6c4f2..a48b8bf 100644 --- a/OpenSim/Framework/LandUpdateArgs.cs +++ b/OpenSim/Framework/LandUpdateArgs.cs @@ -56,5 +56,8 @@ namespace OpenSim.Framework public bool MediaLoop; public bool ObscureMusic; public bool ObscureMedia; + public bool SeeAVs; + public bool AnyAVSounds; + public bool GroupAVSounds; } } -- cgit v1.1 From d6dbfd1687f098d2ef460d5a7a6d3c89f48ef89c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 30 Jul 2014 15:43:54 +0100 Subject: missing file in commit 5fe1f878372b5490304a2ad7c0a41293ae36aaa0 --- OpenSim/Framework/ILandObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 7a24d1e..8d15119 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -67,7 +67,7 @@ namespace OpenSim.Framework void SendLandUpdateToAvatarsOverMe(); void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client); - void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); + bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay); bool IsEitherBannedOrRestricted(UUID avatar); bool IsBannedFromLand(UUID avatar); bool CanBeOnThisLand(UUID avatar, float posHeight); -- cgit v1.1 From a5e9429f2bb2276486cc2f1ed2249e14fba90d6a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 31 Jul 2014 03:10:50 +0100 Subject: MESS: changes in MakeRootAgent and CompleteMovement reordering things. Added sending of land overlay and parcel information. This in order to only send avatar related information after having its position well defined and on the right parcel. THIS MAY STILL BE BAD :) --- OpenSim/Framework/ILandChannel.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index c46c03c..63cc7eb 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -93,5 +93,7 @@ namespace OpenSim.Region.Framework.Interfaces void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); + void sendClientInitialLandInfo(IClientAPI remoteClient); + } } -- cgit v1.1 From 6eca2475d4babfcf84aa40a885ff1e65e99a9420 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 5 Aug 2014 17:55:30 +0100 Subject: dont assume that all zero folded perms are to ignore ( coerence with old code in avn-current ) --- OpenSim/Framework/PermissionsUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index d785a78..5d3186d 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -72,8 +72,8 @@ namespace OpenSim.Framework /// The permissions variable to modify. public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms) { - if ((foldedPerms & 7) == 0) - return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded +// if ((foldedPerms & 7) == 0) +// return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0) mainPerms &= ~(uint)PermissionMask.Copy; -- cgit v1.1 From c3f9c99fb32d15e57b24502b71c79fe028ed3007 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 05:20:45 +0100 Subject: DANGER... changed bakedtextures caching. Assuming grid baking is cache only, reduced number of accesses to it. TESTING --- OpenSim/Framework/WearableCacheItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index 1aecf79..cde2862 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -46,7 +46,7 @@ namespace OpenSim.Framework int itemmax = 21; WearableCacheItem[] retitems = new WearableCacheItem[itemmax]; for (uint i=0;i ret = new List(); -- cgit v1.1 From 4ae0bb7df1774426ffa77898ac062a24bc6234f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 23:29:31 +0100 Subject: add limites checks on wearables size, revert to max 15 for compatibility/testing --- OpenSim/Framework/AvatarAppearance.cs | 12 ++++++++++-- OpenSim/Framework/AvatarWearable.cs | 6 +++--- OpenSim/Framework/ChildAgentDataUpdate.cs | 7 ++++++- 3 files changed, 19 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 40179a2..c384336 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -462,7 +462,10 @@ namespace OpenSim.Framework // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // DEBUG OFF m_wearables[wearableId].Clear(); - for (int i = 0; i < wearable.Count; i++) + int count = wearable.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + for (int i = 0; i < count; i++) m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); } @@ -755,7 +758,12 @@ namespace OpenSim.Framework if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(data["wearables"]); - for (int i = 0; i < wears.Count; i++) + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count; i++) m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); } else diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index b104325..7d33abc 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -67,10 +67,10 @@ namespace OpenSim.Framework public static readonly int ALPHA = 13; public static readonly int TATTOO = 14; - public static readonly int PHYSICS = 15; +// public static readonly int PHYSICS = 15; - public static readonly int MAX_WEARABLES = 16; -// public static readonly int MAX_WEARABLES = 15; +// public static readonly int MAX_WEARABLES = 16; + public static readonly int MAX_WEARABLES = 15; public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 2a8e67d..5beb37d 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -665,7 +665,12 @@ namespace OpenSim.Framework if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(args["wearables"]); - for (int i = 0; i < wears.Count / 2; i++) + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count / 2; i++) { AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); Appearance.SetWearable(i,awear); -- cgit v1.1 From a8e49a45389a2b066c7c204ff79f0016ade3b535 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 23:33:48 +0100 Subject: max 16 for testing --- OpenSim/Framework/AvatarWearable.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 7d33abc..271c90f 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -67,10 +67,11 @@ namespace OpenSim.Framework public static readonly int ALPHA = 13; public static readonly int TATTOO = 14; -// public static readonly int PHYSICS = 15; -// public static readonly int MAX_WEARABLES = 16; - public static readonly int MAX_WEARABLES = 15; +// public static readonly int MAX_WEARABLES = 15; + public static readonly int PHYSICS = 15; + public static readonly int MAX_WEARABLES = 16; + public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); -- cgit v1.1 From 16bcd86dfbdbdb1be77bf6673729f77509a9793b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 Aug 2014 00:01:49 +0100 Subject: back to max 15 wearables until its safe ( and before i kill other grid regions) --- OpenSim/Framework/AvatarWearable.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 271c90f..2d411e3 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -68,9 +68,9 @@ namespace OpenSim.Framework public static readonly int ALPHA = 13; public static readonly int TATTOO = 14; -// public static readonly int MAX_WEARABLES = 15; - public static readonly int PHYSICS = 15; - public static readonly int MAX_WEARABLES = 16; + public static readonly int MAX_WEARABLES = 15; +// public static readonly int PHYSICS = 15; +// public static readonly int MAX_WEARABLES = 16; public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); -- cgit v1.1 From 998e3d435ae70536c386ab4a6337644da57a12b5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 Aug 2014 01:39:19 +0100 Subject: DANGER back to right current max number of wearables ( TP out of regions with this may kill old regions) --- OpenSim/Framework/AvatarWearable.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 2d411e3..271c90f 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -68,9 +68,9 @@ namespace OpenSim.Framework public static readonly int ALPHA = 13; public static readonly int TATTOO = 14; - public static readonly int MAX_WEARABLES = 15; -// public static readonly int PHYSICS = 15; -// public static readonly int MAX_WEARABLES = 16; +// public static readonly int MAX_WEARABLES = 15; + public static readonly int PHYSICS = 15; + public static readonly int MAX_WEARABLES = 16; public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); -- cgit v1.1 From ddfb05e57a510ead0dcd5c21e348feafd0215e3a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 9 Aug 2014 05:31:09 +0200 Subject: Comment out stupid XEngine-bound message about script vs non-script startup, it's annoyed me for a long time. Comment out periodic stats as well, they've never been useful to us and just cause console spew. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index cbd34a2..3055865 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -59,7 +59,7 @@ namespace OpenSim.Framework.Servers /// This will control a periodic log printout of the current 'show stats' (if they are active) for this /// server. /// - private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); +// private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); /// /// Random uuid for private data @@ -77,8 +77,8 @@ namespace OpenSim.Framework.Servers // Random uuid for private data m_osSecret = UUID.Random().ToString(); - m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); - m_periodicDiagnosticsTimer.Enabled = true; +// m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); +// m_periodicDiagnosticsTimer.Enabled = true; } /// @@ -145,9 +145,9 @@ namespace OpenSim.Framework.Servers TimeSpan timeTaken = DateTime.Now - m_startuptime; - MainConsole.Instance.OutputFormat( - "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.", - timeTaken.Minutes, timeTaken.Seconds); +// MainConsole.Instance.OutputFormat( +// "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.", +// timeTaken.Minutes, timeTaken.Seconds); } public string osSecret -- cgit v1.1 From 3e7f475e58500fc51025c6ccbd521ad581687a9f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 21:08:01 +0100 Subject: fix the damm thing --- OpenSim/Framework/Util.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 1775fef..b8b78fa 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -58,6 +58,15 @@ namespace OpenSim.Framework public enum PermissionMask : uint { None = 0, + + // folded perms + foldedTransfer = 1, + foldedModify = 1 << 1, + foldedCopy = 1 << 2, + + foldedMask = 0x07, + + // Transfer = 1 << 13, Modify = 1 << 14, Copy = 1 << 15, @@ -243,14 +252,12 @@ namespace OpenSim.Framework /// /// A 3d vector /// A new vector which is normalized form of the vector - /// The vector paramater cannot be <0,0,0> + public static Vector3 GetNormalizedVector(Vector3 a) { - if (IsZeroVector(a)) - throw new ArgumentException("Vector paramater cannot be a zero vector."); - - float Mag = (float) GetMagnitude(a); - return new Vector3(a.X / Mag, a.Y / Mag, a.Z / Mag); + Vector3 v = new Vector3(a.X, a.Y, a.Z); + v.Normalize(); + return v; } /// -- cgit v1.1 From a1cc218f10be109e6cca19f8e39d877243974984 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 01:53:51 +0100 Subject: *DANGER* make baked textures cross and make use of it * UNTESTED * issue: alll this seems to be sent back to childs, need to stop that --- OpenSim/Framework/AvatarAppearance.cs | 17 +++++++++- OpenSim/Framework/WearableCacheItem.cs | 60 +++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index c384336..25ae0ec 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -183,7 +183,7 @@ namespace OpenSim.Framework m_attachments = new Dictionary>(); } - public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) + public AvatarAppearance(AvatarAppearance appearance): this(appearance, true) { } @@ -221,6 +221,8 @@ namespace OpenSim.Framework { byte[] tbytes = appearance.Texture.GetBytes(); m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); + if (appearance.m_cacheitems != null) + m_cacheitems = (WearableCacheItem[]) appearance.m_cacheitems.Clone(); } m_visualparams = null; @@ -723,6 +725,13 @@ namespace OpenSim.Framework } data["textures"] = textures; + if (m_cacheitems != null) + { + OSDArray baked = WearableCacheItem.BakedToOSD(m_cacheitems); + if (baked != null) + data["bakedcache"] = baked; + } + // Visual Parameters OSDBinary visualparams = new OSDBinary(m_visualparams); data["visualparams"] = visualparams; @@ -789,6 +798,12 @@ namespace OpenSim.Framework m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); } + if ((data != null) && (data["bakedcache"] != null) && (data["bakedcache"]).Type == OSDType.Array) + { + OSDArray bakedOSDArray = (OSDArray)(data["bakedcache"]); + m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray); + } + // Visual Parameters SetDefaultParams(); if ((data != null) && (data["visualparams"] != null)) diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index a890d3b..f49697d 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -49,7 +49,6 @@ namespace OpenSim.Framework retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i}; return retitems; } - public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache) { @@ -100,6 +99,7 @@ namespace OpenSim.Framework return ret.ToArray(); } + public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache) { OSDArray arr = new OSDArray(); @@ -126,6 +126,64 @@ namespace OpenSim.Framework } return arr; } + + public static OSDArray BakedToOSD(WearableCacheItem[] pcacheItems) + { + if (pcacheItems.Length < AvatarAppearance.BAKE_INDICES[AvatarAppearance.BAKE_INDICES.Length - 1]) + return null; + + OSDArray arr = new OSDArray(); + + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) + { + int idx = AvatarAppearance.BAKE_INDICES[i]; + + WearableCacheItem item = pcacheItems[idx]; + + OSDMap itemmap = new OSDMap(); + itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); + itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); + itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); + if (item.TextureAsset != null) + { + itemmap.Add("assetdata", OSD.FromBinary(item.TextureAsset.Data)); + itemmap.Add("assetcreator", OSD.FromString(item.TextureAsset.CreatorID)); + itemmap.Add("assetname", OSD.FromString(item.TextureAsset.Name)); + } + arr.Add(itemmap); + } + return arr; + } + + public static WearableCacheItem[] BakedFromOSD(OSD pInput) + { + WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem(); + + if (pInput.Type == OSDType.Array) + { + OSDArray itemarray = (OSDArray)pInput; + foreach (OSDMap item in itemarray) + { + int idx = (int)item["textureindex"].AsUInteger(); + if (idx < 0 || idx > pcache.Length) + continue; + pcache[idx].CacheId = item["cacheid"].AsUUID(); + pcache[idx].TextureID = item["textureid"].AsUUID(); + if (item.ContainsKey("assetdata")) + { + AssetBase asset = new AssetBase(item["textureid"].AsUUID(), "BakedTexture", (sbyte)AssetType.Texture, UUID.Zero.ToString()); + asset.Temporary = true; + asset.Local = true; + asset.Data = item["assetdata"].AsBinary(); + pcache[idx].TextureAsset = asset; + } + else + pcache[idx].TextureAsset = null; + } + } + return pcache; + } + public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems) { for (int i = 0; i < pcacheItems.Length; i++) -- cgit v1.1 From 395903d58fceb98d467daa49aaa277f54ea3f230 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 02:36:50 +0100 Subject: *DANGER* dont send baked textures assets to Neighbours. Possible we could send a lot less --- OpenSim/Framework/AvatarAppearance.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 25ae0ec..3874c47 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -183,11 +183,16 @@ namespace OpenSim.Framework m_attachments = new Dictionary>(); } - public AvatarAppearance(AvatarAppearance appearance): this(appearance, true) + public AvatarAppearance(AvatarAppearance appearance): this(appearance, true,true) { } public AvatarAppearance(AvatarAppearance appearance, bool copyWearables) + : this(appearance, copyWearables, true) + { + } + + public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked) { // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); @@ -221,8 +226,10 @@ namespace OpenSim.Framework { byte[] tbytes = appearance.Texture.GetBytes(); m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); - if (appearance.m_cacheitems != null) - m_cacheitems = (WearableCacheItem[]) appearance.m_cacheitems.Clone(); + if (copyBaked && appearance.m_cacheitems != null) + m_cacheitems = (WearableCacheItem[])appearance.m_cacheitems.Clone(); + else + m_cacheitems = null; } m_visualparams = null; -- cgit v1.1 From 8c657e48377213e7ee66c05a4047085cee6084ea Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 20:41:36 +0100 Subject: add a estimator of client ping time, and painfully make it visible in show connections console command --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 22cc79d..3b0430b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -755,6 +755,8 @@ namespace OpenSim.Framework /// bool IsActive { get; set; } + int PingTimeMS { get; } + /// /// Set if the client is closing due to a logout request /// -- cgit v1.1 From 447fd0850ae3e5e4165561185dca8e5f99904e75 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 21:39:37 +0100 Subject: remove duplication of textures, wearables and attachments on crossings. receiver checks old method if it doesnt get packed appeareace --- OpenSim/Framework/ChildAgentDataUpdate.cs | 83 ++++++++++++++++++------------- 1 file changed, 49 insertions(+), 34 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 5beb37d..91df64d 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -431,6 +431,8 @@ namespace OpenSim.Framework // The code to pack textures, visuals, wearables and attachments // should be removed; packed appearance contains the full appearance // This is retained for backward compatibility only + +/* then lets remove if (Appearance.Texture != null) { byte[] rawtextures = Appearance.Texture.GetBytes(); @@ -459,7 +461,7 @@ namespace OpenSim.Framework args["attachments"] = attachs; } // End of code to remove - +*/ if ((Controllers != null) && (Controllers.Length > 0)) { OSDArray controls = new OSDArray(Controllers.Length); @@ -647,58 +649,71 @@ namespace OpenSim.Framework // AgentTextures[i++] = o.AsUUID(); //} - Appearance = new AvatarAppearance(); - // The code to unpack textures, visuals, wearables and attachments - // should be removed; packed appearance contains the full appearance - // This is retained for backward compatibility only - if (args["texture_entry"] != null) + // packed_appearence should contain all appearance information + if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) { - byte[] rawtextures = args["texture_entry"].AsBinary(); - Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); - Appearance.SetTextureEntries(textures); + m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance"); + Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); } + else + { + // if missing try the old pack method + m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method"); - if (args["visual_params"] != null) - Appearance.SetVisualParams(args["visual_params"].AsBinary()); + Appearance = new AvatarAppearance(); - if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) - { - OSDArray wears = (OSDArray)(args["wearables"]); + // The code to unpack textures, visuals, wearables and attachments + // should be removed; packed appearance contains the full appearance + // This is retained for backward compatibility only + if (args["texture_entry"] != null) + { + byte[] rawtextures = args["texture_entry"].AsBinary(); + Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length); + Appearance.SetTextureEntries(textures); + } - int count = wears.Count; - if (count > AvatarWearable.MAX_WEARABLES) - count = AvatarWearable.MAX_WEARABLES; + if (args["visual_params"] != null) + Appearance.SetVisualParams(args["visual_params"].AsBinary()); - for (int i = 0; i < count / 2; i++) + if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) { - AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); - Appearance.SetWearable(i,awear); + OSDArray wears = (OSDArray)(args["wearables"]); + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count / 2; i++) + { + AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); + Appearance.SetWearable(i, awear); + } } - } - if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) - { - OSDArray attachs = (OSDArray)(args["attachments"]); - foreach (OSD o in attachs) + if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) { - if (o.Type == OSDType.Map) + OSDArray attachs = (OSDArray)(args["attachments"]); + foreach (OSD o in attachs) { - // We know all of these must end up as attachments so we - // append rather than replace to ensure multiple attachments - // per point continues to work -// m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); - Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); + if (o.Type == OSDType.Map) + { + // We know all of these must end up as attachments so we + // append rather than replace to ensure multiple attachments + // per point continues to work + // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); + Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); + } } } + // end of code to remove } - // end of code to remove - +/* moved above if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); else m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); - +*/ if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) { OSDArray controls = (OSDArray)(args["controllers"]); -- cgit v1.1 From ff518e7cbbb9f810db4bb9374b98390bd5fb3f11 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 02:12:45 +0100 Subject: make webutilmore verbose on PUT for avatar updates. Reduce LargeTime debug level to 500ms from 3000ms --- OpenSim/Framework/WebUtil.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 33ef8e0..86e5293 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -81,7 +81,7 @@ namespace OpenSim.Framework /// Number of milliseconds a call can take before it is considered /// a "long" call for warning & debugging purposes /// - public const int LongCallTime = 3000; + public const int LongCallTime = 500; /// /// The maximum length of any data logged because of a long request time. @@ -208,6 +208,9 @@ namespace OpenSim.Framework string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; + int tickcompressdata = 0; + int tickJsondata = 0; + int compsize = 0; string strBuffer = null; try @@ -225,6 +228,8 @@ namespace OpenSim.Framework { strBuffer = OSDParser.SerializeJsonString(data); + tickJsondata = Util.EnvironmentTickCountSubtract(tickstart); + if (DebugLevel >= 5) LogOutgoingDetail(strBuffer); @@ -243,13 +248,19 @@ namespace OpenSim.Framework // gets written on the strteam upon Dispose() } byte[] buf = ms.ToArray(); + + tickcompressdata = Util.EnvironmentTickCountSubtract(tickstart); + request.ContentLength = buf.Length; //Count bytes to send + compsize = buf.Length; using (Stream requestStream = request.GetRequestStream()) requestStream.Write(buf, 0, (int)buf.Length); } } else { + tickcompressdata = tickJsondata; + compsize = buffer.Length; request.ContentType = "application/json"; request.ContentLength = buffer.Length; //Count bytes to send using (Stream requestStream = request.GetRequestStream()) @@ -291,12 +302,16 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing({5} at Json; {6} at comp), {7} bytes ({8} uncomp): {9}", reqnum, method, url, tickdiff, tickdata, + tickJsondata, + tickcompressdata, + compsize, + strBuffer != null ? strBuffer.Length : 0, strBuffer != null ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) : ""); -- cgit v1.1 From 88587b4e73b240693bd03172d52c4f13b5f47868 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Aug 2014 21:41:16 +0100 Subject: reserve updates priority queue 2 for attachments, send them by it on BestAvatarResp scheme. Attachments cannot be sent on imediate queues, since they will block everything. Changed distance to priority math, keeping identical result, shifted to start at queue 3. --- OpenSim/Framework/PriorityQueue.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index e4f1111..d6c39a7 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -62,7 +62,9 @@ namespace OpenSim.Framework private uint m_nextQueue = 0; private uint m_countFromQueue = 0; // first queues are imediate, so no counts - private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1}; +// private uint[] m_queueCounts = { 0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1 }; + private uint[] m_queueCounts = {0, 0, 8, 8, 5, 4, 3, 2, 1, 1, 1, 1}; + // this is ava, ava, attach, <10m, 20,40,80,160m,320,640,1280, + // next request is a counter of the number of updates queued, it provides // a total ordering on the updates coming through the queue and is more -- cgit v1.1 From 5bf145a3977a55c474106bbe2a6c107dd9457f0d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Aug 2014 00:49:10 +0100 Subject: add a direct sendpartfullUpdate to send a full object update to a part, optionally overriding its parentID. check what it does to attachments --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 3b0430b..d73802e 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1116,6 +1116,8 @@ namespace OpenSim.Framework /// void SendKillObject(List localID); + void SendPartFullUpdate(ISceneEntity ent, uint? parentID); + void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); -- cgit v1.1 From 63d1916f511fdbbec8bc111f4bf80b3e4e0bc267 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Aug 2014 20:59:11 +0100 Subject: Remove entities from updates queues on kill. Do it sync so enqueues after the kill work --- OpenSim/Framework/PriorityQueue.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index d6c39a7..4f05f65 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -134,6 +134,21 @@ namespace OpenSim.Framework return true; } + + public void Remove(List ids) + { + LookupItem lookup; + + foreach (uint localid in ids) + { + if (m_lookupTable.TryGetValue(localid, out lookup)) + { + lookup.Heap.Remove(lookup.Handle); + m_lookupTable.Remove(localid); + } + } + } + /// /// Remove an item from one of the queues. Specifically, it removes the /// oldest item from the next queue in order to provide fair access to -- cgit v1.1 From 7351d92a76ac24edce848fe7410e920f17962101 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 16:19:30 +0100 Subject: add method to get a category throttle rate --- OpenSim/Framework/IClientAPI.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index d73802e..c386c95 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1186,6 +1186,7 @@ namespace OpenSim.Framework void SetChildAgentThrottle(byte[] throttle); void SetAgentThrottleSilent(int throttle, int setting); + int GetAgentThrottleSilent(int throttle); void SendAvatarDataImmediate(ISceneEntity avatar); -- cgit v1.1 From 016e58e354e11825510e1c4bc534e275168577bc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Sep 2014 21:53:27 +0100 Subject: *test* --- OpenSim/Framework/ChildAgentDataUpdate.cs | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 91df64d..538e1b5 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -349,6 +349,8 @@ namespace OpenSim.Framework public List AttachmentObjects; public List AttachmentObjectStates; + public Dictionary MovementAnimationOverRides = new Dictionary(); + public virtual OSDMap Pack() { // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); @@ -417,6 +419,21 @@ namespace OpenSim.Framework args["animation_state"] = AnimState.PackUpdateMessage(); } + if (MovementAnimationOverRides.Count > 0) + { + OSDArray AOs = new OSDArray(MovementAnimationOverRides.Count); + { + foreach (KeyValuePair kvp in MovementAnimationOverRides) + { + OSDMap ao = new OSDMap(2); + ao["state"] = OSD.FromString(kvp.Key); + ao["uuid"] = OSD.FromUUID(kvp.Value); + AOs.Add(ao); + } + } + args["movementAO"] = AOs; + } + if (Appearance != null) args["packed_appearance"] = Appearance.Pack(); @@ -640,6 +657,25 @@ namespace OpenSim.Framework } } + MovementAnimationOverRides.Clear(); + + if (args["movementAO"] != null && args["movementAO"].Type == OSDType.Array) + { + OSDArray AOs = (OSDArray)(args["movementAO"]); + int count = AOs.Count; + + for (int i = 0; i < count; i++) + { + OSDMap ao = (OSDMap)AOs[i]; + if (ao["state"] != null && ao["uuid"] != null) + { + string state = ao["state"].AsString(); + UUID id = ao["uuid"].AsUUID(); + MovementAnimationOverRides[state] = id; + } + } + } + //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) //{ // OSDArray textures = (OSDArray)(args["agent_textures"]); -- cgit v1.1 From 9bf3e2a25745000fc9113c4b00f280fa67460601 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Sep 2014 15:36:22 +0100 Subject: dispose some tmp streams --- OpenSim/Framework/Communications/RestClient.cs | 32 +++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 42c0b18..de34250 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -329,15 +329,16 @@ namespace OpenSim.Framework.Communications return null; } - Stream src = _response.GetResponseStream(); - int length = src.Read(_readbuf, 0, BufferSize); - while (length > 0) + using (Stream src = _response.GetResponseStream()) { - _resource.Write(_readbuf, 0, length); - length = src.Read(_readbuf, 0, BufferSize); + int length = src.Read(_readbuf, 0, BufferSize); + while (length > 0) + { + _resource.Write(_readbuf, 0, length); + length = src.Read(_readbuf, 0, BufferSize); + } } - // TODO! Implement timeout, without killing the server // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); @@ -372,16 +373,19 @@ namespace OpenSim.Framework.Communications m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); src.Seek(0, SeekOrigin.Begin); m_log.Info("[REST]: Seek is ok"); - Stream dst = _request.GetRequestStream(); - m_log.Info("[REST]: GetRequestStream is ok"); - byte[] buf = new byte[1024]; - int length = src.Read(buf, 0, 1024); - m_log.Info("[REST]: First Read is ok"); - while (length > 0) + using (Stream dst = _request.GetRequestStream()) { - dst.Write(buf, 0, length); - length = src.Read(buf, 0, 1024); + m_log.Info("[REST]: GetRequestStream is ok"); + + byte[] buf = new byte[1024]; + int length = src.Read(buf, 0, 1024); + m_log.Info("[REST]: First Read is ok"); + while (length > 0) + { + dst.Write(buf, 0, length); + length = src.Read(buf, 0, 1024); + } } _response = (HttpWebResponse) _request.GetResponse(); -- cgit v1.1 From df389dceb8b9430049c3bedf3632b4df2eb91e15 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Sep 2014 16:19:00 +0100 Subject: add some _response.close. RestClient still looks bad. It should be a proper IDisposable object. --- OpenSim/Framework/Communications/RestClient.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index de34250..ce36fbf 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -326,6 +326,9 @@ namespace OpenSim.Framework.Communications m_log.Debug(e.ToString()); } + if (_response != null) + _response.Close(); + return null; } @@ -390,6 +393,9 @@ namespace OpenSim.Framework.Communications _response = (HttpWebResponse) _request.GetResponse(); + if (_response != null) + _response.Close(); + // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); // TODO! Implement timeout, without killing the server -- cgit v1.1 From 640f3f30745f77d411698739543d0eea82c44468 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 21 Sep 2014 19:24:15 +0200 Subject: A stab at brute force fixing the locking - one, make m_itemLock volatile, two, reset the lock even if the write lock is not apparently held. --- OpenSim/Framework/TaskInventoryDictionary.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 62ecbd1..2c20ef7 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -62,7 +62,7 @@ namespace OpenSim.Framework /// /// An advanced lock for inventory data /// - private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); + private volatile System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); /// /// Are we readlocked by the calling thread? @@ -143,8 +143,8 @@ namespace OpenSim.Framework while (!m_itemLock.TryEnterReadLock(60000)) { m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - if (m_itemLock.IsWriteLockHeld) - { + //if (m_itemLock.IsWriteLockHeld) + //{ m_itemLock = new System.Threading.ReaderWriterLockSlim(); // System.Console.WriteLine("------------------------------------------"); // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); @@ -153,7 +153,7 @@ namespace OpenSim.Framework // System.Console.WriteLine("------------------------------------------"); // LockedByThread = null; // ReadLockers.Clear(); - } + //} } // ReadLockers[Thread.CurrentThread] = Environment.StackTrace; } -- cgit v1.1 From 0bfba122f0b9ea036d18020c64110d041ff56151 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 22 Sep 2014 18:49:08 +0200 Subject: When a ghosted avatar is removed, also remove any remaining CAPS --- OpenSim/Framework/CustomTypes.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 OpenSim/Framework/CustomTypes.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/CustomTypes.cs b/OpenSim/Framework/CustomTypes.cs new file mode 100644 index 0000000..6ad3456 --- /dev/null +++ b/OpenSim/Framework/CustomTypes.cs @@ -0,0 +1,40 @@ +/* + * 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; + +public const sbyte CustomTypeBase = 0x60; + +public enum CustomAssetType : sbyte +{ + AnimationSet = 0x60, +} + +public enum CustomInventoryType : sbyte +{ + AnimationSet = 0x60, +} -- cgit v1.1 From a6b27a7aa45bbc0ae76ce166c425ab21ff936dac Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 24 Sep 2014 00:16:04 +0200 Subject: Add a link number field to ColliderArgs --- OpenSim/Framework/ColliderData.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ColliderData.cs b/OpenSim/Framework/ColliderData.cs index 1b7b682..00013e1 100644 --- a/OpenSim/Framework/ColliderData.cs +++ b/OpenSim/Framework/ColliderData.cs @@ -42,6 +42,7 @@ namespace OpenSim.Framework public Vector3 velVector = Vector3.Zero; public string nameStr = String.Empty; public int colliderType = 0; + public int linkNumber; } public class ColliderArgs : EventArgs -- cgit v1.1 From 80f3e8edbc416c298c401aa02f36967a2de47b18 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 24 Sep 2014 00:21:14 +0200 Subject: Fix stupid stuff. --- OpenSim/Framework/CustomTypes.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/CustomTypes.cs b/OpenSim/Framework/CustomTypes.cs index 6ad3456..d109c26 100644 --- a/OpenSim/Framework/CustomTypes.cs +++ b/OpenSim/Framework/CustomTypes.cs @@ -27,14 +27,17 @@ using System; -public const sbyte CustomTypeBase = 0x60; - -public enum CustomAssetType : sbyte +namespace OpenSim.Framework { - AnimationSet = 0x60, -} + public enum CustomAssetType : sbyte + { + CustomTypeBase = 0x60, + AnimationSet = 0x60, + } -public enum CustomInventoryType : sbyte -{ - AnimationSet = 0x60, + public enum CustomInventoryType : sbyte + { + CustomTypeBase = 0x60, + AnimationSet = 0x60, + } } -- cgit v1.1 From 2e6fd6536b9359dbd7802c5db0bfe092644f838d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Sep 2014 21:53:32 +0200 Subject: Add the AnimationSet skel --- OpenSim/Framework/AnimationSet.cs | 99 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 OpenSim/Framework/AnimationSet.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs new file mode 100644 index 0000000..8b6baab --- /dev/null +++ b/OpenSim/Framework/AnimationSet.cs @@ -0,0 +1,99 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public delegate bool Validator(UUID animID); + + public class AnimationSet + { + private readonly int m_maxAnimations = 255; + + public int AnimationCount { get; private set; } + private Dictionary m_animations = new Dictionary(); + + public UUID AnimationAt(int index) + { + if (m_animations.ContainsKey(index)) + return m_animations[index]; + return UUID.Zero; + } + + public void SetAnimation(int index, UUID animation) + { + if (index < 0 || index > m_maxAnimations) + return; + + m_animations[index] = animation; + } + + public AnimationSet(Byte[] assetData) + { + if (assetData.Length < 2) + throw new System.ArgumentException(); + + if (assetData[0] != 1) // Only version 1 is supported + throw new System.ArgumentException(); + + AnimationCount = assetData[1]; + if (assetData.Length - 2 != 16 * AnimationCount) + throw new System.ArgumentException(); + + // TODO: Read anims from blob + } + + public Byte[] ToBytes() + { + // TODO: Make blob from anims + return new Byte[0]; + } + + public bool Validate(Validator val) + { + List badAnims = new List(); + + bool allOk = true; + foreach (KeyValuePair kvp in m_animations) + { + if (!val(kvp.Value)) + { + allOk = false; + badAnims.Add(kvp.Key); + } + } + + foreach (int idx in badAnims) + m_animations.Remove(idx); + + return allOk; + } + } +} -- cgit v1.1 From 546537c056ddc132a85b4bec774994a60aebbc5d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Sep 2014 21:54:32 +0200 Subject: Rename = too generic --- OpenSim/Framework/AnimationSet.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index 8b6baab..c5ab634 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -31,7 +31,7 @@ using OpenMetaverse; namespace OpenSim.Framework { - public delegate bool Validator(UUID animID); + public delegate bool AnimationSetValidator(UUID animID); public class AnimationSet { @@ -76,7 +76,7 @@ namespace OpenSim.Framework return new Byte[0]; } - public bool Validate(Validator val) + public bool Validate(AnimationSetValidator val) { List badAnims = new List(); -- cgit v1.1 From cce31b66386270e70e833ffe4fcc2906176e31ad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:00:33 +0100 Subject: add centerlized AnimationSet item permitions setting --- OpenSim/Framework/AnimationSet.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index c5ab634..fefe093 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -33,10 +33,29 @@ namespace OpenSim.Framework { public delegate bool AnimationSetValidator(UUID animID); + public class AnimationSet { private readonly int m_maxAnimations = 255; + public const uint allowedPermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + + public uint enforcePermitions(uint currentPerm) + { + return currentPerm & allowedPermitions; + } + + public void enforceItemPermitions(ref InventoryItemBase it) + { + if (it == null) + return; + it.CurrentPermissions &= allowedPermitions; + it.NextPermissions &= allowedPermitions; + it.EveryOnePermissions &= allowedPermitions; + it.GroupPermissions &= allowedPermitions; + it.BasePermissions &= allowedPermitions; + } + public int AnimationCount { get; private set; } private Dictionary m_animations = new Dictionary(); -- cgit v1.1 From 3e2242b4c43171f4576249d48fbb8667c8d1f169 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:06:16 +0100 Subject: change animset permitions to reflect no transfer nature --- OpenSim/Framework/AnimationSet.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index fefe093..3f6987a 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -49,11 +49,15 @@ namespace OpenSim.Framework { if (it == null) return; - it.CurrentPermissions &= allowedPermitions; - it.NextPermissions &= allowedPermitions; - it.EveryOnePermissions &= allowedPermitions; - it.GroupPermissions &= allowedPermitions; + it.BasePermissions &= allowedPermitions; + it.CurrentPermissions &= allowedPermitions; +// it.GroupPermissions &= allowedPermitions; +// it.NextPermissions &= allowedPermitions; +// it.EveryOnePermissions &= allowedPermitions; + it.GroupPermissions = 0; + it.NextPermissions = 0; + it.EveryOnePermissions = 0; } public int AnimationCount { get; private set; } -- cgit v1.1 From fcad64209c29c55cbec78ae94f221120e9956ebf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:17:01 +0100 Subject: make c# more happy --- OpenSim/Framework/AnimationSet.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index 3f6987a..f91838e 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -40,12 +40,12 @@ namespace OpenSim.Framework public const uint allowedPermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); - public uint enforcePermitions(uint currentPerm) + public static uint enforcePermition(uint currentPerm) { return currentPerm & allowedPermitions; } - public void enforceItemPermitions(ref InventoryItemBase it) + public static void enforceItemPermitions(ref InventoryItemBase it) { if (it == null) return; -- cgit v1.1 From 90cad824050ffbd081baf5338638e2e6d95903f2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 14:22:54 +0100 Subject: remove unnecessary argument ref --- OpenSim/Framework/AnimationSet.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index f91838e..7e6aa17 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -45,7 +45,7 @@ namespace OpenSim.Framework return currentPerm & allowedPermitions; } - public static void enforceItemPermitions(ref InventoryItemBase it) + public static void enforceItemPermitions(InventoryItemBase it) { if (it == null) return; -- cgit v1.1 From 46caea6987a24e07f61e3c3bef24ab4495899bda Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 15:03:33 +0100 Subject: change it again... --- OpenSim/Framework/AnimationSet.cs | 47 ++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index 7e6aa17..1743376 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -33,30 +33,55 @@ namespace OpenSim.Framework { public delegate bool AnimationSetValidator(UUID animID); - public class AnimationSet { private readonly int m_maxAnimations = 255; - public const uint allowedPermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + public const uint createBasePermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + public const uint createNextPermitions = (uint)PermissionMask.Modify; + + public const uint allowedBasePermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); + public const uint allowedNextPermitions = (uint)PermissionMask.Modify; - public static uint enforcePermition(uint currentPerm) + public static void setCreateItemPermitions(InventoryItemBase it) { - return currentPerm & allowedPermitions; + if (it == null) + return; + + it.BasePermissions = createBasePermitions; + it.CurrentPermissions = createBasePermitions; + // it.GroupPermissions &= allowedPermitions; + it.NextPermissions = createNextPermitions; + // it.EveryOnePermissions &= allowedPermitions; + it.GroupPermissions = 0; + it.EveryOnePermissions = 0; } - public static void enforceItemPermitions(InventoryItemBase it) + public static void enforceItemPermitions(InventoryItemBase it, bool IsCreator) { if (it == null) return; - it.BasePermissions &= allowedPermitions; - it.CurrentPermissions &= allowedPermitions; -// it.GroupPermissions &= allowedPermitions; -// it.NextPermissions &= allowedPermitions; -// it.EveryOnePermissions &= allowedPermitions; + uint bp; + uint np; + + if (IsCreator) + { + bp = createBasePermitions; + np = createNextPermitions; + } + else + { + bp = allowedBasePermitions; + np = allowedNextPermitions; + } + + it.BasePermissions &= bp; + it.CurrentPermissions &= bp; + // it.GroupPermissions &= allowedPermitions; + it.NextPermissions &= np; + // it.EveryOnePermissions &= allowedPermitions; it.GroupPermissions = 0; - it.NextPermissions = 0; it.EveryOnePermissions = 0; } -- cgit v1.1 From bb019945e8dfb14fcbf4db62561e488bebda7ccb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Sep 2014 15:20:45 +0100 Subject: change permitions again --- OpenSim/Framework/AnimationSet.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index 1743376..56e1068 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -37,11 +37,11 @@ namespace OpenSim.Framework { private readonly int m_maxAnimations = 255; - public const uint createBasePermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); - public const uint createNextPermitions = (uint)PermissionMask.Modify; + public const uint createBasePermitions = (uint)(PermissionMask.All); // no export ? + public const uint createNextPermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); public const uint allowedBasePermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); - public const uint allowedNextPermitions = (uint)PermissionMask.Modify; + public const uint allowedNextPermitions = 0; public static void setCreateItemPermitions(InventoryItemBase it) { -- cgit v1.1 From 3ea76e3131203f6a553d5a540d5d28aa5ca3f74a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 27 Sep 2014 02:30:01 +0200 Subject: Make changes to AnimationSet to allow indexing by names rather than indices. Add some debugging output and prepare for parsing an ascii-based format. --- OpenSim/Framework/AnimationSet.cs | 61 +++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 35 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index c5ab634..e81d978 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -35,53 +35,44 @@ namespace OpenSim.Framework public class AnimationSet { - private readonly int m_maxAnimations = 255; + private bool m_parseError = false; public int AnimationCount { get; private set; } - private Dictionary m_animations = new Dictionary(); - - public UUID AnimationAt(int index) - { - if (m_animations.ContainsKey(index)) - return m_animations[index]; - return UUID.Zero; - } - - public void SetAnimation(int index, UUID animation) + private Dictionary m_animations = new Dictionary(); + public AnimationSet(Byte[] data) { - if (index < 0 || index > m_maxAnimations) - return; - - m_animations[index] = animation; - } - - public AnimationSet(Byte[] assetData) - { - if (assetData.Length < 2) - throw new System.ArgumentException(); - - if (assetData[0] != 1) // Only version 1 is supported - throw new System.ArgumentException(); - - AnimationCount = assetData[1]; - if (assetData.Length - 2 != 16 * AnimationCount) - throw new System.ArgumentException(); - - // TODO: Read anims from blob + string assetData = System.Text.Encoding.ASCII.GetString(data); + Console.WriteLine("--------------------"); + Console.WriteLine("AnimationSet length {0} bytes", assetData.Length); + Console.WriteLine("Data: {0}", assetData); + Console.WriteLine("--------------------"); } public Byte[] ToBytes() { - // TODO: Make blob from anims - return new Byte[0]; + // If there was an error parsing the input, we give back an + // empty set rather than the original data. + if (m_parseError) + { + string dummy = "version 1\ncount 0\n"; + return System.Text.Encoding.ASCII.GetBytes(dummy); + } + + string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count); + foreach (KeyValuePair kvp in m_animations) + assetData += String.Format("{0} {1}\n", kvp.Key, kvp.Value.ToString()); + return System.Text.Encoding.ASCII.GetBytes(assetData); } public bool Validate(AnimationSetValidator val) { - List badAnims = new List(); + if (m_parseError) + return false; + + List badAnims = new List(); bool allOk = true; - foreach (KeyValuePair kvp in m_animations) + foreach (KeyValuePair kvp in m_animations) { if (!val(kvp.Value)) { @@ -90,7 +81,7 @@ namespace OpenSim.Framework } } - foreach (int idx in badAnims) + foreach (string idx in badAnims) m_animations.Remove(idx); return allOk; -- cgit v1.1 From c66e4eeb7d2d22a965650b425fdfbd3bbd317d2f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 3 Oct 2014 18:27:14 +0200 Subject: Also store names of assets in the AnimationSet --- OpenSim/Framework/AnimationSet.cs | 42 +++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index e81d978..fa71405 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -38,13 +38,43 @@ namespace OpenSim.Framework private bool m_parseError = false; public int AnimationCount { get; private set; } - private Dictionary m_animations = new Dictionary(); + private Dictionary> m_animations = new Dictionary>(); + + public UUID GetAnimation(string index) + { + KeyValuePair val; + if (m_animations.TryGetValue(index, out val)) + return val.Value; + + return UUID.Zero; + } + + public string GetAnimationName(string index) + { + KeyValuePair val; + if (m_animations.TryGetValue(index, out val)) + return val.Key; + + return String.Empty; + } + + public void SetAnimation(string index, string name, UUID anim) + { + if (anim == UUID.Zero) + { + m_animations.Remove(index); + return; + } + + m_animations[index] = new KeyValuePair(name, anim); + } + public AnimationSet(Byte[] data) { string assetData = System.Text.Encoding.ASCII.GetString(data); Console.WriteLine("--------------------"); Console.WriteLine("AnimationSet length {0} bytes", assetData.Length); - Console.WriteLine("Data: {0}", assetData); + Console.WriteLine(assetData); Console.WriteLine("--------------------"); } @@ -59,8 +89,8 @@ namespace OpenSim.Framework } string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count); - foreach (KeyValuePair kvp in m_animations) - assetData += String.Format("{0} {1}\n", kvp.Key, kvp.Value.ToString()); + foreach (KeyValuePair> kvp in m_animations) + assetData += String.Format("{0} {1} {2}\n", kvp.Key, kvp.Value.Value.ToString(), kvp.Value.Key); return System.Text.Encoding.ASCII.GetBytes(assetData); } @@ -72,9 +102,9 @@ namespace OpenSim.Framework List badAnims = new List(); bool allOk = true; - foreach (KeyValuePair kvp in m_animations) + foreach (KeyValuePair> kvp in m_animations) { - if (!val(kvp.Value)) + if (!val(kvp.Value.Value)) { allOk = false; badAnims.Add(kvp.Key); -- cgit v1.1 From 8558e97a44048e2d15c58e6d994c317d58154642 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 13 Oct 2014 11:38:51 +0100 Subject: tune poll smartThreadpool use and give it a name --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 4058229..51a1136 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -57,24 +57,27 @@ namespace OpenSim.Framework.Servers.HttpServer private bool m_running = true; private int slowCount = 0; - private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); + private SmartThreadPool m_threadPool; public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) { m_server = pSrv; m_WorkerThreadCount = pWorkerThreadCount; m_workerThreads = new Thread[m_WorkerThreadCount]; + m_threadPool = new SmartThreadPool(30000, 15, 1); + m_threadPool.Name = "PoolService"; } public void Start() { + m_threadPool.Start(); //startup worker threads for (uint i = 0; i < m_WorkerThreadCount; i++) { m_workerThreads[i] = Watchdog.StartThread( PoolWorkerJob, - string.Format("PollServiceWorkerThread{0}:{1}", i, m_server.Port), + string.Format("PollServiceWorkerThread {0}:{1}", i, m_server.Port), ThreadPriority.Normal, false, false, -- cgit v1.1 From cd87c4bec5490311d47e401acab3915f394f1a22 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 13 Oct 2014 12:00:31 +0100 Subject: change/fix previus commits --- .../Servers/HttpServer/PollServiceRequestManager.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 51a1136..e75b705 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -64,8 +64,16 @@ namespace OpenSim.Framework.Servers.HttpServer m_server = pSrv; m_WorkerThreadCount = pWorkerThreadCount; m_workerThreads = new Thread[m_WorkerThreadCount]; - m_threadPool = new SmartThreadPool(30000, 15, 1); - m_threadPool.Name = "PoolService"; + + STPStartInfo startInfo = new STPStartInfo(); + startInfo.IdleTimeout = 30000; + startInfo.MaxWorkerThreads = 15; + startInfo.MinWorkerThreads = 1; + startInfo.ThreadPriority = ThreadPriority.Normal; + startInfo.StartSuspended = true; + startInfo.ThreadPoolName = "PoolService"; + + m_threadPool = new SmartThreadPool(startInfo); } public void Start() -- cgit v1.1 From a301bad8ad047f4acf122d5b47be8d81c371c3c3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 13 Oct 2014 12:10:13 +0100 Subject: on util thread pool reduce the min number of threads, increase the maximum and increase the idle time before release to OS --- OpenSim/Framework/Util.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index b8b78fa..d807e2a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1850,7 +1850,7 @@ namespace OpenSim.Framework STPStartInfo startInfo = new STPStartInfo(); startInfo.ThreadPoolName = "Util"; - startInfo.IdleTimeout = 2000; + startInfo.IdleTimeout = 20000; startInfo.MaxWorkerThreads = maxThreads; startInfo.MinWorkerThreads = minThreads; -- cgit v1.1 From c643ff4cbadbe632654ff97d4d71f6abaa5b8605 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 15 Oct 2014 14:14:25 +0100 Subject: fix some errors when using http debug level > 4 --- OpenSim/Framework/WebUtil.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 86e5293..b5152e0 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -189,7 +189,10 @@ namespace OpenSim.Framework { if (DebugLevel == 5) { - output = output.Substring(0, 80); + int len = output.Length; + if(len > 80) + len = 80; + output = output.Substring(0, len); output = output + "..."; } @@ -1035,13 +1038,13 @@ namespace OpenSim.Framework { writer.Write(obj); writer.Flush(); + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); } length = (int)obj.Length; request.ContentLength = length; - if (WebUtil.DebugLevel >= 5) - WebUtil.LogOutgoingDetail(buffer); Stream requestStream = null; try @@ -1188,14 +1191,13 @@ namespace OpenSim.Framework XmlSerializer serializer = new XmlSerializer(type); serializer.Serialize(writer, obj); writer.Flush(); + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); } int length = (int)buffer.Length; request.ContentLength = length; - if (WebUtil.DebugLevel >= 5) - WebUtil.LogOutgoingDetail(buffer); - Stream requestStream = null; try { -- cgit v1.1 From 2bea66ed27d86ddd7f34ee1e7d0292ae4f1c5644 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 17 Oct 2014 14:07:11 +0100 Subject: send motion control state in update to childs. Reset CollisionPlane on makechild --- OpenSim/Framework/ChildAgentDataUpdate.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 538e1b5..5078f69 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -320,6 +320,7 @@ namespace OpenSim.Framework public Animation[] Anims; public Animation DefaultAnim = null; public Animation AnimState = null; + public Byte MotionState = 0; public UUID GranterID; public UUID ParentPart; @@ -434,6 +435,11 @@ namespace OpenSim.Framework args["movementAO"] = AOs; } + if (MotionState != 0) + { + args["motion_state"] = OSD.FromInteger(MotionState); + } + if (Appearance != null) args["packed_appearance"] = Appearance.Pack(); @@ -676,6 +682,9 @@ namespace OpenSim.Framework } } + if (args.ContainsKey("motion_state")) + MotionState = (byte)args["motion_state"].AsInteger(); + //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) //{ // OSDArray textures = (OSDArray)(args["agent_textures"]); -- cgit v1.1 From f44c29effbd0d14427f288470aee028e9e09d6e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 19 Oct 2014 15:51:12 +0100 Subject: try to fix propagation of seeds to all relevante regions --- OpenSim/Framework/ChildAgentDataUpdate.cs | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 5078f69..0763bbc 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -94,6 +94,7 @@ namespace OpenSim.Framework // This probably shouldn't be here public byte[] Throttles; + public Dictionary ChildrenCapSeeds = null; public OSDMap Pack() { @@ -119,6 +120,19 @@ namespace OpenSim.Framework if ((Throttles != null) && (Throttles.Length > 0)) args["throttles"] = OSD.FromBinary(Throttles); + if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0) + { + OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count); + foreach (KeyValuePair kvp in ChildrenCapSeeds) + { + OSDMap pair = new OSDMap(); + pair["handle"] = OSD.FromString(kvp.Key.ToString()); + pair["seed"] = OSD.FromString(kvp.Value); + childrenSeeds.Add(pair); + } + args["children_seeds"] = childrenSeeds; + } + return args; } @@ -165,6 +179,30 @@ namespace OpenSim.Framework if (args["throttles"] != null) Throttles = args["throttles"].AsBinary(); + + if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) && + (args["children_seeds"].Type == OSDType.Array)) + { + OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); + ChildrenCapSeeds = new Dictionary(); + foreach (OSD o in childrenSeeds) + { + if (o.Type == OSDType.Map) + { + ulong handle = 0; + string seed = ""; + OSDMap pair = (OSDMap)o; + if (pair["handle"] != null) + if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) + continue; + if (pair["seed"] != null) + seed = pair["seed"].AsString(); + if (!ChildrenCapSeeds.ContainsKey(handle)) + ChildrenCapSeeds.Add(handle, seed); + } + } + } + } /// -- cgit v1.1 From afa9b4a002f0cc929d60e1770535eefcdefe3a43 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 20 Oct 2014 09:14:27 +0100 Subject: Assume childreen don't need to know caps seeds --- OpenSim/Framework/ChildAgentDataUpdate.cs | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 0763bbc..a714d86 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -355,6 +355,7 @@ namespace OpenSim.Framework public UUID ActiveGroupID; public AgentGroupData[] Groups; + public Dictionary ChildrenCapSeeds = null; public Animation[] Anims; public Animation DefaultAnim = null; public Animation AnimState = null; @@ -440,6 +441,19 @@ namespace OpenSim.Framework args["groups"] = groups; } + if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0) + { + OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count); + foreach (KeyValuePair kvp in ChildrenCapSeeds) + { + OSDMap pair = new OSDMap(); + pair["handle"] = OSD.FromString(kvp.Key.ToString()); + pair["seed"] = OSD.FromString(kvp.Value); + childrenSeeds.Add(pair); + } + args["children_seeds"] = childrenSeeds; + } + if ((Anims != null) && (Anims.Length > 0)) { OSDArray anims = new OSDArray(Anims.Length); @@ -663,6 +677,29 @@ namespace OpenSim.Framework } } + if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) && + (args["children_seeds"].Type == OSDType.Array)) + { + OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); + ChildrenCapSeeds = new Dictionary(); + foreach (OSD o in childrenSeeds) + { + if (o.Type == OSDType.Map) + { + ulong handle = 0; + string seed = ""; + OSDMap pair = (OSDMap)o; + if (pair["handle"] != null) + if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) + continue; + if (pair["seed"] != null) + seed = pair["seed"].AsString(); + if (!ChildrenCapSeeds.ContainsKey(handle)) + ChildrenCapSeeds.Add(handle, seed); + } + } + } + if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array) { OSDArray anims = (OSDArray)(args["animations"]); -- cgit v1.1 From fd79f75ba6766e1edc196a73dd05fc5f806f82b2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 24 Oct 2014 02:12:30 +0100 Subject: TEST**** wingridproxy detection at grid login. Untested possible not very reliable. Adds some load even on region servers because of code at BaseHttpServer. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 7841f47..799ab80 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -966,6 +966,19 @@ namespace OpenSim.Framework.Servers.HttpServer string responseString = String.Empty; XmlRpcRequest xmlRprcRequest = null; + bool gridproxy = false; + if (requestBody.Contains("encoding=\"utf-8")) + { + int channelindx = -1; + int optionsindx = requestBody.IndexOf(">options<"); + if(optionsindx >0) + { + channelindx = requestBody.IndexOf(">channel<"); + if (optionsindx < channelindx) + gridproxy = true; + } + } + try { xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); @@ -1023,6 +1036,8 @@ namespace OpenSim.Framework.Servers.HttpServer } xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] + if (gridproxy) + xmlRprcRequest.Params.Add("gridproxy"); // Param[4] try { xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); -- cgit v1.1 From 4cbc13b52fcd6082012a36a71a53ddf981726c65 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 24 Oct 2014 19:50:51 +0100 Subject: don't send pack baked texture assets into updates. --- OpenSim/Framework/AvatarAppearance.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3874c47..478851d 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -732,13 +732,14 @@ namespace OpenSim.Framework } data["textures"] = textures; +/* don't send bakes. if (m_cacheitems != null) { OSDArray baked = WearableCacheItem.BakedToOSD(m_cacheitems); if (baked != null) data["bakedcache"] = baked; } - +*/ // Visual Parameters OSDBinary visualparams = new OSDBinary(m_visualparams); data["visualparams"] = visualparams; -- cgit v1.1 From 736490dcb60047e6060c13c990f13dc0c1bf0ea6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Oct 2014 18:13:44 +0000 Subject: dont send baked textures assets, but send cache information --- OpenSim/Framework/WearableCacheItem.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index f49697d..af28abc 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -144,12 +144,14 @@ namespace OpenSim.Framework itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); +/* if (item.TextureAsset != null) { itemmap.Add("assetdata", OSD.FromBinary(item.TextureAsset.Data)); itemmap.Add("assetcreator", OSD.FromString(item.TextureAsset.CreatorID)); itemmap.Add("assetname", OSD.FromString(item.TextureAsset.Name)); } + */ arr.Add(itemmap); } return arr; @@ -169,6 +171,7 @@ namespace OpenSim.Framework continue; pcache[idx].CacheId = item["cacheid"].AsUUID(); pcache[idx].TextureID = item["textureid"].AsUUID(); +/* if (item.ContainsKey("assetdata")) { AssetBase asset = new AssetBase(item["textureid"].AsUUID(), "BakedTexture", (sbyte)AssetType.Texture, UUID.Zero.ToString()); @@ -178,6 +181,7 @@ namespace OpenSim.Framework pcache[idx].TextureAsset = asset; } else + */ pcache[idx].TextureAsset = null; } } -- cgit v1.1 From 932b52f1bf24805a2a7546535f92b13dc4a37568 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Oct 2014 18:22:46 +0000 Subject: missing file --- OpenSim/Framework/AvatarAppearance.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 478851d..3874c47 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -732,14 +732,13 @@ namespace OpenSim.Framework } data["textures"] = textures; -/* don't send bakes. if (m_cacheitems != null) { OSDArray baked = WearableCacheItem.BakedToOSD(m_cacheitems); if (baked != null) data["bakedcache"] = baked; } -*/ + // Visual Parameters OSDBinary visualparams = new OSDBinary(m_visualparams); data["visualparams"] = visualparams; -- cgit v1.1 From f2ea426453e4672aeec3a26c607ca820833e96a3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Nov 2014 15:52:05 +0000 Subject: debug msg --- OpenSim/Framework/WebUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index b5152e0..82e777b 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -281,7 +281,7 @@ namespace OpenSim.Framework { string responseStr = null; responseStr = responseStream.GetStreamString(); - // m_log.DebugFormat("[WEB UTIL]: <{0}> response is <{1}>",reqnum,responseStr); + m_log.DebugFormat("[WEB UTIL]: <{0}> response is <{1}>",reqnum,responseStr); return CanonicalizeResults(responseStr); } } -- cgit v1.1 From 377a8072dcc39728f171d3e15100ba269857aa7f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Nov 2014 16:04:22 +0000 Subject: remove last debug msg --- OpenSim/Framework/WebUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 82e777b..3625a1f 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -281,7 +281,7 @@ namespace OpenSim.Framework { string responseStr = null; responseStr = responseStream.GetStreamString(); - m_log.DebugFormat("[WEB UTIL]: <{0}> response is <{1}>",reqnum,responseStr); + //m_log.DebugFormat("[WEB UTIL]: <{0}> response is <{1}>",reqnum,responseStr); return CanonicalizeResults(responseStr); } } -- cgit v1.1 From caddabb5c4f62767305a589e9d818ae3457a8030 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Nov 2014 22:25:16 +0000 Subject: scale ChildAgentThrottles with distance (internal to child server and not root as was done before ) --- OpenSim/Framework/IClientAPI.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c386c95..4bb865a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1184,6 +1184,7 @@ namespace OpenSim.Framework void SendCoarseLocationUpdate(List users, List CoarseLocations); void SetChildAgentThrottle(byte[] throttle); + void SetChildAgentThrottle(byte[] throttle,float factor); void SetAgentThrottleSilent(int throttle, int setting); int GetAgentThrottleSilent(int throttle); -- cgit v1.1 From 64deb6ae6fdf586bcd2e940d3cbf3ee54367dc83 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2014 19:49:58 +0100 Subject: Second part of invisible base avatar option --- OpenSim/Framework/AvatarAppearance.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3874c47..257997e 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -72,6 +72,7 @@ namespace OpenSim.Framework protected float m_avatarAnimOffset = 0; protected WearableCacheItem[] m_cacheitems; protected bool m_cacheItemsDirty = true; + public static Primitive.TextureEntry Invisible = null; public virtual int Serial { @@ -134,8 +135,30 @@ namespace OpenSim.Framework set { m_cacheItemsDirty = value; } } + private void CreateInvisibleTextureEntry() + { + if (Invisible != null) + return; + Invisible = new Primitive.TextureEntry(new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); + + Invisible.FaceTextures[8] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[8].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[9] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[9].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[10] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[10].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[11] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[11].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[19] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[19].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + Invisible.FaceTextures[20] = new Primitive.TextureEntryFace(null); + Invisible.FaceTextures[20].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); + } + public AvatarAppearance() { + CreateInvisibleTextureEntry(); + // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); m_serial = 0; @@ -149,6 +172,9 @@ namespace OpenSim.Framework public AvatarAppearance(OSDMap map) { + CreateInvisibleTextureEntry(); + + Invisible = new Primitive.TextureEntry(new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); Unpack(map); @@ -157,6 +183,7 @@ namespace OpenSim.Framework public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) { + CreateInvisibleTextureEntry(); // m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); m_serial = 0; @@ -194,6 +221,7 @@ namespace OpenSim.Framework public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked) { + CreateInvisibleTextureEntry(); // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); if (appearance == null) -- cgit v1.1 From bec456c2a529ca0b9ca7fd59e8110e5d5b27c126 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 11 Nov 2014 07:09:30 +0100 Subject: Remove the Invisible stuff and add more baked caching. Refactor selection of textures to save to Bakes module. --- OpenSim/Framework/AvatarAppearance.cs | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 257997e..3874c47 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -72,7 +72,6 @@ namespace OpenSim.Framework protected float m_avatarAnimOffset = 0; protected WearableCacheItem[] m_cacheitems; protected bool m_cacheItemsDirty = true; - public static Primitive.TextureEntry Invisible = null; public virtual int Serial { @@ -135,30 +134,8 @@ namespace OpenSim.Framework set { m_cacheItemsDirty = value; } } - private void CreateInvisibleTextureEntry() - { - if (Invisible != null) - return; - Invisible = new Primitive.TextureEntry(new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); - - Invisible.FaceTextures[8] = new Primitive.TextureEntryFace(null); - Invisible.FaceTextures[8].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); - Invisible.FaceTextures[9] = new Primitive.TextureEntryFace(null); - Invisible.FaceTextures[9].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); - Invisible.FaceTextures[10] = new Primitive.TextureEntryFace(null); - Invisible.FaceTextures[10].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); - Invisible.FaceTextures[11] = new Primitive.TextureEntryFace(null); - Invisible.FaceTextures[11].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); - Invisible.FaceTextures[19] = new Primitive.TextureEntryFace(null); - Invisible.FaceTextures[19].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); - Invisible.FaceTextures[20] = new Primitive.TextureEntryFace(null); - Invisible.FaceTextures[20].TextureID = new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); - } - public AvatarAppearance() { - CreateInvisibleTextureEntry(); - // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); m_serial = 0; @@ -172,9 +149,6 @@ namespace OpenSim.Framework public AvatarAppearance(OSDMap map) { - CreateInvisibleTextureEntry(); - - Invisible = new Primitive.TextureEntry(new UUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); Unpack(map); @@ -183,7 +157,6 @@ namespace OpenSim.Framework public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) { - CreateInvisibleTextureEntry(); // m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); m_serial = 0; @@ -221,7 +194,6 @@ namespace OpenSim.Framework public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked) { - CreateInvisibleTextureEntry(); // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); if (appearance == null) -- cgit v1.1 From fed566b8d3bb480ec89615e011934c10023a4dad Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 18 Feb 2015 01:14:08 +0100 Subject: Abbreviate the stats by removing unneeded and redundant elements. Human readability is overrated. Also add a (hardcoded) password. --- .../Framework/Monitoring/ServerStatsCollector.cs | 43 ++++++++++++++++++++++ OpenSim/Framework/Monitoring/Stats/Stat.cs | 13 ++++++- OpenSim/Framework/Monitoring/StatsManager.cs | 15 +++++++- 3 files changed, 68 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs index ac0f0bc..e6c73d3 100644 --- a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs @@ -246,6 +246,49 @@ namespace OpenSim.Framework.Monitoring (s) => { s.Value = Math.Round(MemoryWatchdog.LastHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); MakeStat("AverageHeapAllocationRate", null, "MB/sec", ContainerMemory, (s) => { s.Value = Math.Round(MemoryWatchdog.AverageHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); + + MakeStat("ProcessResident", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0); + }); + MakeStat("ProcessPaged", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0); + }); + MakeStat("ProcessVirtual", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0); + }); + MakeStat("PeakProcessResident", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0); + }); + MakeStat("PeakProcessPaged", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0); + }); + MakeStat("PeakProcessVirtual", null, "MB", ContainerProcess, + (s) => + { + Process myprocess = Process.GetCurrentProcess(); + myprocess.Refresh(); + s.Value = Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0); + }); } // Notes on performance counters: diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index e095801..bd757d0 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs @@ -238,6 +238,17 @@ namespace OpenSim.Framework.Monitoring return sb.ToString(); } + public virtual OSDMap ToBriefOSDMap() + { + OSDMap ret = new OSDMap(); + + ret.Add("Value", OSD.FromReal(Value)); + + double lastChangeOverTime, averageChangeOverTime; + + return ret; + } + public virtual OSDMap ToOSDMap() { OSDMap ret = new OSDMap(); @@ -322,4 +333,4 @@ namespace OpenSim.Framework.Monitoring } } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 05ee4c5..249cef6 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -253,7 +253,7 @@ namespace OpenSim.Framework.Monitoring if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName)) continue; - statMap.Add(statName, theStats[statName].ToOSDMap()); + statMap.Add(statName, theStats[statName].ToBriefOSDMap()); } contMap.Add(contName, statMap); @@ -275,6 +275,17 @@ namespace OpenSim.Framework.Monitoring string pContainerName = StatsManager.AllSubCommand; string pStatName = StatsManager.AllSubCommand; + if (!request.ContainsKey("pass") || request["pass"].ToString() != "l0st4nge1s") + { + responsedata["int_response_code"] = response_code; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Access denied"; + responsedata["access_control_allow_origin"] = "*"; + + return responsedata; + } + if (request.ContainsKey("cat")) pCategoryName = request["cat"].ToString(); if (request.ContainsKey("cont")) pContainerName = request["cat"].ToString(); if (request.ContainsKey("stat")) pStatName = request["cat"].ToString(); @@ -524,4 +535,4 @@ namespace OpenSim.Framework.Monitoring Debug, Info } -} \ No newline at end of file +} -- cgit v1.1 From b5ac2eb1e1806a826d1c63608641cd7892d4e888 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 10 Mar 2015 01:04:04 +0100 Subject: Allow setting the size of the wearables array from config, for core compatibility --- OpenSim/Framework/AvatarWearable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 271c90f..0ba4e65 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -70,7 +70,7 @@ namespace OpenSim.Framework // public static readonly int MAX_WEARABLES = 15; public static readonly int PHYSICS = 15; - public static readonly int MAX_WEARABLES = 16; + public static int MAX_WEARABLES = 16; public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); -- cgit v1.1 From 9f18e3ba80a6469b7ff03c7cca595a0a3b999592 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 22 Mar 2015 21:53:02 -0700 Subject: Varregion: first cut at removing Border class checks for region crossings. Added Scene.PositionIsInCurrentRegion(pos) to sense when new position needs some crossing work. Many changes made to EntityTransferModule to accomodate new crossing sense logic. --- OpenSim/Framework/RegionInfo.cs | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ae2ff63..90188d2 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -149,11 +149,32 @@ namespace OpenSim.Framework public uint WorldLocX = 0; public uint WorldLocY = 0; public uint WorldLocZ = 0; + + /// + /// X dimension of the region. + /// + /// + /// If this is a varregion then the default size set here will be replaced when we load the region config. + /// public uint RegionSizeX = Constants.RegionSize; + + /// + /// X dimension of the region. + /// + /// + /// If this is a varregion then the default size set here will be replaced when we load the region config. + /// public uint RegionSizeY = Constants.RegionSize; + + /// + /// Z dimension of the region. + /// + /// + /// XXX: Unknown if this accounts for regions with negative Z. + /// public uint RegionSizeZ = Constants.RegionHeight; - private Dictionary m_otherSettings = new Dictionary(); + private Dictionary m_extraSettings = new Dictionary(); // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. @@ -506,16 +527,16 @@ namespace OpenSim.Framework { string val; string keylower = key.ToLower(); - if (m_otherSettings.TryGetValue(keylower, out val)) + if (m_extraSettings.TryGetValue(keylower, out val)) return val; m_log.DebugFormat("[RegionInfo] Could not locate value for parameter {0}", key); return null; } - public void SetOtherSetting(string key, string value) + public void SetExtraSetting(string key, string value) { string keylower = key.ToLower(); - m_otherSettings[keylower] = value; + m_extraSettings[keylower] = value; } private void ReadNiniConfig(IConfigSource source, string name) @@ -733,7 +754,7 @@ namespace OpenSim.Framework foreach (String s in allKeys) { - SetOtherSetting(s, config.GetString(s)); + SetExtraSetting(s, config.GetString(s)); } } -- cgit v1.1 From bedafb8fae9898ef0c5fc6470236ee7244e616a9 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 27 Mar 2015 19:32:50 -0700 Subject: varregion: refactor use of 'double heightmap[,]' into references to new class TerrainData and push the implementation from Scene into the database readers and writers. --- OpenSim/Framework/TerrainData.cs | 464 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 464 insertions(+) create mode 100644 OpenSim/Framework/TerrainData.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs new file mode 100644 index 0000000..6b1be4e --- /dev/null +++ b/OpenSim/Framework/TerrainData.cs @@ -0,0 +1,464 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; + +using OpenMetaverse; + +using log4net; + +namespace OpenSim.Framework +{ + public abstract class TerrainData + { + // Terrain always is a square + public int SizeX { get; protected set; } + public int SizeY { get; protected set; } + public int SizeZ { get; protected set; } + + // A height used when the user doesn't specify anything + public const float DefaultTerrainHeight = 21f; + + public abstract float this[int x, int y] { get; set; } + // Someday terrain will have caves + public abstract float this[int x, int y, int z] { get; set; } + + public abstract bool IsTaintedAt(int xx, int yy); + public abstract bool IsTaintedAt(int xx, int yy, bool clearOnTest); + public abstract void TaintAllTerrain(); + public abstract void ClearTaint(); + + public abstract void ClearLand(); + public abstract void ClearLand(float height); + + // Return a representation of this terrain for storing as a blob in the database. + // Returns 'true' to say blob was stored in the 'out' locations. + public abstract bool GetDatabaseBlob(out int DBFormatRevisionCode, out Array blob); + + // Given a revision code and a blob from the database, create and return the right type of TerrainData. + // The sizes passed are the expected size of the region. The database info will be used to + // initialize the heightmap of that sized region with as much data is in the blob. + // Return created TerrainData or 'null' if unsuccessful. + public static TerrainData CreateFromDatabaseBlobFactory(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob) + { + // For the moment, there is only one implementation class + return new HeightmapTerrainData(pSizeX, pSizeY, pSizeZ, pFormatCode, pBlob); + } + + // return a special compressed representation of the heightmap in ints + public abstract int[] GetCompressedMap(); + public abstract float CompressionFactor { get; } + + public abstract float[] GetFloatsSerialized(); + public abstract double[,] GetDoubles(); + public abstract TerrainData Clone(); + } + + // The terrain is stored in the database as a blob with a 'revision' field. + // Some implementations of terrain storage would fill the revision field with + // the time the terrain was stored. When real revisions were added and this + // feature removed, that left some old entries with the time in the revision + // field. + // Thus, if revision is greater than 'RevisionHigh' then terrain db entry is + // left over and it is presumed to be 'Legacy256'. + // Numbers are arbitrary and are chosen to to reduce possible mis-interpretation. + // If a revision does not match any of these, it is assumed to be Legacy256. + public enum DBTerrainRevision + { + // Terrain is 'double[256,256]' + Legacy256 = 11, + // Terrain is 'int32, int32, float[,]' where the ints are X and Y dimensions + // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. + Variable2D = 22, + // Terrain is 'int32, int32, int32, int16[]' where the ints are X and Y dimensions + // and third int is the 'compression factor'. The heights are compressed as + // "int compressedHeight = (int)(height * compressionFactor);" + // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. + Compressed2D = 27, + // A revision that is not listed above or any revision greater than this value is 'Legacy256'. + RevisionHigh = 1234 + } + + // Version of terrain that is a heightmap. + // This should really be 'LLOptimizedHeightmapTerrainData' as it includes knowledge + // of 'patches' which are 16x16 terrain areas which can be sent separately to the viewer. + // The heighmap is kept as an array of integers. The integer values are converted to + // and from floats by TerrainCompressionFactor. + public class HeightmapTerrainData : TerrainData + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static string LogHeader = "[HEIGHTMAP TERRAIN DATA]"; + + // TerrainData.this[x, y] + public override float this[int x, int y] + { + get { return FromCompressedHeight(m_heightmap[x, y]); } + set { + int newVal = ToCompressedHeight(value); + if (m_heightmap[x, y] != newVal) + { + m_heightmap[x, y] = newVal; + m_taint[x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize] = true; + } + } + } + + // TerrainData.this[x, y, z] + public override float this[int x, int y, int z] + { + get { return this[x, y]; } + set { this[x, y] = value; } + } + + // TerrainData.ClearTaint + public override void ClearTaint() + { + SetAllTaint(false); + } + + // TerrainData.TaintAllTerrain + public override void TaintAllTerrain() + { + SetAllTaint(true); + } + + private void SetAllTaint(bool setting) + { + for (int ii = 0; ii < m_taint.GetLength(0); ii++) + for (int jj = 0; jj < m_taint.GetLength(1); jj++) + m_taint[ii, jj] = setting; + } + + // TerrainData.ClearLand + public override void ClearLand() + { + ClearLand(DefaultTerrainHeight); + } + // TerrainData.ClearLand(float) + public override void ClearLand(float pHeight) + { + int flatHeight = ToCompressedHeight(pHeight); + for (int xx = 0; xx < SizeX; xx++) + for (int yy = 0; yy < SizeY; yy++) + m_heightmap[xx, yy] = flatHeight; + } + + // Return 'true' of the patch that contains these region coordinates has been modified. + // Note that checking the taint clears it. + // There is existing code that relies on this feature. + public override bool IsTaintedAt(int xx, int yy, bool clearOnTest) + { + int tx = xx / Constants.TerrainPatchSize; + int ty = yy / Constants.TerrainPatchSize; + bool ret = m_taint[tx, ty]; + if (ret && clearOnTest) + m_taint[tx, ty] = false; + return ret; + } + + // Old form that clears the taint flag when we check it. + public override bool IsTaintedAt(int xx, int yy) + { + return IsTaintedAt(xx, yy, true /* clearOnTest */); + } + + // TerrainData.GetDatabaseBlob + // The user wants something to store in the database. + public override bool GetDatabaseBlob(out int DBRevisionCode, out Array blob) + { + bool ret = false; + if (SizeX == Constants.RegionSize && SizeY == Constants.RegionSize) + { + DBRevisionCode = (int)DBTerrainRevision.Legacy256; + blob = ToLegacyTerrainSerialization(); + ret = true; + } + else + { + DBRevisionCode = (int)DBTerrainRevision.Compressed2D; + blob = ToCompressedTerrainSerialization(); + ret = true; + } + return ret; + } + + // TerrainData.CompressionFactor + private float m_compressionFactor = 100.0f; + public override float CompressionFactor { get { return m_compressionFactor; } } + + // TerrainData.GetCompressedMap + public override int[] GetCompressedMap() + { + int[] newMap = new int[SizeX * SizeY]; + + int ind = 0; + for (int xx = 0; xx < SizeX; xx++) + for (int yy = 0; yy < SizeY; yy++) + newMap[ind++] = m_heightmap[xx, yy]; + + return newMap; + + } + // TerrainData.Clone + public override TerrainData Clone() + { + HeightmapTerrainData ret = new HeightmapTerrainData(SizeX, SizeY, SizeZ); + ret.m_heightmap = (int[,])this.m_heightmap.Clone(); + return ret; + } + + // TerrainData.GetFloatsSerialized + // This one dimensional version is ordered so height = map[y*sizeX+x]; + // DEPRECATED: don't use this function as it does not retain the dimensions of the terrain + // and the caller will probably do the wrong thing if the terrain is not the legacy 256x256. + public override float[] GetFloatsSerialized() + { + int points = SizeX * SizeY; + float[] heights = new float[points]; + + int idx = 0; + for (int jj = 0; jj < SizeY; jj++) + for (int ii = 0; ii < SizeX; ii++) + { + heights[idx++] = FromCompressedHeight(m_heightmap[ii, jj]); + } + + return heights; + } + + // TerrainData.GetDoubles + public override double[,] GetDoubles() + { + double[,] ret = new double[SizeX, SizeY]; + for (int xx = 0; xx < SizeX; xx++) + for (int yy = 0; yy < SizeY; yy++) + ret[xx, yy] = FromCompressedHeight(m_heightmap[xx, yy]); + + return ret; + } + + + // ============================================================= + + private int[,] m_heightmap; + // Remember subregions of the heightmap that has changed. + private bool[,] m_taint; + + // To save space (especially for large regions), keep the height as a short integer + // that is coded as the float height times the compression factor (usually '100' + // to make for two decimal points). + public int ToCompressedHeight(double pHeight) + { + return (int)(pHeight * CompressionFactor); + } + + public float FromCompressedHeight(int pHeight) + { + return ((float)pHeight) / CompressionFactor; + } + + // To keep with the legacy theme, create an instance of this class based on the + // way terrain used to be passed around. + public HeightmapTerrainData(double[,] pTerrain) + { + SizeX = pTerrain.GetLength(0); + SizeY = pTerrain.GetLength(1); + SizeZ = (int)Constants.RegionHeight; + m_compressionFactor = 100.0f; + + m_heightmap = new int[SizeX, SizeY]; + for (int ii = 0; ii < SizeX; ii++) + { + for (int jj = 0; jj < SizeY; jj++) + { + m_heightmap[ii, jj] = ToCompressedHeight(pTerrain[ii, jj]); + + } + } + // m_log.DebugFormat("{0} new by doubles. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); + + m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; + ClearTaint(); + } + + // Create underlying structures but don't initialize the heightmap assuming the caller will immediately do that + public HeightmapTerrainData(int pX, int pY, int pZ) + { + SizeX = pX; + SizeY = pY; + SizeZ = pZ; + m_compressionFactor = 100.0f; + m_heightmap = new int[SizeX, SizeY]; + m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; + // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); + ClearTaint(); + ClearLand(0f); + } + + public HeightmapTerrainData(int[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) + { + m_compressionFactor = pCompressionFactor; + int ind = 0; + for (int xx = 0; xx < SizeX; xx++) + for (int yy = 0; yy < SizeY; yy++) + m_heightmap[xx, yy] = cmap[ind++]; + // m_log.DebugFormat("{0} new by compressed map. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); + } + + // Create a heighmap from a database blob + public HeightmapTerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob) : this(pSizeX, pSizeY, pSizeZ) + { + switch ((DBTerrainRevision)pFormatCode) + { + case DBTerrainRevision.Compressed2D: + FromCompressedTerrainSerialization(pBlob); + m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + break; + default: + FromLegacyTerrainSerialization(pBlob); + m_log.DebugFormat("{0} HeightmapTerrainData create from legacy serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + break; + } + } + + // Just create an array of doubles. Presumes the caller implicitly knows the size. + public Array ToLegacyTerrainSerialization() + { + Array ret = null; + + using (MemoryStream str = new MemoryStream((int)Constants.RegionSize * (int)Constants.RegionSize * sizeof(double))) + { + using (BinaryWriter bw = new BinaryWriter(str)) + { + for (int xx = 0; xx < Constants.RegionSize; xx++) + { + for (int yy = 0; yy < Constants.RegionSize; yy++) + { + double height = this[xx, yy]; + if (height == 0.0) + height = double.Epsilon; + bw.Write(height); + } + } + } + ret = str.ToArray(); + } + return ret; + } + + // Just create an array of doubles. Presumes the caller implicitly knows the size. + public void FromLegacyTerrainSerialization(byte[] pBlob) + { + // In case database info doesn't match real terrain size, initialize the whole terrain. + ClearLand(); + + using (MemoryStream mstr = new MemoryStream(pBlob)) + { + using (BinaryReader br = new BinaryReader(mstr)) + { + for (int xx = 0; xx < (int)Constants.RegionSize; xx++) + { + for (int yy = 0; yy < (int)Constants.RegionSize; yy++) + { + float val = (float)br.ReadDouble(); + if (xx < SizeX && yy < SizeY) + m_heightmap[xx, yy] = ToCompressedHeight(val); + } + } + } + ClearTaint(); + } + } + + // See the reader below. + public Array ToCompressedTerrainSerialization() + { + Array ret = null; + using (MemoryStream str = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(Int16)))) + { + using (BinaryWriter bw = new BinaryWriter(str)) + { + bw.Write((Int32)DBTerrainRevision.Compressed2D); + bw.Write((Int32)SizeX); + bw.Write((Int32)SizeY); + bw.Write((Int32)CompressionFactor); + for (int yy = 0; yy < SizeY; yy++) + for (int xx = 0; xx < SizeX; xx++) + { + bw.Write((Int16)m_heightmap[xx, yy]); + } + } + ret = str.ToArray(); + } + return ret; + } + + // Initialize heightmap from blob consisting of: + // int32, int32, int32, int32, int16[] + // where the first int32 is format code, next two int32s are the X and y of heightmap data and + // the forth int is the compression factor for the following int16s + // This is just sets heightmap info. The actual size of the region was set on this instance's + // creation and any heights not initialized by theis blob are set to the default height. + public void FromCompressedTerrainSerialization(byte[] pBlob) + { + Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; + + using (MemoryStream mstr = new MemoryStream(pBlob)) + { + using (BinaryReader br = new BinaryReader(mstr)) + { + hmFormatCode = br.ReadInt32(); + hmSizeX = br.ReadInt32(); + hmSizeY = br.ReadInt32(); + hmCompressionFactor = br.ReadInt32(); + + m_compressionFactor = hmCompressionFactor; + + // In case database info doesn't match real terrain size, initialize the whole terrain. + ClearLand(); + + for (int yy = 0; yy < hmSizeY; yy++) + { + for (int xx = 0; xx < hmSizeX; xx++) + { + Int16 val = br.ReadInt16(); + if (xx < SizeX && yy < SizeY) + m_heightmap[xx, yy] = val; + } + } + } + ClearTaint(); + + m_log.InfoFormat("{0} Read compressed 2d heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", + LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); + } + } + } +} -- cgit v1.1 From 08c72a8dc1e54114559521a6c2952905ecf6f105 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 28 Mar 2015 07:50:04 -0700 Subject: varregion: remove use of Constants.RegionSize is various places. More use of the Util routines for conversion of region handles into addresses. --- OpenSim/Framework/RegionInfo.cs | 1 + OpenSim/Framework/UserProfileData.cs | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 90188d2..019fffc 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -825,6 +825,7 @@ namespace OpenSim.Framework if (DataStore != String.Empty) config.Set("Datastore", DataStore); + if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize) { config.Set("SizeX", RegionSizeX); diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs index 9bac739..f7069a5 100644 --- a/OpenSim/Framework/UserProfileData.cs +++ b/OpenSim/Framework/UserProfileData.cs @@ -161,14 +161,18 @@ namespace OpenSim.Framework { get { - return Utils.UIntsToLong( - m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize); + return Util.RegionWorldLocToHandle(Util.RegionToWorldLoc(m_homeRegionX), Util.RegionToWorldLoc(m_homeRegionY)); + // return Utils.UIntsToLong( m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize); } set { - m_homeRegionX = (uint) (value >> 40); - m_homeRegionY = (((uint) (value)) >> 8); + uint regionWorldLocX, regionWorldLocY; + Util.RegionHandleToWorldLoc(value, out regionWorldLocX, out regionWorldLocY); + m_homeRegionX = Util.WorldToRegionLoc(regionWorldLocX); + m_homeRegionY = Util.WorldToRegionLoc(regionWorldLocY); + // m_homeRegionX = (uint) (value >> 40); + // m_homeRegionY = (((uint) (value)) >> 8); } } -- cgit v1.1 From c5a7bf6601dfde518a008d45b4e4a8dc8de698bf Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 28 Mar 2015 08:30:52 -0700 Subject: varregion: add varregion and TerrainData use in LLClientView. Add sending multiple parcel patches and sending patches by avatar view distance. --- OpenSim/Framework/MapBlockData.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/MapBlockData.cs b/OpenSim/Framework/MapBlockData.cs index 2298ac5..4bee499 100644 --- a/OpenSim/Framework/MapBlockData.cs +++ b/OpenSim/Framework/MapBlockData.cs @@ -27,6 +27,7 @@ using System; using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace OpenSim.Framework { @@ -40,9 +41,26 @@ namespace OpenSim.Framework public byte WaterHeight; public ushort X; public ushort Y; + public ushort SizeX; + public ushort SizeY; public MapBlockData() { } + + public OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + map["X"] = X; + map["Y"] = Y; + map["SizeX"] = SizeX; + map["SizeY"] = SizeY; + map["Name"] = Name; + map["Access"] = Access; + map["RegionFlags"] = RegionFlags; + map["WaterHeight"] = WaterHeight; + map["MapImageID"] = MapImageId; + return map; + } } } -- cgit v1.1 From 1fb2f0296fdaff56745daa1c1e8096cd8e25462b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 15 Aug 2015 02:46:41 +0200 Subject: Track selected objects per client --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 4bb865a..b2786d4 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -742,6 +742,8 @@ namespace OpenSim.Framework IScene Scene { get; } + List SelectedObjects { get; } + // [Obsolete("LLClientView Specific - Replace with ???")] int NextAnimationSequenceNumber { get; } -- cgit v1.1 From 2cac56340a079fad8a16736778b6ebef78fb6d56 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 18 Aug 2015 21:03:34 +0100 Subject: try to serialize http requests from same connection, so they are processed in order. ( next commits will be about necessary keepAlive changes needed) --- .../Servers/HttpServer/PollServiceHttpRequest.cs | 38 ++++++++++++++++++ .../HttpServer/PollServiceRequestManager.cs | 46 ++++++++++++++++++++++ 2 files changed, 84 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 6aa9479..e636c38 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -27,6 +27,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Reflection; using System.Text; using HttpServer; @@ -44,6 +45,24 @@ namespace OpenSim.Framework.Servers.HttpServer public readonly IHttpRequest Request; public readonly int RequestTime; public readonly UUID RequestID; + public int contextHash; + + private void GenContextHash() + { + Random rnd = new Random(); + contextHash = 0; + if (Request.Headers["remote_addr"] != null) + contextHash = (Request.Headers["remote_addr"]).GetHashCode() << 16; + else + contextHash = rnd.Next() << 16; + if (Request.Headers["remote_port"] != null) + { + string[] strPorts = Request.Headers["remote_port"].Split(new char[] { ',' }); + contextHash += Int32.Parse(strPorts[0]); + } + else + contextHash += rnd.Next() & 0xffff; + } public PollServiceHttpRequest( PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) @@ -53,6 +72,7 @@ namespace OpenSim.Framework.Servers.HttpServer Request = pRequest; RequestTime = System.Environment.TickCount; RequestID = UUID.Random(); + GenContextHash(); } internal void DoHTTPGruntWork(BaseHttpServer server, Hashtable responsedata) @@ -65,6 +85,7 @@ namespace OpenSim.Framework.Servers.HttpServer response.SendChunked = false; response.ContentLength64 = buffer.Length; response.ContentEncoding = Encoding.UTF8; + response.ReuseContext = false; try { @@ -93,5 +114,22 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceArgs.RequestsHandled++; } } + + } + + class PollServiceHttpRequestComparer : IEqualityComparer + { + public bool Equals(PollServiceHttpRequest b1, PollServiceHttpRequest b2) + { + if (b1.contextHash != b2.contextHash) + return false; + bool b = Object.ReferenceEquals(b1.HttpContext, b2.HttpContext); + return b; + } + + public int GetHashCode(PollServiceHttpRequest b2) + { + return (int)b2.contextHash; + } } } \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index e75b705..2c5c41d 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -46,6 +46,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; + private Dictionary> m_bycontext; private BlockingQueue m_requests = new BlockingQueue(); private static Queue m_slowRequests = new Queue(); private static Queue m_retryRequests = new Queue(); @@ -65,6 +66,9 @@ namespace OpenSim.Framework.Servers.HttpServer m_WorkerThreadCount = pWorkerThreadCount; m_workerThreads = new Thread[m_WorkerThreadCount]; + PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); + m_bycontext = new Dictionary>(preqCp); + STPStartInfo startInfo = new STPStartInfo(); startInfo.IdleTimeout = 30000; startInfo.MaxWorkerThreads = 15; @@ -114,6 +118,45 @@ namespace OpenSim.Framework.Servers.HttpServer public void Enqueue(PollServiceHttpRequest req) { + lock (m_bycontext) + { + Queue ctxQeueue; + if (m_bycontext.TryGetValue(req, out ctxQeueue)) + { + ctxQeueue.Enqueue(req); + } + else + { + ctxQeueue = new Queue(); + m_bycontext[req] = ctxQeueue; + EnqueueInt(req); + } + } + } + + public void byContextDequeue(PollServiceHttpRequest req) + { + Queue ctxQeueue; + lock (m_bycontext) + { + if (m_bycontext.TryGetValue(req, out ctxQeueue)) + { + if (ctxQeueue.Count > 0) + { + PollServiceHttpRequest newreq = ctxQeueue.Dequeue(); + EnqueueInt(newreq); + } + else + { + m_bycontext.Remove(req); + } + } + } + } + + + public void EnqueueInt(PollServiceHttpRequest req) + { if (m_running) { if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll) @@ -220,6 +263,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { req.DoHTTPGruntWork(m_server, responsedata); + byContextDequeue(req); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { @@ -233,6 +277,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { req.DoHTTPGruntWork(m_server, responsedata); + byContextDequeue(req); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { @@ -249,6 +294,7 @@ namespace OpenSim.Framework.Servers.HttpServer { req.DoHTTPGruntWork(m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); + byContextDequeue(req); } else { -- cgit v1.1 From 05d72f77ff38585817dead9b4a812ff97a001dce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 18 Aug 2015 21:32:03 +0100 Subject: do keepalive on mesh and texture GET. Dont use reusecontext any where. setting of keepalive is wrong, it should follow the requested one ( or always as http1.1) only deny if needed (errors). KeepAlive may increase stress on number of avaiable file descritors. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 799ab80..1363eab 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -459,7 +459,7 @@ namespace OpenSim.Framework.Servers.HttpServer } OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); - resp.ReuseContext = true; + resp.ReuseContext = false; HandleRequest(req, resp); // !!!HACK ALERT!!! -- cgit v1.1 From 48ef22f62e07c0b9e6d23ee758a4800d05cfb231 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 18 Aug 2015 23:59:55 +0100 Subject: change pollService stop() to send 503 error and no keepalive. ( untested ) --- .../Servers/HttpServer/PollServiceHttpRequest.cs | 24 +++++++++++++++++++++- .../HttpServer/PollServiceRequestManager.cs | 14 ++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index e636c38..5bd63a6 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -114,7 +114,29 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceArgs.RequestsHandled++; } } - + + internal void DoHTTPstop(BaseHttpServer server) + { + OSHttpResponse response + = new OSHttpResponse(new HttpResponse(HttpContext, Request), HttpContext); + + response.SendChunked = false; + response.ContentLength64 = 0; + response.ContentEncoding = Encoding.UTF8; + response.ReuseContext = false; + response.KeepAlive = false; + response.SendChunked = false; + response.StatusCode = 503; + + try + { + response.OutputStream.Flush(); + response.Send(); + } + catch (Exception e) + { + } + } } class PollServiceHttpRequestComparer : IEqualityComparer diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 2c5c41d..b56ade8 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -204,12 +204,17 @@ namespace OpenSim.Framework.Servers.HttpServer foreach (Thread t in m_workerThreads) Watchdog.AbortThread(t.ManagedThreadId); + // any entry in m_bycontext should have a active request on the other queues + // so just delete contents to easy GC + foreach (Queue qu in m_bycontext.Values) + qu.Clear(); + m_bycontext.Clear(); + try { foreach (PollServiceHttpRequest req in m_retryRequests) { - req.DoHTTPGruntWork(m_server, - req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); + req.DoHTTPstop(m_server); } } catch @@ -221,7 +226,7 @@ namespace OpenSim.Framework.Servers.HttpServer lock (m_slowRequests) { - while (m_slowRequests.Count > 0 && m_running) + while (m_slowRequests.Count > 0) m_requests.Enqueue(m_slowRequests.Dequeue()); } @@ -230,8 +235,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { wreq = m_requests.Dequeue(0); - wreq.DoHTTPGruntWork(m_server, - wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); + wreq.DoHTTPstop(m_server); } catch { -- cgit v1.1 From e3d82ad706db04d295a549543380b71b00848f7f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Aug 2015 04:08:30 +0100 Subject: delay terrain sending if land queue is 2 busy --- OpenSim/Framework/IClientAPI.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index b2786d4..f5fd5f5 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1143,6 +1143,8 @@ namespace OpenSim.Framework void SendGenericMessage(string method, UUID invoice, List message); void SendGenericMessage(string method, UUID invoice, List message); + bool CanSendLayerData(); + void SendLayerData(float[] map); void SendLayerData(int px, int py, float[] map); -- cgit v1.1 From 1c752296bfc25ca709117ad1c557aff2b6097ffb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 24 Aug 2015 18:40:28 +0100 Subject: change internal representation of terrain from int to ushort. This will suporte height from 0 to 655.53m that includes SL limits ( still need to add code to trap eventual negative values from dbs or user input) --- OpenSim/Framework/TerrainData.cs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index 6b1be4e..d0eddc6 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -72,8 +72,8 @@ namespace OpenSim.Framework return new HeightmapTerrainData(pSizeX, pSizeY, pSizeZ, pFormatCode, pBlob); } - // return a special compressed representation of the heightmap in ints - public abstract int[] GetCompressedMap(); + // return a special compressed representation of the heightmap in ushort + public abstract ushort[] GetCompressedMap(); public abstract float CompressionFactor { get; } public abstract float[] GetFloatsSerialized(); @@ -99,7 +99,7 @@ namespace OpenSim.Framework Variable2D = 22, // Terrain is 'int32, int32, int32, int16[]' where the ints are X and Y dimensions // and third int is the 'compression factor'. The heights are compressed as - // "int compressedHeight = (int)(height * compressionFactor);" + // "ushort compressedHeight = (ushort)(height * compressionFactor);" // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. Compressed2D = 27, // A revision that is not listed above or any revision greater than this value is 'Legacy256'. @@ -109,7 +109,7 @@ namespace OpenSim.Framework // Version of terrain that is a heightmap. // This should really be 'LLOptimizedHeightmapTerrainData' as it includes knowledge // of 'patches' which are 16x16 terrain areas which can be sent separately to the viewer. - // The heighmap is kept as an array of integers. The integer values are converted to + // The heighmap is kept as an array of ushorts. The ushort values are converted to // and from floats by TerrainCompressionFactor. public class HeightmapTerrainData : TerrainData { @@ -121,7 +121,7 @@ namespace OpenSim.Framework { get { return FromCompressedHeight(m_heightmap[x, y]); } set { - int newVal = ToCompressedHeight(value); + ushort newVal = ToCompressedHeight(value); if (m_heightmap[x, y] != newVal) { m_heightmap[x, y] = newVal; @@ -164,7 +164,7 @@ namespace OpenSim.Framework // TerrainData.ClearLand(float) public override void ClearLand(float pHeight) { - int flatHeight = ToCompressedHeight(pHeight); + ushort flatHeight = ToCompressedHeight(pHeight); for (int xx = 0; xx < SizeX; xx++) for (int yy = 0; yy < SizeY; yy++) m_heightmap[xx, yy] = flatHeight; @@ -214,9 +214,9 @@ namespace OpenSim.Framework public override float CompressionFactor { get { return m_compressionFactor; } } // TerrainData.GetCompressedMap - public override int[] GetCompressedMap() + public override ushort[] GetCompressedMap() { - int[] newMap = new int[SizeX * SizeY]; + ushort[] newMap = new ushort[SizeX * SizeY]; int ind = 0; for (int xx = 0; xx < SizeX; xx++) @@ -230,7 +230,7 @@ namespace OpenSim.Framework public override TerrainData Clone() { HeightmapTerrainData ret = new HeightmapTerrainData(SizeX, SizeY, SizeZ); - ret.m_heightmap = (int[,])this.m_heightmap.Clone(); + ret.m_heightmap = (ushort[,])this.m_heightmap.Clone(); return ret; } @@ -267,19 +267,19 @@ namespace OpenSim.Framework // ============================================================= - private int[,] m_heightmap; + private ushort[,] m_heightmap; // Remember subregions of the heightmap that has changed. private bool[,] m_taint; // To save space (especially for large regions), keep the height as a short integer // that is coded as the float height times the compression factor (usually '100' // to make for two decimal points). - public int ToCompressedHeight(double pHeight) + public ushort ToCompressedHeight(double pHeight) { - return (int)(pHeight * CompressionFactor); + return (ushort)(pHeight * CompressionFactor); } - public float FromCompressedHeight(int pHeight) + public float FromCompressedHeight(ushort pHeight) { return ((float)pHeight) / CompressionFactor; } @@ -293,7 +293,7 @@ namespace OpenSim.Framework SizeZ = (int)Constants.RegionHeight; m_compressionFactor = 100.0f; - m_heightmap = new int[SizeX, SizeY]; + m_heightmap = new ushort[SizeX, SizeY]; for (int ii = 0; ii < SizeX; ii++) { for (int jj = 0; jj < SizeY; jj++) @@ -315,14 +315,14 @@ namespace OpenSim.Framework SizeY = pY; SizeZ = pZ; m_compressionFactor = 100.0f; - m_heightmap = new int[SizeX, SizeY]; + m_heightmap = new ushort[SizeX, SizeY]; m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); ClearTaint(); ClearLand(0f); } - public HeightmapTerrainData(int[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) + public HeightmapTerrainData(ushort[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) { m_compressionFactor = pCompressionFactor; int ind = 0; @@ -401,7 +401,7 @@ namespace OpenSim.Framework public Array ToCompressedTerrainSerialization() { Array ret = null; - using (MemoryStream str = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(Int16)))) + using (MemoryStream str = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) { using (BinaryWriter bw = new BinaryWriter(str)) { @@ -412,7 +412,7 @@ namespace OpenSim.Framework for (int yy = 0; yy < SizeY; yy++) for (int xx = 0; xx < SizeX; xx++) { - bw.Write((Int16)m_heightmap[xx, yy]); + bw.Write((ushort)m_heightmap[xx, yy]); } } ret = str.ToArray(); @@ -448,7 +448,7 @@ namespace OpenSim.Framework { for (int xx = 0; xx < hmSizeX; xx++) { - Int16 val = br.ReadInt16(); + ushort val = br.ReadUInt16(); if (xx < SizeX && yy < SizeY) m_heightmap[xx, yy] = val; } -- cgit v1.1 From 64d05bab0fe9e12038309275a677e68518fb9b15 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Aug 2015 13:36:45 +0100 Subject: terrain stored as ushorts with gzip compression --- OpenSim/Framework/TerrainData.cs | 251 ++++++++++++++++++++++++++++++++++----- 1 file changed, 221 insertions(+), 30 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index d0eddc6..cc5b8f5 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.IO.Compression; using System.Reflection; using OpenMetaverse; @@ -102,6 +103,11 @@ namespace OpenSim.Framework // "ushort compressedHeight = (ushort)(height * compressionFactor);" // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. Compressed2D = 27, + // as Compressed2D but using ushort[] in place of int16[] + Compressed2Du = 28, + // as Compressed2D but using ushort[] in place of int16[] with Gzip compression + Compressed2DuGzip = 29, + // A revision that is not listed above or any revision greater than this value is 'Legacy256'. RevisionHigh = 1234 } @@ -120,7 +126,8 @@ namespace OpenSim.Framework public override float this[int x, int y] { get { return FromCompressedHeight(m_heightmap[x, y]); } - set { + set + { ushort newVal = ToCompressedHeight(value); if (m_heightmap[x, y] != newVal) { @@ -177,7 +184,7 @@ namespace OpenSim.Framework { int tx = xx / Constants.TerrainPatchSize; int ty = yy / Constants.TerrainPatchSize; - bool ret = m_taint[tx, ty]; + bool ret = m_taint[tx, ty]; if (ret && clearOnTest) m_taint[tx, ty] = false; return ret; @@ -202,8 +209,8 @@ namespace OpenSim.Framework } else { - DBRevisionCode = (int)DBTerrainRevision.Compressed2D; - blob = ToCompressedTerrainSerialization(); + DBRevisionCode = (int)DBTerrainRevision.Compressed2DuGzip; + blob = ToCompressedTerrainSerializationGzip(); ret = true; } return ret; @@ -276,6 +283,11 @@ namespace OpenSim.Framework // to make for two decimal points). public ushort ToCompressedHeight(double pHeight) { + // clamp into valid range + if (pHeight < 0) + pHeight = 0; + else if (pHeight > 655.35f) + pHeight = 655.35f; return (ushort)(pHeight * CompressionFactor); } @@ -322,7 +334,8 @@ namespace OpenSim.Framework ClearLand(0f); } - public HeightmapTerrainData(ushort[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) + public HeightmapTerrainData(ushort[] cmap, float pCompressionFactor, int pX, int pY, int pZ) + : this(pX, pY, pZ) { m_compressionFactor = pCompressionFactor; int ind = 0; @@ -333,12 +346,21 @@ namespace OpenSim.Framework } // Create a heighmap from a database blob - public HeightmapTerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob) : this(pSizeX, pSizeY, pSizeZ) + public HeightmapTerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob) + : this(pSizeX, pSizeY, pSizeZ) { switch ((DBTerrainRevision)pFormatCode) { - case DBTerrainRevision.Compressed2D: + case DBTerrainRevision.Compressed2DuGzip: + FromCompressedTerrainSerializationGZip(pBlob); + m_log.DebugFormat("{0} HeightmapTerrainData create from Gzip Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + break; + case DBTerrainRevision.Compressed2Du: FromCompressedTerrainSerialization(pBlob); + m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + break; + case DBTerrainRevision.Compressed2D: + FromCompressedTerrainSerialization2D(pBlob); m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; default: @@ -379,44 +401,132 @@ namespace OpenSim.Framework // In case database info doesn't match real terrain size, initialize the whole terrain. ClearLand(); - using (MemoryStream mstr = new MemoryStream(pBlob)) + try { - using (BinaryReader br = new BinaryReader(mstr)) + using (MemoryStream mstr = new MemoryStream(pBlob)) { - for (int xx = 0; xx < (int)Constants.RegionSize; xx++) + using (BinaryReader br = new BinaryReader(mstr)) { - for (int yy = 0; yy < (int)Constants.RegionSize; yy++) + for (int xx = 0; xx < (int)Constants.RegionSize; xx++) { - float val = (float)br.ReadDouble(); - if (xx < SizeX && yy < SizeY) - m_heightmap[xx, yy] = ToCompressedHeight(val); + for (int yy = 0; yy < (int)Constants.RegionSize; yy++) + { + float val = (float)br.ReadDouble(); + + if (xx < SizeX && yy < SizeY) + m_heightmap[xx, yy] = ToCompressedHeight(val); + } } } } - ClearTaint(); } + catch + { + ClearLand(); + } + ClearTaint(); + } + + public Array ToCompressedTerrainSerialization2D() + { + Array ret = null; + try + { + using (MemoryStream str = new MemoryStream((4 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) + { + using (BinaryWriter bw = new BinaryWriter(str)) + { + bw.Write((Int32)DBTerrainRevision.Compressed2D); + bw.Write((Int32)SizeX); + bw.Write((Int32)SizeY); + bw.Write((Int32)CompressionFactor); + for (int yy = 0; yy < SizeY; yy++) + for (int xx = 0; xx < SizeX; xx++) + { + bw.Write((Int16)m_heightmap[xx, yy]); + } + } + ret = str.ToArray(); + } + } + catch + { + + } + return ret; } - + // See the reader below. public Array ToCompressedTerrainSerialization() { Array ret = null; - using (MemoryStream str = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) + try { - using (BinaryWriter bw = new BinaryWriter(str)) + using (MemoryStream str = new MemoryStream((4 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) { - bw.Write((Int32)DBTerrainRevision.Compressed2D); - bw.Write((Int32)SizeX); - bw.Write((Int32)SizeY); - bw.Write((Int32)CompressionFactor); - for (int yy = 0; yy < SizeY; yy++) - for (int xx = 0; xx < SizeX; xx++) + using (BinaryWriter bw = new BinaryWriter(str)) + { + bw.Write((Int32)DBTerrainRevision.Compressed2Du); + bw.Write((Int32)SizeX); + bw.Write((Int32)SizeY); + bw.Write((Int32)CompressionFactor); + for (int yy = 0; yy < SizeY; yy++) + for (int xx = 0; xx < SizeX; xx++) + { + bw.Write((ushort)m_heightmap[xx, yy]); + } + } + ret = str.ToArray(); + } + } + catch + { + + } + return ret; + } + + // as above with Gzip compression + public Array ToCompressedTerrainSerializationGzip() + { + Array ret = null; + try + { + using (MemoryStream inp = new MemoryStream((4 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) + { + using (BinaryWriter bw = new BinaryWriter(inp)) + { + bw.Write((Int32)DBTerrainRevision.Compressed2DuGzip); + bw.Write((Int32)SizeX); + bw.Write((Int32)SizeY); + bw.Write((Int32)CompressionFactor); + for (int yy = 0; yy < SizeY; yy++) + for (int xx = 0; xx < SizeX; xx++) + { + bw.Write((ushort)m_heightmap[xx, yy]); + } + + bw.Flush(); + inp.Seek(0,SeekOrigin.Begin); + + using (MemoryStream outputStream = new MemoryStream()) { - bw.Write((ushort)m_heightmap[xx, yy]); + using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress)) + { + inp.CopyStream(compressionStream, int.MaxValue); + compressionStream.Close(); + ret = outputStream.ToArray(); + } } + } } - ret = str.ToArray(); } + catch + { + + } + m_log.InfoFormat("{0} terrain GZiped to {1} bytes (compressed2Dus)", + LogHeader, ret.Length); return ret; } @@ -426,7 +536,7 @@ namespace OpenSim.Framework // the forth int is the compression factor for the following int16s // This is just sets heightmap info. The actual size of the region was set on this instance's // creation and any heights not initialized by theis blob are set to the default height. - public void FromCompressedTerrainSerialization(byte[] pBlob) + public void FromCompressedTerrainSerialization2D(byte[] pBlob) { Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; @@ -448,17 +558,98 @@ namespace OpenSim.Framework { for (int xx = 0; xx < hmSizeX; xx++) { - ushort val = br.ReadUInt16(); + short val = br.ReadInt16(); + if (val < 0) + val = 0; if (xx < SizeX && yy < SizeY) - m_heightmap[xx, yy] = val; + m_heightmap[xx, yy] = (ushort)val; } } } ClearTaint(); - m_log.InfoFormat("{0} Read compressed 2d heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", + m_log.InfoFormat("{0} Read (compressed2D) heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); } } + + // Initialize heightmap from blob consisting of: + // int32, int32, int32, int32, ushort[] + // where the first int32 is format code, next two int32s are the X and y of heightmap data and + // the forth int is the compression factor for the following int16s + // This is just sets heightmap info. The actual size of the region was set on this instance's + // creation and any heights not initialized by theis blob are set to the default height. + public void FromCompressedTerrainSerialization(byte[] pBlob) + { + Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; + try + { + using (MemoryStream mstr = new MemoryStream(pBlob)) + { + using (BinaryReader br = new BinaryReader(mstr)) + { + hmFormatCode = br.ReadInt32(); + hmSizeX = br.ReadInt32(); + hmSizeY = br.ReadInt32(); + hmCompressionFactor = br.ReadInt32(); + + m_compressionFactor = hmCompressionFactor; + + // In case database info doesn't match real terrain size, initialize the whole terrain. + ClearLand(); + + for (int yy = 0; yy < hmSizeY; yy++) + { + for (int xx = 0; xx < hmSizeX; xx++) + { + ushort val = br.ReadUInt16(); + if (xx < SizeX && yy < SizeY) + m_heightmap[xx, yy] = val; + } + } + } + } + } + catch (Exception e) + { + ClearTaint(); + m_log.ErrorFormat("{0} Read (compressed2Dus) terrain error: {1} - terrain may be damaged", + LogHeader,e.Message); + return; + } + ClearTaint(); + + m_log.InfoFormat("{0} Read compressed2D terrain. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", + LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); + + } + + // as above but Gzip compressed + public void FromCompressedTerrainSerializationGZip(byte[] pBlob) + { + m_log.InfoFormat("{0} GZip {1} bytes for terrain", + LogHeader,pBlob.Length); + byte[] gzipout = null; + try + { + using (MemoryStream inputStream = new MemoryStream(pBlob)) + { + using (GZipStream decompressionStream = new GZipStream(inputStream, CompressionMode.Decompress)) + { + using (MemoryStream outputStream = new MemoryStream()) + { + decompressionStream.Flush(); + decompressionStream.CopyTo(outputStream); + gzipout = outputStream.ToArray(); + } + } + } + } + catch + { + } + + FromCompressedTerrainSerialization(gzipout); + } } } -- cgit v1.1 From 244f0c6352a920b8bba5e13fadda49cb5b368e06 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Aug 2015 16:51:48 +0100 Subject: change terrain internal representation to float. ushort work with legal sl terrain, but may break existent terrain and that may cost a lot more than the cost of memory --- OpenSim/Framework/TerrainData.cs | 241 ++++++++++++++++++++++++++------------- 1 file changed, 162 insertions(+), 79 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index cc5b8f5..976c1f0 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -49,6 +49,7 @@ namespace OpenSim.Framework public abstract float this[int x, int y] { get; set; } // Someday terrain will have caves + // at most holes :p public abstract float this[int x, int y, int z] { get; set; } public abstract bool IsTaintedAt(int xx, int yy); @@ -74,7 +75,7 @@ namespace OpenSim.Framework } // return a special compressed representation of the heightmap in ushort - public abstract ushort[] GetCompressedMap(); + public abstract float[] GetCompressedMap(); public abstract float CompressionFactor { get; } public abstract float[] GetFloatsSerialized(); @@ -95,16 +96,21 @@ namespace OpenSim.Framework { // Terrain is 'double[256,256]' Legacy256 = 11, + // Terrain is 'int32, int32, float[,]' where the ints are X and Y dimensions // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. Variable2D = 22, + Variable2DGzip = 23, + // Terrain is 'int32, int32, int32, int16[]' where the ints are X and Y dimensions // and third int is the 'compression factor'. The heights are compressed as // "ushort compressedHeight = (ushort)(height * compressionFactor);" // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. Compressed2D = 27, + // as Compressed2D but using ushort[] in place of int16[] Compressed2Du = 28, + // as Compressed2D but using ushort[] in place of int16[] with Gzip compression Compressed2DuGzip = 29, @@ -125,13 +131,12 @@ namespace OpenSim.Framework // TerrainData.this[x, y] public override float this[int x, int y] { - get { return FromCompressedHeight(m_heightmap[x, y]); } + get { return m_heightmap[x, y]; } set { - ushort newVal = ToCompressedHeight(value); - if (m_heightmap[x, y] != newVal) + if (m_heightmap[x, y] != value) { - m_heightmap[x, y] = newVal; + m_heightmap[x, y] = value; m_taint[x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize] = true; } } @@ -171,10 +176,9 @@ namespace OpenSim.Framework // TerrainData.ClearLand(float) public override void ClearLand(float pHeight) { - ushort flatHeight = ToCompressedHeight(pHeight); for (int xx = 0; xx < SizeX; xx++) for (int yy = 0; yy < SizeY; yy++) - m_heightmap[xx, yy] = flatHeight; + m_heightmap[xx, yy] = pHeight; } // Return 'true' of the patch that contains these region coordinates has been modified. @@ -209,8 +213,8 @@ namespace OpenSim.Framework } else { - DBRevisionCode = (int)DBTerrainRevision.Compressed2DuGzip; - blob = ToCompressedTerrainSerializationGzip(); + DBRevisionCode = (int)DBTerrainRevision.Variable2DGzip; + blob = ToCompressedTerrainSerializationV2DGzip(); ret = true; } return ret; @@ -221,9 +225,9 @@ namespace OpenSim.Framework public override float CompressionFactor { get { return m_compressionFactor; } } // TerrainData.GetCompressedMap - public override ushort[] GetCompressedMap() + public override float[] GetCompressedMap() { - ushort[] newMap = new ushort[SizeX * SizeY]; + float[] newMap = new float[SizeX * SizeY]; int ind = 0; for (int xx = 0; xx < SizeX; xx++) @@ -237,7 +241,7 @@ namespace OpenSim.Framework public override TerrainData Clone() { HeightmapTerrainData ret = new HeightmapTerrainData(SizeX, SizeY, SizeZ); - ret.m_heightmap = (ushort[,])this.m_heightmap.Clone(); + ret.m_heightmap = (float[,])this.m_heightmap.Clone(); return ret; } @@ -254,7 +258,7 @@ namespace OpenSim.Framework for (int jj = 0; jj < SizeY; jj++) for (int ii = 0; ii < SizeX; ii++) { - heights[idx++] = FromCompressedHeight(m_heightmap[ii, jj]); + heights[idx++] = m_heightmap[ii, jj]; } return heights; @@ -266,7 +270,7 @@ namespace OpenSim.Framework double[,] ret = new double[SizeX, SizeY]; for (int xx = 0; xx < SizeX; xx++) for (int yy = 0; yy < SizeY; yy++) - ret[xx, yy] = FromCompressedHeight(m_heightmap[xx, yy]); + ret[xx, yy] = (double)m_heightmap[xx, yy]; return ret; } @@ -274,21 +278,37 @@ namespace OpenSim.Framework // ============================================================= - private ushort[,] m_heightmap; + private float[,] m_heightmap; // Remember subregions of the heightmap that has changed. private bool[,] m_taint; - // To save space (especially for large regions), keep the height as a short integer // that is coded as the float height times the compression factor (usually '100' // to make for two decimal points). - public ushort ToCompressedHeight(double pHeight) + public short ToCompressedHeightshort(float pHeight) + { + // clamp into valid range + pHeight *= CompressionFactor; + if (pHeight < short.MinValue) + return short.MinValue; + else if (pHeight > short.MaxValue) + return short.MaxValue; + return (short)pHeight; + } + + public ushort ToCompressedHeightushort(float pHeight) { // clamp into valid range - if (pHeight < 0) - pHeight = 0; - else if (pHeight > 655.35f) - pHeight = 655.35f; - return (ushort)(pHeight * CompressionFactor); + pHeight *= CompressionFactor; + if (pHeight < ushort.MinValue) + return ushort.MinValue; + else if (pHeight > ushort.MaxValue) + return ushort.MaxValue; + return (ushort)pHeight; + } + + public float FromCompressedHeight(short pHeight) + { + return ((float)pHeight) / CompressionFactor; } public float FromCompressedHeight(ushort pHeight) @@ -305,12 +325,12 @@ namespace OpenSim.Framework SizeZ = (int)Constants.RegionHeight; m_compressionFactor = 100.0f; - m_heightmap = new ushort[SizeX, SizeY]; + m_heightmap = new float[SizeX, SizeY]; for (int ii = 0; ii < SizeX; ii++) { for (int jj = 0; jj < SizeY; jj++) { - m_heightmap[ii, jj] = ToCompressedHeight(pTerrain[ii, jj]); + m_heightmap[ii, jj] = (float)pTerrain[ii, jj]; } } @@ -327,14 +347,14 @@ namespace OpenSim.Framework SizeY = pY; SizeZ = pZ; m_compressionFactor = 100.0f; - m_heightmap = new ushort[SizeX, SizeY]; + m_heightmap = new float[SizeX, SizeY]; m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); ClearTaint(); ClearLand(0f); } - public HeightmapTerrainData(ushort[] cmap, float pCompressionFactor, int pX, int pY, int pZ) + public HeightmapTerrainData(float[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) { m_compressionFactor = pCompressionFactor; @@ -351,12 +371,22 @@ namespace OpenSim.Framework { switch ((DBTerrainRevision)pFormatCode) { + case DBTerrainRevision.Variable2DGzip: + FromCompressedTerrainSerializationV2DGZip(pBlob); + m_log.DebugFormat("{0} HeightmapTerrainData create from Gzip Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + break; + + case DBTerrainRevision.Variable2D: + FromCompressedTerrainSerializationV2D(pBlob); + m_log.DebugFormat("{0} HeightmapTerrainData create from Gzip Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + break; + case DBTerrainRevision.Compressed2DuGzip: - FromCompressedTerrainSerializationGZip(pBlob); + FromCompressedTerrainSerialization2DuGZip(pBlob); m_log.DebugFormat("{0} HeightmapTerrainData create from Gzip Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; case DBTerrainRevision.Compressed2Du: - FromCompressedTerrainSerialization(pBlob); + FromCompressedTerrainSerialization2D(pBlob); m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; case DBTerrainRevision.Compressed2D: @@ -414,7 +444,7 @@ namespace OpenSim.Framework float val = (float)br.ReadDouble(); if (xx < SizeX && yy < SizeY) - m_heightmap[xx, yy] = ToCompressedHeight(val); + m_heightmap[xx, yy] = val; } } } @@ -427,53 +457,33 @@ namespace OpenSim.Framework ClearTaint(); } - public Array ToCompressedTerrainSerialization2D() - { - Array ret = null; - try - { - using (MemoryStream str = new MemoryStream((4 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) - { - using (BinaryWriter bw = new BinaryWriter(str)) - { - bw.Write((Int32)DBTerrainRevision.Compressed2D); - bw.Write((Int32)SizeX); - bw.Write((Int32)SizeY); - bw.Write((Int32)CompressionFactor); - for (int yy = 0; yy < SizeY; yy++) - for (int xx = 0; xx < SizeX; xx++) - { - bw.Write((Int16)m_heightmap[xx, yy]); - } - } - ret = str.ToArray(); - } - } - catch - { - } - return ret; - } + // stores as variable2D + // int32 format + // int32 sizeX + // int32 sizeY + // float[,] array - // See the reader below. - public Array ToCompressedTerrainSerialization() + // may have endian issues like older + + public Array ToCompressedTerrainSerializationV2D() { Array ret = null; try { - using (MemoryStream str = new MemoryStream((4 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) + using (MemoryStream str = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float)))) { using (BinaryWriter bw = new BinaryWriter(str)) { - bw.Write((Int32)DBTerrainRevision.Compressed2Du); + bw.Write((Int32)DBTerrainRevision.Variable2D); bw.Write((Int32)SizeX); bw.Write((Int32)SizeY); - bw.Write((Int32)CompressionFactor); for (int yy = 0; yy < SizeY; yy++) for (int xx = 0; xx < SizeX; xx++) { - bw.Write((ushort)m_heightmap[xx, yy]); + // reduce to 1cm resolution + float val = (float)Math.Round(m_heightmap[xx, yy],2,MidpointRounding.ToEven); + bw.Write(val); } } ret = str.ToArray(); @@ -487,27 +497,26 @@ namespace OpenSim.Framework } // as above with Gzip compression - public Array ToCompressedTerrainSerializationGzip() + public Array ToCompressedTerrainSerializationV2DGzip() { Array ret = null; try { - using (MemoryStream inp = new MemoryStream((4 * sizeof(Int32)) + (SizeX * SizeY * sizeof(ushort)))) + using (MemoryStream inp = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float)))) { using (BinaryWriter bw = new BinaryWriter(inp)) { - bw.Write((Int32)DBTerrainRevision.Compressed2DuGzip); + bw.Write((Int32)DBTerrainRevision.Variable2DGzip); bw.Write((Int32)SizeX); bw.Write((Int32)SizeY); - bw.Write((Int32)CompressionFactor); for (int yy = 0; yy < SizeY; yy++) for (int xx = 0; xx < SizeX; xx++) { - bw.Write((ushort)m_heightmap[xx, yy]); + bw.Write((float)m_heightmap[xx, yy]); } bw.Flush(); - inp.Seek(0,SeekOrigin.Begin); + inp.Seek(0, SeekOrigin.Begin); using (MemoryStream outputStream = new MemoryStream()) { @@ -525,7 +534,7 @@ namespace OpenSim.Framework { } - m_log.InfoFormat("{0} terrain GZiped to {1} bytes (compressed2Dus)", + m_log.InfoFormat("{0} terrain GZiped to {1} bytes (V2DGzip)", LogHeader, ret.Length); return ret; } @@ -558,11 +567,9 @@ namespace OpenSim.Framework { for (int xx = 0; xx < hmSizeX; xx++) { - short val = br.ReadInt16(); - if (val < 0) - val = 0; + float val = FromCompressedHeight(br.ReadInt16()); if (xx < SizeX && yy < SizeY) - m_heightmap[xx, yy] = (ushort)val; + m_heightmap[xx, yy] = val; } } } @@ -579,7 +586,7 @@ namespace OpenSim.Framework // the forth int is the compression factor for the following int16s // This is just sets heightmap info. The actual size of the region was set on this instance's // creation and any heights not initialized by theis blob are set to the default height. - public void FromCompressedTerrainSerialization(byte[] pBlob) + public void FromCompressedTerrainSerialization2Du(byte[] pBlob) { Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; try @@ -602,7 +609,7 @@ namespace OpenSim.Framework { for (int xx = 0; xx < hmSizeX; xx++) { - ushort val = br.ReadUInt16(); + float val = FromCompressedHeight(br.ReadUInt16()); if (xx < SizeX && yy < SizeY) m_heightmap[xx, yy] = val; } @@ -614,7 +621,7 @@ namespace OpenSim.Framework { ClearTaint(); m_log.ErrorFormat("{0} Read (compressed2Dus) terrain error: {1} - terrain may be damaged", - LogHeader,e.Message); + LogHeader, e.Message); return; } ClearTaint(); @@ -625,10 +632,86 @@ namespace OpenSim.Framework } // as above but Gzip compressed - public void FromCompressedTerrainSerializationGZip(byte[] pBlob) + public void FromCompressedTerrainSerialization2DuGZip(byte[] pBlob) + { + m_log.InfoFormat("{0} GZip {1} bytes for terrain", + LogHeader, pBlob.Length); + byte[] gzipout = null; + try + { + using (MemoryStream inputStream = new MemoryStream(pBlob)) + { + using (GZipStream decompressionStream = new GZipStream(inputStream, CompressionMode.Decompress)) + { + using (MemoryStream outputStream = new MemoryStream()) + { + decompressionStream.Flush(); + decompressionStream.CopyTo(outputStream); + gzipout = outputStream.ToArray(); + } + } + } + } + catch + { + } + + FromCompressedTerrainSerialization2Du(gzipout); + } + + // Initialize heightmap from blob consisting of: + // int32, int32, int32, int32, ushort[] + // where the first int32 is format code, next two int32s are the X and y of heightmap data and + // the forth int is the compression factor for the following int16s + // This is just sets heightmap info. The actual size of the region was set on this instance's + // creation and any heights not initialized by theis blob are set to the default height. + public void FromCompressedTerrainSerializationV2D(byte[] pBlob) + { + Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; + try + { + using (MemoryStream mstr = new MemoryStream(pBlob)) + { + using (BinaryReader br = new BinaryReader(mstr)) + { + hmFormatCode = br.ReadInt32(); + hmSizeX = br.ReadInt32(); + hmSizeY = br.ReadInt32(); + + // In case database info doesn't match real terrain size, initialize the whole terrain. + ClearLand(); + + for (int yy = 0; yy < hmSizeY; yy++) + { + for (int xx = 0; xx < hmSizeX; xx++) + { + float val = br.ReadSingle(); + if (xx < SizeX && yy < SizeY) + m_heightmap[xx, yy] = val; + } + } + } + } + } + catch (Exception e) + { + ClearTaint(); + m_log.ErrorFormat("{0} Read (Variable size format) terrain error: {1} - terrain may be damaged", + LogHeader, e.Message); + return; + } + ClearTaint(); + + m_log.InfoFormat("{0} Read Variable size format terrain. Heightmap size=<{1},{2}>. Region size=<{3},{4}>", + LogHeader, hmSizeX, hmSizeY, SizeX, SizeY); + + } + // as above but Gzip compressed + public void FromCompressedTerrainSerializationV2DGZip(byte[] pBlob) { m_log.InfoFormat("{0} GZip {1} bytes for terrain", - LogHeader,pBlob.Length); + LogHeader, pBlob.Length); + byte[] gzipout = null; try { @@ -649,7 +732,7 @@ namespace OpenSim.Framework { } - FromCompressedTerrainSerialization(gzipout); + FromCompressedTerrainSerializationV2D(gzipout); } } } -- cgit v1.1 From ef3deffeeb0664443f7bef6cc7f2f6844355364b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Aug 2015 17:54:49 +0100 Subject: remove rest of ushort test code --- OpenSim/Framework/TerrainData.cs | 125 ++++++++++----------------------------- 1 file changed, 31 insertions(+), 94 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index 976c1f0..c66c1ad 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -108,12 +108,6 @@ namespace OpenSim.Framework // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. Compressed2D = 27, - // as Compressed2D but using ushort[] in place of int16[] - Compressed2Du = 28, - - // as Compressed2D but using ushort[] in place of int16[] with Gzip compression - Compressed2DuGzip = 29, - // A revision that is not listed above or any revision greater than this value is 'Legacy256'. RevisionHigh = 1234 } @@ -373,21 +367,12 @@ namespace OpenSim.Framework { case DBTerrainRevision.Variable2DGzip: FromCompressedTerrainSerializationV2DGZip(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from Gzip Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + m_log.DebugFormat("{0} HeightmapTerrainData create from Variable2DGzip serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; case DBTerrainRevision.Variable2D: FromCompressedTerrainSerializationV2D(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from Gzip Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); - break; - - case DBTerrainRevision.Compressed2DuGzip: - FromCompressedTerrainSerialization2DuGZip(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from Gzip Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); - break; - case DBTerrainRevision.Compressed2Du: - FromCompressedTerrainSerialization2D(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D (unsigned shorts) serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); + m_log.DebugFormat("{0} HeightmapTerrainData create from Variable2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; case DBTerrainRevision.Compressed2D: FromCompressedTerrainSerialization2D(pBlob); @@ -425,7 +410,7 @@ namespace OpenSim.Framework return ret; } - // Just create an array of doubles. Presumes the caller implicitly knows the size. + // Presumes the caller implicitly knows the size. public void FromLegacyTerrainSerialization(byte[] pBlob) { // In case database info doesn't match real terrain size, initialize the whole terrain. @@ -464,8 +449,6 @@ namespace OpenSim.Framework // int32 sizeY // float[,] array - // may have endian issues like older - public Array ToCompressedTerrainSerializationV2D() { Array ret = null; @@ -493,6 +476,10 @@ namespace OpenSim.Framework { } + + m_log.DebugFormat("{0} V2D {1} bytes", + LogHeader, ret.Length); + return ret; } @@ -534,7 +521,7 @@ namespace OpenSim.Framework { } - m_log.InfoFormat("{0} terrain GZiped to {1} bytes (V2DGzip)", + m_log.DebugFormat("{0} V2DGzip {1} bytes", LogHeader, ret.Length); return ret; } @@ -575,20 +562,19 @@ namespace OpenSim.Framework } ClearTaint(); - m_log.InfoFormat("{0} Read (compressed2D) heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", + m_log.DebugFormat("{0} Read (compressed2D) heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); } } // Initialize heightmap from blob consisting of: - // int32, int32, int32, int32, ushort[] - // where the first int32 is format code, next two int32s are the X and y of heightmap data and - // the forth int is the compression factor for the following int16s + // int32, int32, int32, float[] + // where the first int32 is format code, next two int32s are the X and y of heightmap data // This is just sets heightmap info. The actual size of the region was set on this instance's // creation and any heights not initialized by theis blob are set to the default height. - public void FromCompressedTerrainSerialization2Du(byte[] pBlob) + public void FromCompressedTerrainSerializationV2D(byte[] pBlob) { - Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; + Int32 hmFormatCode, hmSizeX, hmSizeY; try { using (MemoryStream mstr = new MemoryStream(pBlob)) @@ -598,9 +584,6 @@ namespace OpenSim.Framework hmFormatCode = br.ReadInt32(); hmSizeX = br.ReadInt32(); hmSizeY = br.ReadInt32(); - hmCompressionFactor = br.ReadInt32(); - - m_compressionFactor = hmCompressionFactor; // In case database info doesn't match real terrain size, initialize the whole terrain. ClearLand(); @@ -609,7 +592,7 @@ namespace OpenSim.Framework { for (int xx = 0; xx < hmSizeX; xx++) { - float val = FromCompressedHeight(br.ReadUInt16()); + float val = br.ReadSingle(); if (xx < SizeX && yy < SizeY) m_heightmap[xx, yy] = val; } @@ -620,59 +603,41 @@ namespace OpenSim.Framework catch (Exception e) { ClearTaint(); - m_log.ErrorFormat("{0} Read (compressed2Dus) terrain error: {1} - terrain may be damaged", + m_log.ErrorFormat("{0} 2D error: {1} - terrain may be damaged", LogHeader, e.Message); return; } ClearTaint(); - m_log.InfoFormat("{0} Read compressed2D terrain. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", - LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); + m_log.DebugFormat("{0} V2D Heightmap size=<{1},{2}>. Region size=<{3},{4}>", + LogHeader, hmSizeX, hmSizeY, SizeX, SizeY); } // as above but Gzip compressed - public void FromCompressedTerrainSerialization2DuGZip(byte[] pBlob) + public void FromCompressedTerrainSerializationV2DGZip(byte[] pBlob) { - m_log.InfoFormat("{0} GZip {1} bytes for terrain", + m_log.InfoFormat("{0} VD2Gzip {1} bytes input", LogHeader, pBlob.Length); - byte[] gzipout = null; + + Int32 hmFormatCode, hmSizeX, hmSizeY; + try { - using (MemoryStream inputStream = new MemoryStream(pBlob)) + using (MemoryStream outputStream = new MemoryStream()) { - using (GZipStream decompressionStream = new GZipStream(inputStream, CompressionMode.Decompress)) + using (MemoryStream inputStream = new MemoryStream(pBlob)) { - using (MemoryStream outputStream = new MemoryStream()) + using (GZipStream decompressionStream = new GZipStream(inputStream, CompressionMode.Decompress)) { decompressionStream.Flush(); decompressionStream.CopyTo(outputStream); - gzipout = outputStream.ToArray(); } } - } - } - catch - { - } - FromCompressedTerrainSerialization2Du(gzipout); - } + outputStream.Seek(0, SeekOrigin.Begin); - // Initialize heightmap from blob consisting of: - // int32, int32, int32, int32, ushort[] - // where the first int32 is format code, next two int32s are the X and y of heightmap data and - // the forth int is the compression factor for the following int16s - // This is just sets heightmap info. The actual size of the region was set on this instance's - // creation and any heights not initialized by theis blob are set to the default height. - public void FromCompressedTerrainSerializationV2D(byte[] pBlob) - { - Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; - try - { - using (MemoryStream mstr = new MemoryStream(pBlob)) - { - using (BinaryReader br = new BinaryReader(mstr)) + using (BinaryReader br = new BinaryReader(outputStream)) { hmFormatCode = br.ReadInt32(); hmSizeX = br.ReadInt32(); @@ -693,46 +658,18 @@ namespace OpenSim.Framework } } } - catch (Exception e) + catch( Exception e) { ClearTaint(); - m_log.ErrorFormat("{0} Read (Variable size format) terrain error: {1} - terrain may be damaged", + m_log.ErrorFormat("{0} V2DGzip error: {1} - terrain may be damaged", LogHeader, e.Message); return; } - ClearTaint(); - m_log.InfoFormat("{0} Read Variable size format terrain. Heightmap size=<{1},{2}>. Region size=<{3},{4}>", + ClearTaint(); + m_log.DebugFormat("{0} V2DGzip. Heightmap size=<{1},{2}>. Region size=<{3},{4}>", LogHeader, hmSizeX, hmSizeY, SizeX, SizeY); } - // as above but Gzip compressed - public void FromCompressedTerrainSerializationV2DGZip(byte[] pBlob) - { - m_log.InfoFormat("{0} GZip {1} bytes for terrain", - LogHeader, pBlob.Length); - - byte[] gzipout = null; - try - { - using (MemoryStream inputStream = new MemoryStream(pBlob)) - { - using (GZipStream decompressionStream = new GZipStream(inputStream, CompressionMode.Decompress)) - { - using (MemoryStream outputStream = new MemoryStream()) - { - decompressionStream.Flush(); - decompressionStream.CopyTo(outputStream); - gzipout = outputStream.ToArray(); - } - } - } - } - catch - { - } - - FromCompressedTerrainSerializationV2D(gzipout); - } } } -- cgit v1.1 From c7f148ee6410700a11bbf1439e1fd5788dc70f51 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 27 Aug 2015 14:13:23 +0100 Subject: minor clear. Use isTainted in is read clear form --- OpenSim/Framework/TerrainData.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index c66c1ad..d2e1c6a 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -189,6 +189,8 @@ namespace OpenSim.Framework } // Old form that clears the taint flag when we check it. + // ubit: this dangerus naming should be only check without clear + // keeping for old modules outthere public override bool IsTaintedAt(int xx, int yy) { return IsTaintedAt(xx, yy, true /* clearOnTest */); @@ -208,7 +210,9 @@ namespace OpenSim.Framework else { DBRevisionCode = (int)DBTerrainRevision.Variable2DGzip; +// DBRevisionCode = (int)DBTerrainRevision.Variable2D; blob = ToCompressedTerrainSerializationV2DGzip(); +// blob = ToCompressedTerrainSerializationV2D(); ret = true; } return ret; @@ -444,7 +448,6 @@ namespace OpenSim.Framework // stores as variable2D - // int32 format // int32 sizeX // int32 sizeY // float[,] array @@ -454,11 +457,10 @@ namespace OpenSim.Framework Array ret = null; try { - using (MemoryStream str = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float)))) + using (MemoryStream str = new MemoryStream((2 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float)))) { using (BinaryWriter bw = new BinaryWriter(str)) { - bw.Write((Int32)DBTerrainRevision.Variable2D); bw.Write((Int32)SizeX); bw.Write((Int32)SizeY); for (int yy = 0; yy < SizeY; yy++) @@ -489,11 +491,10 @@ namespace OpenSim.Framework Array ret = null; try { - using (MemoryStream inp = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float)))) + using (MemoryStream inp = new MemoryStream((2 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float)))) { using (BinaryWriter bw = new BinaryWriter(inp)) { - bw.Write((Int32)DBTerrainRevision.Variable2DGzip); bw.Write((Int32)SizeX); bw.Write((Int32)SizeY); for (int yy = 0; yy < SizeY; yy++) @@ -574,14 +575,13 @@ namespace OpenSim.Framework // creation and any heights not initialized by theis blob are set to the default height. public void FromCompressedTerrainSerializationV2D(byte[] pBlob) { - Int32 hmFormatCode, hmSizeX, hmSizeY; + Int32 hmSizeX, hmSizeY; try { using (MemoryStream mstr = new MemoryStream(pBlob)) { using (BinaryReader br = new BinaryReader(mstr)) { - hmFormatCode = br.ReadInt32(); hmSizeX = br.ReadInt32(); hmSizeY = br.ReadInt32(); @@ -620,7 +620,7 @@ namespace OpenSim.Framework m_log.InfoFormat("{0} VD2Gzip {1} bytes input", LogHeader, pBlob.Length); - Int32 hmFormatCode, hmSizeX, hmSizeY; + Int32 hmSizeX, hmSizeY; try { @@ -639,7 +639,6 @@ namespace OpenSim.Framework using (BinaryReader br = new BinaryReader(outputStream)) { - hmFormatCode = br.ReadInt32(); hmSizeX = br.ReadInt32(); hmSizeY = br.ReadInt32(); -- cgit v1.1 From 0edffae7e42c0705303e015036fa85687508ecf0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 30 Aug 2015 19:17:35 +0100 Subject: more on tps and crossings --- OpenSim/Framework/Util.cs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index d807e2a..5f4ab06 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -675,17 +675,26 @@ namespace OpenSim.Framework /// Old region y-coord /// New region y-coord /// - public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy) + public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy, + int oldsizex, int oldsizey, int newsizex, int newsizey) { - int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize); + // we still need to make sure we see new region 1stNeighbors - int startX = (int)oldx - dd; - int startY = (int)oldy - dd; + oldx *= Constants.RegionSize; + newx *= Constants.RegionSize; + if (oldx + oldsizex + drawdist < newx) + return true; + if (newx + newsizex + drawdist < oldx) + return true; - int endX = (int)oldx + dd; - int endY = (int)oldy + dd; + oldy *= Constants.RegionSize; + newy *= Constants.RegionSize; + if (oldy + oldsizey + drawdist < newy) + return true; + if (newy + newsizey + drawdist< oldy) + return true; - return (newx < startX || endX < newx || newy < startY || endY < newy); + return false; } public static string FieldToString(byte[] bytes) -- cgit v1.1