From 5d6d0aa14226fe31e59c4f2e8a9bd6d6dfc4f995 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 15 Feb 2011 08:38:37 -0800 Subject: [PATCH 01/46] Catch HttpServer exception: mantis #5381 --- bin/HttpServer_OpenSim.dll | Bin 115712 -> 115712 bytes bin/HttpServer_OpenSim.pdb | Bin 409088 -> 409088 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/HttpServer_OpenSim.dll b/bin/HttpServer_OpenSim.dll index a7a1303c63a454d186cd99f206b470a6127d054c..95ea5dd7ffc4891df56a52ba27d558cb81ea2d1a 100644 GIT binary patch delta 434 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 Hd3gLAM%y~8 delta 7702 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 k<&mTmn(o#5ysNL2K` Date: Wed, 16 Feb 2011 08:06:11 +0000 Subject: [PATCH 02/46] Change the QUERYACCESS method to eliminate spurious access denied messages --- .../EntityTransfer/EntityTransferModule.cs | 10 +++++----- .../Simulation/LocalSimulationConnector.cs | 5 +++-- .../Simulation/RemoteSimulationConnector.cs | 7 ++++--- OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++- .../Server/Handlers/Simulation/AgentHandlers.cs | 11 +++++++++-- .../Simulation/SimulationServiceConnector.cs | 17 ++++++++++++++++- .../Services/Interfaces/ISimulationService.cs | 2 +- 7 files changed, 40 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1337143a31..98aa563a4f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -284,9 +284,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } - if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero)) + string reason; + if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason)) { - sp.ControllingClient.SendTeleportFailed("The destination region has refused access"); + sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); return; } @@ -323,8 +324,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); } - string reason = String.Empty; - // Let's create an agent there if one doesn't exist yet. bool logout = false; if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) @@ -778,7 +777,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); - if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos)) + string reason; + if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason)) { agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); if (r == null) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 56720b7b7a..a298b65820 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -257,15 +257,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; } - public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) + public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) { + reason = "Communications failure"; if (destination == null) return false; foreach (Scene s in m_sceneList) { if (s.RegionInfo.RegionID == destination.RegionID) - return s.QueryAccess(id, position); + return s.QueryAccess(id, position, out reason); } //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); return false; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index c4919b319c..0c92bd1c57 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -239,18 +239,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation } - public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) + public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) { + reason = "Communications failure"; if (destination == null) return false; // Try local first - if (m_localBackend.QueryAccess(destination, id, position)) + if (m_localBackend.QueryAccess(destination, id, position, out reason)) return true; // else do the remote thing if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) - return m_remoteConnector.QueryAccess(destination, id, position); + return m_remoteConnector.QueryAccess(destination, id, position, out reason); return false; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 355671cde3..2fd6b52cea 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4923,8 +4923,9 @@ namespace OpenSim.Region.Framework.Scenes // from logging into the region, teleporting into the region // or corssing the broder walking, but will NOT prevent // child agent creation, thereby emulating the SL behavior. - public bool QueryAccess(UUID agentID, Vector3 position) + public bool QueryAccess(UUID agentID, Vector3 position, out string reason) { + reason = String.Empty; return true; } } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6a23deefb2..372a59c038 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -341,10 +341,17 @@ namespace OpenSim.Server.Handlers.Simulation GridRegion destination = new GridRegion(); destination.RegionID = regionID; - bool result = m_SimulationService.QueryAccess(destination, id, position); + string reason; + bool result = m_SimulationService.QueryAccess(destination, id, position, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = result.ToString(); + + OSDMap resp = new OSDMap(2); + + resp["success"] = OSD.FromBoolean(result); + resp["reason"] = OSD.FromString(reason); + + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); } protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index cc6bffb7bb..f6ee493bfc 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -256,8 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation /// /// - public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) + public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) { + reason = "Failed to contact destination"; + // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); IPEndPoint ext = destination.ExternalEndPoint; @@ -283,8 +285,21 @@ namespace OpenSim.Services.Connectors.Simulation m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); return true; } + + reason = result["Message"]; } + else + { + reason = "Communications failure"; + } + + return false; } + + OSDMap resp = (OSDMap)result["_Result"]; + success = resp["success"].AsBoolean(); + reason = resp["reason"].AsString(); + return success; } catch (Exception e) diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 48a2185b62..b7967578ce 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs @@ -60,7 +60,7 @@ namespace OpenSim.Services.Interfaces bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); - bool QueryAccess(GridRegion destination, UUID id, Vector3 position); + bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason); /// /// Message from receiving region to departing region, telling it got contacted by the client. From fc84225038a44e114fe58e4b789b746c9b7a8338 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 16 Feb 2011 08:18:49 -0800 Subject: [PATCH 03/46] XFF capitalization strikes again -- this time in the XMLRPC method. mantis #5386 --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 4c35132ad1..1d05b0284b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -785,7 +785,19 @@ namespace OpenSim.Framework.Servers.HttpServer if (methodWasFound) { xmlRprcRequest.Params.Add(request.Url); // Param[2] - xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] + + string xff = "X-Forwarded-For"; + string xfflower = xff.ToLower(); + foreach (string s in request.Headers.AllKeys) + { + if (s != null && s.Equals(xfflower)) + { + xff = xfflower; + break; + } + } + xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] + try { From 5c15c5e0ffa2da1bbc57e590d05ca19d46470f89 Mon Sep 17 00:00:00 2001 From: Marck Date: Wed, 16 Feb 2011 17:42:01 +0100 Subject: [PATCH 04/46] Changed default directory for storing map tile images from remote regions. --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- bin/Robust.HG.ini.example | 2 +- bin/config-include/GridCommon.ini.example | 2 +- bin/config-include/StandaloneCommon.ini.example | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 9d98c8f59c..12ea453bbc 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService m_Check4096 = gridConfig.GetBoolean("Check4096", true); - m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty); + m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 9adf1ac5ff..f12a1434ef 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -72,7 +72,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 AssetService = "OpenSim.Services.AssetService.dll:AssetService" ;; Directory for map tile images of linked regions - ; MapTileDirectory = "./" + ; MapTileDirectory = "./maptiles" ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index e1bcf00f51..4dc0e53342 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -43,7 +43,7 @@ ;AllowHypergridMapSearch = true ;; Directory for map tile images of linked regions - ; MapTileDirectory = "./" + ; MapTileDirectory = "./maptiles" [AvatarService] ; diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 213219c12b..816e9a6f10 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -70,7 +70,7 @@ ; Check4096 = true ;; Directory for map tile images of remote regions - ; MapTileDirectory = "./" + ; MapTileDirectory = "./maptiles" ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" From 25265c964f22a34fa3757ae487c15744f1da5850 Mon Sep 17 00:00:00 2001 From: Marck Date: Wed, 16 Feb 2011 18:34:44 +0100 Subject: [PATCH 05/46] Changed console command "alert" and added new command "alert-user". This addresses Mantis #4709. Command "alert" always sends a message to everybody; the variant "alert general" has been removed. Sending messages to one user is done with the dedicated command "alert-user". --- .../CoreModules/Avatar/Dialog/DialogModule.cs | 60 ++++++------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 2b3d2a9b14..8a977c9b44 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -49,16 +49,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { m_scene = scene; m_scene.RegisterModuleInterface(this); - + m_scene.AddCommand( - this, "alert", "alert ", - "Send an alert to a user", + this, "alert", "alert ", + "Send an alert to everyone", HandleAlertConsoleCommand); m_scene.AddCommand( - this, "alert general", "alert [general] ", - "Send an alert to everyone", - "If keyword 'general' is omitted, then must be surrounded by quotation marks.", + this, "alert-user", "alert-user ", + "Send an alert to a user", HandleAlertConsoleCommand); } @@ -177,55 +176,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) return; - - bool isGeneral = false; - string firstName = string.Empty; - string lastName = string.Empty; + string message = string.Empty; - if (cmdparams.Length > 1) + if (cmdparams[0].ToLower().Equals("alert")) { - firstName = cmdparams[1]; - isGeneral = firstName.ToLower().Equals("general"); - } - if (cmdparams.Length == 2 && !isGeneral) - { - // alert "message" - message = cmdparams[1]; - isGeneral = true; - } - else if (cmdparams.Length > 2 && isGeneral) - { - // alert general - message = CombineParams(cmdparams, 2); + message = CombineParams(cmdparams, 1); + m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", + m_scene.RegionInfo.RegionName, message); + SendGeneralAlert(message); } else if (cmdparams.Length > 3) { - // alert - lastName = cmdparams[2]; + string firstName = cmdparams[1]; + string lastName = cmdparams[2]; message = CombineParams(cmdparams, 3); + m_log.InfoFormat( + "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", + m_scene.RegionInfo.RegionName, firstName, lastName, message); + SendAlertToUser(firstName, lastName, message, false); } else { OpenSim.Framework.Console.MainConsole.Instance.Output( - "Usage: alert \"message\" | alert general | alert "); + "Usage: alert | alert-user "); return; } - - if (isGeneral) - { - m_log.InfoFormat( - "[DIALOG]: Sending general alert in region {0} with message {1}", - m_scene.RegionInfo.RegionName, message); - SendGeneralAlert(message); - } - else - { - m_log.InfoFormat( - "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", - m_scene.RegionInfo.RegionName, firstName, lastName, message); - SendAlertToUser(firstName, lastName, message, false); - } } private string CombineParams(string[] commandParams, int pos) From c6f2d66eae890bae56cdb9acf6b2691fe539b5f0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 16 Feb 2011 09:57:12 -0800 Subject: [PATCH 06/46] Fix bug introduced by Query Access. The response does not come in a packaged _Result field, it comes as simple OSDMap with 2 fields in it. Also in this commit: comment out irrelevant debug message on AuthService. --- .../PasswordAuthenticationService.cs | 2 +- .../Simulation/SimulationServiceConnector.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 17619ff14f..2fc92487d6 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -71,7 +71,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) { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index f6ee493bfc..8aa88cbeec 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -274,7 +274,11 @@ namespace OpenSim.Services.Connectors.Simulation try { OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); - bool success = result["Success"].AsBoolean(); + bool success = result["success"].AsBoolean(); + reason = result["reason"].AsString(); + + //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}", uri, success); + if (!success) { if (result.ContainsKey("Message")) @@ -296,10 +300,6 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - OSDMap resp = (OSDMap)result["_Result"]; - success = resp["success"].AsBoolean(); - reason = resp["reason"].AsString(); - return success; } catch (Exception e) From 47a5d8d7420f86088d75e4b578e7e997ba2d11c8 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 21 Jan 2011 19:55:35 +0100 Subject: [PATCH 07/46] Make osTeleportOwner work in foreign regions by relaxing the restrictions on teleporting an agent. --- .../Shared/Api/Implementation/OSSL_Api.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 688dfe4649..402d3a5ecf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -681,10 +681,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - TeleportAgent(agent, regionName, position, lookat); + TeleportAgent(agent, regionName, position, lookat, false); } - private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + private void TeleportAgent(string agent, string regionName, + LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { m_host.AddScriptLPS(1); UUID agentId = new UUID(); @@ -694,7 +695,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // agent must be over owners land to avoid abuse - if (m_host.OwnerID + if (relaxRestrictions || + m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { @@ -728,10 +730,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - TeleportAgent(agent, regionX, regionY, position, lookat); + TeleportAgent(agent, regionX, regionY, position, lookat, false); } - private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + private void TeleportAgent(string agent, int regionX, int regionY, + LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); @@ -742,8 +745,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentId); if (presence != null) { - // agent must be over owners land to avoid abuse - if (m_host.OwnerID + // For osTeleportAgent, agent must be over owners land to avoid abuse + // For osTeleportOwner, this restriction isn't necessary + if (relaxRestrictions || + m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { @@ -766,7 +771,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Threat level None because this is what can already be done with the World Map in the viewer CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); - TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); + TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); } public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) @@ -778,7 +783,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); - TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); + TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); } // Functions that get information from the agent itself. From 4f9c3c73ad8cc2178e44c724c72a4bb292e5ea93 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 21 Jan 2011 20:00:04 +0100 Subject: [PATCH 08/46] Add support for new naming syntax of linked regions to osTeleportAgent and osTeleportOwner. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++--- .../Shared/Api/Implementation/OSSL_Api.cs | 17 ++--------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2fd6b52cea..02a0268e36 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3770,15 +3770,15 @@ namespace OpenSim.Region.Framework.Scenes public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, Vector3 lookat, uint teleportFlags) { - GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); - if (regionInfo == null) + List regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1); + if (regions == null || regions.Count == 0) { // can't find the region: Tell viewer and abort remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); return; } - RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); + RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags); } /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 402d3a5ecf..64931d06c5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -694,26 +694,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentId); if (presence != null) { - // agent must be over owners land to avoid abuse + // For osTeleportAgent, agent must be over owners land to avoid abuse + // For osTeleportOwner, this restriction isn't necessary if (relaxRestrictions || m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { - // Check for hostname, attempt to make a HG link, - // and convert the regionName to the target region - if (regionName.Contains(".") && regionName.Contains(":")) - { - // Even though we use none of the results, we need to perform this call because it appears - // to have some the side effect of setting up hypergrid teleport locations. - World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); -// List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); - - string[] parts = regionName.Split(new char[] { ':' }); - if (parts.Length > 2) - regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; - regionName = "http://" + regionName; - } World.RequestTeleportLocation(presence.ControllingClient, regionName, new Vector3((float)position.x, (float)position.y, (float)position.z), new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); From 47252214354cb768ecddb50062d650d22f7d1c4f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 20:54:00 +0000 Subject: [PATCH 09/46] Stop the avatar sometimes pausing for more than a second on the border when region crossing. This restores a RemoveFromPhysicalScene() call in ScenePresence.CheckForBorderCrossing() when the agent has been placed in transit. If we don't remove the agent from the physical scene, then the method continues to be called via ScenePresence.Update() until the handover of the client between regions is completed. Since this handover can take more than 1000ms (due to the 1000ms event queue polling response from the server), this results in the avatar pausing on the border for the entire handover period. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd70de8440..4150f4a245 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2776,6 +2776,13 @@ namespace OpenSim.Region.Framework.Scenes } else { + // We must remove the agent from the physical scene if it has been placed in transit. If we don't, + // then this method continues to be called from ScenePresence.Update() until the handover of the client between + // regions is completed. Since this handover can take more than 1000ms (due to the 1000ms + // event queue polling response from the server), this results in the avatar pausing on the border + // for the handover period. + RemoveFromPhysicalScene(); + // This constant has been inferred from experimentation // I'm not sure what this value should be, so I tried a few values. timeStep = 0.04f; From e774679f62dc0de54c1926b1b4a611ca317d2bd7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 21:19:16 +0000 Subject: [PATCH 10/46] minor: add method doc to a few ScenePresence methods --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4150f4a245..b47ec3c6ce 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2652,8 +2652,11 @@ namespace OpenSim.Region.Framework.Scenes #region Border Crossing Methods /// - /// Checks to see if the avatar is in range of a border and calls CrossToNewRegion + /// Starts the process of moving an avatar into another region if they are crossing the border. /// + /// + /// Also removes the avatar from the physical scene if transit has started. + /// protected void CheckForBorderCrossing() { if (IsChildAgent) @@ -2721,7 +2724,6 @@ namespace OpenSim.Region.Framework.Scenes neighbor = HaveNeighbor(Cardinals.N, ref fix); } - // Makes sure avatar does not end up outside region if (neighbor <= 0) { @@ -2794,6 +2796,15 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Checks whether this region has a neighbour in the given direction. + /// + /// + /// + /// + /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8. + /// Returns a positive integer if there is a region in that direction, a negative integer if not. + /// protected int HaveNeighbor(Cardinals car, ref int[] fix) { uint neighbourx = m_regionInfo.RegionLocX; From 88da253c947c78e97f78119203e3c2f216a788e2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 21:54:44 +0000 Subject: [PATCH 11/46] Add very basic test which invokes the scene update loop once and checks the frame number. This makes Scene.Update() match its original description of performing a single update, which also matches the semantics of SOG and ScenePresence. --- OpenSim/Region/Framework/Scenes/Scene.cs | 323 +++++++++--------- .../Scenes/Tests/ScenePresenceTests.cs | 3 - .../Framework/Scenes/Tests/SceneTests.cs | 71 ++++ 3 files changed, 232 insertions(+), 165 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 02a0268e36..e0af2d6709 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -129,7 +129,16 @@ namespace OpenSim.Region.Framework.Scenes protected ICapabilitiesModule m_capsModule; // Central Update Loop protected int m_fps = 10; - protected uint m_frame; + + /// + /// Current scene frame number + /// + public uint Frame + { + get; + protected set; + } + protected float m_timespan = 0.089f; protected DateTime m_lastupdate = DateTime.UtcNow; @@ -1183,7 +1192,8 @@ namespace OpenSim.Region.Framework.Scenes try { - Update(); + while (!shuttingdown) + Update(); m_lastUpdate = Util.EnvironmentTickCount(); m_firstHeartbeat = false; @@ -1200,187 +1210,176 @@ namespace OpenSim.Region.Framework.Scenes Watchdog.RemoveThread(); } - /// - /// Performs per-frame updates on the scene, this should be the central scene loop - /// public override void Update() - { - float physicsFPS; - int maintc; + { + TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; + float physicsFPS = 0f; - while (!shuttingdown) + int maintc = Util.EnvironmentTickCount(); + int tmpFrameMS = maintc; + tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; + + // Increment the frame counter + ++Frame; + + try { - TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; - physicsFPS = 0f; + // Check if any objects have reached their targets + CheckAtTargets(); - maintc = Util.EnvironmentTickCount(); - int tmpFrameMS = maintc; - tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; + // Update SceneObjectGroups that have scheduled themselves for updates + // Objects queue their updates onto all scene presences + if (Frame % m_update_objects == 0) + m_sceneGraph.UpdateObjectGroups(); - // Increment the frame counter - ++m_frame; + // Run through all ScenePresences looking for updates + // Presence updates and queued object updates for each presence are sent to clients + if (Frame % m_update_presences == 0) + m_sceneGraph.UpdatePresences(); - try + // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) + if (Frame % m_update_coarse_locations == 0) { - // Check if any objects have reached their targets - CheckAtTargets(); - - // Update SceneObjectGroups that have scheduled themselves for updates - // Objects queue their updates onto all scene presences - if (m_frame % m_update_objects == 0) - m_sceneGraph.UpdateObjectGroups(); - - // Run through all ScenePresences looking for updates - // Presence updates and queued object updates for each presence are sent to clients - if (m_frame % m_update_presences == 0) - m_sceneGraph.UpdatePresences(); - - // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) - if (m_frame % m_update_coarse_locations == 0) + List coarseLocations; + List avatarUUIDs; + SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); + // Send coarse locations to clients + ForEachScenePresence(delegate(ScenePresence presence) { - List coarseLocations; - List avatarUUIDs; - SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); - // Send coarse locations to clients - ForEachScenePresence(delegate(ScenePresence presence) - { - presence.SendCoarseLocations(coarseLocations, avatarUUIDs); - }); + presence.SendCoarseLocations(coarseLocations, avatarUUIDs); + }); + } + + int tmpPhysicsMS2 = Util.EnvironmentTickCount(); + if ((Frame % m_update_physics == 0) && m_physics_enabled) + m_sceneGraph.UpdatePreparePhysics(); + physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); + + // Apply any pending avatar force input to the avatar's velocity + if (Frame % m_update_entitymovement == 0) + m_sceneGraph.UpdateScenePresenceMovement(); + + // Perform the main physics update. This will do the actual work of moving objects and avatars according to their + // velocity + int tmpPhysicsMS = Util.EnvironmentTickCount(); + if (Frame % m_update_physics == 0) + { + if (m_physics_enabled) + physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); + if (SynchronizeScene != null) + SynchronizeScene(this); + } + physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); + + // Delete temp-on-rez stuff + if (Frame % 1000 == 0 && !m_cleaningTemps) + { + int tmpTempOnRezMS = Util.EnvironmentTickCount(); + m_cleaningTemps = true; + Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); + tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); + } + + if (RegionStatus != RegionStatus.SlaveScene) + { + if (Frame % m_update_events == 0) + { + int evMS = Util.EnvironmentTickCount(); + UpdateEvents(); + eventMS = Util.EnvironmentTickCountSubtract(evMS); ; } - int tmpPhysicsMS2 = Util.EnvironmentTickCount(); - if ((m_frame % m_update_physics == 0) && m_physics_enabled) - m_sceneGraph.UpdatePreparePhysics(); - physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); - - // Apply any pending avatar force input to the avatar's velocity - if (m_frame % m_update_entitymovement == 0) - m_sceneGraph.UpdateScenePresenceMovement(); - - // Perform the main physics update. This will do the actual work of moving objects and avatars according to their - // velocity - int tmpPhysicsMS = Util.EnvironmentTickCount(); - if (m_frame % m_update_physics == 0) + if (Frame % m_update_backup == 0) { - if (m_physics_enabled) - physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); - if (SynchronizeScene != null) - SynchronizeScene(this); - } - physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); - - // Delete temp-on-rez stuff - if (m_frame % 1000 == 0 && !m_cleaningTemps) - { - int tmpTempOnRezMS = Util.EnvironmentTickCount(); - m_cleaningTemps = true; - Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); - tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); + int backMS = Util.EnvironmentTickCount(); + UpdateStorageBackup(); + backupMS = Util.EnvironmentTickCountSubtract(backMS); } - if (RegionStatus != RegionStatus.SlaveScene) + if (Frame % m_update_terrain == 0) { - if (m_frame % m_update_events == 0) - { - int evMS = Util.EnvironmentTickCount(); - UpdateEvents(); - eventMS = Util.EnvironmentTickCountSubtract(evMS); ; - } - - if (m_frame % m_update_backup == 0) - { - int backMS = Util.EnvironmentTickCount(); - UpdateStorageBackup(); - backupMS = Util.EnvironmentTickCountSubtract(backMS); - } - - if (m_frame % m_update_terrain == 0) - { - int terMS = Util.EnvironmentTickCount(); - UpdateTerrain(); - terrainMS = Util.EnvironmentTickCountSubtract(terMS); - } - - //if (m_frame % m_update_land == 0) - //{ - // int ldMS = Util.EnvironmentTickCount(); - // UpdateLand(); - // landMS = Util.EnvironmentTickCountSubtract(ldMS); - //} - - frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); - otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; - lastCompletedFrame = Util.EnvironmentTickCount(); - - // if (m_frame%m_update_avatars == 0) - // UpdateInWorldTime(); - StatsReporter.AddPhysicsFPS(physicsFPS); - StatsReporter.AddTimeDilation(TimeDilation); - StatsReporter.AddFPS(1); - StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); - StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); - StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); - StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); - StatsReporter.addFrameMS(frameMS); - StatsReporter.addPhysicsMS(physicsMS + physicsMS2); - StatsReporter.addOtherMS(otherMS); - StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); - StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); + int terMS = Util.EnvironmentTickCount(); + UpdateTerrain(); + terrainMS = Util.EnvironmentTickCountSubtract(terMS); } - if (LoginsDisabled && m_frame == 20) - { - // In 99.9% of cases it is a bad idea to manually force garbage collection. However, - // this is a rare case where we know we have just went through a long cycle of heap - // allocations, and there is no more work to be done until someone logs in - GC.Collect(); + //if (Frame % m_update_land == 0) + //{ + // int ldMS = Util.EnvironmentTickCount(); + // UpdateLand(); + // landMS = Util.EnvironmentTickCountSubtract(ldMS); + //} - IConfig startupConfig = m_config.Configs["Startup"]; - if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) - { - m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); - LoginsDisabled = false; - m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); - } + frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); + otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; + lastCompletedFrame = Util.EnvironmentTickCount(); + + // if (Frame%m_update_avatars == 0) + // UpdateInWorldTime(); + StatsReporter.AddPhysicsFPS(physicsFPS); + StatsReporter.AddTimeDilation(TimeDilation); + StatsReporter.AddFPS(1); + StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); + StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); + StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); + StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); + StatsReporter.addFrameMS(frameMS); + StatsReporter.addPhysicsMS(physicsMS + physicsMS2); + StatsReporter.addOtherMS(otherMS); + StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); + StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); + } + + if (LoginsDisabled && Frame == 20) + { + // In 99.9% of cases it is a bad idea to manually force garbage collection. However, + // this is a rare case where we know we have just went through a long cycle of heap + // allocations, and there is no more work to be done until someone logs in + GC.Collect(); + + IConfig startupConfig = m_config.Configs["Startup"]; + if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) + { + m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); + LoginsDisabled = false; + m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); } } - catch (NotImplementedException) - { - throw; - } - catch (AccessViolationException e) - { - m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - } - //catch (NullReferenceException e) - //{ - // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - //} - catch (InvalidOperationException e) - { - m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - } - catch (Exception e) - { - m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - } - finally - { - m_lastupdate = DateTime.UtcNow; - } - - maintc = Util.EnvironmentTickCountSubtract(maintc); - maintc = (int)(m_timespan * 1000) - maintc; - - if (maintc > 0) - Thread.Sleep(maintc); - - // Tell the watchdog that this thread is still alive - Watchdog.UpdateThread(); } - } + catch (NotImplementedException) + { + throw; + } + catch (AccessViolationException e) + { + m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + } + //catch (NullReferenceException e) + //{ + // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + //} + catch (InvalidOperationException e) + { + m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + } + catch (Exception e) + { + m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + } + finally + { + m_lastupdate = DateTime.UtcNow; + } - + maintc = Util.EnvironmentTickCountSubtract(maintc); + maintc = (int)(m_timespan * 1000) - maintc; + + if (maintc > 0) + Thread.Sleep(maintc); + + // Tell the watchdog that this thread is still alive + Watchdog.UpdateThread(); + } public void AddGroupTarget(SceneObjectGroup grp) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index ef52363611..8286e4f919 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -116,9 +116,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests agent.ChildrenCapSeeds = new Dictionary(); agent.child = true; - if (scene.PresenceService == null) - Console.WriteLine("Presence Service is null"); - scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); string reason; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs new file mode 100644 index 0000000000..9aba8a8bfc --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Timers; +using Timer=System.Timers.Timer; +using Nini.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.World.Serialiser; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Scene presence tests + /// + [TestFixture] + public class SceneTests + { + /// + /// Very basic scene update test. Should become more elaborate with time. + /// + [Test] + public void TestUpdateScene() + { + TestHelper.InMethod(); + + Scene scene = SceneSetupHelpers.SetupScene(); + scene.Update(); + + Assert.That(scene.Frame, Is.EqualTo(1)); + } + } +} \ No newline at end of file From 60d47836ce4bc25d6eed637f506a459dccde6b82 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 22:00:52 +0000 Subject: [PATCH 12/46] minor: remove mono compiler warning --- .../Connectors/Simulation/SimulationServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 8aa88cbeec..463b2fbc7f 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -185,7 +185,7 @@ namespace OpenSim.Services.Connectors.Simulation } // unreachable - return true; +// return true; } /// From c763edf56dab869982b5ba002d798f147112a361 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 22:20:08 +0000 Subject: [PATCH 13/46] separate attachment tests out into their own class --- .../Framework/Scenes/Tests/AttachmentTests.cs | 180 ++++++++++++++++++ .../Scenes/Tests/ScenePresenceTests.cs | 50 ----- 2 files changed, 180 insertions(+), 50 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs new file mode 100644 index 0000000000..60e47f6881 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -0,0 +1,180 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Timers; +using Timer=System.Timers.Timer; +using Nini.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.World.Serialiser; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Scene presence tests + /// + [TestFixture] + public class AttachmentTests + { + public Scene scene, scene2; + public UUID agent1; + public static Random random; + public ulong region1, region2; + public AgentCircuitData acd1; + public SceneObjectGroup sog1, sog2, sog3; + + [TestFixtureSetUp] + public void Init() + { + TestHelper.InMethod(); + + scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + + ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); + interregionComms.Initialise(new IniConfigSource()); + interregionComms.PostInitialise(); + SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); + + agent1 = UUID.Random(); + random = new Random(); + sog1 = NewSOG(UUID.Random(), scene, agent1); + sog2 = NewSOG(UUID.Random(), scene, agent1); + sog3 = NewSOG(UUID.Random(), scene, agent1); + + //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); + region1 = scene.RegionInfo.RegionHandle; + region2 = scene2.RegionInfo.RegionHandle; + + SceneSetupHelpers.AddRootAgent(scene, agent1); + } + + [TearDown] + public void TearDown() + { + if (MainServer.Instance != null) MainServer.Instance.Stop(); + } + + [Test] + public void T030_TestAddAttachments() + { + TestHelper.InMethod(); + + ScenePresence presence = scene.GetScenePresence(agent1); + + presence.AddAttachment(sog1); + presence.AddAttachment(sog2); + presence.AddAttachment(sog3); + + Assert.That(presence.HasAttachments(), Is.True); + Assert.That(presence.ValidateAttachments(), Is.True); + } + + [Test] + public void T031_RemoveAttachments() + { + TestHelper.InMethod(); + + ScenePresence presence = scene.GetScenePresence(agent1); + presence.RemoveAttachment(sog1); + presence.RemoveAttachment(sog2); + presence.RemoveAttachment(sog3); + Assert.That(presence.HasAttachments(), Is.False); + } + + // I'm commenting this test because scene setup NEEDS InventoryService to + // be non-null + //[Test] + public void T032_CrossAttachments() + { + TestHelper.InMethod(); + + ScenePresence presence = scene.GetScenePresence(agent1); + ScenePresence presence2 = scene2.GetScenePresence(agent1); + presence2.AddAttachment(sog1); + presence2.AddAttachment(sog2); + + ISharedRegionModule serialiser = new SerialiserModule(); + SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); + SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); + + Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); + + //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); + Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); + Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); + } + + private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) + { + SceneObjectPart sop = new SceneObjectPart(); + sop.Name = RandomName(); + sop.Description = RandomName(); + sop.Text = RandomName(); + sop.SitName = RandomName(); + sop.TouchName = RandomName(); + sop.UUID = uuid; + sop.Shape = PrimitiveBaseShape.Default; + sop.Shape.State = 1; + sop.OwnerID = agent; + + SceneObjectGroup sog = new SceneObjectGroup(sop); + sog.SetScene(scene); + + return sog; + } + + private static string RandomName() + { + StringBuilder name = new StringBuilder(); + int size = random.Next(5,12); + char ch; + for (int i = 0; i < size; i++) + { + ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; + name.Append(ch); + } + + return name.ToString(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 8286e4f919..d82760ee94 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -331,56 +331,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); } - [Test] - public void T030_TestAddAttachments() - { - TestHelper.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - - presence.AddAttachment(sog1); - presence.AddAttachment(sog2); - presence.AddAttachment(sog3); - - Assert.That(presence.HasAttachments(), Is.True); - Assert.That(presence.ValidateAttachments(), Is.True); - } - - [Test] - public void T031_RemoveAttachments() - { - TestHelper.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - presence.RemoveAttachment(sog1); - presence.RemoveAttachment(sog2); - presence.RemoveAttachment(sog3); - Assert.That(presence.HasAttachments(), Is.False); - } - - // I'm commenting this test because scene setup NEEDS InventoryService to - // be non-null - //[Test] - public void T032_CrossAttachments() - { - TestHelper.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - ScenePresence presence2 = scene2.GetScenePresence(agent1); - presence2.AddAttachment(sog1); - presence2.AddAttachment(sog2); - - ISharedRegionModule serialiser = new SerialiserModule(); - SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); - SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); - - Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); - - //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); - Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); - Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); - } - [TearDown] public void TearDown() { From c155f57dbe6b36697d2e1e50d4de43f7af2b97d1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 22:22:51 +0000 Subject: [PATCH 14/46] remove unused test teardown method --- .../Region/Framework/Scenes/Tests/AttachmentTests.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index 60e47f6881..af4464081b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -49,7 +49,7 @@ using OpenSim.Tests.Common.Setup; namespace OpenSim.Region.Framework.Scenes.Tests { /// - /// Scene presence tests + /// Attachment tests /// [TestFixture] public class AttachmentTests @@ -86,13 +86,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests region2 = scene2.RegionInfo.RegionHandle; SceneSetupHelpers.AddRootAgent(scene, agent1); - } - - [TearDown] - public void TearDown() - { - if (MainServer.Instance != null) MainServer.Instance.Stop(); - } + } [Test] public void T030_TestAddAttachments() From 023f953f39709e90c8eb31bc332dc2c01346cbd9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 22:25:45 +0000 Subject: [PATCH 15/46] remove another unused test teardown method --- OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index d82760ee94..ddff89669a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -331,12 +331,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); } - [TearDown] - public void TearDown() - { - if (MainServer.Instance != null) MainServer.Instance.Stop(); - } - public static string GetRandomCapsObjectPath() { UUID caps = UUID.Random(); From eb699df5f6c7a68a500e38dc994ed7c2f2aa89d9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 22:49:19 +0000 Subject: [PATCH 16/46] On SceneSetupHelpers, go back to calling ScenePresence.CompleteMovement() for the last stage of AddRootAgent() instead of SP.MakeRootAgent() Going this extra step doesn't appear to cause any test failures. This is arguably better for test purposes, though at some stage another method may arise which does just call AddRootAgent(). --- .../Scenes/Tests/ScenePresenceTests.cs | 60 +++++++++++++------ .../Tests/Common/Setup/SceneSetupHelpers.cs | 8 +-- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index ddff89669a..92c73be722 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -172,25 +172,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(neighbours.Count, Is.EqualTo(2)); } - - public void fixNullPresence() - { - string firstName = "testfirstname"; - - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = agent1; - agent.firstname = firstName; - agent.lastname = "testlastname"; - agent.SessionID = UUID.Zero; - agent.SecureSessionID = UUID.Zero; - agent.circuitcode = 123; - agent.BaseFolder = UUID.Zero; - agent.InventoryFolder = UUID.Zero; - agent.startpos = Vector3.Zero; - agent.CapsPath = GetRandomCapsObjectPath(); - - acd1 = agent; - } [Test] public void T013_TestRemoveNeighbourRegion() @@ -208,6 +189,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests CompleteAvatarMovement */ } + + /// + /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region + /// + /// + /// Please note that unlike the other tests here, this doesn't rely on structures + /// + [Test] + public void TestChildAgentEstablished() + { + UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); + + TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + + SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); + ScenePresence childPresence = myScene2.GetScenePresence(agent1); + + // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents +// Assert.That(childPresence, Is.Not.Null); +// Assert.That(childPresence.IsChildAgent, Is.True); + } // I'm commenting this test, because this is not supposed to happen here //[Test] @@ -330,7 +333,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); } + + public void fixNullPresence() + { + string firstName = "testfirstname"; + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = agent1; + agent.firstname = firstName; + agent.lastname = "testlastname"; + agent.SessionID = UUID.Zero; + agent.SecureSessionID = UUID.Zero; + agent.circuitcode = 123; + agent.BaseFolder = UUID.Zero; + agent.InventoryFolder = UUID.Zero; + agent.startpos = Vector3.Zero; + agent.CapsPath = GetRandomCapsObjectPath(); + + acd1 = agent; + } + public static string GetRandomCapsObjectPath() { UUID caps = UUID.Random(); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 8b1649635c..d199e42440 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -504,12 +504,10 @@ namespace OpenSim.Tests.Common.Setup TestClient client = new TestClient(agentData, scene); scene.AddNewClient(client); - // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, - // inventory, etc.) - //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE - + // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. ScenePresence scp = scene.GetScenePresence(agentData.AgentID); - scp.MakeRootAgent(new Vector3(90, 90, 90), true); + scp.CompleteMovement(client); + //scp.MakeRootAgent(new Vector3(90, 90, 90), true); return client; } From dd9efc183812a66b1654aaeb419945cf57650b08 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 23:05:56 +0000 Subject: [PATCH 17/46] extend TestChildAgentEstablished() test slightly to put in EntityTransferModule. Not yet enabled. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- .../Framework/Scenes/Tests/ScenePresenceTests.cs | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b47ec3c6ce..51b8dcc004 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1161,7 +1161,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_agentTransfer != null) m_agentTransfer.EnableChildAgents(this); else - m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active"); + m_log.DebugFormat( + "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}", + m_scene.RegionInfo.RegionName); IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 92c73be722..60bc86c719 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -40,6 +40,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Tests.Common; @@ -199,10 +200,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestChildAgentEstablished() { + TestHelper.InMethod(); + log4net.Config.XmlConfigurator.Configure(); + UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); + TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + + EntityTransferModule etm = new EntityTransferModule(); + SceneSetupHelpers.SetupSceneModules(myScene1, etm); SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); ScenePresence childPresence = myScene2.GetScenePresence(agent1); From 5c92f62941e21b6e5eec503ab95f149092e20217 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 23:10:46 +0000 Subject: [PATCH 18/46] minor: remove mono compiler warning --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 584c57719a..583214ca0b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -845,7 +845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandleUseCircuitCode(object o) { - DateTime startTime = DateTime.Now; +// DateTime startTime = DateTime.Now; object[] array = (object[])o; UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1]; From 8249d77991352697b4972f7109c014db0ebd5f68 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 23:25:59 +0000 Subject: [PATCH 19/46] If GridService.GetNeighbours() could not find the region then log a warning rather than causing a null reference on the normal log line This also extends the TestChildAgentEstablished() test to actually activate the EntityTransferModule, though the test is not yet viable --- .../Framework/Scenes/Tests/ScenePresenceTests.cs | 7 +++++-- OpenSim/Services/GridService/GridService.cs | 12 +++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 60bc86c719..5e1ff79b6b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -201,15 +201,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestChildAgentEstablished() { TestHelper.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + IConfigSource configSource = new IniConfigSource(); + configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); EntityTransferModule etm = new EntityTransferModule(); - SceneSetupHelpers.SetupSceneModules(myScene1, etm); + + SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); ScenePresence childPresence = myScene2.GetScenePresence(agent1); diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index aeff9b524f..985d77b02d 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -271,6 +271,7 @@ namespace OpenSim.Services.GridService { List rinfos = new List(); RegionData region = m_Database.Get(regionID, scopeID); + if (region != null) { // Not really? Maybe? @@ -278,15 +279,24 @@ namespace OpenSim.Services.GridService region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); foreach (RegionData rdata in rdatas) + { if (rdata.RegionID != regionID) { int flags = Convert.ToInt32(rdata.Data["flags"]); if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours rinfos.Add(RegionData2RegionInfo(rdata)); } + } + m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); } - m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); + else + { + m_log.WarnFormat( + "[GRID SERVICE]: GetNeighbours() called for scope {0}, region {1} but no such region found", + scopeID, regionID); + } + return rinfos; } From 60fe3d48ee83f004861044c51537256c0c389478 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 23:50:54 +0000 Subject: [PATCH 20/46] Put some CapabilitiesModule null checks in Scene Stop tests setting up a capabilities module by default --- OpenSim/Framework/Capabilities/Caps.cs | 1 - OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++++++---- OpenSim/Tests/Common/Mock/TestClient.cs | 7 +++++-- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 8 ++++---- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index c2f9c3ab7b..3be97b5c89 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -181,7 +181,6 @@ namespace OpenSim.Framework.Capabilities RegisterRegionServiceHandlers(capsBase); RegisterInventoryServiceHandlers(capsBase); - } public void RegisterRegionServiceHandlers(string capsBase) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e0af2d6709..ee1e0beee4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3010,7 +3010,9 @@ namespace OpenSim.Region.Framework.Scenes (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); m_sceneGraph.removeUserCount(!childagentYN); - CapsModule.RemoveCapsHandler(agentID); + + if (CapsModule != null) + CapsModule.RemoveCapsHandler(agentID); // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // this method is doing is HORRIBLE!!! @@ -3265,8 +3267,11 @@ namespace OpenSim.Region.Framework.Scenes RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); - CapsModule.NewUserConnection(agent); - CapsModule.AddCapsHandler(agent.AgentID); + if (CapsModule != null) + { + CapsModule.NewUserConnection(agent); + CapsModule.AddCapsHandler(agent.AgentID); + } } else { @@ -3281,7 +3286,9 @@ namespace OpenSim.Region.Framework.Scenes agent.AgentID, RegionInfo.RegionName); sp.AdjustKnownSeeds(); - CapsModule.NewUserConnection(agent); + + if (CapsModule != null) + CapsModule.NewUserConnection(agent); } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index dc0d4deb18..ebe0a72a87 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -560,8 +560,11 @@ namespace OpenSim.Tests.Common.Mock agentData.lastname = m_lastName; ICapabilitiesModule capsModule = m_scene.RequestModuleInterface(); - agentData.CapsPath = capsModule.GetCapsPath(m_agentId); - agentData.ChildrenCapSeeds = new Dictionary(capsModule.GetChildrenSeeds(m_agentId)); + if (capsModule != null) + { + agentData.CapsPath = capsModule.GetCapsPath(m_agentId); + agentData.ChildrenCapSeeds = new Dictionary(capsModule.GetChildrenSeeds(m_agentId)); + } return agentData; } diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index d199e42440..91426166e0 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -164,10 +164,10 @@ namespace OpenSim.Tests.Common.Setup TestScene testScene = new TestScene( regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); - INonSharedRegionModule capsModule = new CapabilitiesModule(); - capsModule.Initialise(new IniConfigSource()); - testScene.AddRegionModule(capsModule.Name, capsModule); - capsModule.AddRegion(testScene); +// INonSharedRegionModule capsModule = new CapabilitiesModule(); +// capsModule.Initialise(new IniConfigSource()); +// testScene.AddRegionModule(capsModule.Name, capsModule); +// capsModule.AddRegion(testScene); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); From 9d668b09ca893c706745cd2b8fb9b7922b6eeee6 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 19 Feb 2011 00:07:16 +0000 Subject: [PATCH 21/46] remove unused code to share services between scenes in SceneSetupHelpers - this is done differently elsewhere --- .../Tests/Common/Setup/SceneSetupHelpers.cs | 68 +++++-------------- 1 file changed, 16 insertions(+), 52 deletions(-) diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 91426166e0..3980c180cd 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -132,24 +132,11 @@ namespace OpenSim.Tests.Common.Setup public static TestScene SetupScene( string name, UUID id, uint x, uint y, String realServices) { - bool newScene = false; - Console.WriteLine("Setting up test scene {0}", name); - // REFACTORING PROBLEM! - //// If cm is the same as our last commsManager used, this means the tester wants to link - //// regions. In this case, don't use the sameshared region modules and dont initialize them again. - //// Also, no need to start another MainServer and MainConsole instance. - //if (cm == null || cm != commsManager) - //{ - // System.Console.WriteLine("Starting a brand new scene"); - // newScene = true; - MainConsole.Instance = new MockConsole("TEST PROMPT"); - // MainServer.Instance = new BaseHttpServer(980); - // commsManager = cm; - //} - // We must set up a console otherwise setup of some modules may fail + MainConsole.Instance = new MockConsole("TEST PROMPT"); + RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; @@ -164,50 +151,27 @@ namespace OpenSim.Tests.Common.Setup TestScene testScene = new TestScene( regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); -// INonSharedRegionModule capsModule = new CapabilitiesModule(); -// capsModule.Initialise(new IniConfigSource()); -// testScene.AddRegionModule(capsModule.Name, capsModule); -// capsModule.AddRegion(testScene); - IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); - // IConfigSource config = new IniConfigSource(); - // If we have a brand new scene, need to initialize shared region modules - if ((m_assetService == null && m_inventoryService == null) || newScene) - { - if (realServices.Contains("asset")) - StartAssetService(testScene, true); - else - StartAssetService(testScene, false); - - // For now, always started a 'real' authentication service - StartAuthenticationService(testScene, true); - - if (realServices.Contains("inventory")) - StartInventoryService(testScene, true); - else - StartInventoryService(testScene, false); - - StartGridService(testScene, true); - StartUserAccountService(testScene); - StartPresenceService(testScene); - } - // If not, make sure the shared module gets references to this new scene + if (realServices.Contains("asset")) + StartAssetService(testScene, true); else - { - m_assetService.AddRegion(testScene); - m_assetService.RegionLoaded(testScene); - m_inventoryService.AddRegion(testScene); - m_inventoryService.RegionLoaded(testScene); - m_userAccountService.AddRegion(testScene); - m_userAccountService.RegionLoaded(testScene); - m_presenceService.AddRegion(testScene); - m_presenceService.RegionLoaded(testScene); + StartAssetService(testScene, false); - } + // For now, always started a 'real' authentication service + StartAuthenticationService(testScene, true); + + if (realServices.Contains("inventory")) + StartInventoryService(testScene, true); + else + StartInventoryService(testScene, false); + + StartGridService(testScene, true); + StartUserAccountService(testScene); + StartPresenceService(testScene); m_inventoryService.PostInitialise(); m_assetService.PostInitialise(); From b3a1d8c7f787dd2ad24b925bfcdd08b676b3d8b3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 19 Feb 2011 00:11:08 +0000 Subject: [PATCH 22/46] Remove unused SceneSetupHelpers.DeleteObjectAsync(). Calling async code in automated tests is never a good idea - things become very fragile very quickly --- .../Tests/Common/Setup/SceneSetupHelpers.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 3980c180cd..5be70bc710 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -505,24 +505,5 @@ namespace OpenSim.Tests.Common.Setup return part; } - - /// - /// Delete a scene object asynchronously - /// - /// - /// - /// - /// - /// - public static void DeleteSceneObjectAsync( - TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client) - { - // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test - AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; - - scene.DeRezObjects(client, new List() { part.LocalId }, UUID.Zero, action, destinationId); - sogd.InventoryDeQueueAndDelete(); - } } } From 9e47018cfb42cc67a1d414e73396861b3a6b99ea Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 19 Feb 2011 00:14:13 +0000 Subject: [PATCH 23/46] Remove test T020_TestMakeRootAgent() which hasn't been active for ages anyway This test was non-viable. Keeping inactive T021_TestCrossToNewRegion() around for now since it's still useful for reference purposes in constructing a future working test. --- .../Scenes/Tests/ScenePresenceTests.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 5e1ff79b6b..fd2d6fab2d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -222,25 +222,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Assert.That(childPresence.IsChildAgent, Is.True); } - // I'm commenting this test, because this is not supposed to happen here - //[Test] - public void T020_TestMakeRootAgent() - { - TestHelper.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - Assert.That(presence.IsChildAgent, Is.False, "Starts out as a root agent"); - - presence.MakeChildAgent(); - Assert.That(presence.IsChildAgent, Is.True, "Did not change to child agent after MakeChildAgent"); - - // Accepts 0 but rejects Constants.RegionSize - Vector3 pos = new Vector3(0,unchecked(Constants.RegionSize-1),0); - presence.MakeRootAgent(pos,true); - Assert.That(presence.IsChildAgent, Is.False, "Did not go back to root agent"); - Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered"); - } - // I'm commenting this test because it does not represent // crossings. The Thread.Sleep's in here are not meaningful mocks, // and they sometimes fail in panda. From af22b7cb1af041ab685128f507265d9c7e7fac9c Mon Sep 17 00:00:00 2001 From: Marck Date: Tue, 22 Feb 2011 13:00:45 +0100 Subject: [PATCH 24/46] GetRegion(s)ByName with SQLite behaves like it does with other databases. The in-memory storage of region data that is used by default with SQLite now handles wildcards in region names in the same way as SQL queries do with other databases. --- OpenSim/Data/Null/NullRegionData.cs | 50 ++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 2065355890..53e5207a6e 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs @@ -51,27 +51,55 @@ namespace OpenSim.Data.Null //Console.WriteLine("[XXX] NullRegionData constructor"); } + private delegate bool Matcher(string value); + public List Get(string regionName, UUID scopeID) { if (Instance != this) return Instance.Get(regionName, scopeID); + string cleanName = regionName.ToLower(); + + // Handle SQL wildcards + const string wildcard = "%"; + bool wildcardPrefix = false; + bool wildcardSuffix = false; + if (cleanName.Equals(wildcard)) + { + wildcardPrefix = wildcardSuffix = true; + cleanName = string.Empty; + } + else + { + if (cleanName.StartsWith(wildcard)) + { + wildcardPrefix = true; + cleanName = cleanName.Substring(1); + } + if (regionName.EndsWith(wildcard)) + { + wildcardSuffix = true; + cleanName = cleanName.Remove(cleanName.Length - 1); + } + } + Matcher queryMatch; + if (wildcardPrefix && wildcardSuffix) + queryMatch = delegate(string s) { return s.Contains(cleanName); }; + else if (wildcardSuffix) + queryMatch = delegate(string s) { return s.StartsWith(cleanName); }; + else if (wildcardPrefix) + queryMatch = delegate(string s) { return s.EndsWith(cleanName); }; + else + queryMatch = delegate(string s) { return s.Equals(cleanName); }; + + // Find region data List ret = new List(); foreach (RegionData r in m_regionData.Values) { - if (regionName.Contains("%")) - { - string cleanname = regionName.Replace("%", ""); - m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower()); - if (r.RegionName.ToLower().Contains(cleanname.ToLower())) + m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); + if (queryMatch(r.RegionName.ToLower())) ret.Add(r); - } - else - { - if (r.RegionName.ToLower() == regionName.ToLower()) - ret.Add(r); - } } if (ret.Count > 0) From 5a16fa882c0f1a6200bc3fdb63b0f4564acf0e6d Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 22 Feb 2011 13:23:54 -0800 Subject: [PATCH 25/46] Parameterizes the view distance used to compute and manage child agents in neighbor regions. This means you can extend the view on a simulator beyond the default 3x3 regions. This uses a region default draw distance and should be replaced at some point by the avatar specified draw distance. That will require more careful, dynamic recomputation of child agents every time the draw distance changes. WARNING: this is experimental and has known instabilities. specifically all regions "within site" should be running the same default draw distance or agents will not be closed correctly. --- OpenSim/Framework/Util.cs | 13 +++++-- .../EntityTransfer/EntityTransferModule.cs | 37 +++++++++++++------ .../EntityTransfer/HGEntityTransferModule.cs | 4 +- OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++ .../Region/Framework/Scenes/ScenePresence.cs | 24 +++++++++--- bin/OpenSimDefaults.ini | 7 ++++ 6 files changed, 73 insertions(+), 21 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 533e53abd5..5a5046e547 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -459,10 +459,17 @@ namespace OpenSim.Framework /// Old region y-coord /// New region y-coord /// - public static bool IsOutsideView(uint oldx, uint newx, uint oldy, uint newy) + public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy) { - // Eventually this will be a function of the draw distance / camera position too. - return (((int)Math.Abs((int)(oldx - newx)) > 1) || ((int)Math.Abs((int)(oldy - newy)) > 1)); + int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize); + + int startX = (int)oldx - dd; + int startY = (int)oldy - dd; + + int endX = (int)oldx + dd; + int endY = (int)oldy + dd; + + return (newx < startX || endX < newx || newy < startY || endY < newy); } public static string FieldToString(byte[] bytes) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 98aa563a4f..95c771e60f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agentCircuit.Id0 = currentAgentCircuit.Id0; } - if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) + if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) { // brand new agent, let's create a new caps seed agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); @@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // OK, it got this agent. Let's close some child agents sp.CloseChildAgents(newRegionX, newRegionY); IClientIPEndpoint ipepClient; - if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) + if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) { //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); #region IP Translation for NAT @@ -447,7 +447,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone - if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) + if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) { Thread.Sleep(5000); sp.Close(); @@ -521,14 +521,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return region; } - protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) + protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) { - return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); + return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); } - protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) + protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) { - return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); + return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); } protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) @@ -1045,7 +1045,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_regionInfo != null) { - neighbours = RequestNeighbours(sp.Scene, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); + neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); } else { @@ -1272,8 +1272,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// /// - protected List RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) + protected List RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) { + Scene pScene = avatar.Scene; RegionInfo m_regionInfo = pScene.RegionInfo; Border[] northBorders = pScene.NorthBorders.ToArray(); @@ -1281,10 +1282,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Border[] eastBorders = pScene.EastBorders.ToArray(); Border[] westBorders = pScene.WestBorders.ToArray(); - // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. + // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't + // clear what should be done with a "far view" given that megaregions already extended the + // view to include everything in the megaregion if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) { - return pScene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); + int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; + + int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); + int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); + + int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); + int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); + + List neighbours = + avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); + + neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); + return neighbours; } else { diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 35dcd95aa0..79e76b4cbf 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -130,9 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return region; } - protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) + protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) { - if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) + if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) return true; int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ee1e0beee4..7def7e9ca3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -83,6 +83,13 @@ namespace OpenSim.Region.Framework.Scenes public bool m_useFlySlow; public bool m_usePreJump; public bool m_seeIntoRegionFromNeighbor; + + protected float m_defaultDrawDistance = 255.0f; + public float DefaultDrawDistance + { + get { return m_defaultDrawDistance; } + } + // TODO: need to figure out how allow client agents but deny // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; @@ -627,6 +634,8 @@ namespace OpenSim.Region.Framework.Scenes // IConfig startupConfig = m_config.Configs["Startup"]; + m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); + //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); // TODO: Change default to true once the feature is supported diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 51b8dcc004..9e9481e815 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -626,7 +626,7 @@ namespace OpenSim.Region.Framework.Scenes Utils.LongToUInts(handle, out x, out y); x = x / Constants.RegionSize; y = y / Constants.RegionSize; - if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) + if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) { old.Add(handle); } @@ -700,6 +700,7 @@ namespace OpenSim.Region.Framework.Scenes private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() { + m_DrawDistance = world.DefaultDrawDistance; m_rootRegionHandle = reginfo.RegionHandle; m_controllingClient = client; m_firstname = m_controllingClient.FirstName; @@ -1279,7 +1280,11 @@ namespace OpenSim.Region.Framework.Scenes m_CameraUpAxis = agentData.CameraUpAxis; // The Agent's Draw distance setting - m_DrawDistance = agentData.Far; + // When we get to the point of re-computing neighbors everytime this + // changes, then start using the agent's drawdistance rather than the + // region's draw distance. + // m_DrawDistance = agentData.Far; + m_DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); @@ -2913,7 +2918,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); - if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) + if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) { byebyeRegions.Add(handle); } @@ -2989,7 +2994,12 @@ namespace OpenSim.Region.Framework.Scenes Vector3 offset = new Vector3(shiftx, shifty, 0f); - m_DrawDistance = cAgentData.Far; + // When we get to the point of re-computing neighbors everytime this + // changes, then start using the agent's drawdistance rather than the + // region's draw distance. + // m_DrawDistance = cAgentData.Far; + m_DrawDistance = Scene.DefaultDrawDistance; + if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! m_pos = cAgentData.Position + offset; @@ -3139,7 +3149,11 @@ namespace OpenSim.Region.Framework.Scenes m_CameraLeftAxis = cAgent.LeftAxis; m_CameraUpAxis = cAgent.UpAxis; - m_DrawDistance = cAgent.Far; + // When we get to the point of re-computing neighbors everytime this + // changes, then start using the agent's drawdistance rather than the + // region's draw distance. + // m_DrawDistance = cAgent.Far; + m_DrawDistance = Scene.DefaultDrawDistance; if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) ControllingClient.SetChildAgentThrottle(cAgent.Throttles); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 475d4a0c53..96ffb7ea6b 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -94,6 +94,13 @@ ; Warning! Don't use this with regions that have existing content!, This will likely break them CombineContiguousRegions = false + ; Extend the region's draw distance; 255m is the default which includes + ; one neighbor on each side of the current region, 767m would go three + ; neighbors on each side for a total of 49 regions in view. Warning, unless + ; all the regions have the same drawdistance, you will end up with strange + ; effects because the agents that get closed may be inconsistent. + ; DefaultDrawDistance = 255.0 + ; If you have only one region in an instance, or to avoid the many bugs ; that you can trigger in modules by restarting a region, set this to ; true to make the entire instance exit instead of restarting the region. From 1bb0bae78aa6654730e1095ba07086679de529de Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 22 Feb 2011 13:30:38 -0800 Subject: [PATCH 26/46] Forces the owner of a rezzed object to be the "rezzer" of the object rather than the owner of the inventory item. In theory, this shouldn't happen unless you are using grid-wide library for inventory. --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 7bb8789f16..bd316c6200 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -524,6 +524,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (item != null) { + item.Owner = remoteClient.AgentId; + AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); if (rezAsset != null) From db7c758b7f4d2d1f7f7fa7708256ef18bd69c294 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 24 Feb 2011 00:55:50 +0000 Subject: [PATCH 27/46] On a Grid Handler exception, explicitly log the exception message and stack trace so that we get somewhat better diagnostics on windows --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 913c6c9b3a..edc05612db 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -115,15 +115,15 @@ namespace OpenSim.Server.Handlers.Grid case "get_region_flags": return GetRegionFlags(request); } + m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); } catch (Exception e) { - m_log.DebugFormat("[GRID HANDLER]: Exception {0}", e); + m_log.ErrorFormat("[GRID HANDLER]: Exception {0} {1}", e.Message, e.StackTrace); } return FailureResult(); - } #region Method-specific handlers From 2f5394e70ddefb5e7ec6a04022eef42a8ac89b0d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 24 Feb 2011 22:33:54 +0000 Subject: [PATCH 28/46] Fix bug where avatars in other regions would not always show up on the mini-map --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 969ff13ac7..734ba22e9c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -204,9 +204,10 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) { ScenePresence sp = presences[i]; + // If this presence is a child agent, we don't want its coarse locations if (sp.IsChildAgent) - return; + continue; if (sp.ParentID != 0) { From 197cc3883fe5c532588f6b721d5f9d1295c24abc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Feb 2011 01:16:47 +0000 Subject: [PATCH 29/46] Fix bug where having no maximum memory cache timeout would cause the flotsam asset cache to try using Double.MaxValue, which would cause the underlying OpenMetaverse.ExpiringCache to choke. There is probably an underlying bug to fix in ExpiringCache. --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 6ed48674b2..edb6710829 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache } else { - m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue); + m_MemoryCache.AddOrUpdate(key, asset, m_DefaultMemoryExpiration); } } } From beff0ac32f0575e7805fd0691ba3907b3d13b70c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Feb 2011 01:18:43 +0000 Subject: [PATCH 30/46] log actual cache directory for FlotsamAssetCache instead of always logging the default --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index edb6710829..90fb9b3175 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -147,7 +147,7 @@ namespace Flotsam.RegionModules.AssetCache } m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); - m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory); + m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_CacheDirectory); m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false); m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration)); From 939c47ac521dee943083d87abe70a7271ee78077 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Feb 2011 01:25:38 +0000 Subject: [PATCH 31/46] instead of using different default memory expiration depending on whether there is a [FLOTSAM ASSET CACHE] section present at all, use the same default all the time this simplifies the code --- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 90fb9b3175..02a4e4d979 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -92,7 +92,7 @@ namespace Flotsam.RegionModules.AssetCache // Expiration is expressed in hours. private const double m_DefaultMemoryExpiration = 1.0; private const double m_DefaultFileExpiration = 48; - private TimeSpan m_MemoryExpiration = TimeSpan.Zero; + private TimeSpan m_MemoryExpiration = TimeSpan.FromHours(m_DefaultMemoryExpiration); private TimeSpan m_FileExpiration = TimeSpan.Zero; private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; @@ -245,16 +245,7 @@ namespace Flotsam.RegionModules.AssetCache private void UpdateMemoryCache(string key, AssetBase asset) { if (m_MemoryCacheEnabled) - { - if (m_MemoryExpiration > TimeSpan.Zero) - { - m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration); - } - else - { - m_MemoryCache.AddOrUpdate(key, asset, m_DefaultMemoryExpiration); - } - } + m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration); } public void Cache(AssetBase asset) From 0f545abfc17392c4a2113b07a945bd4cc7b8366f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Feb 2011 01:31:38 +0000 Subject: [PATCH 32/46] Make the file expiration defaults the same whether the whole [FLOTSAM ASSET CACHE] section is missing or just the particular config values --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 02a4e4d979..9adb68bc0d 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -93,8 +93,8 @@ namespace Flotsam.RegionModules.AssetCache private const double m_DefaultMemoryExpiration = 1.0; private const double m_DefaultFileExpiration = 48; private TimeSpan m_MemoryExpiration = TimeSpan.FromHours(m_DefaultMemoryExpiration); - private TimeSpan m_FileExpiration = TimeSpan.Zero; - private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; + private TimeSpan m_FileExpiration = TimeSpan.FromHours(m_DefaultFileExpiration); + private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.FromHours(m_DefaultFileExpiration); private static int m_CacheDirectoryTiers = 1; private static int m_CacheDirectoryTierLen = 3; @@ -441,7 +441,7 @@ namespace Flotsam.RegionModules.AssetCache private void CleanupExpiredFiles(object source, ElapsedEventArgs e) { if (m_LogLevel >= 2) - m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString()); + m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration); // Purge all files last accessed prior to this point DateTime purgeLine = DateTime.Now - m_FileExpiration; From 2b04cab1ee4b7c89bdfbe93622f421f031879943 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Feb 2011 02:15:06 +0000 Subject: [PATCH 33/46] change some log messages from info to debug --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index f8ce444b50..08ac62418e 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } - m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId); + m_log.DebugFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId); // If we only found default textures, then the appearance is not cached return (defonly ? false : true); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7def7e9ca3..1a6a70bfbe 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3210,7 +3210,7 @@ namespace OpenSim.Region.Framework.Scenes // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport // Don't disable this log message - it's too helpful - m_log.InfoFormat( + m_log.DebugFormat( "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode, teleportFlags); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9e9481e815..00a1487ab6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2442,7 +2442,7 @@ namespace OpenSim.Region.Framework.Scenes // If we are using the the cached appearance then send it out to everyone if (cachedappearance) { - m_log.InfoFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); + m_log.DebugFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); // If the avatars baked textures are all in the cache, then we have a // complete appearance... send it out, if not, then we'll send it when From cea47491de6723230a49b1ac99cecc5c32758f40 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Feb 2011 18:55:17 +0100 Subject: [PATCH 34/46] Fix a few little things --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 3 +++ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index bd316c6200..798547a82d 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -148,6 +148,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = m_Scene.InventoryService.GetItem(item); + if (item.Owner != remoteClient.AgentId) + return UUID.Zero; + if (item != null) { if ((InventoryType)item.InvType == InventoryType.Notecard) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e2d96d9a37..fcbcf593ba 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -321,6 +321,8 @@ namespace OpenSim.Region.Framework.Scenes // Passing something to another avatar or a an object will already InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = InventoryService.GetItem(item); + if (item.Owner != remoteClient.AgentId) + return; if (item != null) { From b82b0b16770af89b0bbe48ba63a0d9fec9839d6d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 1 Mar 2011 09:20:50 -0800 Subject: [PATCH 35/46] Normalizing comparison to lower case, just in case ppl set their config vars inconsistently. (maybe related to mantis #5386) --- OpenSim/Services/HypergridService/UserAgentService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 3ead180a0b..445d45e250 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -253,7 +253,7 @@ namespace OpenSim.Services.HypergridService TravelingAgentInfo travel = m_TravelingAgents[sessionID]; - return travel.GridExternalName == thisGridExternalName; + return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower(); } public bool VerifyClient(UUID sessionID, string reportedIP) From 3c89527b222c2ddc50553ce1c49f22e9f05db11b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 00:06:51 +0000 Subject: [PATCH 36/46] Fix bug where llSetPrimMediaParams() reported success but never set the media texture. We weren't setting the TextureEntryFace.MediaFlags = true when a media texture was set directly via a script. This was being done when the viewer was setting them directly. --- .../CoreModules/World/Media/Moap/MoapModule.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 7c5d044347..9132753460 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -227,15 +227,24 @@ namespace OpenSim.Region.CoreModules.Media.Moap public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) { +// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face); + CheckFaceParam(part, face); if (null == part.Shape.Media) part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); - + lock (part.Shape.Media) - part.Shape.Media[face] = me; + part.Shape.Media[face] = me; UpdateMediaUrl(part, UUID.Zero); + + // Temporary code to fix llSetPrimMediaParams() bug, pending refactoring + Primitive.TextureEntry te = part.Shape.Textures; + Primitive.TextureEntryFace teFace = te.CreateFace((uint)face); + teFace.MediaFlags = true; + part.Shape.Textures = te; + part.ScheduleFullUpdate(); part.TriggerScriptChangedEvent(Changed.MEDIA); } @@ -333,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap } // m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); - +// // for (int i = 0; i < omu.FaceMedia.Length; i++) // { // MediaEntry me = omu.FaceMedia[i]; @@ -380,6 +389,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap } else { +// m_log.DebugFormat("[MOAP]: Setting existing media list for {0}", part.Name); + // We need to go through the media textures one at a time to make sure that we have permission // to change them From 481ca910da47e68546623573ac9bba669d7b44c1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 01:07:05 +0000 Subject: [PATCH 37/46] add test for MoapModule.SetMediaUrl() --- .../World/Media/Moap/Tests/MoapTests.cs | 72 +++++++++++++++++++ prebuild.xml | 1 + 2 files changed, 73 insertions(+) create mode 100644 OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs new file mode 100644 index 0000000000..d4c9245ec4 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -0,0 +1,72 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Threading; +using log4net.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.Media.Moap; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Serialization; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests +{ + [TestFixture] + public class MoapTests + { + [Test] + public void TestSetMediaUrl() + { + TestHelper.InMethod(); + + string homeUrl = "opensimulator.org"; + + MoapModule module = new MoapModule(); + TestScene scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(scene, module); + + SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + MediaEntry me = new MediaEntry() { HomeURL = homeUrl }; + + module.SetMediaEntry(part, 1, me); + + Assert.That(part.Shape.Media[1].HomeURL, Is.EqualTo(homeUrl)); + Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000000/" + UUID.Zero)); + Assert.That(part.Shape.Textures.FaceTextures[1].MediaFlags, Is.True); + } + } +} \ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index cbe539ea17..b31812dc17 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2927,6 +2927,7 @@ + From 72cb498fd0c167867d71c26e55afedc2e23ab9b4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 01:13:59 +0000 Subject: [PATCH 38/46] minor: Make MoapModule namespace consistent with other modules --- OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 2 +- OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 9132753460..b6ec6dc9f2 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -50,7 +50,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; using OSDArray = OpenMetaverse.StructuredData.OSDArray; using OSDMap = OpenMetaverse.StructuredData.OSDMap; -namespace OpenSim.Region.CoreModules.Media.Moap +namespace OpenSim.Region.CoreModules.World.Media.Moap { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] public class MoapModule : INonSharedRegionModule, IMoapModule diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index d4c9245ec4..9e5c7ae5d2 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -36,7 +36,7 @@ using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; using OpenMetaverse.Assets; using OpenSim.Framework; -using OpenSim.Region.CoreModules.Media.Moap; +using OpenSim.Region.CoreModules.World.Media.Moap; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Tests.Common; From 8efb01b3df1ea98d5e4a68aa220bafc4ab5306f4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 01:15:27 +0000 Subject: [PATCH 39/46] minor: remove some mono compiler warnings --- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 2 +- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 12 ++++++------ .../SimianGroupsServicesConnectorModule.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index dfeecb1bbc..6a24cc1092 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] public class LindenUDPInfoModule : ISharedRegionModule { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Dictionary m_scenes = new Dictionary(); diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index e9c545308c..05a1c3b427 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice private static string m_freeSwitchUrlResetPassword; private uint m_freeSwitchServicePort; private string m_openSimWellKnownHTTPAddress; - private string m_freeSwitchContext; +// private string m_freeSwitchContext; private readonly Dictionary m_UUIDName = new Dictionary(); private Dictionary m_ParcelAddress = new Dictionary(); @@ -144,7 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice m_freeSwitchDefaultWellKnownIP = map["DefaultWellKnownIP"].AsString(); m_freeSwitchDefaultTimeout = map["DefaultTimeout"].AsInteger(); m_freeSwitchUrlResetPassword = String.Empty; - m_freeSwitchContext = map["Context"].AsString(); +// m_freeSwitchContext = map["Context"].AsString(); if (String.IsNullOrEmpty(m_freeSwitchRealm) || String.IsNullOrEmpty(m_freeSwitchAPIPrefix)) @@ -662,7 +662,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice resp.Append(""); response["str_response_string"] = resp.ToString(); - Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); +// Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); //m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],"")); return response; @@ -671,9 +671,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request) { m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called"); - string requestbody = (string)request["body"]; - string uri = (string)request["uri"]; - string contenttype = (string)request["content-type"]; +// string requestbody = (string)request["body"]; +// string uri = (string)request["uri"]; +// string contenttype = (string)request["content-type"]; Hashtable requestBody = ParseRequestBody((string)request["body"]); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 81725c55c7..02751eafa7 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -712,7 +712,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); GroupMembershipData data = null; - bool foundData = false; +// bool foundData = false; OSDMap UserGroupMemberInfo; if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) From 3c0d607f454492bbec622e4dc36696ca969dd247 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 4 Mar 2011 17:17:53 -0800 Subject: [PATCH 40/46] Changed order of checks for local regions when processing AgentUpdate messages. Should improve throttles and reprioritization when an avatar is moving. --- .../Simulation/RemoteSimulationConnector.cs | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 0c92bd1c57..67f4d6030c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -192,15 +192,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; // Try local first - if (m_localBackend.UpdateAgent(destination, cAgentData)) - return true; - - // else do the remote thing - if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) - return m_remoteConnector.UpdateAgent(destination, cAgentData); - - return false; + if (m_localBackend.IsLocalRegion(destination.RegionHandle)) + return m_localBackend.UpdateAgent(destination, cAgentData); + return m_remoteConnector.UpdateAgent(destination, cAgentData); } public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) @@ -209,15 +204,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; // Try local first - if (m_localBackend.UpdateAgent(destination, cAgentData)) - return true; - - // else do the remote thing - if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) - return m_remoteConnector.UpdateAgent(destination, cAgentData); - - return false; + if (m_localBackend.IsLocalRegion(destination.RegionHandle)) + return m_localBackend.UpdateAgent(destination, cAgentData); + return m_remoteConnector.UpdateAgent(destination, cAgentData); } public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) From 9f85ee29ac9f5e0aa8c1976944f9af12da3514db Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 02:18:03 +0000 Subject: [PATCH 41/46] Change MoapModule.ClearMediaEntry to set TextureEntryFace.MediaFlags back to false Implement test for ClearMediaEntry() --- OpenSim/Framework/PrimitiveBaseShape.cs | 2 +- .../World/Media/Moap/MoapModule.cs | 30 ++++++++++++- .../World/Media/Moap/Tests/MoapTests.cs | 45 ++++++++++++++++--- 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 927415e850..7b5fb2e8f1 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -250,7 +250,7 @@ namespace OpenSim.Framework { get { - //m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); +// m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } catch { } diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index b6ec6dc9f2..ffb3221bc6 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -225,6 +225,12 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap return me; } + /// + /// Set the media entry on the face of the given part. + /// + /// /param> + /// + /// public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) { // m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face); @@ -249,9 +255,31 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap part.TriggerScriptChangedEvent(Changed.MEDIA); } + /// + /// Clear the media entry from the face of the given part. + /// + /// + /// public void ClearMediaEntry(SceneObjectPart part, int face) { - SetMediaEntry(part, face, null); + CheckFaceParam(part, face); + + // If no media has been set up yetthen we don't need to clear anything + if (null == part.Shape.Media) + return; + + lock (part.Shape.Media) + part.Shape.Media[face] = null; + + UpdateMediaUrl(part, UUID.Zero); + + Primitive.TextureEntry te = part.Shape.Textures; + Primitive.TextureEntryFace teFace = te.CreateFace((uint)face); + teFace.MediaFlags = false; + part.Shape.Textures = te; + + part.ScheduleFullUpdate(); + part.TriggerScriptChangedEvent(Changed.MEDIA); } /// diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index 9e5c7ae5d2..7a68e55c7e 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -48,21 +48,52 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests [TestFixture] public class MoapTests { + protected TestScene m_scene; + protected MoapModule m_module; + + [SetUp] + public void SetUp() + { + m_module = new MoapModule(); + m_scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(m_scene, m_module); + } + + [Test] + public void TestClearMediaUrl() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); + MediaEntry me = new MediaEntry(); + + m_module.SetMediaEntry(part, 1, me); + m_module.ClearMediaEntry(part, 1); + + Assert.That(part.Shape.Media[1], Is.EqualTo(null)); + + // Although we've cleared one face, other faces may still be present. So we need to check for an + // update media url version + Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000001/" + UUID.Zero)); + + // By changing media flag to false, the face texture once again becomes identical to the DefaultTexture. + // Therefore, when libOMV reserializes it, it disappears and we are left with no face texture in this slot. + // Not at all confusing, eh? + Assert.That(part.Shape.Textures.FaceTextures[1], Is.Null); + } + [Test] public void TestSetMediaUrl() { TestHelper.InMethod(); - string homeUrl = "opensimulator.org"; + string homeUrl = "opensimulator.org"; - MoapModule module = new MoapModule(); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, module); - - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); MediaEntry me = new MediaEntry() { HomeURL = homeUrl }; - module.SetMediaEntry(part, 1, me); + m_module.SetMediaEntry(part, 1, me); Assert.That(part.Shape.Media[1].HomeURL, Is.EqualTo(homeUrl)); Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000000/" + UUID.Zero)); From 9e579a7891d6eb4c3e5a0593d67837ed423135ee Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 02:21:53 +0000 Subject: [PATCH 42/46] Fold ClearMediaEntry() back into SetMediaEntry() --- .../World/Media/Moap/MoapModule.cs | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index ffb3221bc6..b8943adbe8 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap /// /// /param> /// - /// + /// If null, then the media entry is cleared. public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) { // m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face); @@ -238,7 +238,12 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap CheckFaceParam(part, face); if (null == part.Shape.Media) - part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); + { + if (me == null) + return; + else + part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); + } lock (part.Shape.Media) part.Shape.Media[face] = me; @@ -248,7 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap // Temporary code to fix llSetPrimMediaParams() bug, pending refactoring Primitive.TextureEntry te = part.Shape.Textures; Primitive.TextureEntryFace teFace = te.CreateFace((uint)face); - teFace.MediaFlags = true; + teFace.MediaFlags = me != null; part.Shape.Textures = te; part.ScheduleFullUpdate(); @@ -262,24 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap /// public void ClearMediaEntry(SceneObjectPart part, int face) { - CheckFaceParam(part, face); - - // If no media has been set up yetthen we don't need to clear anything - if (null == part.Shape.Media) - return; - - lock (part.Shape.Media) - part.Shape.Media[face] = null; - - UpdateMediaUrl(part, UUID.Zero); - - Primitive.TextureEntry te = part.Shape.Textures; - Primitive.TextureEntryFace teFace = te.CreateFace((uint)face); - teFace.MediaFlags = false; - part.Shape.Textures = te; - - part.ScheduleFullUpdate(); - part.TriggerScriptChangedEvent(Changed.MEDIA); + SetMediaEntry(part, face, null); } /// From 2e46027c14fb7a7084e3909cd8b57db5565cce7d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 02:34:44 +0000 Subject: [PATCH 43/46] Construct test load iar only once and reuse for each test, rather than recreating it every time --- .../Archiver/Tests/InventoryArchiverTests.cs | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 76d0b85774..8a84c7a2d9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -53,9 +53,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests public class InventoryArchiverTests { protected ManualResetEvent mre = new ManualResetEvent(false); - + /// - /// Stream of data representing a common IAR that can be reused in load tests. + /// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test. + /// + protected byte[] m_iarStreamBytes; + + /// + /// Stream of data representing a common IAR for load tests. /// protected MemoryStream m_iarStream; @@ -79,12 +84,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests } [SetUp] - public void Init() + public void SetUp() { - ConstructDefaultIarForTestLoad(); + m_iarStream = new MemoryStream(m_iarStreamBytes); } - protected void ConstructDefaultIarForTestLoad() + [TestFixtureSetUp] + public void FixtureSetup() + { + ConstructDefaultIarBytesForTestLoad(); + } + + protected void ConstructDefaultIarBytesForTestLoad() { string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); @@ -107,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary(), scene.UserAccountService)); tar.Close(); - m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); + m_iarStreamBytes = archiveWriteStream.ToArray(); } /// @@ -392,8 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); - archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); - + archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); InventoryItemBase foundItem1 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); From 9b345ebf73663a04d8baa69f0fb48ab80b8b1a58 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 5 Mar 2011 02:42:47 +0000 Subject: [PATCH 44/46] factor out SetPartMediaFlags() function in MoapModule. --- .../World/Media/Moap/MoapModule.cs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index b8943adbe8..898ca4a4c3 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -250,11 +250,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap UpdateMediaUrl(part, UUID.Zero); - // Temporary code to fix llSetPrimMediaParams() bug, pending refactoring - Primitive.TextureEntry te = part.Shape.Textures; - Primitive.TextureEntryFace teFace = te.CreateFace((uint)face); - teFace.MediaFlags = me != null; - part.Shape.Textures = te; + SetPartMediaFlags(part, face, me != null); part.ScheduleFullUpdate(); part.TriggerScriptChangedEvent(Changed.MEDIA); @@ -270,6 +266,23 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap SetMediaEntry(part, face, null); } + /// + /// Set the media flags on the texture face of the given part. + /// + /// + /// The fact that we need a separate function to do what should be a simple one line operation is BUTT UGLY. + /// + /// + /// + /// + protected void SetPartMediaFlags(SceneObjectPart part, int face, bool flag) + { + Primitive.TextureEntry te = part.Shape.Textures; + Primitive.TextureEntryFace teFace = te.CreateFace((uint)face); + teFace.MediaFlags = flag; + part.Shape.Textures = te; + } + /// /// Sets or gets per face media textures. /// @@ -393,10 +406,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap // FIXME: Race condition here since some other texture entry manipulator may overwrite/get // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry // directly. - Primitive.TextureEntry te = part.Shape.Textures; - Primitive.TextureEntryFace face = te.CreateFace((uint)i); - face.MediaFlags = true; - part.Shape.Textures = te; + SetPartMediaFlags(part, i, true); // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", // i, part.Shape.Textures.FaceTextures[i].MediaFlags); @@ -428,8 +438,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap if (null == media[i]) continue; - Primitive.TextureEntryFace face = te.CreateFace((uint)i); - face.MediaFlags = true; + SetPartMediaFlags(part, i, true); // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", From 3fe31ad457ba3b663b0ff1b834dd06756526e771 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 7 Mar 2011 15:51:59 -0800 Subject: [PATCH 45/46] Added back the LocalFlags as one of the SOP properties to be synced, so that script events such as touch is propogated properly. Also removed some debug messages. --- .../RegionSyncModule/RegionSyncServerModule.cs | 2 +- .../RegionSyncModule/SymmetricSync/RegionSyncModule.cs | 10 ++++++++-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++++--- .../Scenes/Serialization/SceneObjectSerializer.cs | 7 ++++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs index e8972604c3..820cd18ea0 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs @@ -271,7 +271,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { m_presenceUpdates[presence.UUID] = presence; } - m_log.DebugFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString()); + //m_log.DebugFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString()); } public void SendUpdates() diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index dd13272bcc..2a2698bc49 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -752,7 +752,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID); SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data)); - m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString()); + //m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString()); SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg); } } @@ -1268,8 +1268,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule HashSet newlist = new HashSet(currentlist); newlist.Remove(syncConnector); + if (newlist.Count == 0) + { + m_synced = false; + } + m_syncConnectors = newlist; } + } public void StopAllSyncConnectors() @@ -1517,7 +1523,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule UUID partUUID = data["UUID"].AsUUID(); string bucketName = data["Bucket"].AsString(); - m_log.DebugFormat("{0}: HandleUpdatedBucketProperties {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName); + //m_log.DebugFormat("{0}: HandleUpdatedBucketProperties {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName); /* Commented out since OSDMap is now passed all the way through to the unpacker. * Previous implementation is to create a SOP and copy the values into same and copy them out later. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index df5320192a..d8461d4052 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -166,7 +166,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_physActor; } set { - m_log.DebugFormat("[SCENE OBJECT PART]: PhysActor set to {0} for {1} {2}", value, Name, UUID); + //m_log.DebugFormat("[SCENE OBJECT PART]: PhysActor set to {0} for {1} {2}", value, Name, UUID); m_physActor = value; } } @@ -5450,6 +5450,7 @@ namespace OpenSim.Region.Framework.Scenes localPart.EveryoneMask = updatedPart.EveryoneMask; localPart.NextOwnerMask = updatedPart.NextOwnerMask; localPart.Flags = updatedPart.Flags; + localPart.LocalFlags = updatedPart.LocalFlags; //We will update CollisionSound with special care so that it does not lead to ScheduleFullUpdate of this part, to make the actor think it just made an update and //need to propogate that update to other actors. @@ -5830,8 +5831,8 @@ namespace OpenSim.Region.Framework.Scenes { if (updatedProperties != null && updatedProperties.Count > 0) { - m_log.DebugFormat("{0}: Tainting bucket for properties {1}", - "[SCENE OBJECT PART]", updatedProperties.ToString()); + //m_log.DebugFormat("{0}: Tainting bucket for properties {1}", + // "[SCENE OBJECT PART]", updatedProperties.ToString()); foreach (SceneObjectPartProperties property in updatedProperties) { TaintBucketSyncInfo(property); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 170c45a030..588ffc7dae 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -330,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); //SYMMETRIC SYNC - //m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags); + m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags); //m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp); //m_SOPXmlProcessors.Add("LastUpdateActorID", ProcessLastUpdateActorID); m_SOPXmlProcessors.Add("IsAttachment", ProcessIsAttachment); @@ -718,13 +718,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { obj.LastUpdateActorID = reader.ReadElementContentAsString("LastUpdateActorID", string.Empty); } + * */ private static void ProcessLocalFlags(SceneObjectPart obj, XmlTextReader reader) { obj.LocalFlags = Util.ReadEnum(reader, "LocalFlags"); } - * */ + private static void ProcessIsAttachment(SceneObjectPart obj, XmlTextReader reader) { @@ -1273,7 +1274,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); //SYMMETRIC SYNC: also serialize SceneObjectPart:LocalFlags, so that it can be propogated across actors WriteFlags(writer, "Flags", sop.Flags.ToString(), options); - //WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options); + WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options); //end SYMMETRIC SYNC WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); From 052af34a5205f9bf62424e7df600edea2f74ab36 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 7 Mar 2011 16:24:48 -0800 Subject: [PATCH 46/46] Added Shape as one of the properties just updated in MoapModule.SetMediaEntry. --- OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index fc493211ea..5eda422b16 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap SetPartMediaFlags(part, face, me != null); //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.MediaUrl}); + part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.MediaUrl, SceneObjectPartProperties.Shape}); part.TriggerScriptChangedEvent(Changed.MEDIA); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d8461d4052..4bcef483d2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5513,7 +5513,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart localPart = this; PhysicsActor pa = localPart.PhysActor; - m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString()); + //m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString()); lock (m_bucketUpdateLocks[bucketName]) {