From 7cf970fb27297d9550d4bdb1d520e9c6ff0a381d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 21 Feb 2012 14:21:03 -0500 Subject: V3 Support: This starts V3 support by adding a profile server url to the login response. This requires viewer support - which is also being worked on. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 20 +++++++++++++++++++- OpenSim/Services/LLLoginService/LLLoginService.cs | 4 +++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 1a874c8..b6f6d31 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -168,6 +168,9 @@ namespace OpenSim.Services.LLLoginService // Web map private string mapTileURL; + // Web Profiles + private string profileURL; + private string searchURL; // Error Flags @@ -220,7 +223,7 @@ namespace OpenSim.Services.LLLoginService public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List gestures, string message, - GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency) + GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string searchURL, string currency) : this() { FillOutInventoryData(invSkel, libService); @@ -237,6 +240,8 @@ namespace OpenSim.Services.LLLoginService BuddList = ConvertFriendListItem(friendsList); StartLocation = where; MapTileURL = mapTileURL; + ProfileURL = profileURL; + SearchURL = searchURL; Currency = currency; @@ -384,6 +389,7 @@ namespace OpenSim.Services.LLLoginService InitialOutfitHash["gender"] = "female"; initialOutfit.Add(InitialOutfitHash); mapTileURL = String.Empty; + profileURL = String.Empty; searchURL = String.Empty; currency = String.Empty; @@ -456,6 +462,9 @@ namespace OpenSim.Services.LLLoginService if (mapTileURL != String.Empty) responseData["map-server-url"] = mapTileURL; + if (profileURL != String.Empty) + responseData["profile-server-url"] = profileURL; + if (m_buddyList != null) { responseData["buddy-list"] = m_buddyList.ToArray(); @@ -561,6 +570,9 @@ namespace OpenSim.Services.LLLoginService if (mapTileURL != String.Empty) map["map-server-url"] = OSD.FromString(mapTileURL); + if (profileURL != String.Empty) + map["profile-server-url"] = OSD.FromString(profileURL); + if (searchURL != String.Empty) map["search"] = OSD.FromString(searchURL); @@ -933,6 +945,12 @@ namespace OpenSim.Services.LLLoginService set { mapTileURL = value; } } + public string ProfileURL + { + get { return profileURL; } + set { profileURL = value; } + } + public string SearchURL { get { return searchURL; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 5dff512..02e62c8 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -74,6 +74,7 @@ namespace OpenSim.Services.LLLoginService protected string m_GatekeeperURL; protected bool m_AllowRemoteSetLoginLevel; protected string m_MapTileURL; + protected string m_ProfileURL; protected string m_SearchURL; protected string m_Currency; @@ -108,6 +109,7 @@ namespace OpenSim.Services.LLLoginService m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); + m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); @@ -413,7 +415,7 @@ namespace OpenSim.Services.LLLoginService // Finally, fill out the response and return it // LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, - where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL, m_Currency); + where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_SearchURL, m_Currency); m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); return response; -- cgit v1.1 From 67bea681e2a75039595be9dab23ad157d123e597 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 21 Feb 2012 23:04:49 -0500 Subject: Add web profile url setting to ini --- bin/Robust.ini.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 90f7b5c..91cd6d0 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -224,6 +224,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; For V2 map MapTileURL = "http://127.0.0.1:8002"; + ; For V2/3 Web Profiles + ProfileServerURL = "http://127.0.0.1/profiles/[AGENT_NAME] + ; If you run this login server behind a proxy, set this to true ; HasProxy = false -- cgit v1.1 From 165ae251ec132da30dc58513101e4ec438df8d2f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 22 Feb 2012 16:36:28 -0500 Subject: V3 Support The V3 webapps need SSO capability and use OpenID. We need to send both our OpenID server url and a token for the user in the login response. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 20 +++++++++++++++++++- OpenSim/Services/LLLoginService/LLLoginService.cs | 4 +++- bin/Robust.ini.example | 3 +++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index b6f6d31..844c5ae 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -171,6 +171,9 @@ namespace OpenSim.Services.LLLoginService // Web Profiles private string profileURL; + // OpenID + private string openIDURL; + private string searchURL; // Error Flags @@ -223,7 +226,7 @@ namespace OpenSim.Services.LLLoginService public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List gestures, string message, - GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string searchURL, string currency) + GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency) : this() { FillOutInventoryData(invSkel, libService); @@ -241,6 +244,7 @@ namespace OpenSim.Services.LLLoginService StartLocation = where; MapTileURL = mapTileURL; ProfileURL = profileURL; + OpenIDURL = openIDURL; SearchURL = searchURL; Currency = currency; @@ -390,6 +394,7 @@ namespace OpenSim.Services.LLLoginService initialOutfit.Add(InitialOutfitHash); mapTileURL = String.Empty; profileURL = String.Empty; + openIDURL = String.Empty; searchURL = String.Empty; currency = String.Empty; @@ -465,6 +470,10 @@ namespace OpenSim.Services.LLLoginService if (profileURL != String.Empty) responseData["profile-server-url"] = profileURL; + // We need to send an openid_token back in the response too + if (openIDURL != String.Empty) + responseData["openid_url"] = openIDURL; + if (m_buddyList != null) { responseData["buddy-list"] = m_buddyList.ToArray(); @@ -573,6 +582,9 @@ namespace OpenSim.Services.LLLoginService if (profileURL != String.Empty) map["profile-server-url"] = OSD.FromString(profileURL); + if (openIDURL != String.Empty) + map["openid_url"] = OSD.FromString(openIDURL); + if (searchURL != String.Empty) map["search"] = OSD.FromString(searchURL); @@ -951,6 +963,12 @@ namespace OpenSim.Services.LLLoginService set { profileURL = value; } } + public string OpenIDURL + { + get { return openIDURL; } + set { openIDURL = value; } + } + public string SearchURL { get { return searchURL; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 02e62c8..f7b38d4 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -75,6 +75,7 @@ namespace OpenSim.Services.LLLoginService protected bool m_AllowRemoteSetLoginLevel; protected string m_MapTileURL; protected string m_ProfileURL; + protected string m_OpenIDURL; protected string m_SearchURL; protected string m_Currency; @@ -110,6 +111,7 @@ namespace OpenSim.Services.LLLoginService m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); + m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); @@ -415,7 +417,7 @@ namespace OpenSim.Services.LLLoginService // Finally, fill out the response and return it // LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, - where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_SearchURL, m_Currency); + where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency); m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); return response; diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 91cd6d0..326caeb 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -227,6 +227,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; For V2/3 Web Profiles ProfileServerURL = "http://127.0.0.1/profiles/[AGENT_NAME] + ; For V2/V3 webapp authentication SSO + OpenIDServerURL = "http://127.0.0.1/openid/openidserver/ + ; If you run this login server behind a proxy, set this to true ; HasProxy = false -- cgit v1.1 From f034958bdca00cdec77f05b7cbddd07ea2584b02 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 23 Feb 2012 23:11:47 +0000 Subject: Load appropriate 32-bit/64-bit Windows sqlite dll if using WebStatsModule. This should resolve http://opensimulator.org/mantis/view.php?id=5901 --- OpenSim/Region/UserStatistics/WebStatsModule.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index f627e37..ad272f7 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics { if (m_scenes.Count == 0) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + //IConfig startupConfig = config.Configs["Startup"]; dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); -- cgit v1.1 From 0b9f4d7e749a14c556d7f8a4ea64c54625cf58dc Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Wed, 22 Feb 2012 20:15:42 +0100 Subject: llLinkSitTarget implementation http://wiki.secondlife.com/wiki/LlLinkSitTarget --- .../Shared/Api/Implementation/LSL_Api.cs | 32 ++++++++++++++++++---- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 61a6907..2eba2b1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6376,16 +6376,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) + protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot) { - m_host.AddScriptLPS(1); // LSL quaternions can normalize to 0, normal Quaternions can't. if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) rot.z = 1; // ZERO_ROTATION = 0,0,0,1 - m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); - m_host.SitTargetOrientation = Rot2Quaternion(rot); - m_host.ParentGroup.HasGroupChanged = true; + part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + part.SitTargetOrientation = Rot2Quaternion(rot); + part.ParentGroup.HasGroupChanged = true; + } + + public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) + { + m_host.AddScriptLPS(1); + SitTarget(m_host, offset, rot); + } + + public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) + { + m_host.AddScriptLPS(1); + if (link == ScriptBaseClass.LINK_ROOT) + SitTarget(m_host.ParentGroup.RootPart, offset, rot); + else if (link == ScriptBaseClass.LINK_THIS) + SitTarget(m_host, offset, rot); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + { + SitTarget(part, offset, rot); + } + } } public LSL_String llAvatarOnSitTarget() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 6106a65..7d39ccc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -218,6 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetDisplayName(string id); LSL_String llRequestDisplayName(string id); void llLinkParticleSystem(int linknum, LSL_List rules); + void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot); LSL_String llList2CSV(LSL_List src); LSL_Float llList2Float(LSL_List src, int index); LSL_Integer llList2Integer(LSL_List src, int index); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 83550a5..24c3d95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1688,6 +1688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSitTarget(offset, rot); } + public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) + { + m_LSL_Functions.llLinkSitTarget(link, offset, rot); + } + public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); -- cgit v1.1 From fe229f10e65ca979a127b316f75bb48fc7d19aa2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 04:08:59 +0000 Subject: In osSetSpeed(), if no avatar for a uuid is found then don't attempt to set speed. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c55e2ae..ff1f5fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); m_host.AddScriptLPS(1); ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); - avatar.SpeedModifier = (float)SpeedModifier; + + if (avatar != null) + avatar.SpeedModifier = (float)SpeedModifier; } public void osKickAvatar(string FirstName,string SurName,string alert) -- cgit v1.1 From f67f37074f3f7e0602b66aa66a044dd9fd107f6a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:02:33 +0000 Subject: Stop spurious scene loop startup timeout alarms for scenes with many prims. On the first frame, all startup scene objects are added to the physics scene. This can cause a considerable delay, so we don't start raising the alarm on scene loop timeouts until the second frame. This commit also slightly changes the behaviour of timeout reporting. Previously, a report was made for the very first timed out thread, ignoring all others until the next watchdog check. Instead, we now report every timed out thread, though we still only do this once no matter how long the timeout. --- .../HttpServer/PollServiceRequestManager.cs | 2 + OpenSim/Framework/Watchdog.cs | 57 +++++++++++++++------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 7 ++- .../InterGrid/OpenGridProtocolModule.cs | 2 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.cs | 12 +++-- .../Server/IRCClientView.cs | 2 +- .../InternetRelayClientView/Server/IRCServer.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 2 + .../Api/Implementation/AsyncCommandManager.cs | 4 +- 10 files changed, 65 insertions(+), 26 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 2206feb..0062d4e 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer String.Format("PollServiceWorkerThread{0}", i), ThreadPriority.Normal, false, + true, int.MaxValue); } @@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer "PollServiceWatcherThread", ThreadPriority.Normal, false, + true, 1000 * 60 * 10); } diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 2dd6ebe..e443f0a 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -72,6 +72,11 @@ namespace OpenSim.Framework /// public bool IsTimedOut { get; set; } + /// + /// Will this thread trigger the alarm function if it has timed out? + /// + public bool AlarmIfTimeout { get; set; } + public ThreadWatchdogInfo(Thread thread, int timeout) { Thread = thread; @@ -112,12 +117,13 @@ namespace OpenSim.Framework /// The method that will be executed in a new thread /// A name to give to the new thread /// Priority to run the thread at - /// True to run this thread as a background - /// thread, otherwise false + /// True to run this thread as a background thread, otherwise false + /// Trigger an alarm function is we have timed out /// The newly created Thread object - public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground) + public static Thread StartThread( + ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout) { - return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS); + return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS); } /// @@ -128,21 +134,21 @@ namespace OpenSim.Framework /// Priority to run the thread at /// True to run this thread as a background /// thread, otherwise false - /// - /// Number of milliseconds to wait until we issue a warning about timeout. - /// + /// Trigger an alarm function is we have timed out + /// Number of milliseconds to wait until we issue a warning about timeout. /// The newly created Thread object public static Thread StartThread( - ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout) + ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout) { Thread thread = new Thread(start); thread.Name = name; thread.Priority = priority; thread.IsBackground = isBackground; - ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout); + ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout }; - m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")"); + m_log.DebugFormat( + "[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); lock (m_threads) m_threads.Add(twi.Thread.ManagedThreadId, twi); @@ -230,6 +236,26 @@ namespace OpenSim.Framework return m_threads.Values.ToArray(); } + /// + /// Return the current thread's watchdog info. + /// + /// The watchdog info. null if the thread isn't being monitored. + public static ThreadWatchdogInfo GetCurrentThreadInfo() + { + lock (m_threads) + { + if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId)) + return m_threads[Thread.CurrentThread.ManagedThreadId]; + } + + return null; + } + + /// + /// Check watched threads. Fire alarm if appropriate. + /// + /// + /// private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) { WatchdogTimeout callback = OnWatchdogTimeout; @@ -246,21 +272,18 @@ namespace OpenSim.Framework { if (threadInfo.Thread.ThreadState == ThreadState.Stopped) { - timedOut = threadInfo; RemoveThread(threadInfo.Thread.ManagedThreadId); - break; + callback(threadInfo.Thread, threadInfo.LastTick); } else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) { threadInfo.IsTimedOut = true; - timedOut = threadInfo; - break; + + if (threadInfo.AlarmIfTimeout) + callback(threadInfo.Thread, threadInfo.LastTick); } } } - - if (timedOut != null) - callback(timedOut.Thread, timedOut.LastTick); } m_watchdogTimer.Start(); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 1e22fcc..fb6b11e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP base.Start(m_recvBufferSize, m_asyncPacketHandling); // Start the packet processing threads - Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); - Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); + Watchdog.StartThread( + IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); + Watchdog.StartThread( + OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); + m_elapsedMSSinceLastStatReport = Environment.TickCount; } diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index f367739..a6e2548 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid if (homeScene.TryGetScenePresence(avatarId,out avatar)) { KillAUser ku = new KillAUser(avatar,mod); - Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); + Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true); } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b315d2c..74b047b 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap process, string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), ThreadPriority.BelowNormal, + true, true); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cf6e6af..19d4bad 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1140,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes HeartbeatThread = Watchdog.StartThread( - Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); + Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); } /// @@ -1178,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes try { m_eventManager.TriggerOnRegionStarted(this); + + // The first frame can take a very long time due to physics actors being added on startup. Therefore, + // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false + // alarms for scenes with many objects. + Update(); + Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; + while (!shuttingdown) Update(); @@ -1206,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes ++Frame; -// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); +// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); try { @@ -1418,7 +1425,6 @@ namespace OpenSim.Region.Framework.Scenes entry.checkAtTargets(); } - /// /// Send out simstats data to all clients /// diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index c928af7..d3c96e2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_client = client; m_scene = scene; - Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); + Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); } private void SendServerCommand(string command) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index eb39026..a7c5020 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_listener.Start(50); - Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); + Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); m_baseScene = baseScene; } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 75364b7..97890ee 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:"); /// private void changeadd() { +// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); + int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index ee32755..14edde4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (cmdHandlerThread == null) { // Start the thread that will be doing the work - cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); + cmdHandlerThread + = Watchdog.StartThread( + CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); } } -- cgit v1.1 From 84735b644cbd8902dd749fadb4056d26044fd564 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:12:56 +0000 Subject: Get rid of some of the identical exception catching in Scene.Update(). --- OpenSim/Region/Framework/Scenes/Scene.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 19d4bad..9bca654 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1368,26 +1368,10 @@ namespace OpenSim.Region.Framework.Scenes { throw; } - catch (AccessViolationException e) - { - m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", - RegionInfo.RegionName, e.Message, e.StackTrace); - } - //catch (NullReferenceException e) - //{ - // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - //} - catch (InvalidOperationException e) - { - m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", - RegionInfo.RegionName, e.Message, e.StackTrace); - } catch (Exception e) { m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", + "[SCENE]: Failed on region {0} with exception {1}{2}", RegionInfo.RegionName, e.Message, e.StackTrace); } -- cgit v1.1 From 9e6ffe779841f470c0e2dbe673ef4b10253bcd84 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:15:47 +0000 Subject: Rename Watchdog.GetThreads() to GetThreadsInfo() to reflect what it actually returns and for consistency. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 +- OpenSim/Framework/Watchdog.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 0dd01af..6a3135e 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}"; StringBuilder sb = new StringBuilder(); - Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); + Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo(); sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index e443f0a..4891a66 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -230,7 +230,7 @@ namespace OpenSim.Framework /// Get currently watched threads for diagnostic purposes /// /// - public static ThreadWatchdogInfo[] GetThreads() + public static ThreadWatchdogInfo[] GetThreadsInfo() { lock (m_threads) return m_threads.Values.ToArray(); -- cgit v1.1 From bafef292f4d41df14a1edeafc7ba5f9d623d7822 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:25:18 +0000 Subject: Take watchdog alarm calling back outside the m_threads lock. This is how it was originally. This stops a very long running alarm callback from causing a problem. --- OpenSim/Framework/Watchdog.cs | 19 ++++++++++++++++--- .../Framework/Scenes/SceneCommunicationService.cs | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 4891a66..e93e50e 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -262,7 +262,7 @@ namespace OpenSim.Framework if (callback != null) { - ThreadWatchdogInfo timedOut = null; + List callbackInfos = null; lock (m_threads) { @@ -273,17 +273,30 @@ namespace OpenSim.Framework if (threadInfo.Thread.ThreadState == ThreadState.Stopped) { RemoveThread(threadInfo.Thread.ManagedThreadId); - callback(threadInfo.Thread, threadInfo.LastTick); + + if (callbackInfos == null) + callbackInfos = new List(); + + callbackInfos.Add(threadInfo); } else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) { threadInfo.IsTimedOut = true; if (threadInfo.AlarmIfTimeout) - callback(threadInfo.Thread, threadInfo.LastTick); + { + if (callbackInfos == null) + callbackInfos = new List(); + + callbackInfos.Add(threadInfo); + } } } } + + if (callbackInfos != null) + foreach (ThreadWatchdogInfo callbackInfo in callbackInfos) + callback(callbackInfo.Thread, callbackInfo.LastTick); } m_watchdogTimer.Start(); diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 19c9745..4d98f00 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes // that the region position is cached or performance will degrade Utils.LongToUInts(regionHandle, out x, out y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - bool v = true; - if (! simulatorList.Contains(dest.ServerURI)) +// bool v = true; + if (!simulatorList.Contains(dest.ServerURI)) { // we havent seen this simulator before, add it to the list // and send it an update -- cgit v1.1 From 7b5e42c744ceeee739f1fbdb2c96552dfd4add52 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Fri, 24 Feb 2012 20:46:14 +0100 Subject: llGetLinkMedia, llSetLinkMedia, llClearLinkMedia implementation mantis: http://opensimulator.org/mantis/view.php?id=5756 http://opensimulator.org/mantis/view.php?id=5755 http://opensimulator.org/mantis/view.php?id=5754 --- .../Shared/Api/Implementation/LSL_Api.cs | 106 ++++++++++++++++----- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 7 +- .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 19 +++- 3 files changed, 105 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2eba2b1..525c3c3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8173,23 +8173,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); ScriptSleep(1000); + return GetPrimMediaParams(m_host, face, rules); + } + + public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); + else if (link == ScriptBaseClass.LINK_THIS) + return GetPrimMediaParams(m_host, face, rules); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return GetPrimMediaParams(part, face, rules); + } + + return new LSL_List(); + } + private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) + { // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). // Assuming silently fail means give back an empty list. Ideally, need to check this. - if (face < 0 || face > m_host.GetNumberOfSides() - 1) + if (face < 0 || face > part.GetNumberOfSides() - 1) return new LSL_List(); - return GetPrimMediaParams(face, rules); - } - - private LSL_List GetPrimMediaParams(int face, LSL_List rules) - { IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return new LSL_List(); - MediaEntry me = module.GetMediaEntry(m_host, face); + MediaEntry me = module.GetMediaEntry(part, face); // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams if (null == me) @@ -8271,33 +8288,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: res.Add(new LSL_Integer((int)me.ControlPermissions)); break; + + default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; } } return res; } - public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) + public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) { m_host.AddScriptLPS(1); ScriptSleep(1000); + return SetPrimMediaParams(m_host, face, rules); + } - // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid - // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. - // Don't perform the media check directly - if (face < 0 || face > m_host.GetNumberOfSides() - 1) - return ScriptBaseClass.LSL_STATUS_OK; + public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); + else if (link == ScriptBaseClass.LINK_THIS) + return SetPrimMediaParams(m_host, face, rules); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return SetPrimMediaParams(part, face, rules); + } - return SetPrimMediaParams(face, rules); + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; } - private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) + private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules) { + // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid + // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. + // Don't perform the media check directly + if (face < 0 || face > part.GetNumberOfSides() - 1) + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; + IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; - MediaEntry me = module.GetMediaEntry(m_host, face); + MediaEntry me = module.GetMediaEntry(part, face); if (null == me) me = new MediaEntry(); @@ -8376,10 +8412,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); break; + + default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; } } - module.SetMediaEntry(m_host, face, me); + module.SetMediaEntry(part, face, me); return ScriptBaseClass.LSL_STATUS_OK; } @@ -8388,18 +8426,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); ScriptSleep(1000); + return ClearPrimMedia(m_host, face); + } + public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return ClearPrimMedia(m_host.ParentGroup.RootPart, face); + else if (link == ScriptBaseClass.LINK_THIS) + return ClearPrimMedia(m_host, face); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return ClearPrimMedia(part, face); + } + + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; + } + + private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face) + { // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. // FIXME: Don't perform the media check directly - if (face < 0 || face > m_host.GetNumberOfSides() - 1) - return ScriptBaseClass.LSL_STATUS_OK; + if (face < 0 || face > part.GetNumberOfSides() - 1) + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; - module.ClearMediaEntry(m_host, face); + module.ClearMediaEntry(part, face); return ScriptBaseClass.LSL_STATUS_OK; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7d39ccc..0f53bc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); LSL_Integer llCeil(double f); void llClearCameraParams(); + LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face); LSL_Integer llClearPrimMedia(LSL_Integer face); void llCloseRemoteDataChannel(string channel); LSL_Float llCloud(LSL_Vector offset); @@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetLinkName(int linknum); LSL_Integer llGetLinkNumber(); LSL_Integer llGetLinkNumberOfSides(int link); - LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); + LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); + LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); LSL_Integer llGetListEntryType(LSL_List src, int index); LSL_Integer llGetListLength(LSL_List src); LSL_Vector llGetLocalPos(); @@ -335,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetInventoryPermMask(string item, int mask, int value); void llSetLinkAlpha(int linknumber, double alpha, int face); void llSetLinkColor(int linknumber, LSL_Vector color, int face); + LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); void llSetLinkTexture(int linknumber, string texture, int face); void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); @@ -345,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetParcelMusicURL(string url); void llSetPayPrice(int price, LSL_List quick_pay_buttons); void llSetPos(LSL_Vector pos); - LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); + LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules); void llSetPrimitiveParams(LSL_List rules); void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); void llSetPrimURL(string url); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 24c3d95..f8e3c36 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1887,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LSL_Functions.llGetPrimMediaParams(face, rules); } - + + public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + return m_LSL_Functions.llGetLinkMedia(link, face, rules); + } + public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) { return m_LSL_Functions.llSetPrimMediaParams(face, rules); } - + + public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + return m_LSL_Functions.llSetLinkMedia(link, face, rules); + } + public LSL_Integer llClearPrimMedia(LSL_Integer face) { return m_LSL_Functions.llClearPrimMedia(face); } + public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) + { + return m_LSL_Functions.llClearLinkMedia(link, face); + } + public void print(string str) { m_LSL_Functions.print(str); -- cgit v1.1 From f9066e7d8657204b575c4d3c31151d6814991e0a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 00:36:28 +0000 Subject: Establish a distsrc nant target for producing the source distribution. This is in addition to the distbin target. The distbin target now needs distsrc to be run first. Still needs some extra tweaking that I shall eventually put in as sed invocations or similar. --- .nant/local.include | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.nant/local.include b/.nant/local.include index 4fa3e4d..7d16810 100644 --- a/.nant/local.include +++ b/.nant/local.include @@ -2,13 +2,19 @@ - - - + + + + + + + + + -- cgit v1.1 From b48b0b1e5861810b4d77e4ade1a44b8a9db79f90 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 00:48:41 +0000 Subject: Remove EXPERIMENTAL tags from load iar/save iar commands. --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index a81f36c..650069a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -349,8 +349,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { try { - m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); - Dictionary options = new Dictionary(); OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); @@ -412,7 +410,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return; } - m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); if (options.ContainsKey("home")) m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); -- cgit v1.1 From 3fbcd21916e351edc2f38441a7f98814f26a3ba5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 03:12:41 +0000 Subject: Remove xunit.dll, Fadd.Globalization.Yaml.dll and Fadd.dll. It looks like these were once connected with HttpServer.dll but are now unused. --- bin/Fadd.Globalization.Yaml.dll | Bin 28672 -> 0 bytes bin/Fadd.dll | Bin 172032 -> 0 bytes bin/xunit.dll | Bin 65536 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/Fadd.Globalization.Yaml.dll delete mode 100755 bin/Fadd.dll delete mode 100755 bin/xunit.dll diff --git a/bin/Fadd.Globalization.Yaml.dll b/bin/Fadd.Globalization.Yaml.dll deleted file mode 100755 index 66a0706..0000000 Binary files a/bin/Fadd.Globalization.Yaml.dll and /dev/null differ diff --git a/bin/Fadd.dll b/bin/Fadd.dll deleted file mode 100755 index 06183f1..0000000 Binary files a/bin/Fadd.dll and /dev/null differ diff --git a/bin/xunit.dll b/bin/xunit.dll deleted file mode 100755 index a512735..0000000 Binary files a/bin/xunit.dll and /dev/null differ -- cgit v1.1 From 6138662716f8fe10738f0da0b19fc9b52ee610e2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 03:25:56 +0000 Subject: Move other sqlite and ode 32-bit and 64-bit libraries into lib32 or lib64 as appropriate. --- bin/Mono.Data.Sqlite.dll.config | 6 +++--- bin/Ode.NET.dll.config | 12 ++++++------ bin/lib32/libode.so | Bin 0 -> 3051566 bytes bin/lib32/libsqlite3.txt | 1 + bin/lib32/libsqlite3_32.so | Bin 0 -> 635852 bytes bin/lib64/libode-x86_64.so | Bin 0 -> 5546089 bytes bin/lib64/libode.dylib | Bin 0 -> 2916380 bytes bin/lib64/libsqlite3.dylib | Bin 0 -> 2175300 bytes bin/lib64/libsqlite3_64.so | Bin 0 -> 783200 bytes bin/libode-x86_64.so | Bin 5546089 -> 0 bytes bin/libode.dylib | Bin 2916380 -> 0 bytes bin/libode.so | Bin 3051566 -> 0 bytes bin/libsqlite3.dylib | Bin 2175300 -> 0 bytes bin/libsqlite3.txt | 1 - bin/libsqlite3_32.so | Bin 635852 -> 0 bytes bin/libsqlite3_64.so | Bin 783200 -> 0 bytes 16 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 bin/lib32/libode.so create mode 100644 bin/lib32/libsqlite3.txt create mode 100755 bin/lib32/libsqlite3_32.so create mode 100644 bin/lib64/libode-x86_64.so create mode 100644 bin/lib64/libode.dylib create mode 100755 bin/lib64/libsqlite3.dylib create mode 100755 bin/lib64/libsqlite3_64.so delete mode 100644 bin/libode-x86_64.so delete mode 100644 bin/libode.dylib delete mode 100644 bin/libode.so delete mode 100755 bin/libsqlite3.dylib delete mode 100644 bin/libsqlite3.txt delete mode 100755 bin/libsqlite3_32.so delete mode 100755 bin/libsqlite3_64.so diff --git a/bin/Mono.Data.Sqlite.dll.config b/bin/Mono.Data.Sqlite.dll.config index ccc0cf5..e66d1b7 100644 --- a/bin/Mono.Data.Sqlite.dll.config +++ b/bin/Mono.Data.Sqlite.dll.config @@ -1,5 +1,5 @@ - - - + + + diff --git a/bin/Ode.NET.dll.config b/bin/Ode.NET.dll.config index f8f071e..c72c281 100644 --- a/bin/Ode.NET.dll.config +++ b/bin/Ode.NET.dll.config @@ -1,7 +1,7 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/bin/lib32/libode.so b/bin/lib32/libode.so new file mode 100644 index 0000000..6bb85fb Binary files /dev/null and b/bin/lib32/libode.so differ diff --git a/bin/lib32/libsqlite3.txt b/bin/lib32/libsqlite3.txt new file mode 100644 index 0000000..8ef66bd --- /dev/null +++ b/bin/lib32/libsqlite3.txt @@ -0,0 +1 @@ +libsqlite version: 3.7.5 diff --git a/bin/lib32/libsqlite3_32.so b/bin/lib32/libsqlite3_32.so new file mode 100755 index 0000000..171ffcd Binary files /dev/null and b/bin/lib32/libsqlite3_32.so differ diff --git a/bin/lib64/libode-x86_64.so b/bin/lib64/libode-x86_64.so new file mode 100644 index 0000000..9c3070a Binary files /dev/null and b/bin/lib64/libode-x86_64.so differ diff --git a/bin/lib64/libode.dylib b/bin/lib64/libode.dylib new file mode 100644 index 0000000..958d202 Binary files /dev/null and b/bin/lib64/libode.dylib differ diff --git a/bin/lib64/libsqlite3.dylib b/bin/lib64/libsqlite3.dylib new file mode 100755 index 0000000..94dcca8 Binary files /dev/null and b/bin/lib64/libsqlite3.dylib differ diff --git a/bin/lib64/libsqlite3_64.so b/bin/lib64/libsqlite3_64.so new file mode 100755 index 0000000..2646a9c Binary files /dev/null and b/bin/lib64/libsqlite3_64.so differ diff --git a/bin/libode-x86_64.so b/bin/libode-x86_64.so deleted file mode 100644 index 9c3070a..0000000 Binary files a/bin/libode-x86_64.so and /dev/null differ diff --git a/bin/libode.dylib b/bin/libode.dylib deleted file mode 100644 index 958d202..0000000 Binary files a/bin/libode.dylib and /dev/null differ diff --git a/bin/libode.so b/bin/libode.so deleted file mode 100644 index 6bb85fb..0000000 Binary files a/bin/libode.so and /dev/null differ diff --git a/bin/libsqlite3.dylib b/bin/libsqlite3.dylib deleted file mode 100755 index 94dcca8..0000000 Binary files a/bin/libsqlite3.dylib and /dev/null differ diff --git a/bin/libsqlite3.txt b/bin/libsqlite3.txt deleted file mode 100644 index 8ef66bd..0000000 --- a/bin/libsqlite3.txt +++ /dev/null @@ -1 +0,0 @@ -libsqlite version: 3.7.5 diff --git a/bin/libsqlite3_32.so b/bin/libsqlite3_32.so deleted file mode 100755 index 171ffcd..0000000 Binary files a/bin/libsqlite3_32.so and /dev/null differ diff --git a/bin/libsqlite3_64.so b/bin/libsqlite3_64.so deleted file mode 100755 index 2646a9c..0000000 Binary files a/bin/libsqlite3_64.so and /dev/null differ -- cgit v1.1 From ca19b9078fc215f949123ba41bc28a565c984289 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 03:36:43 +0000 Subject: Remove old libbulletnet native libraries. These are not used in the current generation bullet physics plugin. --- bin/libbulletnet.dll | Bin 369664 -> 0 bytes bin/libbulletnet.so | Bin 4286426 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/libbulletnet.dll delete mode 100644 bin/libbulletnet.so diff --git a/bin/libbulletnet.dll b/bin/libbulletnet.dll deleted file mode 100755 index 8ec7c55..0000000 Binary files a/bin/libbulletnet.dll and /dev/null differ diff --git a/bin/libbulletnet.so b/bin/libbulletnet.so deleted file mode 100644 index 14779ea..0000000 Binary files a/bin/libbulletnet.so and /dev/null differ -- cgit v1.1 From 61591102580c824e199a2803f0f58baad662f0f6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 04:22:59 +0000 Subject: Remove some more unused Bullet libraries. --- bin/BulletDotNET.dll | Bin 58880 -> 0 bytes bin/BulletDotNET.pdb | Bin 198144 -> 0 bytes bin/Modified.XnaDevRu.BulletX.dll | Bin 208896 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/BulletDotNET.dll delete mode 100644 bin/BulletDotNET.pdb delete mode 100755 bin/Modified.XnaDevRu.BulletX.dll diff --git a/bin/BulletDotNET.dll b/bin/BulletDotNET.dll deleted file mode 100755 index 40c4348..0000000 Binary files a/bin/BulletDotNET.dll and /dev/null differ diff --git a/bin/BulletDotNET.pdb b/bin/BulletDotNET.pdb deleted file mode 100644 index a5499ec..0000000 Binary files a/bin/BulletDotNET.pdb and /dev/null differ diff --git a/bin/Modified.XnaDevRu.BulletX.dll b/bin/Modified.XnaDevRu.BulletX.dll deleted file mode 100755 index a047f99..0000000 Binary files a/bin/Modified.XnaDevRu.BulletX.dll and /dev/null differ -- cgit v1.1 From 4a5f9fe6a20a17917da4a55f043aed5f161ec025 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 04:26:32 +0000 Subject: Move libopenjpeg native libraries into lib32 and lib64 as appropriate. --- bin/OpenMetaverse.dll.config | 10 +++++----- bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so | Bin 0 -> 124540 bytes bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so | Bin 0 -> 128100 bytes .../libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so | Bin 0 -> 142616 bytes bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib | Bin 0 -> 125136 bytes bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so | Bin 124540 -> 0 bytes bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so | Bin 142616 -> 0 bytes bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib | Bin 125136 -> 0 bytes bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so | Bin 128100 -> 0 bytes 9 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so create mode 100644 bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so create mode 100644 bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so create mode 100644 bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib delete mode 100644 bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so delete mode 100644 bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so delete mode 100644 bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib delete mode 100644 bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so diff --git a/bin/OpenMetaverse.dll.config b/bin/OpenMetaverse.dll.config index 13fdc11..e8c90a4 100644 --- a/bin/OpenMetaverse.dll.config +++ b/bin/OpenMetaverse.dll.config @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so b/bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so new file mode 100644 index 0000000..0106b56 Binary files /dev/null and b/bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so differ diff --git a/bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so b/bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so new file mode 100644 index 0000000..53543e7 Binary files /dev/null and b/bin/lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so differ diff --git a/bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so b/bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so new file mode 100644 index 0000000..be11bb4 Binary files /dev/null and b/bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so differ diff --git a/bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib b/bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib new file mode 100644 index 0000000..dc50775 Binary files /dev/null and b/bin/lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib differ diff --git a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so b/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so deleted file mode 100644 index 0106b56..0000000 Binary files a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686.so and /dev/null differ diff --git a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so b/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so deleted file mode 100644 index be11bb4..0000000 Binary files a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64.so and /dev/null differ diff --git a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib b/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib deleted file mode 100644 index dc50775..0000000 Binary files a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib and /dev/null differ diff --git a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so b/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so deleted file mode 100644 index 53543e7..0000000 Binary files a/bin/libopenjpeg-dotnet-2.1.3.0-dotnet-1.so and /dev/null differ -- cgit v1.1 From 01f454242d20dd513e82eae1eb79db7842e597ea Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Sat, 25 Feb 2012 16:39:14 +0100 Subject: PRIM_SCULPT_FLAG_INVERT, PRIM_SCULPT_FLAG_MIRROR implemented http://opensimulator.org/mantis/view.php?id=5763 --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 ++++++---- .../Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 525c3c3..c5392b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7069,10 +7069,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathScaleX = 100; shapeBlock.PathScaleY = 150; - if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER && - type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE && - type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE && - type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) + int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR); + + if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) && + type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) && + type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) && + type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag)) { // default type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index bb498b5..5a53e15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -378,6 +378,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_SCULPT_TYPE_TORUS = 2; public const int PRIM_SCULPT_TYPE_PLANE = 3; public const int PRIM_SCULPT_TYPE_CYLINDER = 4; + public const int PRIM_SCULPT_FLAG_INVERT = 64; + public const int PRIM_SCULPT_FLAG_MIRROR = 128; public const int MASK_BASE = 0; public const int MASK_OWNER = 1; -- cgit v1.1 From 142f8a4aeca211ff6f88c7227f8654cd43a0dbaf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 25 Feb 2012 21:00:19 -0800 Subject: HG: Remove async in posting assets to foreign grid. Mono hates concurrency there. --- .../CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 0c4ff7f..d2fe388 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess string userAssetServer = string.Empty; if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) { - Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); + m_assMapper.Post(assetID, avatarID, userAssetServer); } } -- cgit v1.1 From 4268427ac36410452bcfee9fe51d7deeb0ef303d Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 27 Feb 2012 15:15:03 -0800 Subject: Some clean up in WebUtil, remove unused ServiceRequest function. --- OpenSim/Framework/WebUtil.cs | 78 ++++---------------------------------------- 1 file changed, 7 insertions(+), 71 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index b761dfe..af25da9 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -63,77 +63,7 @@ namespace OpenSim.Framework // a "long" call for warning & debugging purposes public const int LongCallTime = 500; -// /// -// /// Send LLSD to an HTTP client in application/llsd+json form -// /// -// /// HTTP response to send the data in -// /// LLSD to send to the client -// public static void SendJSONResponse(OSHttpResponse response, OSDMap body) -// { -// byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body)); -// -// response.ContentEncoding = Encoding.UTF8; -// response.ContentLength = responseData.Length; -// response.ContentType = "application/llsd+json"; -// response.Body.Write(responseData, 0, responseData.Length); -// } -// -// /// -// /// Send LLSD to an HTTP client in application/llsd+xml form -// /// -// /// HTTP response to send the data in -// /// LLSD to send to the client -// public static void SendXMLResponse(OSHttpResponse response, OSDMap body) -// { -// byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body); -// -// response.ContentEncoding = Encoding.UTF8; -// response.ContentLength = responseData.Length; -// response.ContentType = "application/llsd+xml"; -// response.Body.Write(responseData, 0, responseData.Length); -// } - - /// - /// 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(httpVerb + " on URL " + url + " failed: " + ex.Message); - errorMessage = ex.Message; - } - - return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } }; - } + #region JSONRequest /// /// PUT JSON-encoded data to a web service that returns LLSD or @@ -303,6 +233,10 @@ namespace OpenSim.Framework return result; } + #endregion JSONRequest + + #region FormRequest + /// /// POST URL-encoded form data to a web service that returns LLSD or /// JSON data @@ -397,6 +331,8 @@ namespace OpenSim.Framework result["Message"] = OSD.FromString("Service request failed: " + msg); return result; } + + #endregion FormRequest #region Uri -- cgit v1.1 From a813e7ffdd811979a0b326fd73f2199b528e95a6 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Tue, 28 Feb 2012 15:45:07 -0500 Subject: Fixed two typos. White space cleanups. Signed-off-by: nebadon --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 74b047b..fd122da 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { } - public Type ReplaceableInterface + public Type ReplaceableInterface { get { return null; } } @@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // There is a major hack going on in this method. The viewer doesn't request // map blocks (RequestMapBlocks) above 2048. That means that if we don't hack, // grids above that cell don't have a map at all. So, here's the hack: we wait - // for this CAP request to come, and we inject the map blocks at this point. + // for this CAP request to come, and we inject the map blocks at this point. // In a normal scenario, this request simply sends back the MapLayer (the blue color). // In the hacked scenario, it also sends the map blocks via UDP. // @@ -751,7 +751,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { uint x = 0, y = 0; Utils.LongToUInts(regionhandle, out x, out y); - GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); + GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); if (mreg != null) { @@ -857,7 +857,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap finally { if (os != null) - os.Close(); + os.Close(); } string response_mapItems_reply = null; @@ -960,16 +960,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // on an unloaded square. // But make sure: Look whether the one we requested is in there List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - minX * (int)Constants.RegionSize, - maxX * (int)Constants.RegionSize, - minY * (int)Constants.RegionSize, + minX * (int)Constants.RegionSize, + maxX * (int)Constants.RegionSize, + minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); if (regions != null) { foreach (GridRegion r in regions) { - if ((r.RegionLocX == minX * (int)Constants.RegionSize) && + if ((r.RegionLocX == minX * (int)Constants.RegionSize) && (r.RegionLocY == minY * (int)Constants.RegionSize)) { // found it => add it to response @@ -1004,7 +1004,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { List mapBlocks = new List(); List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - (minX - 4) * (int)Constants.RegionSize, + (minX - 4) * (int)Constants.RegionSize, (maxX + 4) * (int)Constants.RegionSize, (minY - 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize); @@ -1336,7 +1336,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // Cannot create a map for a nonexistant heightmap if (m_scene.Heightmap == null) return; - + //create a texture asset of the terrain IMapImageGenerator terrain = m_scene.RequestModuleInterface(); if (terrain == null) @@ -1345,7 +1345,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap byte[] data = terrain.WriteJpeg2000Image(); if (data == null) return; - + byte[] overlay = GenerateOverlay(); m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); @@ -1366,7 +1366,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // Store the new one m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); m_scene.AssetService.Store(asset); - + if (overlay != null) { parcelImageID = UUID.Random(); @@ -1390,7 +1390,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; m_scene.RegionInfo.RegionSettings.Save(); - + // Delete the old one // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); m_scene.AssetService.Delete(lastTerrainImageID.ToString()); @@ -1469,18 +1469,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0) { landForSale = true; - + saleBitmap = land.MergeLandBitmaps(saleBitmap, land.GetLandBitmap()); } } if (!landForSale) { - m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not geenrating overlay", m_scene.RegionInfo.RegionName); + m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not generating overlay", m_scene.RegionInfo.RegionName); return null; } - m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, genrating overlay", m_scene.RegionInfo.RegionName); + m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName); for (int x = 0 ; x < 64 ; x++) { -- cgit v1.1 From 2fce7dd593571986cc08122a4fe015800fa765a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 28 Feb 2012 22:54:21 +0000 Subject: Call Dispose() via using() on SqliteCommands in WebStatsModule after use. --- OpenSim/Region/UserStatistics/WebStatsModule.cs | 197 ++++++++++++------------ 1 file changed, 98 insertions(+), 99 deletions(-) diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index ad272f7..b9ba4bc 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -224,13 +224,11 @@ namespace OpenSim.Region.UserStatistics concurrencyCounter--; response_code = 200; - } else { strOut = MainServer.Instance.GetHTTP404(""); } - responsedata["int_response_code"] = response_code; responsedata["content_type"] = contenttype; @@ -247,43 +245,44 @@ namespace OpenSim.Region.UserStatistics // TODO: FIXME: implement stats migrations const string SQL = @"SELECT * FROM migrations LIMIT 1"; - SqliteCommand cmd = new SqliteCommand(SQL, db); - - try - { - cmd.ExecuteNonQuery(); - } - catch (SqliteSyntaxException) + using (SqliteCommand cmd = new SqliteCommand(SQL, db)) { - CreateTables(db); + try + { + cmd.ExecuteNonQuery(); + } + catch (SqliteSyntaxException) + { + CreateTables(db); + } } } } public void CreateTables(SqliteConnection db) { - SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db); - createcmd.ExecuteNonQuery(); + using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db)) + { + createcmd.ExecuteNonQuery(); - createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; - createcmd.ExecuteNonQuery(); + createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; + createcmd.ExecuteNonQuery(); + } } public virtual void PostInitialise() { if (!enabled) - { return; - } + AddHandlers(); } public virtual void Close() { if (!enabled) - { return; - } + dbConn.Close(); dbConn.Dispose(); m_sessions.Clear(); @@ -304,7 +303,8 @@ namespace OpenSim.Region.UserStatistics public void OnRegisterCaps(UUID agentID, Caps caps) { - m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); +// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); + string capsPath = "/CAPS/VS/" + UUID.Random(); caps.RegisterHandler("ViewerStats", new RestStreamHandler("POST", capsPath, @@ -318,7 +318,6 @@ namespace OpenSim.Region.UserStatistics public void OnDeRegisterCaps(UUID agentID, Caps caps) { - } protected virtual void AddHandlers() @@ -368,7 +367,6 @@ namespace OpenSim.Region.UserStatistics public void OnMakeChildAgent(ScenePresence agent) { - } public void OnClientClosed(UUID agentID, Scene scene) @@ -430,6 +428,7 @@ namespace OpenSim.Region.UserStatistics return scene.RegionInfo.RegionID; } } + return UUID.Zero; } @@ -458,14 +457,14 @@ namespace OpenSim.Region.UserStatistics UserSessionData usd; OSD message = OSDParser.DeserializeLLSDXml(request); OSDMap mmap; + lock (m_sessions) { if (agentID != UUID.Zero) { - if (!m_sessions.ContainsKey(agentID)) { - m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure"); + m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID); return new UserSessionID(); } uid = m_sessions[agentID]; @@ -585,8 +584,6 @@ namespace OpenSim.Region.UserStatistics usd.n_out_kb = (float)net_out["kbytes"].AsReal(); usd.n_out_pk = net_out["packets"].AsInteger(); } - - } } @@ -602,83 +599,85 @@ namespace OpenSim.Region.UserStatistics lock (db) { - SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db); - updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated)); - updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip)); - updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f)); - updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view", - (int) uid.session_data.min_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view", - (int) uid.session_data.max_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view", - (int) uid.session_data.mode_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language)); - updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use)); - updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited)); - updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time)); - updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version)); - updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu)); - updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu)); - updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os)); - updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram)); - updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk)); - updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk)); - updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped)); - updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends)); - updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid)); - - updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit)); - updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent)); - updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); - - updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); -// m_log.Debug("UPDATE"); - - int result = updatecmd.ExecuteNonQuery(); - - if (result == 0) + using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db)) { -// m_log.Debug("INSERT"); - updatecmd.CommandText = SQL_STATS_TABLE_INSERT; - try - { - updatecmd.ExecuteNonQuery(); - } - catch (SqliteExecutionException) + updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated)); + updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip)); + updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f)); + updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view", + (int) uid.session_data.min_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view", + (int) uid.session_data.max_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view", + (int) uid.session_data.mode_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language)); + updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use)); + updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited)); + updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time)); + updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version)); + updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu)); + updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu)); + updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os)); + updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram)); + updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk)); + updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk)); + updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped)); + updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends)); + updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid)); + + updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit)); + updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent)); + updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); + + updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); + +// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id); + + int result = updatecmd.ExecuteNonQuery(); + + if (result == 0) { - m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception"); - } - catch (SqliteSyntaxException) - { - m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception"); - } +// m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id); + + updatecmd.CommandText = SQL_STATS_TABLE_INSERT; + try + { + updatecmd.ExecuteNonQuery(); + } + catch (Exception e) + { + m_log.WarnFormat( + "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}", + uid.session_data.agent_id, e.Message, e.StackTrace); + } + } } } } -- cgit v1.1 From 40c838896c18a9ee0283386cdcdc13adec5ae3d6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 29 Feb 2012 00:33:17 +0000 Subject: Use correct casing of RegionSettings.Sandbox in the various database modules. MySQL and MSSQL have it as Sandbox, sqlite as sandbox. In various different places in every plugin the wrong casing is used... Consistency, who needs it? Or one day sqlite can change to Sandbox. --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 4 ++-- OpenSim/Data/MySQL/MySQLSimulationData.cs | 2 +- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index e58620a..d6b1561 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -1367,7 +1367,7 @@ VALUES newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); - newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); + newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]); newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); newSettings.SunVector = new Vector3( @@ -1782,7 +1782,7 @@ VALUES parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit)); parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit)); parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun)); - parameters.Add(_Database.CreateParameter("sandbox", settings.Sandbox)); + parameters.Add(_Database.CreateParameter("Sandbox", settings.Sandbox)); parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun)); parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition)); parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X)); diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 7c995ad..381a514 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1283,7 +1283,7 @@ namespace OpenSim.Data.MySQL newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); - newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); + newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]); newSettings.SunVector = new Vector3 ( Convert.ToSingle(row["sunvectorx"]), Convert.ToSingle(row["sunvectory"]), diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 186a586..7e7c08a 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -2157,7 +2157,7 @@ namespace OpenSim.Data.SQLite row["terrain_raise_limit"] = settings.TerrainRaiseLimit; row["terrain_lower_limit"] = settings.TerrainLowerLimit; row["use_estate_sun"] = settings.UseEstateSun; - row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox + row["sandbox"] = settings.Sandbox; // unlike other database modules, sqlite uses a lower case s for sandbox! row["sunvectorx"] = settings.SunVector.X; row["sunvectory"] = settings.SunVector.Y; row["sunvectorz"] = settings.SunVector.Z; -- cgit v1.1 From a181fae72276073d7b3cd9c15e1448a3fabbb8f9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 29 Feb 2012 03:00:56 +0000 Subject: Don't start pCampbot if the user doesn't supply bot firstname, lastname stub and password --- OpenSim/Tools/pCampBot/pCampBot.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index a73fcbe..ec5ad04 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -56,6 +56,10 @@ namespace pCampBot { Help(); } + else if (config.Get("firstname") == null || config.Get("lastname") == null || config.Get("password") == null) + { + Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots."); + } else { int botcount = config.GetInt("botcount", 1); -- cgit v1.1 From 9f597c2d423a80279c4aed042be8a991eedefa21 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 29 Feb 2012 14:37:52 -0500 Subject: Fix authentication for OpenID provider --- .../Services/AuthenticationService/PasswordAuthenticationService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 48eb3f8..da19b2e 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -78,9 +78,9 @@ namespace OpenSim.Services.AuthenticationService } else { - string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); + string hashed = Util.Md5Hash(Util.Md5Hash(password) + ":" + data.Data["passwordSalt"].ToString()); - //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); + // m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}; passonly {3}", password, hashed, data.Data["passwordHash"].ToString(), hashed2); if (data.Data["passwordHash"].ToString() == hashed) { -- cgit v1.1 From 1a54e769488c9d2eaaaa7e65e0956e7a7bac789a Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 29 Feb 2012 14:54:06 -0500 Subject: Trigger a build --- README.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/README.txt b/README.txt index 72702a2..a5dec24 100644 --- a/README.txt +++ b/README.txt @@ -128,3 +128,4 @@ OpenSim, as well as how to report bugs, and participate in the OpenSim project can always be found at http://opensimulator.org. Thanks for trying OpenSim, we hope it is a pleasant experience. + -- cgit v1.1 From 69c999033b4d5772c8eed0a90d5f9237785224ff Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 29 Feb 2012 15:52:15 -0500 Subject: Revert "Fix authentication for OpenID provider" This reverts commit 9f597c2d423a80279c4aed042be8a991eedefa21. Fixing OpenID causes issues with other parts of the code. --- .../Services/AuthenticationService/PasswordAuthenticationService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index da19b2e..48eb3f8 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -78,9 +78,9 @@ namespace OpenSim.Services.AuthenticationService } else { - string hashed = Util.Md5Hash(Util.Md5Hash(password) + ":" + data.Data["passwordSalt"].ToString()); + string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); - // m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}; passonly {3}", password, hashed, data.Data["passwordHash"].ToString(), hashed2); + //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); if (data.Data["passwordHash"].ToString() == hashed) { -- cgit v1.1 From 1e95b01f13044703c6737a0aee84ae3ac998534c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 29 Feb 2012 21:51:46 +0000 Subject: Extend distsrc target to cleanup the files generated by running prebuild --- .nant/local.include | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.nant/local.include b/.nant/local.include index 7d16810..6d3e972 100644 --- a/.nant/local.include +++ b/.nant/local.include @@ -8,6 +8,24 @@ + + + + + + + + + + + + + + + + + + -- cgit v1.1 From aabbbb32ffd353ece2addf39c64f3ff3e15ca7d4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 29 Feb 2012 23:45:14 +0000 Subject: Flick master up to 0.7.4 --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index f30cb7a..7a5d715 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.4"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From 255afbf08a8829d05ea7fb24ad9d21e397d53428 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 1 Mar 2012 02:11:15 +0000 Subject: Remove more now unused third party libraries. --- bin/Google.ProtocolBuffers.dll | Bin 246784 -> 0 bytes bin/Iesi.Collections.dll | Bin 32768 -> 0 bytes bin/Kds.Serialization.dll | Bin 40960 -> 0 bytes bin/MonoXnaCompactMaths.dll | Bin 36864 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/Google.ProtocolBuffers.dll delete mode 100755 bin/Iesi.Collections.dll delete mode 100755 bin/Kds.Serialization.dll delete mode 100755 bin/MonoXnaCompactMaths.dll diff --git a/bin/Google.ProtocolBuffers.dll b/bin/Google.ProtocolBuffers.dll deleted file mode 100755 index 666aa93..0000000 Binary files a/bin/Google.ProtocolBuffers.dll and /dev/null differ diff --git a/bin/Iesi.Collections.dll b/bin/Iesi.Collections.dll deleted file mode 100755 index 107c362..0000000 Binary files a/bin/Iesi.Collections.dll and /dev/null differ diff --git a/bin/Kds.Serialization.dll b/bin/Kds.Serialization.dll deleted file mode 100755 index 7f03277..0000000 Binary files a/bin/Kds.Serialization.dll and /dev/null differ diff --git a/bin/MonoXnaCompactMaths.dll b/bin/MonoXnaCompactMaths.dll deleted file mode 100755 index 9fe8334..0000000 Binary files a/bin/MonoXnaCompactMaths.dll and /dev/null differ -- cgit v1.1 From 0007711eb5947d292f10325dd4af640ece79ea2d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 1 Mar 2012 03:23:10 +0000 Subject: Use a fully stubbed out MockConsole for unit tests rather than inheriting from CommandConsole. This is so that the static MainConsole.Instance doesn't retain references to methods registered by scene and other modules to service commands. This prevents the scene from being garbage collected at the end of a test. This is not the final thing preventing GC - next up is the timer started by SimStatsReporter that holds a reference to Scene that prevents end of test gc. --- OpenSim/Framework/Console/MockConsole.cs | 59 +++++++++++++++++----------- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs index a29b370..4d8751f 100644 --- a/OpenSim/Framework/Console/MockConsole.cs +++ b/OpenSim/Framework/Console/MockConsole.cs @@ -29,6 +29,7 @@ using System; using System.Threading; using System.Collections.Generic; using System.Text; +using System.Xml; namespace OpenSim.Framework.Console { @@ -37,28 +38,42 @@ namespace OpenSim.Framework.Console /// Don't use this except for Unit Testing or you're in for a world of hurt when the /// sim gets to ReadLine /// - public class MockConsole : CommandConsole + public class MockConsole : ICommandConsole { - public MockConsole(string defaultPrompt) : base(defaultPrompt) - { - } - public override void Output(string text) - { - } - public override void Output(string text, string level) - { - } + private MockCommands m_commands = new MockCommands(); - public override string ReadLine(string p, bool isCommand, bool e) - { - //Thread.CurrentThread.Join(1000); - return string.Empty; - } - public override void UnlockOutput() - { - } - public override void LockOutput() - { - } + public ICommands Commands { get { return m_commands; } } + + public void Prompt() {} + + public void RunCommand(string cmd) {} + + public string ReadLine(string p, bool isCommand, bool e) { return ""; } + + public object ConsoleScene { get { return null; } } + + public void Output(string text, string level) {} + public void Output(string text) {} + public void OutputFormat(string format, params object[] components) {} + + public string CmdPrompt(string p) { return ""; } + public string CmdPrompt(string p, string def) { return ""; } + public string CmdPrompt(string p, List excludedCharacters) { return ""; } + public string CmdPrompt(string p, string def, List excludedCharacters) { return ""; } + + public string CmdPrompt(string prompt, string defaultresponse, List options) { return ""; } + + public string PasswdPrompt(string p) { return ""; } + } + + public class MockCommands : ICommands + { + public void FromXml(XmlElement root, CommandDelegate fn) {} + public List GetHelp(string[] cmd) { return null; } + public void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn) {} + public void AddCommand(string module, bool shared, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) {} + public string[] FindNextOption(string[] cmd, bool term) { return null; } + public string[] Resolve(string[] cmd) { return null; } + public XmlElement GetXml(XmlDocument doc) { return null; } } -} +} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index aa904aa..8a69d7c 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -113,7 +113,7 @@ namespace OpenSim.Tests.Common Console.WriteLine("Setting up test scene {0}", name); // We must set up a console otherwise setup of some modules may fail - MainConsole.Instance = new MockConsole("TEST PROMPT"); + MainConsole.Instance = new MockConsole(); RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; -- cgit v1.1 From a2b0ed537ebb539e17491ea368903a346b1bed56 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 1 Mar 2012 14:18:48 -0500 Subject: Fix indexing on string trim Thanks to zadark for pointing this out, smxy for deciphering the ?: operator and Plugh for the fix \o/ yay for IRC --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c5392b5..0003515 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4039,7 +4039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), Util.Clip((float)color.y, 0.0f, 1.0f), Util.Clip((float)color.z, 0.0f, 1.0f)); - m_host.SetText(text.Length > 254 ? text.Remove(255) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); + m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); } -- cgit v1.1 From 8a375f3c30302c4a7ace1afb05a8b49fbb415640 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 1 Mar 2012 14:49:49 -0800 Subject: Adds an OSSL command for regular expression-based string replacement. Parameters are osReplaceString(string source, string patter, string replace, integer count, integer start) The count parameter specifies the total number of replacements to make, -1 makes all replacements. --- .../Shared/Api/Implementation/OSSL_Api.cs | 25 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 6 ++++++ 3 files changed, 32 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ff1f5fd..8edd146 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2160,6 +2160,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return result; } + public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) + { + CheckThreatLevel(ThreatLevel.High, "osReplaceString"); + m_host.AddScriptLPS(1); + + // Normalize indices (if negative). + // After normlaization they may still be + // negative, but that is now relative to + // the start, rather than the end, of the + // sequence. + if (start < 0) + { + start = src.Length + start; + } + + if (start < 0 || start >= src.Length) + { + return src; + } + + // Find matches beginning at start position + Regex matcher = new Regex(pattern); + return matcher.Replace(src,replace,count,start); + } + public string osLoadedCreationDate() { CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index dbc1dfc..82a6caf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -165,6 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String osFormatString(string str, LSL_List strings); LSL_List osMatchString(string src, string pattern, int start); + LSL_String osReplaceString(string src, string pattern, string replace, int count, int start); // Information about data loaded into the region string osLoadedCreationDate(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index cc8d417..4341246 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -472,6 +472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osMatchString(src, pattern, start); } + public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) + { + return m_OSSL_Functions.osReplaceString(src,pattern,replace,count,start); + } + + // Information about data loaded into the region public string osLoadedCreationDate() { -- cgit v1.1 From dcfd05c8eaa4550d9be4c673d660497da1e035c8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 00:22:23 +0000 Subject: lock SenseRepeatListLock when added a new sensor during script reconstitution. This is already being done in the other place where a sensor is added. Adding a sensor whilst another thread is iterating over the sensor list can cause a concurrency exception. --- .../ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 5c1bdff..8383c7f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -635,7 +635,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); - SenseRepeaters.Add(ts); + lock (SenseRepeatListLock) + SenseRepeaters.Add(ts); + idx += 6; } } -- cgit v1.1 From d8c4985527f1ffdea0f21714808522a350d85013 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 00:28:37 +0000 Subject: Move SenseRepeaters.Count check inside the SenseRepeatListLock. No methods in the List class are thread safe in the MS specification/documentation --- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 8383c7f..fbb7c39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -157,12 +157,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public void CheckSenseRepeaterEvents() { - // Nothing to do here? - if (SenseRepeaters.Count == 0) - return; - lock (SenseRepeatListLock) { + // Nothing to do here? + if (SenseRepeaters.Count == 0) + return; + // Go through all timers foreach (SenseRepeatClass ts in SenseRepeaters) { -- cgit v1.1 From 94971bf3b9fd53b571701e7d9a3a94628763da71 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 01:31:28 +0000 Subject: Provide feedback on bot login states in pCampbot --- OpenSim/Tools/pCampBot/Bot.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index 0bd0bcc..da090dd 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -420,6 +420,8 @@ namespace pCampBot public void Network_LoginProgress(object sender, LoginProgressEventArgs args) { + m_log.DebugFormat("[BOT]: Bot {0} {1} in Network_LoginProcess", Name, args.Status); + if (args.Status == LoginStatus.Success) { if (OnConnected != null) @@ -431,10 +433,15 @@ namespace pCampBot public void Network_SimConnected(object sender, SimConnectedEventArgs args) { + m_log.DebugFormat( + "[BOT]: Bot {0} connected to {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint); } public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) { + m_log.DebugFormat( + "[BOT]: Bot {0} disconnected reason {1}, message {2}", Name, args.Reason, args.Message); + // m_log.ErrorFormat("Fired Network_OnDisconnected"); // if ( -- cgit v1.1 From ec48a2f32ba991b89705b8212b0df8a79e961156 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 01:54:48 +0000 Subject: minor: Rename pCampbot console prompt to "pCampbot" rather than "Region" --- OpenSim/Tools/pCampBot/BotManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 6481e97..0f501b7 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -266,7 +266,7 @@ namespace pCampBot /// protected CommandConsole CreateConsole() { - return new LocalConsole("Region"); + return new LocalConsole("pCampbot"); } private void HandleShutdown(string module, string[] cmd) -- cgit v1.1 From dd63cd165631886806233958526f994baf60e855 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 02:23:35 +0000 Subject: Start by adding XAssetService as a copy of the existing AssetService. This is the start of exploring the creation of a bundled OpenSimulator asset service that does de-duplication and possibly file storage of assets. Along the lines of coyled's SRAS, but not intended to replace, merely to act as a more performant bundled default. Might end up nicking stuff from kcozen's patch at http://opensimulator.org/mantis/view.php?id=5429 More details at http://opensimulator.org/wiki/Feature_Proposals/Deduplicating_Asset_Service Feedback and discussion welcome as commits are made. --- .../Asset/LocalAssetServiceConnector.cs | 7 +- OpenSim/Services/AssetService/XAssetService.cs | 213 +++++++++++++++++++++ 2 files changed, 218 insertions(+), 2 deletions(-) create mode 100644 OpenSim/Services/AssetService/XAssetService.cs diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 2e6ec90..c78915f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -73,14 +73,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset return; } - string serviceDll = assetConfig.GetString("LocalServiceModule", - String.Empty); + string serviceDll = assetConfig.GetString("LocalServiceModule", String.Empty); if (serviceDll == String.Empty) { m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService"); return; } + else + { + m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Loading asset service at {0}", serviceDll); + } Object[] args = new Object[] { source }; m_AssetService = ServerUtils.LoadPlugin(serviceDll, args); diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs new file mode 100644 index 0000000..d161c58 --- /dev/null +++ b/OpenSim/Services/AssetService/XAssetService.cs @@ -0,0 +1,213 @@ +/* + * 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 Nini.Config; +using log4net; +using OpenSim.Framework; +using OpenSim.Data; +using OpenSim.Services.Interfaces; +using OpenMetaverse; + +namespace OpenSim.Services.AssetService +{ + /// + /// This will be developed into a de-duplicating asset service. + /// XXX: Currently it's a just a copy of the existing AssetService. so please don't attempt to use it. + /// + public class XAssetService : AssetServiceBase, IAssetService + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected static XAssetService m_RootInstance; + + public XAssetService(IConfigSource config) : base(config) + { + if (m_RootInstance == null) + { + m_RootInstance = this; + + if (m_AssetLoader != null) + { + IConfig assetConfig = config.Configs["AssetService"]; + if (assetConfig == null) + throw new Exception("No AssetService configuration"); + + string loaderArgs = assetConfig.GetString("AssetLoaderArgs", + String.Empty); + + bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true); + + if (assetLoaderEnabled) + { + m_log.DebugFormat("[XASSET SERVICE]: Loading default asset set from {0}", loaderArgs); + + m_AssetLoader.ForEachDefaultXmlAsset( + loaderArgs, + delegate(AssetBase a) + { + AssetBase existingAsset = Get(a.ID); +// AssetMetadata existingMetadata = GetMetadata(a.ID); + + if (existingAsset == null || Util.SHA1Hash(existingAsset.Data) != Util.SHA1Hash(a.Data)) + { +// m_log.DebugFormat("[ASSET]: Storing {0} {1}", a.Name, a.ID); + Store(a); + } + }); + } + + m_log.Debug("[XASSET SERVICE]: Local asset service enabled"); + } + } + } + + public virtual AssetBase Get(string id) + { +// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id); + + UUID assetID; + + if (!UUID.TryParse(id, out assetID)) + { + m_log.WarnFormat("[XASSET SERVICE]: Could not parse requested asset id {0}", id); + return null; + } + + try + { + return m_Database.GetAsset(assetID); + } + catch (Exception e) + { + m_log.ErrorFormat("[XASSET SERVICE]: Exception getting asset {0} {1}", assetID, e); + return null; + } + } + + public virtual AssetBase GetCached(string id) + { + return Get(id); + } + + public virtual AssetMetadata GetMetadata(string id) + { +// m_log.DebugFormat("[XASSET SERVICE]: Get asset metadata for {0}", id); + + UUID assetID; + + if (!UUID.TryParse(id, out assetID)) + return null; + + AssetBase asset = m_Database.GetAsset(assetID); + if (asset != null) + return asset.Metadata; + + return null; + } + + public virtual byte[] GetData(string id) + { +// m_log.DebugFormat("[XASSET SERVICE]: Get asset data for {0}", id); + + UUID assetID; + + if (!UUID.TryParse(id, out assetID)) + return null; + + AssetBase asset = m_Database.GetAsset(assetID); + return asset.Data; + } + + public virtual bool Get(string id, Object sender, AssetRetrieved handler) + { + //m_log.DebugFormat("[XASSET SERVICE]: Get asset async {0}", id); + + UUID assetID; + + if (!UUID.TryParse(id, out assetID)) + return false; + + AssetBase asset = m_Database.GetAsset(assetID); + + //m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset); + + handler(id, sender, asset); + + return true; + } + + public virtual string Store(AssetBase asset) + { + if (!m_Database.ExistsAsset(asset.FullID)) + { +// m_log.DebugFormat( +// "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); + m_Database.StoreAsset(asset); + } +// else +// { +// m_log.DebugFormat( +// "[XASSET SERVICE]: Not storing asset {0} {1}, bytes {2} as it already exists", asset.Name, asset.FullID, asset.Data.Length); +// } + + return asset.ID; + } + + public bool UpdateContent(string id, byte[] data) + { + return false; + } + + public virtual bool Delete(string id) + { + m_log.DebugFormat("[XASSET SERVICE]: Deleting asset {0}", id); + UUID assetID; + if (!UUID.TryParse(id, out assetID)) + return false; + + AssetBase asset = m_Database.GetAsset(assetID); + if (asset == null) + return false; + + if ((int)(asset.Flags & AssetFlags.Maptile) != 0) + { + return m_Database.Delete(id); + } + else + { + m_log.DebugFormat("[XASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id); + } + + return false; + } + } +} + -- cgit v1.1 From e8779cd9e54416349e67d9e5c48b35bab43b69e9 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 1 Mar 2012 19:22:05 -0800 Subject: In ScenePresence, removed several private variables used to store public parameters. They were only used by the get/set and make code harder to refactor. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 152 +++++++---------------- 1 file changed, 44 insertions(+), 108 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 40c8d06..e982bfe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -341,15 +341,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Position of agent's camera in world (region cordinates) /// - protected Vector3 m_lastCameraPosition; - - protected Vector3 m_CameraPosition; - - public Vector3 CameraPosition - { - get { return m_CameraPosition; } - private set { m_CameraPosition = value; } - } + protected Vector3 m_lastCameraPosition; + + public Vector3 CameraPosition { get; set; } public Quaternion CameraRotation { @@ -358,29 +352,10 @@ namespace OpenSim.Region.Framework.Scenes // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - // - protected Vector3 m_CameraAtAxis; - protected Vector3 m_CameraLeftAxis; - protected Vector3 m_CameraUpAxis; - - public Vector3 CameraAtAxis - { - get { return m_CameraAtAxis; } - private set { m_CameraAtAxis = value; } - } - - - public Vector3 CameraLeftAxis - { - get { return m_CameraLeftAxis; } - private set { m_CameraLeftAxis = value; } - } - - public Vector3 CameraUpAxis - { - get { return m_CameraUpAxis; } - private set { m_CameraUpAxis = value; } - } + // + public Vector3 CameraAtAxis { get; set; } + public Vector3 CameraLeftAxis { get; set; } + public Vector3 CameraUpAxis { get; set; } public Vector3 Lookat { @@ -396,33 +371,15 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - public readonly string Firstname; - public readonly string Lastname; - - private string m_grouptitle; - - public string Grouptitle - { - get { return m_grouptitle; } - set { m_grouptitle = value; } - } - - // Agent's Draw distance. - protected float m_DrawDistance; - - public float DrawDistance - { - get { return m_DrawDistance; } - private set { m_DrawDistance = value; } - } - - protected bool m_allowMovement = true; + public string Firstname { get; private set; } + public string Lastname { get; private set; } + + public string Grouptitle { get; set; } - public bool AllowMovement - { - get { return m_allowMovement; } - set { m_allowMovement = value; } - } + // Agent's Draw distance. + public float DrawDistance { get; set; } + + public bool AllowMovement { get; set; } private bool m_setAlwaysRun; @@ -447,15 +404,9 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.SetAlwaysRun = value; } } - } - - private byte m_state; - - public byte State - { - get { return m_state; } - set { m_state = value; } - } + } + + public byte State { get; set; } private AgentManager.ControlFlags m_AgentControlFlags; @@ -463,31 +414,16 @@ namespace OpenSim.Region.Framework.Scenes { get { return (uint)m_AgentControlFlags; } set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } - } - - /// - /// This works out to be the ClientView object associated with this avatar, or it's client connection manager - /// - private IClientAPI m_controllingClient; - - public IClientAPI ControllingClient - { - get { return m_controllingClient; } - private set { m_controllingClient = value; } - } + } + + public IClientAPI ControllingClient { get; set; } public IClientCore ClientView - { - get { return (IClientCore) m_controllingClient; } - } - - protected Vector3 m_parentPosition; - - public Vector3 ParentPosition - { - get { return m_parentPosition; } - set { m_parentPosition = value; } - } + { + get { return (IClientCore)ControllingClient; } + } + + public Vector3 ParentPosition { get; set; } /// /// Position of this avatar relative to the region the avatar is in @@ -825,18 +761,18 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { - Vector3[] vector = new Vector3[11]; - vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD - vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK + Vector3[] vector = new Vector3[11]; + vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP - vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE - vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE + vector[3] = -Vector3.UnitY; //RIGHT + vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN + vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE + vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE - vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE + vector[9] = -Vector3.UnitY; //RIGHT_NUDGE + vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE return vector; } @@ -1333,7 +1269,7 @@ namespace OpenSim.Region.Framework.Scenes // Convert it to a Matrix and/or Quaternion CameraAtAxis = agentData.CameraAtAxis; CameraLeftAxis = agentData.CameraLeftAxis; - m_CameraUpAxis = agentData.CameraUpAxis; + CameraUpAxis = agentData.CameraUpAxis; // The Agent's Draw distance setting // When we get to the point of re-computing neighbors everytime this @@ -1343,9 +1279,9 @@ namespace OpenSim.Region.Framework.Scenes DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); - - m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); + + m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; @@ -3077,8 +3013,8 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Velocity = m_velocity; cAgent.Center = CameraPosition; cAgent.AtAxis = CameraAtAxis; - cAgent.LeftAxis = CameraLeftAxis; - cAgent.UpAxis = m_CameraUpAxis; + cAgent.LeftAxis = CameraLeftAxis; + cAgent.UpAxis = CameraUpAxis; cAgent.Far = DrawDistance; @@ -3163,8 +3099,8 @@ namespace OpenSim.Region.Framework.Scenes m_velocity = cAgent.Velocity; CameraPosition = cAgent.Center; CameraAtAxis = cAgent.AtAxis; - CameraLeftAxis = cAgent.LeftAxis; - m_CameraUpAxis = cAgent.UpAxis; + CameraLeftAxis = cAgent.LeftAxis; + CameraUpAxis = cAgent.UpAxis; // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the -- cgit v1.1 From 8fccd2b55514a373bf127b49a729d047240c9701 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 1 Mar 2012 19:55:51 -0800 Subject: Send the right name and creation date on the BasicProfileModule. --- .../Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index eb1e4b5..8101ca2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs @@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile string skillsText = String.Empty; string languages = String.Empty; - Byte[] charterMember = Utils.StringToBytes("Avatar"); + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID); + + string name = "Avatar"; + int created = 0; + if (account != null) + { + name = account.FirstName + " " + account.LastName; + created = account.Created; + } + Byte[] charterMember = Utils.StringToBytes(name); profileUrl = "No profile data"; aboutText = string.Empty; @@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile partner = UUID.Zero; remoteClient.SendAvatarProperties(avatarID, aboutText, - Util.ToDateTime(0).ToString( + Util.ToDateTime(created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture), charterMember, firstLifeAboutText, (uint)(0 & 0xff), -- cgit v1.1 From be4199c3bc2439b0eb4ea5beef7d5702e55809c7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 03:57:55 +0000 Subject: Make XAssetService a de-duplicating asset service. This is an extremely crude implemenation which almost works by accident. Nevertheless it does work. It can be tested with the instructions at http://opensimulator.org/wiki/Feature_Proposals/Deduplicating_Asset_Service#Testing It does not interact at all with the existing asset service or any data stored there. This code is subject to change without notice and should not be used for anything other than gawking. --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 416 +++++++++++++++++++++ .../Data/MySQL/Resources/XAssetStore.migrations | 27 ++ 2 files changed, 443 insertions(+) create mode 100644 OpenSim/Data/MySQL/MySQLXAssetData.cs create mode 100644 OpenSim/Data/MySQL/Resources/XAssetStore.migrations diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs new file mode 100644 index 0000000..f15a9f3 --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -0,0 +1,416 @@ +/* + * 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.Data; +using System.Reflection; +using System.Collections.Generic; +using System.Text; +using log4net; +using MySql.Data.MySqlClient; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Data; + +namespace OpenSim.Data.MySQL +{ + public class MySQLXAssetData : AssetDataBase + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string m_connectionString; + private object m_dbLock = new object(); + + protected virtual Assembly Assembly + { + get { return GetType().Assembly; } + } + + #region IPlugin Members + + public override string Version { get { return "1.0.0.0"; } } + + /// + /// Initialises Asset interface + /// + /// + /// Loads and initialises the MySQL storage plugin. + /// Warns and uses the obsolete mysql_connection.ini if connect string is empty. + /// Check for migration + /// + /// + /// + /// connect string + public override void Initialise(string connect) + { + m_connectionString = connect; + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + Migration m = new Migration(dbcon, Assembly, "XAssetStore"); + m.Update(); + } + } + + public override void Initialise() + { + throw new NotImplementedException(); + } + + public override void Dispose() { } + + /// + /// The name of this DB provider + /// + override public string Name + { + get { return "MySQL XAsset storage engine"; } + } + + #endregion + + #region IAssetDataPlugin Members + + /// + /// Fetch Asset from database + /// + /// Asset UUID to fetch + /// Return the asset + /// On failure : throw an exception and attempt to reconnect to database + override public AssetBase GetAsset(UUID assetID) + { + AssetBase asset = null; + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + string hash = null; + + using (MySqlCommand cmd = new MySqlCommand( + "SELECT name, hash, description, asset_type, local, temporary, asset_flags, creator_id FROM xassetsmeta WHERE id=?id", + dbcon)) + { + cmd.Parameters.AddWithValue("?id", assetID.ToString()); + + try + { + using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) + { + if (dbReader.Read()) + { + asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["asset_type"], dbReader["creator_id"].ToString()); + hash = (string)dbReader["hash"]; + asset.Description = (string)dbReader["description"]; + + string local = dbReader["local"].ToString(); + if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase)) + asset.Local = true; + else + asset.Local = false; + + asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); + asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); + } + } + } + catch (Exception e) + { + m_log.Error("[MYSQL XASSET DATA]: MySql failure fetching asset " + assetID + ": " + e.Message); + } + } + + if (asset == null) + return null; + + m_log.DebugFormat( + "[MYSQL XASSET DATA]: Looking for asset {0} {1} with hash {2}", asset.FullID, asset.Name, hash); + + using (MySqlCommand cmd = new MySqlCommand( + "SELECT data FROM xassetsdata WHERE hash=?hash", + dbcon)) + { + cmd.Parameters.AddWithValue("?hash", hash); + + try + { + using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) + { + if (dbReader.Read()) + asset.Data = (byte[])dbReader["data"]; + } + } + catch (Exception e) + { + m_log.Error("[MYSQL XASSET DATA]: MySql failure fetching asset metadata " + assetID + ": " + e.Message); + } + } + } + } + + return asset; + } + + /// + /// Create an asset in database, or update it if existing. + /// + /// Asset UUID to create + /// On failure : Throw an exception and attempt to reconnect to database + override public void StoreAsset(AssetBase asset) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + string assetName = asset.Name; + if (asset.Name.Length > 64) + { + assetName = asset.Name.Substring(0, 64); + m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); + } + + string assetDescription = asset.Description; + if (asset.Description.Length > 64) + { + assetDescription = asset.Description.Substring(0, 64); + m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); + } + + string hash = Util.SHA1Hash(asset.Data); + + try + { + using (MySqlCommand cmd = + new MySqlCommand( + "replace INTO xassetsmeta(id, hash, name, description, asset_type, local, temporary, create_time, access_time, asset_flags, creator_id)" + + "VALUES(?id, ?hash, ?name, ?description, ?asset_type, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?creator_id)", + dbcon)) + { + // create unix epoch time + int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); + cmd.Parameters.AddWithValue("?id", asset.ID); + cmd.Parameters.AddWithValue("?hash", hash); + cmd.Parameters.AddWithValue("?name", assetName); + cmd.Parameters.AddWithValue("?description", assetDescription); + cmd.Parameters.AddWithValue("?asset_type", asset.Type); + cmd.Parameters.AddWithValue("?local", asset.Local); + cmd.Parameters.AddWithValue("?temporary", asset.Temporary); + cmd.Parameters.AddWithValue("?create_time", now); + cmd.Parameters.AddWithValue("?access_time", now); + cmd.Parameters.AddWithValue("?creator_id", asset.Metadata.CreatorID); + cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); + cmd.Parameters.AddWithValue("?data", asset.Data); + cmd.ExecuteNonQuery(); + cmd.Dispose(); + } + } + catch (Exception e) + { + m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset metadata {0} with name \"{1}\". Error: {2}", + asset.FullID, asset.Name, e.Message); + } + + try + { + using (MySqlCommand cmd = + new MySqlCommand( + "replace INTO xassetsdata(hash, data) VALUES(?hash, ?data)", + dbcon)) + { + cmd.Parameters.AddWithValue("?hash", hash); + cmd.Parameters.AddWithValue("?data", asset.Data); + cmd.ExecuteNonQuery(); + cmd.Dispose(); + } + } + catch (Exception e) + { + m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}", + asset.FullID, asset.Name, e.Message); + } + } + } + } + +// private void UpdateAccessTime(AssetBase asset) +// { +// lock (m_dbLock) +// { +// using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) +// { +// dbcon.Open(); +// MySqlCommand cmd = +// new MySqlCommand("update assets set access_time=?access_time where id=?id", +// dbcon); +// +// // need to ensure we dispose +// try +// { +// using (cmd) +// { +// // create unix epoch time +// int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); +// cmd.Parameters.AddWithValue("?id", asset.ID); +// cmd.Parameters.AddWithValue("?access_time", now); +// cmd.ExecuteNonQuery(); +// cmd.Dispose(); +// } +// } +// catch (Exception e) +// { +// m_log.ErrorFormat( +// "[ASSETS DB]: " + +// "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() +// + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); +// } +// } +// } +// +// } + + /// + /// Check if the asset exists in the database + /// + /// The asset UUID + /// true if it exists, false otherwise. + override public bool ExistsAsset(UUID uuid) + { +// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); + + bool assetExists = false; + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + using (MySqlCommand cmd = new MySqlCommand("SELECT id FROM xassetsmeta WHERE id=?id", dbcon)) + { + cmd.Parameters.AddWithValue("?id", uuid.ToString()); + + try + { + using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) + { + if (dbReader.Read()) + { +// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid); + assetExists = true; + } + } + } + catch (Exception e) + { + m_log.ErrorFormat( + "[XASSETS DB]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString(), uuid); + } + } + } + } + + return assetExists; + } + + /// + /// Returns a list of AssetMetadata objects. The list is a subset of + /// the entire data set offset by containing + /// elements. + /// + /// The number of results to discard from the total data set. + /// The number of rows the returned list should contain. + /// A list of AssetMetadata objects. + public override List FetchAssetMetadataSet(int start, int count) + { + List retList = new List(count); + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + MySqlCommand cmd = new MySqlCommand("SELECT name,description,asset_type,temporary,id,asset_flags,creator_id FROM xassetsmeta LIMIT ?start, ?count", dbcon); + cmd.Parameters.AddWithValue("?start", start); + cmd.Parameters.AddWithValue("?count", count); + + try + { + using (MySqlDataReader dbReader = cmd.ExecuteReader()) + { + while (dbReader.Read()) + { + AssetMetadata metadata = new AssetMetadata(); + metadata.Name = (string)dbReader["name"]; + metadata.Description = (string)dbReader["description"]; + metadata.Type = (sbyte)dbReader["asset_type"]; + metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. + metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); + metadata.FullID = DBGuid.FromDB(dbReader["id"]); + metadata.CreatorID = dbReader["creator_id"].ToString(); + metadata.SHA1 = Encoding.Default.GetBytes((string)dbReader["hash"]); + + retList.Add(metadata); + } + } + } + catch (Exception e) + { + m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); + } + } + } + + return retList; + } + + public override bool Delete(string id) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + MySqlCommand cmd = new MySqlCommand("delete from xassetsmeta where id=?id", dbcon); + cmd.Parameters.AddWithValue("?id", id); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + // TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we + // keep a reference count (?) + } + } + + return true; + } + + #endregion + } +} \ No newline at end of file diff --git a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations new file mode 100644 index 0000000..b89eab2 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations @@ -0,0 +1,27 @@ +# ----------------- +:VERSION 1 + +BEGIN; + +CREATE TABLE `xassetsmeta` ( + `id` char(36) NOT NULL, + `hash` char(64) NOT NULL, + `name` varchar(64) NOT NULL, + `description` varchar(64) NOT NULL, + `asset_type` tinyint(4) NOT NULL, + `local` tinyint(1) NOT NULL, + `temporary` tinyint(1) NOT NULL, + `create_time` int(11) NOT NULL, + `access_time` int(11) NOT NULL, + `asset_flags` int(11) NOT NULL, + `creator_id` varchar(128) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; + +CREATE TABLE `xassetsdata` ( + `hash` char(64) NOT NULL, + `data` longblob NOT NULL, + PRIMARY KEY (`hash`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; + +COMMIT; \ No newline at end of file -- cgit v1.1 From 6e3523e25e8d5538ed63984241093c1cfb6f2388 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 04:08:07 +0000 Subject: minor: remove mono compiler warning --- OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index e4b607d..e16903c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -65,8 +65,7 @@ namespace OpenSim.Region.Framework.Tests // Create an object embedded inside the first UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); - TaskInventoryItem taskSceneObjectItem - = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); + TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); -- cgit v1.1 From 8d249f8456f6bf70f4d81098007a02b1ede5587e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 2 Mar 2012 09:19:13 -0800 Subject: ScenePresence line endings and fix AllowMovement default to true. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 60 ++++++++++++------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e982bfe..ec6bb89 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -341,8 +341,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Position of agent's camera in world (region cordinates) /// - protected Vector3 m_lastCameraPosition; - + protected Vector3 m_lastCameraPosition; + public Vector3 CameraPosition { get; set; } public Quaternion CameraRotation @@ -352,9 +352,9 @@ namespace OpenSim.Region.Framework.Scenes // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - // - public Vector3 CameraAtAxis { get; set; } - public Vector3 CameraLeftAxis { get; set; } + // + public Vector3 CameraAtAxis { get; set; } + public Vector3 CameraLeftAxis { get; set; } public Vector3 CameraUpAxis { get; set; } public Vector3 Lookat @@ -371,14 +371,14 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - public string Firstname { get; private set; } - public string Lastname { get; private set; } - + public string Firstname { get; private set; } + public string Lastname { get; private set; } + public string Grouptitle { get; set; } - // Agent's Draw distance. - public float DrawDistance { get; set; } - + // Agent's Draw distance. + public float DrawDistance { get; set; } + public bool AllowMovement { get; set; } private bool m_setAlwaysRun; @@ -404,8 +404,8 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.SetAlwaysRun = value; } } - } - + } + public byte State { get; set; } private AgentManager.ControlFlags m_AgentControlFlags; @@ -414,15 +414,15 @@ namespace OpenSim.Region.Framework.Scenes { get { return (uint)m_AgentControlFlags; } set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } - } - + } + public IClientAPI ControllingClient { get; set; } public IClientCore ClientView - { + { get { return (IClientCore)ControllingClient; } - } - + } + public Vector3 ParentPosition { get; set; } /// @@ -683,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) { AttachmentsSyncLock = new Object(); - + AllowMovement = true; IsChildAgent = true; m_sendCourseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); @@ -761,17 +761,17 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { - Vector3[] vector = new Vector3[11]; - vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + Vector3[] vector = new Vector3[11]; + vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP - vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE + vector[3] = -Vector3.UnitY; //RIGHT + vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN + vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE + vector[9] = -Vector3.UnitY; //RIGHT_NUDGE vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE return vector; } @@ -1279,8 +1279,8 @@ namespace OpenSim.Region.Framework.Scenes DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); - + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); + m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; @@ -3013,7 +3013,7 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Velocity = m_velocity; cAgent.Center = CameraPosition; cAgent.AtAxis = CameraAtAxis; - cAgent.LeftAxis = CameraLeftAxis; + cAgent.LeftAxis = CameraLeftAxis; cAgent.UpAxis = CameraUpAxis; cAgent.Far = DrawDistance; @@ -3099,7 +3099,7 @@ namespace OpenSim.Region.Framework.Scenes m_velocity = cAgent.Velocity; CameraPosition = cAgent.Center; CameraAtAxis = cAgent.AtAxis; - CameraLeftAxis = cAgent.LeftAxis; + CameraLeftAxis = cAgent.LeftAxis; CameraUpAxis = cAgent.UpAxis; // When we get to the point of re-computing neighbors everytime this -- cgit v1.1 From d242d47e5cf1274225091e843e065366a3620c14 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 2 Mar 2012 15:05:06 -0500 Subject: OpenID auth needs hashing before authenticating --- OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs | 2 +- OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index 440b898..dfed761 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -248,7 +248,7 @@ For more information, see http://openid.net/. if (passwordValues != null && passwordValues.Length == 1) { if (account != null && - (m_authenticationService.Authenticate(account.PrincipalID, passwordValues[0], 30) != string.Empty)) + (m_authenticationService.Authenticate(account.PrincipalID,Util.Md5Hash(passwordValues[0]), 30) != string.Empty)) authRequest.IsAuthenticated = true; else authRequest.IsAuthenticated = false; diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 48eb3f8..5f1bde1 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -80,7 +80,7 @@ namespace OpenSim.Services.AuthenticationService { string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); - //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); + m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); if (data.Data["passwordHash"].ToString() == hashed) { -- cgit v1.1 From 089fd61a3b27faa2479f6b56c6d0dc1cf14774a2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 22:43:24 +0000 Subject: Allow a script to receive events if its root prim is in an area where it's allowed to run rather than checking its own prim. This allows scripts to run in child prims that are outside region boundaries. This is an interim patch applied from http://opensimulator.org/mantis/view.php?id=5899 though it does not resolve that bug Thanks tglion! --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9bca654..f45a08c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4162,10 +4162,7 @@ namespace OpenSim.Region.Framework.Scenes // their scripts will actually run. // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 SceneObjectPart parent = part.ParentGroup.RootPart; - if (part.ParentGroup.IsAttachment) - return ScriptDanger(parent, parent.GetWorldPosition()); - else - return ScriptDanger(part, part.GetWorldPosition()); + return ScriptDanger(parent, parent.GetWorldPosition()); } else { -- cgit v1.1 From c2c102d33e46d0ed651198e0e9b7459423516660 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 22:52:26 +0000 Subject: Remove outdated comment about checking attachment prims in Scene.PipeEventsForScript() --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f45a08c..a01b851 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4156,11 +4156,9 @@ namespace OpenSim.Region.Framework.Scenes public bool PipeEventsForScript(uint localID) { SceneObjectPart part = GetSceneObjectPart(localID); + if (part != null) { - // Changed so that child prims of attachments return ScriptDanger for their parent, so that - // their scripts will actually run. - // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 SceneObjectPart parent = part.ParentGroup.RootPart; return ScriptDanger(parent, parent.GetWorldPosition()); } -- cgit v1.1 From e81b3502ef0fef2b5f449b52ea2f016861aa23f4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 23:26:03 +0000 Subject: Make xassetservice execute one query to retrieve the asset, not two --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index f15a9f3..0dadf5e 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -104,6 +104,8 @@ namespace OpenSim.Data.MySQL /// On failure : throw an exception and attempt to reconnect to database override public AssetBase GetAsset(UUID assetID) { +// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID); + AssetBase asset = null; lock (m_dbLock) { @@ -114,7 +116,7 @@ namespace OpenSim.Data.MySQL string hash = null; using (MySqlCommand cmd = new MySqlCommand( - "SELECT name, hash, description, asset_type, local, temporary, asset_flags, creator_id FROM xassetsmeta WHERE id=?id", + "SELECT name, description, asset_type, local, temporary, asset_flags, creator_id, data FROM xassetsmeta JOIN xassetsdata ON xassetsmeta.hash = xassetsdata.hash WHERE id=?id", dbcon)) { cmd.Parameters.AddWithValue("?id", assetID.ToString()); @@ -126,7 +128,7 @@ namespace OpenSim.Data.MySQL if (dbReader.Read()) { asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["asset_type"], dbReader["creator_id"].ToString()); - hash = (string)dbReader["hash"]; + asset.Data = (byte[])dbReader["data"]; asset.Description = (string)dbReader["description"]; string local = dbReader["local"].ToString(); @@ -145,32 +147,6 @@ namespace OpenSim.Data.MySQL m_log.Error("[MYSQL XASSET DATA]: MySql failure fetching asset " + assetID + ": " + e.Message); } } - - if (asset == null) - return null; - - m_log.DebugFormat( - "[MYSQL XASSET DATA]: Looking for asset {0} {1} with hash {2}", asset.FullID, asset.Name, hash); - - using (MySqlCommand cmd = new MySqlCommand( - "SELECT data FROM xassetsdata WHERE hash=?hash", - dbcon)) - { - cmd.Parameters.AddWithValue("?hash", hash); - - try - { - using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) - { - if (dbReader.Read()) - asset.Data = (byte[])dbReader["data"]; - } - } - catch (Exception e) - { - m_log.Error("[MYSQL XASSET DATA]: MySql failure fetching asset metadata " + assetID + ": " + e.Message); - } - } } } -- cgit v1.1 From 98ad6ed255e1b1e55b58c633263480fb12ed3f7a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 23:29:35 +0000 Subject: comment out "[CAPS]: ScriptTaskInventory Request" log spam --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index be699db..35cb575 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -262,7 +262,7 @@ namespace OpenSim.Region.ClientStack.Linden { try { - m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); +// m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); -- cgit v1.1 From 94b323d1d87dab168cebb2235f2969c7ca159230 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 23:41:54 +0000 Subject: Perform asset storage transactionally --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 126 +++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 57 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 0dadf5e..778c7f4 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -166,71 +166,83 @@ namespace OpenSim.Data.MySQL { dbcon.Open(); - string assetName = asset.Name; - if (asset.Name.Length > 64) + using (MySqlTransaction transaction = dbcon.BeginTransaction()) { - assetName = asset.Name.Substring(0, 64); - m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); - } + + string assetName = asset.Name; + if (asset.Name.Length > 64) + { + assetName = asset.Name.Substring(0, 64); + m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); + } + + string assetDescription = asset.Description; + if (asset.Description.Length > 64) + { + assetDescription = asset.Description.Substring(0, 64); + m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); + } + + string hash = Util.SHA1Hash(asset.Data); + + try + { + using (MySqlCommand cmd = + new MySqlCommand( + "replace INTO xassetsmeta(id, hash, name, description, asset_type, local, temporary, create_time, access_time, asset_flags, creator_id)" + + "VALUES(?id, ?hash, ?name, ?description, ?asset_type, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?creator_id)", + dbcon)) + { + // create unix epoch time + int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); + cmd.Parameters.AddWithValue("?id", asset.ID); + cmd.Parameters.AddWithValue("?hash", hash); + cmd.Parameters.AddWithValue("?name", assetName); + cmd.Parameters.AddWithValue("?description", assetDescription); + cmd.Parameters.AddWithValue("?asset_type", asset.Type); + cmd.Parameters.AddWithValue("?local", asset.Local); + cmd.Parameters.AddWithValue("?temporary", asset.Temporary); + cmd.Parameters.AddWithValue("?create_time", now); + cmd.Parameters.AddWithValue("?access_time", now); + cmd.Parameters.AddWithValue("?creator_id", asset.Metadata.CreatorID); + cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); + cmd.Parameters.AddWithValue("?data", asset.Data); + cmd.ExecuteNonQuery(); + } + } + catch (Exception e) + { + m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset metadata {0} with name \"{1}\". Error: {2}", + asset.FullID, asset.Name, e.Message); - string assetDescription = asset.Description; - if (asset.Description.Length > 64) - { - assetDescription = asset.Description.Substring(0, 64); - m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); - } + transaction.Rollback(); - string hash = Util.SHA1Hash(asset.Data); + return; + } - try - { - using (MySqlCommand cmd = - new MySqlCommand( - "replace INTO xassetsmeta(id, hash, name, description, asset_type, local, temporary, create_time, access_time, asset_flags, creator_id)" + - "VALUES(?id, ?hash, ?name, ?description, ?asset_type, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?creator_id)", - dbcon)) + try { - // create unix epoch time - int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); - cmd.Parameters.AddWithValue("?id", asset.ID); - cmd.Parameters.AddWithValue("?hash", hash); - cmd.Parameters.AddWithValue("?name", assetName); - cmd.Parameters.AddWithValue("?description", assetDescription); - cmd.Parameters.AddWithValue("?asset_type", asset.Type); - cmd.Parameters.AddWithValue("?local", asset.Local); - cmd.Parameters.AddWithValue("?temporary", asset.Temporary); - cmd.Parameters.AddWithValue("?create_time", now); - cmd.Parameters.AddWithValue("?access_time", now); - cmd.Parameters.AddWithValue("?creator_id", asset.Metadata.CreatorID); - cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); - cmd.Parameters.AddWithValue("?data", asset.Data); - cmd.ExecuteNonQuery(); - cmd.Dispose(); + using (MySqlCommand cmd = + new MySqlCommand( + "replace INTO xassetsdata(hash, data) VALUES(?hash, ?data)", + dbcon)) + { + cmd.Parameters.AddWithValue("?hash", hash); + cmd.Parameters.AddWithValue("?data", asset.Data); + cmd.ExecuteNonQuery(); + } } - } - catch (Exception e) - { - m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset metadata {0} with name \"{1}\". Error: {2}", - asset.FullID, asset.Name, e.Message); - } - - try - { - using (MySqlCommand cmd = - new MySqlCommand( - "replace INTO xassetsdata(hash, data) VALUES(?hash, ?data)", - dbcon)) + catch (Exception e) { - cmd.Parameters.AddWithValue("?hash", hash); - cmd.Parameters.AddWithValue("?data", asset.Data); - cmd.ExecuteNonQuery(); - cmd.Dispose(); + m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}", + asset.FullID, asset.Name, e.Message); + + transaction.Rollback(); + + return; } - } - catch (Exception e) - { - m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}", - asset.FullID, asset.Name, e.Message); + + transaction.Commit(); } } } -- cgit v1.1 From 2535a4cafc45863a9f6bd4d30b90248014a6c2c2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Mar 2012 00:05:02 +0000 Subject: If asset data already exists with the required hash then don't rewrite it --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 76 +++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 778c7f4..748578b 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -168,7 +168,6 @@ namespace OpenSim.Data.MySQL using (MySqlTransaction transaction = dbcon.BeginTransaction()) { - string assetName = asset.Name; if (asset.Name.Length > 64) { @@ -220,26 +219,29 @@ namespace OpenSim.Data.MySQL return; } - try + if (!ExistsData(dbcon, transaction, hash)) { - using (MySqlCommand cmd = - new MySqlCommand( - "replace INTO xassetsdata(hash, data) VALUES(?hash, ?data)", - dbcon)) + try { - cmd.Parameters.AddWithValue("?hash", hash); - cmd.Parameters.AddWithValue("?data", asset.Data); - cmd.ExecuteNonQuery(); + using (MySqlCommand cmd = + new MySqlCommand( + "INSERT INTO xassetsdata(hash, data) VALUES(?hash, ?data)", + dbcon)) + { + cmd.Parameters.AddWithValue("?hash", hash); + cmd.Parameters.AddWithValue("?data", asset.Data); + cmd.ExecuteNonQuery(); + } } - } - catch (Exception e) - { - m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}", - asset.FullID, asset.Name, e.Message); - - transaction.Rollback(); + catch (Exception e) + { + m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}", + asset.FullID, asset.Name, e.Message); - return; + transaction.Rollback(); + + return; + } } transaction.Commit(); @@ -285,6 +287,46 @@ namespace OpenSim.Data.MySQL // } /// + /// We assume we already have the m_dbLock. + /// + /// TODO: need to actually use the transaction. + /// + /// + /// + /// + private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, string hash) + { +// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); + + bool exists = false; + + using (MySqlCommand cmd = new MySqlCommand("SELECT hash FROM xassetsdata WHERE hash=?hash", dbcon)) + { + cmd.Parameters.AddWithValue("?hash", hash); + + try + { + using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) + { + if (dbReader.Read()) + { +// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid); + exists = true; + } + } + } + catch (Exception e) + { + m_log.ErrorFormat( + "[XASSETS DB]: MySql failure in ExistsData fetching hash {0}. Exception {1}{2}", + hash, e.Message, e.StackTrace); + } + } + + return exists; + } + + /// /// Check if the asset exists in the database /// /// The asset UUID -- cgit v1.1 From 75dc8b1aedbd31f669c657ecc6beb6d8cbc9e037 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Mar 2012 01:28:58 +0000 Subject: Implement basic gzip compression for xassetdata Whether this is worthwhile is debatable since here we are not transmitting data over a network In addition, jpeg2000 (the biggest data hog) is already a compressed image format. May not remain. --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 51 ++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 748578b..bb03871 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -26,9 +26,11 @@ */ using System; +using System.Collections.Generic; using System.Data; +using System.IO; +using System.IO.Compression; using System.Reflection; -using System.Collections.Generic; using System.Text; using log4net; using MySql.Data.MySqlClient; @@ -139,6 +141,18 @@ namespace OpenSim.Data.MySQL asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); + + using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) + { + MemoryStream outputStream = new MemoryStream(); + WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue); +// int compressedLength = asset.Data.Length; + asset.Data = outputStream.ToArray(); + +// m_log.DebugFormat( +// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", +// asset.ID, asset.Name, asset.Data.Length, compressedLength); + } } } } @@ -181,9 +195,24 @@ namespace OpenSim.Data.MySQL assetDescription = asset.Description.Substring(0, 64); m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); } - - string hash = Util.SHA1Hash(asset.Data); - + + byte[] compressedData; + MemoryStream outputStream = new MemoryStream(); + + using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false)) + { + Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue)); + // We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream. + compressionStream.Close(); + compressedData = outputStream.ToArray(); + } + + string hash = Util.SHA1Hash(compressedData); + +// m_log.DebugFormat( +// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}", +// asset.ID, asset.Name, hash, compressedData.Length); + try { using (MySqlCommand cmd = @@ -205,7 +234,6 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?access_time", now); cmd.Parameters.AddWithValue("?creator_id", asset.Metadata.CreatorID); cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); - cmd.Parameters.AddWithValue("?data", asset.Data); cmd.ExecuteNonQuery(); } } @@ -229,7 +257,7 @@ namespace OpenSim.Data.MySQL dbcon)) { cmd.Parameters.AddWithValue("?hash", hash); - cmd.Parameters.AddWithValue("?data", asset.Data); + cmd.Parameters.AddWithValue("?data", compressedData); cmd.ExecuteNonQuery(); } } @@ -422,16 +450,19 @@ namespace OpenSim.Data.MySQL public override bool Delete(string id) { +// m_log.DebugFormat("[XASSETS DB]: Deleting asset {0}", id); + lock (m_dbLock) { using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) { dbcon.Open(); - MySqlCommand cmd = new MySqlCommand("delete from xassetsmeta where id=?id", dbcon); - cmd.Parameters.AddWithValue("?id", id); - cmd.ExecuteNonQuery(); - cmd.Dispose(); + using (MySqlCommand cmd = new MySqlCommand("delete from xassetsmeta where id=?id", dbcon)) + { + cmd.Parameters.AddWithValue("?id", id); + cmd.ExecuteNonQuery(); + } // TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we // keep a reference count (?) -- cgit v1.1 From 3780df8a329c81471c486acab7f641f7742267f4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Mar 2012 01:43:36 +0000 Subject: Make asset compression optional. Currently set to false and not configurable from outside MySQLXAssetData. --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 40 +++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index bb03871..bfc1c55 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -44,6 +44,7 @@ namespace OpenSim.Data.MySQL { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private bool m_enableCompression = false; private string m_connectionString; private object m_dbLock = new object(); @@ -142,16 +143,19 @@ namespace OpenSim.Data.MySQL asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); - using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) + if (m_enableCompression) { - MemoryStream outputStream = new MemoryStream(); - WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue); -// int compressedLength = asset.Data.Length; - asset.Data = outputStream.ToArray(); - -// m_log.DebugFormat( -// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", -// asset.ID, asset.Name, asset.Data.Length, compressedLength); + using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) + { + MemoryStream outputStream = new MemoryStream(); + WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue); + // int compressedLength = asset.Data.Length; + asset.Data = outputStream.ToArray(); + + // m_log.DebugFormat( + // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", + // asset.ID, asset.Name, asset.Data.Length, compressedLength); + } } } } @@ -199,15 +203,19 @@ namespace OpenSim.Data.MySQL byte[] compressedData; MemoryStream outputStream = new MemoryStream(); - using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false)) + if (m_enableCompression) { - Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue)); - // We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream. - compressionStream.Close(); - compressedData = outputStream.ToArray(); + using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false)) + { + // Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue)); + // We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream. + compressionStream.Close(); + compressedData = outputStream.ToArray(); + asset.Data = compressedData; + } } - string hash = Util.SHA1Hash(compressedData); + string hash = Util.SHA1Hash(asset.Data); // m_log.DebugFormat( // "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}", @@ -257,7 +265,7 @@ namespace OpenSim.Data.MySQL dbcon)) { cmd.Parameters.AddWithValue("?hash", hash); - cmd.Parameters.AddWithValue("?data", compressedData); + cmd.Parameters.AddWithValue("?data", asset.Data); cmd.ExecuteNonQuery(); } } -- cgit v1.1 From ac934e2dbb57f9ba42ed1b2405e294c802f05616 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 4 Mar 2012 11:11:01 -0500 Subject: Add WebProfiles config to other config example --- bin/Robust.HG.ini.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index ab5880d..db9f08b 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -241,6 +241,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; For V2 map MapTileURL = "http://127.0.0.1:8002"; + ; For WebProfiles (V3) + ProfileServerURL = "http://127.0.0.1/profiles/[AGENT_NAME]" + ; If you run this login server behind a proxy, set this to true ; HasProxy = false -- cgit v1.1 From fd2b285b1bf35d02ce8c901eaccf0b41066fb6d6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 5 Mar 2012 23:50:41 +0000 Subject: remove unnecessary hash local variable --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index bfc1c55..0aff618 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -116,8 +116,6 @@ namespace OpenSim.Data.MySQL { dbcon.Open(); - string hash = null; - using (MySqlCommand cmd = new MySqlCommand( "SELECT name, description, asset_type, local, temporary, asset_flags, creator_id, data FROM xassetsmeta JOIN xassetsdata ON xassetsmeta.hash = xassetsdata.hash WHERE id=?id", dbcon)) -- cgit v1.1 From 441449e240ffceef4322661ad936928d98e3f724 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 00:14:21 +0000 Subject: Switch to sha256 from sha1 in order to avoid future asset hash collisions. Some successful collision attacks have been carried out on sha1 with speculation that more are possible. http://en.wikipedia.org/wiki/Cryptographic_hash_function#Cryptographic_hash_algorithms No successful attacks have been shown on sha256, which makes it less likely that anybody will be able to engineer an asset hash collision in the future. Tradeoff is more storage required for hashes, and more cpu to hash, though this is neglible compared to db operations and network access. --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 22 +++++++++++++++------- .../Data/MySQL/Resources/XAssetStore.migrations | 4 ++-- prebuild.xml | 3 ++- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 0aff618..4cb89fa 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -31,6 +31,7 @@ using System.Data; using System.IO; using System.IO.Compression; using System.Reflection; +using System.Security.Cryptography; using System.Text; using log4net; using MySql.Data.MySqlClient; @@ -44,15 +45,20 @@ namespace OpenSim.Data.MySQL { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private bool m_enableCompression = false; - private string m_connectionString; - private object m_dbLock = new object(); - protected virtual Assembly Assembly { get { return GetType().Assembly; } } + private bool m_enableCompression = false; + private string m_connectionString; + private object m_dbLock = new object(); + + /// + /// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock + /// + private HashAlgorithm hasher = new SHA256CryptoServiceProvider(); + #region IPlugin Members public override string Version { get { return "1.0.0.0"; } } @@ -213,7 +219,7 @@ namespace OpenSim.Data.MySQL } } - string hash = Util.SHA1Hash(asset.Data); + byte[] hash = hasher.ComputeHash(asset.Data); // m_log.DebugFormat( // "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}", @@ -328,7 +334,7 @@ namespace OpenSim.Data.MySQL /// /// /// - private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, string hash) + private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, byte[] hash) { // m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); @@ -438,7 +444,9 @@ namespace OpenSim.Data.MySQL metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); metadata.FullID = DBGuid.FromDB(dbReader["id"]); metadata.CreatorID = dbReader["creator_id"].ToString(); - metadata.SHA1 = Encoding.Default.GetBytes((string)dbReader["hash"]); + + // We'll ignore this for now - it appears unused! +// metadata.SHA1 = dbReader["hash"]); retList.Add(metadata); } diff --git a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations index b89eab2..d3cca5e 100644 --- a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations +++ b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations @@ -5,7 +5,7 @@ BEGIN; CREATE TABLE `xassetsmeta` ( `id` char(36) NOT NULL, - `hash` char(64) NOT NULL, + `hash` binary(32) NOT NULL, `name` varchar(64) NOT NULL, `description` varchar(64) NOT NULL, `asset_type` tinyint(4) NOT NULL, @@ -19,7 +19,7 @@ CREATE TABLE `xassetsmeta` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; CREATE TABLE `xassetsdata` ( - `hash` char(64) NOT NULL, + `hash` binary(32) NOT NULL, `data` longblob NOT NULL, PRIMARY KEY (`hash`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; diff --git a/prebuild.xml b/prebuild.xml index 79814ac..030d232 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2051,9 +2051,10 @@ ../../../bin/ - + + -- cgit v1.1 From 413bc1e77e07f586f418b14f47fc72ac5b803fa0 Mon Sep 17 00:00:00 2001 From: Chris Hart Date: Sun, 4 Mar 2012 16:46:54 -0500 Subject: Updates to MSSQL store for 0.7.3 to include: * Telehub support * Bugfix to Friends lookups * Updates to Creator fields to store up to 255 characters for HG item creator storage --- OpenSim/Data/MSSQL/MSSQLFriendsData.cs | 6 ++ OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 2 +- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 83 +++++++++++++++++++-- .../Data/MSSQL/Resources/RegionStore.migrations | 85 +++++++++++++++++++++- 4 files changed, 169 insertions(+), 7 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs index 09dde5e..fef6978 100644 --- a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs +++ b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs @@ -89,5 +89,11 @@ namespace OpenSim.Data.MSSQL return DoQuery(cmd); } } + + public FriendsData[] GetFriends(Guid principalID) + { + return GetFriends(principalID.ToString()); + } + } } diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 4d06377..961593f 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs @@ -813,7 +813,7 @@ namespace OpenSim.Data.MSSQL { try { - using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection)) + using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection)) { command.Parameters.Add(database.CreateParameter("folderID", folderID)); diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index d6b1561..d9dfe86 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -675,7 +675,7 @@ VALUES cmd.ExecuteNonQuery(); } - sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; + sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)"; using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlCommand cmd = new SqlCommand(sql, conn)) @@ -1215,6 +1215,8 @@ VALUES //Store new values StoreNewRegionSettings(regionSettings); + LoadSpawnPoints(regionSettings); + return regionSettings; } @@ -1252,7 +1254,7 @@ VALUES ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position -,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id +,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID WHERE [regionUUID] = @regionUUID"; using (SqlConnection conn = new SqlConnection(m_connectionString)) @@ -1263,6 +1265,7 @@ VALUES cmd.ExecuteNonQuery(); } } + SaveSpawnPoints(regionSettings); } public void Shutdown() @@ -1383,6 +1386,11 @@ VALUES newSettings.LoadedCreationID = ""; else newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; + + newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]); + newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]); + newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]); + return newSettings; } @@ -1454,6 +1462,13 @@ VALUES } newData.ParcelAccessList = new List(); + newData.MediaDescription = (string)row["MediaDescription"]; + newData.MediaType = (string)row["MediaType"]; + newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]); + newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]); + newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); + newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); + newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); return newData; } @@ -1468,7 +1483,7 @@ VALUES LandAccessEntry entry = new LandAccessEntry(); entry.AgentID = new UUID((Guid)row["AccessUUID"]); entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); - entry.Expires = 0; + entry.Expires = Convert.ToInt32(row["Expires"]); return entry; } @@ -1497,7 +1512,8 @@ VALUES prim.TouchName = (string)primRow["TouchName"]; // permissions prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); - prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); + //prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); + prim.CreatorIdentification = (string)primRow["CreatorID"]; prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); prim.GroupID = new UUID((Guid)primRow["GroupID"]); prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); @@ -1691,7 +1707,8 @@ VALUES taskItem.Name = (string)inventoryRow["name"]; taskItem.Description = (string)inventoryRow["description"]; taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); - taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); + //taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); + taskItem.CreatorIdentification = (string)inventoryRow["creatorID"]; taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); @@ -1792,6 +1809,9 @@ VALUES parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime)); parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); + parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID)); + parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID)); + parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject)); return parameters.ToArray(); } @@ -1859,6 +1879,7 @@ VALUES parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); + parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires)); return parameters.ToArray(); } @@ -2063,5 +2084,57 @@ VALUES #endregion #endregion + + private void LoadSpawnPoints(RegionSettings rs) + { + rs.ClearSpawnPoints(); + + string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString())); + conn.Open(); + using (SqlDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + SpawnPoint sp = new SpawnPoint(); + + sp.Yaw = (float)reader["Yaw"]; + sp.Pitch = (float)reader["Pitch"]; + sp.Distance = (float)reader["Distance"]; + + rs.AddSpawnPoint(sp); + } + } + } + } + + private void SaveSpawnPoints(RegionSettings rs) + { + string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + foreach (SpawnPoint p in rs.SpawnPoints()) + { + sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID)); + cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw)); + cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch)); + cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + } } } diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations index a98690a..d6a3be9 100644 --- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations @@ -1044,10 +1044,93 @@ ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL COMMIT -:VERSION 29 #--------------------- +:VERSION 29 #----------------- Region Covenant changed time BEGIN TRANSACTION ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0 COMMIT + +:VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support + +BEGIN TRANSACTION + +EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN' +EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN' + +COMMIT + +:VERSION 31 #--------------------- + +BEGIN TRANSACTION + +ALTER TABLE prims ADD CreatorID varchar(255) +ALTER TABLE primitems ADD CreatorID varchar(255) + +COMMIT + +:VERSION 32 #--------------------- + +BEGIN TRANSACTION + +UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold) +UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold) + +COMMIT + +:VERSION 33 #--------------------- + +BEGIN TRANSACTION + +ALTER TABLE prims +ADD CONSTRAINT DF_prims_CreatorIDNew +DEFAULT '00000000-0000-0000-0000-000000000000' +FOR CreatorID + +ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL + +ALTER TABLE primitems +ADD CONSTRAINT DF_primitems_CreatorIDNew +DEFAULT '00000000-0000-0000-0000-000000000000' +FOR CreatorID + +ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL + +COMMIT + +:VERSION 34 #--------------- Telehub support + +BEGIN TRANSACTION + +CREATE TABLE [dbo].[Spawn_Points]( + [RegionUUID] [uniqueidentifier] NOT NULL, + [Yaw] [float] NOT NULL, + [Pitch] [float] NOT NULL, + [Distance] [float] NOT NULL, + PRIMARY KEY CLUSTERED + ( + [RegionUUID] ASC + )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] +) ON [PRIMARY] + +ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; + +COMMIT + +:VERSION 35 #---------------- Parcels for sale + +BEGIN TRANSACTION + +ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; + +COMMIT + +:VERSION 36 #---------------- Timed bans/access + +BEGIN TRANSACTION + +ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0; + +COMMIT + -- cgit v1.1 From d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 01:27:30 +0000 Subject: Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914 The part reverted is from commit 2ebb421. Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments. I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :) Regression test added for this case. Mantis ref: http://opensimulator.org/mantis/view.php?id=5914 --- .../Region/OptionalModules/World/NPC/NPCModule.cs | 20 ++++++---- .../World/NPC/Tests/NPCModuleTests.cs | 46 +++++++++++++++++++++- 2 files changed, 57 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 2052cdb..2b8379d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -88,22 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) { - ScenePresence sp = scene.GetScenePresence(agentId); - if (sp == null || sp.IsChildAgent) + ScenePresence npc = scene.GetScenePresence(agentId); + if (npc == null || npc.IsChildAgent) return false; lock (m_avatars) if (!m_avatars.ContainsKey(agentId)) return false; - // Delete existing sp attachments - scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); + // Delete existing npc attachments + scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); - // Set new sp appearance. Also sends to clients. - scene.RequestModuleInterface().SetAppearance(sp, new AvatarAppearance(appearance, true)); + // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); + npc.Appearance = npcAppearance; - // Rez needed sp attachments - scene.AttachmentsModule.RezAttachments(sp); + // Rez needed npc attachments + scene.AttachmentsModule.RezAttachments(npc); + + IAvatarFactoryModule module = scene.RequestModuleInterface(); + module.SendAppearance(npc.UUID); return true; } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index d507822..36e2d4a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests } [Test] - public void TestAttachments() + public void TestCreateWithAttachments() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -179,6 +179,50 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests } [Test] + public void TestLoadAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = TestHelpers.ParseTail(0x1); + UserAccountHelpers.CreateUserWithInventory(scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + + INPCModule npcModule = scene.RequestModuleInterface(); + UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + + // Now add the attachment to the original avatar and use that to load a new appearance + // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here + UUID attItemId = TestHelpers.ParseTail(0x2); + UUID attAssetId = TestHelpers.ParseTail(0x3); + string attName = "att"; + + UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); + + am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); + + npcModule.SetNPCAppearance(npcId, sp.Appearance, scene); + + ScenePresence npc = scene.GetScenePresence(npcId); + + // Check scene presence status + Assert.That(npc.HasAttachments(), Is.True); + List attachments = npc.GetAttachments(); + Assert.That(attachments.Count, Is.EqualTo(1)); + SceneObjectGroup attSo = attachments[0]; + + // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item + // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC. +// Assert.That(attSo.Name, Is.EqualTo(attName)); + + Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); + Assert.That(attSo.IsAttachment); + Assert.That(attSo.UsesPhysics, Is.False); + Assert.That(attSo.IsTemporary, Is.False); + Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID)); + } + + [Test] public void TestMove() { TestHelpers.InMethod(); -- cgit v1.1 From 1dc03e5c4f76064fc193dab3c8f3e1f3783ec227 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 01:47:43 +0000 Subject: Simplify NPCModuleTests code by putting the NPCModule in an instance variable rather than making each test fetch it seperately. Also rename instance variables in the test to conform to naming standards and for understandability --- .../World/NPC/Tests/NPCModuleTests.cs | 117 ++++++++++----------- 1 file changed, 56 insertions(+), 61 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 36e2d4a..9a7e9e8 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests [TestFixture] public class NPCModuleTests { - private TestScene scene; - private AvatarFactoryModule afm; - private UserManagementModule umm; - private AttachmentsModule am; + private TestScene m_scene; + private AvatarFactoryModule m_afMod; + private UserManagementModule m_umMod; + private AttachmentsModule m_attMod; + private NPCModule m_npcMod; [TestFixtureSetUp] public void FixtureInit() @@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); - afm = new AvatarFactoryModule(); - umm = new UserManagementModule(); - am = new AttachmentsModule(); + m_afMod = new AvatarFactoryModule(); + m_umMod = new UserManagementModule(); + m_attMod = new AttachmentsModule(); + m_npcMod = new NPCModule(); - scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); } [Test] @@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell // ScenePresence.SendInitialData() to reset our entire appearance. - scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); + m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); - afm.SetAppearance(sp, originalTe, null); + m_afMod.SetAppearance(sp, originalTe, null); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); - Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); + Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); } [Test] @@ -124,16 +125,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - npcModule.DeleteNPC(npcId, scene); + m_npcMod.DeleteNPC(npcId, m_scene); - ScenePresence deletedNpc = scene.GetScenePresence(npcId); + ScenePresence deletedNpc = m_scene.GetScenePresence(npcId); Assert.That(deletedNpc, Is.Null); } @@ -145,21 +145,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // log4net.Config.XmlConfigurator.Configure(); UUID userId = TestHelpers.ParseTail(0x1); - UserAccountHelpers.CreateUserWithInventory(scene, userId); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + UserAccountHelpers.CreateUserWithInventory(m_scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); UUID attItemId = TestHelpers.ParseTail(0x2); UUID attAssetId = TestHelpers.ParseTail(0x3); string attName = "att"; - UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); + UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); - am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); + m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); // Check scene presence status Assert.That(npc.HasAttachments(), Is.True); @@ -185,11 +184,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // log4net.Config.XmlConfigurator.Configure(); UUID userId = TestHelpers.ParseTail(0x1); - UserAccountHelpers.CreateUserWithInventory(scene, userId); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + UserAccountHelpers.CreateUserWithInventory(m_scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); // Now add the attachment to the original avatar and use that to load a new appearance // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here @@ -197,13 +195,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests UUID attAssetId = TestHelpers.ParseTail(0x3); string attName = "att"; - UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); + UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); - am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); + m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); - npcModule.SetNPCAppearance(npcId, sp.Appearance, scene); + m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); // Check scene presence status Assert.That(npc.HasAttachments(), Is.True); @@ -228,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); // For now, we'll make the scene presence fly to simplify this test, but this needs to change. npc.Flying = true; - scene.Update(); + m_scene.Update(); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 10, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); + m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); Assert.That( npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); - scene.Update(); + m_scene.Update(); // We should really check the exact figure. Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); @@ -261,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); for (int i = 0; i < 10; i++) - scene.Update(); + m_scene.Update(); double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); @@ -271,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // Try a second movement startPos = npc.AbsolutePosition; targetPos = startPos + new Vector3(10, 0, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); + m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); Assert.That( npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); - scene.Update(); + m_scene.Update(); // We should really check the exact figure. Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); @@ -287,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); for (int i = 0; i < 10; i++) - scene.Update(); + m_scene.Update(); distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); @@ -300,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); Vector3 startPos = new Vector3(128, 128, 30); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + ScenePresence npc = m_scene.GetScenePresence(npcId); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); part.SitTargetPosition = new Vector3(0, 0, 1); - npcModule.Sit(npc.UUID, part.UUID, scene); + m_npcMod.Sit(npc.UUID, part.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); @@ -318,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests npc.AbsolutePosition, Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); - npcModule.Stand(npc.UUID, scene); + m_npcMod.Stand(npc.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(npc.ParentID, Is.EqualTo(0)); @@ -330,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // FIXME: To get this to work for now, we are going to place the npc right next to the target so that // the autopilot doesn't trigger Vector3 startPos = new Vector3(1, 1, 1); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + ScenePresence npc = m_scene.GetScenePresence(npcId); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); - npcModule.Sit(npc.UUID, part.UUID, scene); + m_npcMod.Sit(npc.UUID, part.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); @@ -355,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests npc.AbsolutePosition, Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); - npcModule.Stand(npc.UUID, scene); + m_npcMod.Stand(npc.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(npc.ParentID, Is.EqualTo(0)); -- cgit v1.1 From 85198a45cb944a3de7402d7fccc75ec499002f01 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 02:01:47 +0000 Subject: Fix off by one error in script error reporting. --- OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 8b88588..65d3b9b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools emessage = emessage.Substring(slinfo.Length+2); message = String.Format("({0},{1}) {2}", - e.slInfo.lineNumber - 2, + e.slInfo.lineNumber - 1, e.slInfo.charPosition - 1, emessage); throw new Exception(message); -- cgit v1.1 From a92153ed88859af9d68b206ec320fc993fe5cdc7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 02:21:19 +0000 Subject: Get all test methods in OpenSim.Region.ScriptEngine.Tests.dll to report that they're running --- .../Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 95 ++++++++++++++++++++++ .../Shared/CodeTools/Tests/CompilerTest.cs | 7 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 11 ++- .../Shared/Tests/LSL_TypesTestLSLFloat.cs | 74 ++++++++++++++--- .../Shared/Tests/LSL_TypesTestLSLInteger.cs | 8 ++ .../Shared/Tests/LSL_TypesTestLSLString.cs | 8 ++ .../ScriptEngine/Shared/Tests/LSL_TypesTestList.cs | 42 ++++++++-- .../Shared/Tests/LSL_TypesTestVector3.cs | 9 +- 8 files changed, 228 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 63afb0b..2add011 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using NUnit.Framework; using OpenSim.Region.ScriptEngine.Shared.CodeTools; +using OpenSim.Tests.Common; namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests { @@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests [Test] public void TestDefaultState() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests [Test] public void TestCustomState() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -93,6 +98,8 @@ state another_state [Test] public void TestEventWithArguments() { + TestHelpers.InMethod(); + string input = @"default { at_rot_target(integer tnum, rotation targetrot, rotation ourrot) @@ -113,6 +120,8 @@ state another_state [Test] public void TestIntegerDeclaration() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -135,6 +144,8 @@ state another_state [Test] public void TestLoneIdent() { + TestHelpers.InMethod(); + // A lone ident should be removed completely as it's an error in C# // (MONO at least). string input = @"default @@ -161,6 +172,8 @@ state another_state [Test] public void TestAssignments() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -187,6 +200,8 @@ state another_state [Test] public void TestAdditionSubtractionOperator() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -215,6 +230,8 @@ state another_state [Test] public void TestStrings() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -242,6 +259,8 @@ state another_state [Test] public void TestBinaryExpression() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -284,6 +303,8 @@ state another_state [Test] public void TestFloatConstants() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -336,6 +357,8 @@ state another_state [Test] public void TestComments() { + TestHelpers.InMethod(); + string input = @"// this test tests comments default { @@ -358,6 +381,8 @@ default [Test] public void TestStringsWithEscapedQuotesAndComments() { + TestHelpers.InMethod(); + string input = @"// this test tests strings, with escaped quotes and comments in strings default { @@ -397,6 +422,8 @@ default [Test] public void TestCStyleComments() { + TestHelpers.InMethod(); + string input = @"/* this test tests comments of the C variety */ @@ -426,6 +453,8 @@ default [Test] public void TestGlobalDefinedFunctions() { + TestHelpers.InMethod(); + string input = @"// this test tests custom defined functions string onefunc() @@ -470,6 +499,8 @@ default [Test] public void TestGlobalDeclaredVariables() { + TestHelpers.InMethod(); + string input = @"// this test tests custom defined functions and global variables string globalString; @@ -525,6 +556,8 @@ default [Test] public void TestMoreAssignments() { + TestHelpers.InMethod(); + string input = @"// this test tests +=, -=, *=, /=, %= string globalString; @@ -579,6 +612,8 @@ default [Test] public void TestVectorConstantNotation() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -606,6 +641,8 @@ default [Test] public void TestVectorMemberAccess() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -632,6 +669,8 @@ default [Test] public void TestExpressionInParentheses() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -660,6 +699,8 @@ default [Test] public void TestIncrementDecrementOperator() { + TestHelpers.InMethod(); + string input = @"// here we'll test the ++ and -- operators default @@ -690,6 +731,8 @@ default [Test] public void TestLists() { + TestHelpers.InMethod(); + string input = @"// testing lists default @@ -718,6 +761,8 @@ default [Test] public void TestIfStatement() { + TestHelpers.InMethod(); + string input = @"// let's test if statements default @@ -822,6 +867,8 @@ default [Test] public void TestIfElseStatement() { + TestHelpers.InMethod(); + string input = @"// let's test complex logical expressions default @@ -928,6 +975,8 @@ default [Test] public void TestWhileLoop() { + TestHelpers.InMethod(); + string input = @"// let's test while loops default @@ -968,6 +1017,8 @@ default [Test] public void TestDoWhileLoop() { + TestHelpers.InMethod(); + string input = @"// let's test do-while loops default @@ -1012,6 +1063,8 @@ default [Test] public void TestForLoop() { + TestHelpers.InMethod(); + string input = @"// let's test for loops default @@ -1056,6 +1109,8 @@ default [Test] public void TestFloatsWithTrailingDecimal() { + TestHelpers.InMethod(); + string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot default @@ -1108,6 +1163,8 @@ default [Test] public void TestUnaryAndBinaryOperators() { + TestHelpers.InMethod(); + string input = @"// let's test a few more operators default @@ -1144,6 +1201,8 @@ default [Test] public void TestTypecasts() { + TestHelpers.InMethod(); + string input = @"// let's test typecasts default @@ -1189,6 +1248,8 @@ default [Test] public void TestStates() { + TestHelpers.InMethod(); + string input = @"// let's test states default @@ -1229,6 +1290,8 @@ state statetwo [Test] public void TestHexIntegerConstants() { + TestHelpers.InMethod(); + string input = @"// let's test hex integers default @@ -1261,6 +1324,8 @@ default [Test] public void TestJumps() { + TestHelpers.InMethod(); + string input = @"// let's test jumps default @@ -1291,6 +1356,8 @@ default [Test] public void TestImplicitVariableInitialization() { + TestHelpers.InMethod(); + string input = @"// let's test implicitly initializing variables default @@ -1334,6 +1401,8 @@ default [Test] public void TestMultipleEqualsExpression() { + TestHelpers.InMethod(); + string input = @"// let's test x = y = 5 type expressions default @@ -1366,6 +1435,8 @@ default [Test] public void TestUnaryExpressionLastInVectorConstant() { + TestHelpers.InMethod(); + string input = @"// let's test unary expressions some more default @@ -1390,6 +1461,8 @@ default [Test] public void TestVectorMemberPlusEquals() { + TestHelpers.InMethod(); + string input = @"// let's test unary expressions some more default @@ -1424,6 +1497,8 @@ default [Test] public void TestWhileLoopWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1447,6 +1522,8 @@ default [Test] public void TestDoWhileLoopWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1472,6 +1549,8 @@ default [Test] public void TestIfWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1495,6 +1574,8 @@ default [Test] public void TestIfElseWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1521,6 +1602,8 @@ default [Test] public void TestForLoopWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1544,6 +1627,8 @@ default [Test] public void TestForLoopWithNoAssignment() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1569,6 +1654,8 @@ default [Test] public void TestForLoopWithOnlyIdentInAssignment() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1594,6 +1681,8 @@ default [Test] public void TestAssignmentInIfWhileDoWhile() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1631,6 +1720,8 @@ default [Test] public void TestLSLListHack() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1656,6 +1747,8 @@ default [ExpectedException(typeof(System.Exception))] public void TestSyntaxError() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1682,6 +1775,8 @@ default [ExpectedException(typeof(System.Exception))] public void TestSyntaxErrorDeclaringVariableInForLoop() { + TestHelpers.InMethod(); + string input = @"default { state_entry() diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index c5483c8..1fa6954 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using Microsoft.CSharp; using NUnit.Framework; using OpenSim.Region.ScriptEngine.Shared.CodeTools; +using OpenSim.Tests.Common; namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests { @@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests //[Test] public void TestUseUndeclaredVariable() { + TestHelpers.InMethod(); + m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); string input = @"default @@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests //[Test] public void TestCastAndConcatString() { + TestHelpers.InMethod(); + m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); string input = @"string s = "" a string""; @@ -150,4 +155,4 @@ default Assert.AreEqual(0, m_compilerResults.Errors.Count); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 3baa723..9cf9258 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -46,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [TestFixture, LongRunning] public class LSL_ApiTest { - private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; private const float FLOAT_ACCURACY = 0.00005f; @@ -55,7 +54,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [SetUp] public void SetUp() { - IConfigSource initConfigSource = new IniConfigSource(); IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); @@ -75,6 +73,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestllAngleBetween() { + TestHelpers.InMethod(); + CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1); CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1); CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1); @@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // llRot2Euler test. public void TestllRot2Euler() { + TestHelpers.InMethod(); + // 180, 90 and zero degree rotations. CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f)); @@ -256,6 +258,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // llSetPrimitiveParams and llGetPrimitiveParams test. public void TestllSetPrimitiveParams() { + TestHelpers.InMethod(); + // Create Prim1. Scene scene = SceneHelpers.SetupScene(); string obj1Name = "Prim1"; @@ -486,9 +490,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests } [Test] - // llVecNorm test. public void TestllVecNorm() { + TestHelpers.InMethod(); + // Check special case for normalizing zero vector. CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Check various vectors. diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs index 10b52cf..3ed2562 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs @@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConstructFromInt() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_intDoubleSet) @@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConstructFromDouble() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToInt() { + TestHelpers.InMethod(); + int testNumber; foreach (KeyValuePair number in m_doubleIntSet) @@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToUint() { + TestHelpers.InMethod(); + uint testNumber; foreach (KeyValuePair number in m_doubleUintSet) @@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLFloatToBooleanTrue() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; bool testBool; @@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLFloatToBooleanFalse() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); bool testBool = testFloat; @@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastIntToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (int number in m_intList) @@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLIntegerToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (int number in m_intList) @@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLIntegerToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (int number in m_intList) @@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastStringToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_stringDoubleSet) @@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLStringToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_stringDoubleSet) @@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastDoubleToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (double number in m_doubleList) @@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLFloatToDouble() { + TestHelpers.InMethod(); + double testNumber; LSL_Types.LSLFloat testFloat; @@ -411,19 +437,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToFloat() { - float testFloat; - float numberAsFloat; - LSL_Types.LSLFloat testLSLFloat; - foreach (double number in m_doubleList) - { - testLSLFloat = new LSL_Types.LSLFloat(number); - numberAsFloat = (float)number; - testFloat = (float)testLSLFloat; - - Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); - } - } + TestHelpers.InMethod(); + + float testFloat; + float numberAsFloat; + LSL_Types.LSLFloat testLSLFloat; + foreach (double number in m_doubleList) + { + testLSLFloat = new LSL_Types.LSLFloat(number); + numberAsFloat = (float)number; + testFloat = (float)testLSLFloat; + + Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); + } + } /// /// Tests the equality (==) operator. @@ -431,6 +459,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestEqualsOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloatA, testFloatB; foreach (double number in m_doubleList) @@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestNotEqualOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloatA, testFloatB; foreach (double number in m_doubleList) @@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestIncrementOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; double testNumber; @@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestDecrementOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; double testNumber; @@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestToString() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_doubleStringSet) @@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestAddTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestSubtractTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestMultiplyTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestDivideTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastBooleanToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; testFloat = (1 == 0); @@ -610,4 +658,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs index 3ad673b..8d1169a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs @@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; foreach (KeyValuePair number in m_doubleIntSet) @@ -94,6 +96,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastStringToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; foreach (KeyValuePair number in m_stringIntSet) @@ -109,6 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLStringToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; foreach (KeyValuePair number in m_stringIntSet) @@ -124,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastBooleanToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; testInteger = (1 == 0); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs index fa976ed..c4ca1a8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs @@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConstructFromLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLString testString; foreach (KeyValuePair number in m_doubleStringSet) @@ -86,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToLSLString() { + TestHelpers.InMethod(); + LSL_Types.LSLString testString; foreach (KeyValuePair number in m_doubleStringSet) @@ -101,6 +105,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLStringToQuaternion() { + TestHelpers.InMethod(); + string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>"; LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString); @@ -118,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastBooleanToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLString testString; testString = (LSL_Types.LSLString) (1 == 0); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs index 66a7329..b81225f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConcatenateString() { + TestHelpers.InMethod(); + LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); testList += new LSL_Types.LSLString("addition"); @@ -64,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConcatenateInteger() { + TestHelpers.InMethod(); + LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); testList += new LSL_Types.LSLInteger(20); @@ -84,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConcatenateDouble() { + TestHelpers.InMethod(); + LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); testList += new LSL_Types.LSLFloat(2.0f); @@ -104,6 +110,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastLSLIntegerItemToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -116,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastLSLFloatItemToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -128,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastLSLStringItemToLSLString() { + TestHelpers.InMethod(); + LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there"); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -140,6 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastVector3ItemToVector3() { + TestHelpers.InMethod(); + LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -151,6 +165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastQuaternionItemToQuaternion() { + TestHelpers.InMethod(); + LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -165,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLIntegerItemForLSLIntegerItem() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -177,6 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLFloatItemForLSLFloatItem() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -189,11 +209,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLFloatItemForLSLIntegerItem() { - LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); - LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); - LSL_Types.list testList = new LSL_Types.list(testValue); + TestHelpers.InMethod(); + + LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); + LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); + LSL_Types.list testList = new LSL_Types.list(testValue); - Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); + Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); } /// @@ -202,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLStringItemForLSLStringItem() { + TestHelpers.InMethod(); + LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all"); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -214,6 +238,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLStringItemForKeyItem() { + TestHelpers.InMethod(); + LSL_Types.key testValue = new LSL_Types.key("98000000-0000-2222-3333-100000001000"); LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue); @@ -228,6 +254,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetVector3ItemForVector3Item() { + TestHelpers.InMethod(); + LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -239,6 +267,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetQuaternionItemForQuaternionItem() { + TestHelpers.InMethod(); + LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -251,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetKeyItemForKeyItem() { + TestHelpers.InMethod(); + LSL_Types.key testValue = new LSL_Types.key("00000000-0000-2222-3333-100000001012"); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -258,4 +290,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(testValue, testList.GetKeyItem(0)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs index 195af7f..ebf8001 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs @@ -32,16 +32,17 @@ using OpenSim.Region.ScriptEngine.Shared; namespace OpenSim.Region.ScriptEngine.Shared.Tests { + /// + /// Tests for Vector3 + /// [TestFixture] public class LSL_TypesTestVector3 { - /// - /// Tests for Vector3 - /// [Test] - public void TestDotProduct() { + TestHelpers.InMethod(); + // The numbers we test for. Dictionary expectsSet = new Dictionary(); expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0); -- cgit v1.1 From b3449e998ab7fc9a952559821caea6484fc57e6e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 02:30:22 +0000 Subject: Fix TestSyntaxError() and TestSyntaxErrorDeclaringVariableInForLoop() They were all failing assertions but the exceptions these threw were caught as expected Exceptions. I don't think we can easily distinguish these from the Exceptions that we're expecting. So for now we'll do some messy manually checking with boolean setting instead. This patch also corrects the assertions themselves. --- .../Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 2add011..7763619 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs @@ -1744,11 +1744,12 @@ default } [Test] - [ExpectedException(typeof(System.Exception))] public void TestSyntaxError() { TestHelpers.InMethod(); + bool gotException = false; + string input = @"default { state_entry() @@ -1764,19 +1765,22 @@ default } catch (System.Exception e) { - // The syntax error is on line 6, char 5 (expected ';', found + // The syntax error is on line 5, char 4 (expected ';', found // '}'). - Assert.AreEqual("(4,4) syntax error", e.Message); - throw; + Assert.AreEqual("(5,4) syntax error", e.Message); + gotException = true; } + + Assert.That(gotException, Is.True); } [Test] - [ExpectedException(typeof(System.Exception))] public void TestSyntaxErrorDeclaringVariableInForLoop() { TestHelpers.InMethod(); + bool gotException = false; + string input = @"default { state_entry() @@ -1792,11 +1796,13 @@ default } catch (System.Exception e) { - // The syntax error is on line 5, char 14 (Syntax error) - Assert.AreEqual("(3,13) syntax error", e.Message); + // The syntax error is on line 4, char 13 (Syntax error) + Assert.AreEqual("(4,13) syntax error", e.Message); - throw; + gotException = true; } + + Assert.That(gotException, Is.True); } } } -- cgit v1.1 From 0f4cdc0c5bb750ec4ab7b100dc82d3ff08c9e427 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 19:05:32 +0000 Subject: Explictly close down the StatsReporter so that we can shutdown its timer This is another step necessary for the scene to be garbage collected between performance tests --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a01b851..6b28581 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1076,6 +1076,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); + StatsReporter.Close(); + m_restartTimer.Stop(); m_restartTimer.Close(); diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 35cd025..210f48d 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -185,6 +185,12 @@ namespace OpenSim.Region.Framework.Scenes OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; } + public void Close() + { + m_report.Elapsed -= statsHeartBeat; + m_report.Close(); + } + public void SetUpdateMS(int ms) { statsUpdatesEveryMS = ms; -- cgit v1.1 From e9d8eb5a270645ece83c864dbd3c84bf226a57f7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 22:31:25 +0000 Subject: Remove unnecessary explicit ElapsedEventHandler in SimReporter --- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 210f48d..5c56264 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -178,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes m_objectCapacity = scene.RegionInfo.ObjectCapacity; m_report.AutoReset = true; m_report.Interval = statsUpdatesEveryMS; - m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); + m_report.Elapsed += statsHeartBeat; m_report.Enabled = true; if (StatsManager.SimExtraStats != null) -- cgit v1.1 From 98251cdab364baf20537a1b5a6260c68e6630ccf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 23:21:17 +0000 Subject: Add sensor, dataserver requests, timer and listener counts to "xengine status" command. This is for diagnostic purposes. --- .../Scripting/WorldComm/WorldCommModule.cs | 20 ++++++++ OpenSim/Region/Framework/Interfaces/IWorldComm.cs | 5 ++ .../Api/Implementation/AsyncCommandManager.cs | 53 +++++++++++++++++++++- .../Api/Implementation/Plugins/Dataserver.cs | 9 ++++ .../Shared/Api/Implementation/Plugins/Listener.cs | 25 +++++----- .../Api/Implementation/Plugins/SensorRepeat.cs | 12 +++++ .../Shared/Api/Implementation/Plugins/Timer.cs | 9 ++++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 15 ++++++ 8 files changed, 136 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 640a60b..ef9b4e0 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm #region IWorldComm Members + public int ListenerCount + { + get + { + return m_listenerManager.ListenerCount; + } + } + /// /// Create a listen event callback with the specified filters. /// The parameters localID,itemID are needed to uniquely identify @@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm private int m_maxhandles; private int m_curlisteners; + /// + /// Total number of listeners + /// + public int ListenerCount + { + get + { + lock (m_listeners) + return m_listeners.Count; + } + } + public ListenerManager(int maxlisteners, int maxhandles) { m_maxlisteners = maxlisteners; diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index dafbf30..e8e375e 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs @@ -50,6 +50,11 @@ namespace OpenSim.Region.Framework.Interfaces public interface IWorldComm { /// + /// Total number of listeners + /// + int ListenerCount { get; } + + /// /// Create a listen event callback with the specified filters. /// The parameters localID,itemID are needed to uniquely identify /// the script during 'peek' time. Parameter hostID is needed to diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 14edde4..993d10f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -247,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Remove Sensors m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); + } + + /// + /// Get the sensor repeat plugin for this script engine. + /// + /// + /// + public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine) + { + if (m_SensorRepeat.ContainsKey(engine)) + return m_SensorRepeat[engine]; + else + return null; + } + /// + /// Get the dataserver plugin for this script engine. + /// + /// + /// + public static Dataserver GetDataserverPlugin(IScriptEngine engine) + { + if (m_Dataserver.ContainsKey(engine)) + return m_Dataserver[engine]; + else + return null; + } + + /// + /// Get the timer plugin for this script engine. + /// + /// + /// + public static Timer GetTimerPlugin(IScriptEngine engine) + { + if (m_Timer.ContainsKey(engine)) + return m_Timer[engine]; + else + return null; + } + + /// + /// Get the listener plugin for this script engine. + /// + /// + /// + public static Listener GetListenerPlugin(IScriptEngine engine) + { + if (m_Listener.ContainsKey(engine)) + return m_Listener[engine]; + else + return null; } public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) @@ -270,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api data.AddRange(timers); } - Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID); + Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID); if (sensors.Length > 0) { data.Add("sensor"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs index 7fa19b1..9f78a49 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs @@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { public AsyncCommandManager m_CmdManager; + public int DataserverRequestsCount + { + get + { + lock (DataserverRequests) + return DataserverRequests.Count; + } + } + private Dictionary DataserverRequests = new Dictionary(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index 740816f..93e0261 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs @@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public AsyncCommandManager m_CmdManager; + private IWorldComm m_commsPlugin; + + public int ListenerCount + { + get { return m_commsPlugin.ListenerCount; } + } + public Listener(AsyncCommandManager CmdManager) { m_CmdManager = CmdManager; + m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); } public void CheckListeners() { if (m_CmdManager.m_ScriptEngine.World == null) return; - IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); - if (comms != null) + if (m_commsPlugin != null) { - while (comms.HasMessages()) + while (m_commsPlugin.HasMessages()) { - ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage(); + ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage(); //Deliver data to prim's listen handler object[] resobj = new object[] @@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public Object[] GetSerializationData(UUID itemID) { - IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); - - return comms.GetSerializationData(itemID); + return m_commsPlugin.GetSerializationData(itemID); } public void CreateFromData(uint localID, UUID itemID, UUID hostID, Object[] data) { - IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); - - comms.CreateFromData(localID, itemID, hostID, data); + m_commsPlugin.CreateFromData(localID, itemID, hostID, data); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index fbb7c39..1c272f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public AsyncCommandManager m_CmdManager; + /// + /// Number of sensors active. + /// + public int SensorsCount + { + get + { + lock (SenseRepeatListLock) + return SenseRepeaters.Count; + } + } + public SensorRepeat(AsyncCommandManager CmdManager) { m_CmdManager = CmdManager; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index eeb59d9..bc63030 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs @@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { public AsyncCommandManager m_CmdManager; + public int TimersCount + { + get + { + lock (TimerListLock) + return Timers.Count; + } + } + public Timer(AsyncCommandManager CmdManager) { m_CmdManager = CmdManager; diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c68f03f..d1cac9c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -49,7 +49,10 @@ using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Shared.CodeTools; using OpenSim.Region.ScriptEngine.Shared.Instance; +using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Interfaces; +using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; using ScriptCompileQueue = OpenSim.Framework.LocklessQueue; @@ -386,6 +389,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); + SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this); + sb.AppendFormat("Sensors : {0}\n", sr.SensorsCount); + + Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this); + sb.AppendFormat("Dataserver requests : {0}\n", ds.DataserverRequestsCount); + + Timer t = AsyncCommandManager.GetTimerPlugin(this); + sb.AppendFormat("Timers : {0}\n", t.TimersCount); + + Listener l = AsyncCommandManager.GetListenerPlugin(this); + sb.AppendFormat("Listeners : {0}\n", l.ListenerCount); + MainConsole.Instance.OutputFormat(sb.ToString()); } -- cgit v1.1 From 33769799233c144a4971efecf25afe1f6ab1d66f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 23:51:50 +0000 Subject: Remove static m_MainInstance in LocalGridServiceConnector. I believe this was originally required back when there could be two LocalGridServiceConnectors but this is no longer the case. Having such statics makes performance testing much more difficult since they prevent GC of objects unless static references are explicitly nulled. --- .../Grid/LocalGridServiceConnector.cs | 34 +++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 3c36799..4f0363a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -48,8 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private static LocalGridServicesConnector m_MainInstance; - private IGridService m_GridService; private Dictionary m_LocalCache = new Dictionary(); @@ -62,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public LocalGridServicesConnector(IConfigSource source) { m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); - m_MainInstance = this; InitialiseService(source); } @@ -87,7 +84,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (name == Name) { InitialiseService(source); - m_MainInstance = this; m_Enabled = true; m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); } @@ -126,12 +122,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public void PostInitialise() { - if (m_MainInstance == this) - { - MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours", - "show neighbours", - "Shows the local regions' neighbours", NeighboursCommand); - } + MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours", + "show neighbours", + "Shows the local regions' neighbours", NeighboursCommand); } public void Close() @@ -143,22 +136,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (m_Enabled) scene.RegisterModuleInterface(this); - if (m_MainInstance == this) - { - if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) - m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); - else - m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); - } + if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) + m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); + else + m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); } public void RemoveRegion(Scene scene) { - if (m_MainInstance == this) - { - m_LocalCache[scene.RegionInfo.RegionID].Clear(); - m_LocalCache.Remove(scene.RegionInfo.RegionID); - } + m_LocalCache[scene.RegionInfo.RegionID].Clear(); + m_LocalCache.Remove(scene.RegionInfo.RegionID); } public void RegionLoaded(Scene scene) @@ -259,6 +246,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid MainConsole.Instance.Output(caps.ToString()); } - } -} +} \ No newline at end of file -- cgit v1.1 From 23aba007dd0c6e8983feef6fc078b3d5b674ed3a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 7 Mar 2012 00:04:24 +0000 Subject: Add documentation to make more explicit the difference between OnRezScript and OnNewScript in the event manager OnNewScript fires when a script is added to a scene OnRezScript fires when the script actually runs (i.e. after permission checks, state retrieval, etc.) --- OpenSim/Region/Framework/Scenes/EventManager.cs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 569c235..6ff2a6f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -138,8 +138,11 @@ namespace OpenSim.Region.Framework.Scenes public event OnPermissionErrorDelegate OnPermissionError; /// - /// Fired when a new script is created. + /// Fired when a script is run. /// + /// + /// Occurs after OnNewScript. + /// public event NewRezScript OnRezScript; public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); @@ -187,10 +190,16 @@ namespace OpenSim.Region.Framework.Scenes public event ClientClosed OnClientClosed; - // Fired when a script is created - // The indication that a new script exists in this region. public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); + + /// + /// Fired when a script is created. + /// + /// + /// Occurs before OnRezScript + /// public event NewScript OnNewScript; + public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) { NewScript handlerNewScript = OnNewScript; @@ -212,10 +221,16 @@ namespace OpenSim.Region.Framework.Scenes } } - //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset - // An indication that the script has changed. public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); + + /// + /// An indication that the script has changed. + /// + /// + /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset. + /// public event UpdateScript OnUpdateScript; + public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) { UpdateScript handlerUpdateScript = OnUpdateScript; -- cgit v1.1 From f3678d217f7b1d69faf4aaeb0097348f3d7f91b6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 7 Mar 2012 00:31:18 +0000 Subject: Stop individually deleting objects at the end of each ObjectTortureTest. We can now do this since the entire scene and all objects within it are now successfully gc'd at the end of these tests. This greatly improves the time taken to run each test (by reducing teardown time, not the time to actually do the test work that we're interested in). Slightly simplifies config read in Scene constructor to help facilitate this. --- OpenSim/Region/Framework/Scenes/Scene.cs | 49 ++++++++++++---------------- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- OpenSim/Tests/Torture/NPCTortureTests.cs | 4 +++ OpenSim/Tests/Torture/ObjectTortureTests.cs | 8 ++--- OpenSim/Tests/Torture/ScriptTortureTests.cs | 8 +++++ 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6b28581..11e5ce3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -628,10 +628,10 @@ namespace OpenSim.Region.Framework.Scenes #region Region Config - try + // Region config overrides global config + // + if (m_config.Configs["Startup"] != null) { - // Region config overrides global config - // IConfig startupConfig = m_config.Configs["Startup"]; m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); @@ -721,46 +721,39 @@ namespace OpenSim.Region.Framework.Scenes m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); } - catch - { - m_log.Warn("[SCENE]: Failed to load StartupConfig"); - } #endregion Region Config #region Interest Management - if (m_config != null) + IConfig interestConfig = m_config.Configs["InterestManagement"]; + if (interestConfig != null) { - IConfig interestConfig = m_config.Configs["InterestManagement"]; - if (interestConfig != null) - { - string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); - - try - { - m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); - } - catch (Exception) - { - m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); - m_priorityScheme = UpdatePrioritizationSchemes.Time; - } + string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); - m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); - m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); - m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); - m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); + try + { + m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); } + catch (Exception) + { + m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); + m_priorityScheme = UpdatePrioritizationSchemes.Time; + } + + m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); + m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); + m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); + m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); } - m_log.InfoFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); + m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); #endregion Interest Management StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; - StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; + StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; } /// diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 8a69d7c..7bf08ae 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -136,7 +136,7 @@ namespace OpenSim.Tests.Common StartAuthenticationService(testScene); LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); StartGridService(testScene); - LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); + LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); inventoryService.PostInitialise(); diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Torture/NPCTortureTests.cs index 8078d9d..65732db 100644 --- a/OpenSim/Tests/Torture/NPCTortureTests.cs +++ b/OpenSim/Tests/Torture/NPCTortureTests.cs @@ -75,6 +75,10 @@ namespace OpenSim.Tests.Torture [TestFixtureTearDown] public void TearDown() { + scene.Close(); + GC.Collect(); + GC.WaitForPendingFinalizers(); + // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple // threads. Possibly, later tests should be rewritten not to worry about such things. Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs index e83186a..7e9946b 100644 --- a/OpenSim/Tests/Torture/ObjectTortureTests.cs +++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs @@ -156,11 +156,6 @@ namespace OpenSim.Tests.Torture // objects will be clean up by the garbage collector before the next stress test is run. scene.Update(); - // Currently, we need to do this in order to garbage collect the scene objects ready for the next test run. - // However, what we really need to do is find out why the entire scene is not garbage collected in - // teardown. - scene.DeleteAllSceneObjects(); - Console.WriteLine( "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)", Math.Round(elapsed.TotalMilliseconds), @@ -170,7 +165,8 @@ namespace OpenSim.Tests.Torture objectsToAdd, primsInEachObject); - scene = null; + scene.Close(); +// scene = null; } } } \ No newline at end of file diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Torture/ScriptTortureTests.cs index d94bbde..87932cb 100644 --- a/OpenSim/Tests/Torture/ScriptTortureTests.cs +++ b/OpenSim/Tests/Torture/ScriptTortureTests.cs @@ -91,6 +91,14 @@ namespace OpenSim.Tests.Torture m_scene.StartScripts(); } + [TearDown] + public void TearDown() + { + m_scene.Close(); + GC.Collect(); + GC.WaitForPendingFinalizers(); + } + [Test] public void TestCompileAndStart100Scripts() { -- cgit v1.1 From 5884d080623fddb3ee50b8215d896bdee3fa31a4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Mar 2012 00:58:01 +0000 Subject: Fix merge issue --- OpenSim/Region/Framework/Scenes/Scene.cs | 155 ++++++++++++++++--------------- 1 file changed, 79 insertions(+), 76 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fc72946..d016887 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -653,99 +653,102 @@ namespace OpenSim.Region.Framework.Scenes // Region config overrides global config // - if (m_config.Configs["Startup"] != null) + try { - IConfig startupConfig = m_config.Configs["Startup"]; + if (m_config.Configs["Startup"] != null) + { + IConfig startupConfig = m_config.Configs["Startup"]; - m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); - m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); - if (!m_useBackup) - m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); - - //Animation states - m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); + m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); + m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); + if (!m_useBackup) + m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); + + //Animation states + m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); - PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); - CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); + PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); + CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); - m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); - if (RegionInfo.NonphysPrimMax > 0) - { - m_maxNonphys = RegionInfo.NonphysPrimMax; - } + m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); + if (RegionInfo.NonphysPrimMax > 0) + { + m_maxNonphys = RegionInfo.NonphysPrimMax; + } - m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); + m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); - if (RegionInfo.PhysPrimMax > 0) - { - m_maxPhys = RegionInfo.PhysPrimMax; - } + if (RegionInfo.PhysPrimMax > 0) + { + m_maxPhys = RegionInfo.PhysPrimMax; + } - // Here, if clamping is requested in either global or - // local config, it will be used - // - m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); - if (RegionInfo.ClampPrimSize) - { - m_clampPrimSize = true; - } + // Here, if clamping is requested in either global or + // local config, it will be used + // + m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); + if (RegionInfo.ClampPrimSize) + { + m_clampPrimSize = true; + } - m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); - m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); - m_dontPersistBefore = - startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); - m_dontPersistBefore *= 10000000; - m_persistAfter = - startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); - m_persistAfter *= 10000000; + m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); + m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); + m_dontPersistBefore = + startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); + m_dontPersistBefore *= 10000000; + m_persistAfter = + startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); + m_persistAfter *= 10000000; - m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); - m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); + m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); + m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); - IConfig packetConfig = m_config.Configs["PacketPool"]; - if (packetConfig != null) - { - PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); - PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); - } + IConfig packetConfig = m_config.Configs["PacketPool"]; + if (packetConfig != null) + { + PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); + PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); + } - m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); - m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); - CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); + m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); + m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); + CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); - m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); - if (m_generateMaptiles) - { - int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); - if (maptileRefresh != 0) + m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); + if (m_generateMaptiles) { - m_mapGenerationTimer.Interval = maptileRefresh * 1000; - m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; - m_mapGenerationTimer.AutoReset = true; - m_mapGenerationTimer.Start(); + int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); + if (maptileRefresh != 0) + { + m_mapGenerationTimer.Interval = maptileRefresh * 1000; + m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; + m_mapGenerationTimer.AutoReset = true; + m_mapGenerationTimer.Start(); + } } - } - else - { - string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); - UUID tileID; - - if (UUID.TryParse(tile, out tileID)) + else { - RegionInfo.RegionSettings.TerrainImageID = tileID; + string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); + UUID tileID; + + if (UUID.TryParse(tile, out tileID)) + { + RegionInfo.RegionSettings.TerrainImageID = tileID; + } } - } - MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); - m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); - m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); - m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); - m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); - m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); - m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); - m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); - m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); - m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); + MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); + m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); + m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); + m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); + m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); + m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); + m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); + m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); + m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); + m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); + } } catch (Exception e) { -- cgit v1.1 From 776936268705940bfb13d10d6b6824ef20eb99cb Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Mar 2012 01:03:26 +0000 Subject: Always zero the PhysActor on dupes to prevent side effects on the orignal prim --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 65905a0..439b718 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1546,10 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes if (userExposed) dupe.UUID = UUID.Random(); - //memberwiseclone means it also clones the physics actor reference - // This will make physical prim 'bounce' if not set to null. - if (!userExposed) - dupe.PhysActor = null; + dupe.PhysActor = null; dupe.OwnerID = AgentID; dupe.GroupID = GroupID; -- cgit v1.1 From 6bdea15ecf6fdaaf705704dddf9199b882675963 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 7 Mar 2012 01:11:37 +0000 Subject: minor: make NPC tests run in a given order, comment out log lines in mock region data plugins, null out scene in script and npc torture tests, add other doc comments to torture tests --- OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 22 +++++++++++----------- OpenSim/Tests/Torture/NPCTortureTests.cs | 7 ++++--- OpenSim/Tests/Torture/ObjectTortureTests.cs | 15 +++++++++------ OpenSim/Tests/Torture/ScriptTortureTests.cs | 1 + 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 79bb9c2..295e868 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -177,9 +177,9 @@ namespace OpenSim.Data.Null // Therefore, we need to store parts rather than groups. foreach (SceneObjectPart prim in obj.Parts) { - m_log.DebugFormat( - "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}", - prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID); +// m_log.DebugFormat( +// "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}", +// prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID); m_sceneObjectParts[prim.UUID] = prim; } @@ -193,9 +193,9 @@ namespace OpenSim.Data.Null { if (part.ParentGroup.UUID == obj) { - m_log.DebugFormat( - "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}", - part.Name, part.UUID, obj, regionUUID); +// m_log.DebugFormat( +// "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}", +// part.Name, part.UUID, obj, regionUUID); m_sceneObjectParts.Remove(part.UUID); } } @@ -215,8 +215,8 @@ namespace OpenSim.Data.Null { if (prim.IsRoot) { - m_log.DebugFormat( - "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); +// m_log.DebugFormat( +// "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); objects[prim.UUID] = new SceneObjectGroup(prim); } } @@ -240,9 +240,9 @@ namespace OpenSim.Data.Null } else { - m_log.WarnFormat( - "[MOCK REGION DATA PLUGIN]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.", - prim.Name, prim.UUID, regionUUID, prim.ParentUUID); +// m_log.WarnFormat( +// "[MOCK REGION DATA PLUGIN]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.", +// prim.Name, prim.UUID, regionUUID, prim.ParentUUID); } } } diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Torture/NPCTortureTests.cs index 65732db..0224505 100644 --- a/OpenSim/Tests/Torture/NPCTortureTests.cs +++ b/OpenSim/Tests/Torture/NPCTortureTests.cs @@ -76,6 +76,7 @@ namespace OpenSim.Tests.Torture public void TearDown() { scene.Close(); + scene = null; GC.Collect(); GC.WaitForPendingFinalizers(); @@ -102,7 +103,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void TestAddRemove100NPCs() + public void Test_0001_AddRemove100NPCs() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -111,7 +112,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void TestAddRemove1000NPCs() + public void Test_0002_AddRemove1000NPCs() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -120,7 +121,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void TestAddRemove2000NPCs() + public void Test_0003_AddRemove2000NPCs() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs index 7e9946b..978a308 100644 --- a/OpenSim/Tests/Torture/ObjectTortureTests.cs +++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs @@ -66,7 +66,7 @@ namespace OpenSim.Tests.Torture // } [Test] - public void Test0001_10K_1PrimObjects() + public void Test_0001_10K_1PrimObjects() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -75,7 +75,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void Test0002_100K_1PrimObjects() + public void Test_0002_100K_1PrimObjects() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -84,7 +84,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void Test0003_200K_1PrimObjects() + public void Test_0003_200K_1PrimObjects() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -93,7 +93,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void Test0011_100_100PrimObjects() + public void Test_0011_100_100PrimObjects() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -102,7 +102,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void Test0012_1K_100PrimObjects() + public void Test_0012_1K_100PrimObjects() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -111,7 +111,7 @@ namespace OpenSim.Tests.Torture } [Test] - public void Test0013_2K_100PrimObjects() + public void Test_0013_2K_100PrimObjects() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -123,6 +123,9 @@ namespace OpenSim.Tests.Torture { UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000"); + // Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage + // collected when we teardown this test. If it's done in a member variable, even if that is subsequently + // nulled out, the garbage collect can be delayed. TestScene scene = SceneHelpers.SetupScene(); // Process process = Process.GetCurrentProcess(); diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Torture/ScriptTortureTests.cs index 87932cb..2ef55b3 100644 --- a/OpenSim/Tests/Torture/ScriptTortureTests.cs +++ b/OpenSim/Tests/Torture/ScriptTortureTests.cs @@ -95,6 +95,7 @@ namespace OpenSim.Tests.Torture public void TearDown() { m_scene.Close(); + m_scene = null; GC.Collect(); GC.WaitForPendingFinalizers(); } -- cgit v1.1 From 749c3fef8ad2d3af97fcd9ab9c72740675e46715 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 Mar 2012 01:51:37 +0000 Subject: Change "help" to display categories/module list then "help " to display commands in a category. This is to deal with the hundred lines of command splurge when one previously typed "help" Modelled somewhat on the mysql console One can still type help to get per command help at any point. Categories capitalized to avoid conflict with the all-lowercase commands (except for commander system, as of yet). Does not affect command parsing or any other aspects of the console apart from the help system. Backwards compatible with existing modules. --- OpenSim/Framework/Console/CommandConsole.cs | 114 +++++++++++++++++---- OpenSim/Framework/ICommandConsole.cs | 2 +- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 20 ++-- OpenSim/Region/Application/OpenSim.cs | 87 +++++++--------- OpenSim/Region/Application/OpenSimBase.cs | 12 +-- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 8 +- .../CoreModules/Avatar/Dialog/DialogModule.cs | 4 +- .../Inventory/Archiver/InventoryArchiverModule.cs | 4 +- .../Framework/Caps/CapabilitiesModule.cs | 5 +- .../Framework/Monitoring/MonitorModule.cs | 2 +- .../UserManagement/UserManagementModule.cs | 2 +- .../Grid/LocalGridServiceConnector.cs | 2 +- .../CoreModules/World/Access/AccessModule.cs | 6 +- .../World/Estate/EstateManagementCommands.cs | 4 +- .../World/Objects/Commands/ObjectCommandsModule.cs | 18 ++-- .../World/Permissions/PermissionsModule.cs | 6 +- .../CoreModules/World/Region/RestartModule.cs | 6 +- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 9 +- .../Region/CoreModules/World/Wind/WindModule.cs | 19 ++-- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneBase.cs | 71 +++++++++++-- .../Agent/TextureSender/J2KDecoderCommandModule.cs | 2 +- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 14 +-- .../OptionalModules/Asset/AssetInfoModule.cs | 4 +- .../Avatar/Appearance/AppearanceInfoModule.cs | 10 +- .../PhysicsParameters/PhysicsParameters.cs | 24 ++--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 14 +-- OpenSim/Server/Base/ServicesServerBase.cs | 8 +- .../Server/Handlers/Asset/AssetServerConnector.cs | 6 +- OpenSim/Services/GridService/GridService.cs | 4 +- OpenSim/Services/LLLoginService/LLLoginService.cs | 6 +- .../UserAccountService/UserAccountService.cs | 8 +- prebuild.xml | 1 + 35 files changed, 316 insertions(+), 192 deletions(-) diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 0d6288b..2bb7de1 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -29,6 +29,7 @@ using System; using System.Xml; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Reflection; using System.Text; using System.Text.RegularExpressions; @@ -40,6 +41,8 @@ namespace OpenSim.Framework.Console { public class Commands : ICommands { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// Encapsulates a command that can be invoked from the console /// @@ -76,6 +79,8 @@ namespace OpenSim.Framework.Console public List fn; } + public const string GeneralHelpText = "For more information, type 'help ' where is one of the following categories:"; + /// /// Commands organized by keyword in a tree /// @@ -83,6 +88,11 @@ namespace OpenSim.Framework.Console new Dictionary(); /// + /// Commands organized by module + /// + private Dictionary> m_modulesCommands = new Dictionary>(); + + /// /// Get help for the given help string /// /// Parsed parts of the help string. If empty then general help is returned. @@ -98,8 +108,8 @@ namespace OpenSim.Framework.Console // General help if (helpParts.Count == 0) { - help.AddRange(CollectHelp(tree)); - help.Sort(); + help.Add(GeneralHelpText); + help.AddRange(CollectModulesHelp(tree)); } else { @@ -118,6 +128,13 @@ namespace OpenSim.Framework.Console { string originalHelpRequest = string.Join(" ", helpParts.ToArray()); List help = new List(); + + // Check modules first to see if we just need to display a list of those commands + if (TryCollectModuleHelp(originalHelpRequest, help)) + { + help.Insert(0, GeneralHelpText); + return help; + } Dictionary dict = tree; while (helpParts.Count > 0) @@ -161,25 +178,61 @@ namespace OpenSim.Framework.Console return help; } - private List CollectHelp(Dictionary dict) + /// + /// Try to collect help for the given module if that module exists. + /// + /// + /// /param> + /// true if there was the module existed, false otherwise. + private bool TryCollectModuleHelp(string moduleName, List helpText) { - List result = new List(); - - foreach (KeyValuePair kvp in dict) + lock (m_modulesCommands) { - if (kvp.Value is Dictionary) + if (m_modulesCommands.ContainsKey(moduleName)) { - result.AddRange(CollectHelp((Dictionary)kvp.Value)); + List commands = m_modulesCommands[moduleName]; + var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help)); + ourHelpText.Sort(); + helpText.AddRange(ourHelpText); + + return true; } else { - if (((CommandInfo)kvp.Value).long_help != String.Empty) - result.Add(((CommandInfo)kvp.Value).help_text+" - "+ - ((CommandInfo)kvp.Value).long_help); + return false; } } - return result; } + + private List CollectModulesHelp(Dictionary dict) + { + lock (m_modulesCommands) + { + List helpText = new List(m_modulesCommands.Keys); + helpText.Sort(); + return helpText; + } + } + +// private List CollectHelp(Dictionary dict) +// { +// List result = new List(); +// +// foreach (KeyValuePair kvp in dict) +// { +// if (kvp.Value is Dictionary) +// { +// result.AddRange(CollectHelp((Dictionary)kvp.Value)); +// } +// else +// { +// if (((CommandInfo)kvp.Value).long_help != String.Empty) +// result.Add(((CommandInfo)kvp.Value).help_text+" - "+ +// ((CommandInfo)kvp.Value).long_help); +// } +// } +// return result; +// } /// /// Add a command to those which can be invoked from the console. @@ -212,21 +265,19 @@ namespace OpenSim.Framework.Console Dictionary current = tree; - foreach (string s in parts) + foreach (string part in parts) { - if (current.ContainsKey(s)) + if (current.ContainsKey(part)) { - if (current[s] is Dictionary) - { - current = (Dictionary)current[s]; - } + if (current[part] is Dictionary) + current = (Dictionary)current[part]; else return; } else { - current[s] = new Dictionary(); - current = (Dictionary)current[s]; + current[part] = new Dictionary(); + current = (Dictionary)current[part]; } } @@ -250,6 +301,24 @@ namespace OpenSim.Framework.Console info.fn = new List(); info.fn.Add(fn); current[String.Empty] = info; + + // Now add command to modules dictionary + lock (m_modulesCommands) + { + List commands; + if (m_modulesCommands.ContainsKey(module)) + { + commands = m_modulesCommands[module]; + } + else + { + commands = new List(); + m_modulesCommands[module] = commands; + } + +// m_log.DebugFormat("[COMMAND CONSOLE]: Adding to category {0} command {1}", module, command); + commands.Add(info); + } } public string[] FindNextOption(string[] cmd, bool term) @@ -607,8 +676,9 @@ namespace OpenSim.Framework.Console { Commands = new Commands(); - Commands.AddCommand("console", false, "help", "help []", - "Get general command list or more detailed help on a specific command", Help); + Commands.AddCommand( + "Help", false, "help", "help []", + "Display help on a particular command or on a list of commands in a category", Help); } private void Help(string module, string[] cmd) diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs index d33b9b5..ca0ff93 100644 --- a/OpenSim/Framework/ICommandConsole.cs +++ b/OpenSim/Framework/ICommandConsole.cs @@ -40,7 +40,7 @@ namespace OpenSim.Framework /// /// Get help for the given help string /// - /// Parsed parts of the help string. If empty then general help is returned. + /// Parsed parts of the help string. If empty then general help is returned. /// List GetHelp(string[] cmd); diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 6a3135e..d5c2515 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -161,43 +161,43 @@ namespace OpenSim.Framework.Servers Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); } - m_console.Commands.AddCommand("base", false, "quit", + m_console.Commands.AddCommand("General", false, "quit", "quit", "Quit the application", HandleQuit); - m_console.Commands.AddCommand("base", false, "shutdown", + m_console.Commands.AddCommand("General", false, "shutdown", "shutdown", "Quit the application", HandleQuit); - m_console.Commands.AddCommand("base", false, "set log level", + m_console.Commands.AddCommand("General", false, "set log level", "set log level ", "Set the console logging level", HandleLogLevel); - m_console.Commands.AddCommand("base", false, "show info", + m_console.Commands.AddCommand("General", false, "show info", "show info", "Show general information about the server", HandleShow); - m_console.Commands.AddCommand("base", false, "show stats", + m_console.Commands.AddCommand("General", false, "show stats", "show stats", "Show statistics", HandleShow); - m_console.Commands.AddCommand("base", false, "show threads", + m_console.Commands.AddCommand("General", false, "show threads", "show threads", "Show thread status", HandleShow); - m_console.Commands.AddCommand("base", false, "show uptime", + m_console.Commands.AddCommand("General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); - m_console.Commands.AddCommand("base", false, "show version", + m_console.Commands.AddCommand("General", false, "show version", "show version", "Show server version", HandleShow); - m_console.Commands.AddCommand("base", false, "threads abort", + m_console.Commands.AddCommand("General", false, "threads abort", "threads abort ", "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort); - m_console.Commands.AddCommand("base", false, "threads show", + m_console.Commands.AddCommand("General", false, "threads show", "threads show", "Show thread status. Synonym for \"show threads\"", (string module, string[] args) => Notice(GetThreadsReport())); diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 145875b..a46ce7f 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -225,12 +225,12 @@ namespace OpenSim /// private void RegisterConsoleCommands() { - m_console.Commands.AddCommand("region", false, "force update", + m_console.Commands.AddCommand("Regions", false, "force update", "force update", "Force the update of all objects on clients", HandleForceUpdate); - m_console.Commands.AddCommand("region", false, "debug packet", + m_console.Commands.AddCommand("Comms", false, "debug packet", "debug packet [ ]", "Turn on packet debugging", "If level > 255 then all incoming and outgoing packets are logged.\n" @@ -242,7 +242,7 @@ namespace OpenSim + "If an avatar name is given then only packets from that avatar are logged", Debug); - m_console.Commands.AddCommand("region", false, "debug http", + m_console.Commands.AddCommand("Comms", false, "debug http", "debug http ", "Turn on inbound http request debugging for everything except the event queue (see debug eq).", "If level >= 2 then the handler used to service the request is logged.\n" @@ -250,37 +250,37 @@ namespace OpenSim + "If level <= 0 then no extra http logging is done.\n", Debug); - m_console.Commands.AddCommand("region", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); + m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); - m_console.Commands.AddCommand("region", false, "debug scene", + m_console.Commands.AddCommand("Regions", false, "debug scene", "debug scene ", "Turn on scene debugging", Debug); - m_console.Commands.AddCommand("region", false, "change region", + m_console.Commands.AddCommand("Regions", false, "change region", "change region ", "Change current console region", ChangeSelectedRegion); - m_console.Commands.AddCommand("region", false, "save xml", + m_console.Commands.AddCommand("Archiving", false, "save xml", "save xml", "Save a region's data in XML format", SaveXml); - m_console.Commands.AddCommand("region", false, "save xml2", + m_console.Commands.AddCommand("Archiving", false, "save xml2", "save xml2", "Save a region's data in XML2 format", SaveXml2); - m_console.Commands.AddCommand("region", false, "load xml", + m_console.Commands.AddCommand("Archiving", false, "load xml", "load xml [-newIDs [ ]]", "Load a region's data from XML format", LoadXml); - m_console.Commands.AddCommand("region", false, "load xml2", + m_console.Commands.AddCommand("Archiving", false, "load xml2", "load xml2", "Load a region's data from XML2 format", LoadXml2); - m_console.Commands.AddCommand("region", false, "save prims xml2", + m_console.Commands.AddCommand("Archiving", false, "save prims xml2", "save prims xml2 [ ]", "Save named prim to XML2", SavePrimsXml2); - m_console.Commands.AddCommand("region", false, "load oar", + m_console.Commands.AddCommand("Archiving", false, "load oar", "load oar [--merge] [--skip-assets] []", "Load a region's data from an OAR archive.", "--merge will merge the OAR with the existing scene." + Environment.NewLine @@ -289,7 +289,7 @@ namespace OpenSim + " If this is not given then the command looks for an OAR named region.oar in the current directory.", LoadOar); - m_console.Commands.AddCommand("region", false, "save oar", + m_console.Commands.AddCommand("Archiving", false, "save oar", //"save oar [-v|--version=] [-p|--profile=] []", "save oar [-h|--home=] [--noassets] [--publish] [--perm=] []", "Save a region's data to an OAR archive.", @@ -306,54 +306,54 @@ namespace OpenSim + " If this is not given then the oar is saved to region.oar in the current directory.", SaveOar); - m_console.Commands.AddCommand("region", false, "edit scale", + m_console.Commands.AddCommand("Regions", false, "edit scale", "edit scale ", "Change the scale of a named prim", HandleEditScale); - m_console.Commands.AddCommand("region", false, "kick user", + m_console.Commands.AddCommand("Users", false, "kick user", "kick user [message]", "Kick a user off the simulator", KickUserCommand); - m_console.Commands.AddCommand("region", false, "show users", + m_console.Commands.AddCommand("Users", false, "show users", "show users [full]", "Show user data for users currently on the region", "Without the 'full' option, only users actually on the region are shown." + " With the 'full' option child agents of users in neighbouring regions are also shown.", HandleShow); - m_console.Commands.AddCommand("region", false, "show connections", + m_console.Commands.AddCommand("Comms", false, "show connections", "show connections", "Show connection data", HandleShow); - m_console.Commands.AddCommand("region", false, "show circuits", + m_console.Commands.AddCommand("Comms", false, "show circuits", "show circuits", "Show agent circuit data", HandleShow); - m_console.Commands.AddCommand("region", false, "show http-handlers", + m_console.Commands.AddCommand("Comms", false, "show http-handlers", "show http-handlers", "Show all registered http handlers", HandleShow); - m_console.Commands.AddCommand("region", false, "show pending-objects", + m_console.Commands.AddCommand("Comms", false, "show pending-objects", "show pending-objects", "Show # of objects on the pending queues of all scene viewers", HandleShow); - m_console.Commands.AddCommand("region", false, "show modules", + m_console.Commands.AddCommand("General", false, "show modules", "show modules", "Show module data", HandleShow); - m_console.Commands.AddCommand("region", false, "show regions", + m_console.Commands.AddCommand("Regions", false, "show regions", "show regions", "Show region data", HandleShow); - m_console.Commands.AddCommand("region", false, "show ratings", + m_console.Commands.AddCommand("Regions", false, "show ratings", "show ratings", "Show rating data", HandleShow); - m_console.Commands.AddCommand("region", false, "backup", + m_console.Commands.AddCommand("Regions", false, "backup", "backup", "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); - m_console.Commands.AddCommand("region", false, "create region", + m_console.Commands.AddCommand("Regions", false, "create region", "create region [\"region name\"] ", "Create a new region.", "The settings for \"region name\" are read from . Paths specified with are relative to your Regions directory, unless an absolute path is given." @@ -362,62 +362,57 @@ namespace OpenSim + "If does not exist, it will be created.", HandleCreateRegion); - m_console.Commands.AddCommand("region", false, "restart", + m_console.Commands.AddCommand("Regions", false, "restart", "restart", "Restart all sims in this instance", RunCommand); - m_console.Commands.AddCommand("region", false, "config set", + m_console.Commands.AddCommand("General", false, "config set", "config set
", "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig); - m_console.Commands.AddCommand("region", false, "config get", + m_console.Commands.AddCommand("General", false, "config get", "config get [
] []", "Synonym for config show", HandleConfig); - m_console.Commands.AddCommand("region", false, "config show", + m_console.Commands.AddCommand("General", false, "config show", "config show [
] []", "Show config information", "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine + "If a section is given but not a field, then all fields in that section are printed.", HandleConfig); - m_console.Commands.AddCommand("region", false, "config save", + m_console.Commands.AddCommand("General", false, "config save", "config save ", "Save current configuration to a file at the given path", HandleConfig); - m_console.Commands.AddCommand("region", false, "command-script", + m_console.Commands.AddCommand("General", false, "command-script", "command-script