From 918c12c965e822457807563acd4e16638a6bd3cc Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 16 Feb 2011 08:06:11 +0000
Subject: Change the QUERYACCESS method to eliminate spurious access denied
messages
---
.../Framework/EntityTransfer/EntityTransferModule.cs | 10 +++++-----
.../Simulation/LocalSimulationConnector.cs | 5 +++--
.../Simulation/RemoteSimulationConnector.cs | 7 ++++---
OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++-
OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 11 +++++++++--
.../Connectors/Simulation/SimulationServiceConnector.cs | 17 ++++++++++++++++-
OpenSim/Services/Interfaces/ISimulationService.cs | 2 +-
7 files changed, 40 insertions(+), 15 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 1337143..98aa563 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 56720b7..a298b65 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 c4919b3..0c92bd1 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 355671c..2fd6b52 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 6a23dee..372a59c 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 cc6bffb..f6ee493 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 48a2185..b796757 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.
--
cgit v1.1
From fc84225038a44e114fe58e4b789b746c9b7a8338 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 16 Feb 2011 08:18:49 -0800
Subject: XFF capitalization strikes again -- this time in the XMLRPC method.
mantis #5386
---
OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 4c35132..1d05b02 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
{
--
cgit v1.1
From 5c15c5e0ffa2da1bbc57e590d05ca19d46470f89 Mon Sep 17 00:00:00 2001
From: Marck
Date: Wed, 16 Feb 2011 17:42:01 +0100
Subject: Changed default directory for storing map tile images from remote
regions.
---
OpenSim/Services/GridService/HypergridLinker.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 9d98c8f..12ea453 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);
--
cgit v1.1
From 25265c964f22a34fa3757ae487c15744f1da5850 Mon Sep 17 00:00:00 2001
From: Marck
Date: Wed, 16 Feb 2011 18:34:44 +0100
Subject: 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(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 2b3d2a9..8a977c9 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)
- {
- firstName = cmdparams[1];
- isGeneral = firstName.ToLower().Equals("general");
- }
- if (cmdparams.Length == 2 && !isGeneral)
+ if (cmdparams[0].ToLower().Equals("alert"))
{
- // 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)
--
cgit v1.1
From c6f2d66eae890bae56cdb9acf6b2691fe539b5f0 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 16 Feb 2011 09:57:12 -0800
Subject: 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.
---
.../AuthenticationService/PasswordAuthenticationService.cs | 2 +-
.../Connectors/Simulation/SimulationServiceConnector.cs | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 17619ff..2fc9248 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 f6ee493..8aa88cb 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)
--
cgit v1.1
From 47a5d8d7420f86088d75e4b578e7e997ba2d11c8 Mon Sep 17 00:00:00 2001
From: Marck
Date: Fri, 21 Jan 2011 19:55:35 +0100
Subject: 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(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 688dfe4..402d3a5 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.
--
cgit v1.1
From 4f9c3c73ad8cc2178e44c724c72a4bb292e5ea93 Mon Sep 17 00:00:00 2001
From: Marck
Date: Fri, 21 Jan 2011 20:00:04 +0100
Subject: Add support for new naming syntax of linked regions to
osTeleportAgent and osTeleportOwner.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++---
.../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 17 ++---------------
2 files changed, 5 insertions(+), 18 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2fd6b52..02a0268 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 402d3a5..64931d0 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);
--
cgit v1.1
From 47252214354cb768ecddb50062d650d22f7d1c4f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 20:54:00 +0000
Subject: 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(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cd70de8..4150f4a 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;
--
cgit v1.1
From e774679f62dc0de54c1926b1b4a611ca317d2bd7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 21:19:16 +0000
Subject: minor: add method doc to a few ScenePresence methods
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4150f4a..b47ec3c 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;
--
cgit v1.1
From 88da253c947c78e97f78119203e3c2f216a788e2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 21:54:44 +0000
Subject: 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 | 307 ++++++++++-----------
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 3 -
.../Region/Framework/Scenes/Tests/SceneTests.cs | 71 +++++
3 files changed, 224 insertions(+), 157 deletions(-)
create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 02a0268..e0af2d6 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();
+ List coarseLocations;
+ List avatarUUIDs;
+ SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
+ // Send coarse locations to clients
+ ForEachScenePresence(delegate(ScenePresence presence)
+ {
+ presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
+ });
+ }
- // 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();
+ int tmpPhysicsMS2 = Util.EnvironmentTickCount();
+ if ((Frame % m_update_physics == 0) && m_physics_enabled)
+ m_sceneGraph.UpdatePreparePhysics();
+ physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
- // 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)
- {
- presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
- });
- }
+ // Apply any pending avatar force input to the avatar's velocity
+ if (Frame % m_update_entitymovement == 0)
+ m_sceneGraph.UpdateScenePresenceMovement();
- int tmpPhysicsMS2 = Util.EnvironmentTickCount();
- if ((m_frame % m_update_physics == 0) && m_physics_enabled)
- m_sceneGraph.UpdatePreparePhysics();
- physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
+ // 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);
- // Apply any pending avatar force input to the avatar's velocity
- if (m_frame % m_update_entitymovement == 0)
- m_sceneGraph.UpdateScenePresenceMovement();
+ // 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);
+ }
- // 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 (RegionStatus != RegionStatus.SlaveScene)
+ {
+ if (Frame % m_update_events == 0)
{
- if (m_physics_enabled)
- physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
- if (SynchronizeScene != null)
- SynchronizeScene(this);
+ int evMS = Util.EnvironmentTickCount();
+ UpdateEvents();
+ eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
}
- physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
- // Delete temp-on-rez stuff
- if (m_frame % 1000 == 0 && !m_cleaningTemps)
+ if (Frame % m_update_backup == 0)
{
- 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);
- }
+ int terMS = Util.EnvironmentTickCount();
+ UpdateTerrain();
+ terrainMS = Util.EnvironmentTickCountSubtract(terMS);
+ }
- if (m_frame % m_update_terrain == 0)
- {
- int terMS = Util.EnvironmentTickCount();
- UpdateTerrain();
- terrainMS = Util.EnvironmentTickCountSubtract(terMS);
- }
+ //if (Frame % m_update_land == 0)
+ //{
+ // int ldMS = Util.EnvironmentTickCount();
+ // UpdateLand();
+ // landMS = Util.EnvironmentTickCountSubtract(ldMS);
+ //}
- //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 (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());
+ }
- 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());
- }
+ 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();
- if (LoginsDisabled && m_frame == 20)
+ IConfig startupConfig = m_config.Configs["Startup"];
+ if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
{
- // 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);
- }
+ 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;
+ }
+ 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;
+ }
- if (maintc > 0)
- Thread.Sleep(maintc);
+ maintc = Util.EnvironmentTickCountSubtract(maintc);
+ maintc = (int)(m_timespan * 1000) - maintc;
- // Tell the watchdog that this thread is still alive
- Watchdog.UpdateThread();
- }
- }
+ 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 ef52363..8286e4f 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 0000000..9aba8a8
--- /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
--
cgit v1.1
From 60d47836ce4bc25d6eed637f506a459dccde6b82 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 22:00:52 +0000
Subject: minor: remove mono compiler warning
---
OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 8aa88cb..463b2fb 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;
}
///
--
cgit v1.1
From c763edf56dab869982b5ba002d798f147112a361 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 22:20:08 +0000
Subject: separate attachment tests out into their own class
---
.../Framework/Scenes/Tests/AttachmentTests.cs | 180 +++++++++++++++++++++
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 50 ------
2 files changed, 180 insertions(+), 50 deletions(-)
create mode 100644 OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
new file mode 100644
index 0000000..60e47f6
--- /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 8286e4f..d82760e 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()
{
--
cgit v1.1
From c155f57dbe6b36697d2e1e50d4de43f7af2b97d1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 22:22:51 +0000
Subject: remove unused test teardown method
---
OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
index 60e47f6..af44640 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()
--
cgit v1.1
From 023f953f39709e90c8eb31bc332dc2c01346cbd9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 22:25:45 +0000
Subject: remove another unused test teardown method
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 6 ------
1 file changed, 6 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index d82760e..ddff896 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();
--
cgit v1.1
From eb699df5f6c7a68a500e38dc994ed7c2f2aa89d9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 22:49:19 +0000
Subject: 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().
---
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 60 +++++++++++++++-------
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 8 ++-
2 files changed, 44 insertions(+), 24 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index ddff896..92c73be 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 8b16496..d199e42 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;
}
--
cgit v1.1
From dd9efc183812a66b1654aaeb419945cf57650b08 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 23:05:56 +0000
Subject: extend TestChildAgentEstablished() test slightly to put in
EntityTransferModule. Not yet enabled.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++-
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 11 +++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b47ec3c..51b8dcc 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 92c73be..60bc86c 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);
--
cgit v1.1
From 5c92f62941e21b6e5eec503ab95f149092e20217 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 23:10:46 +0000
Subject: minor: remove mono compiler warning
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 584c577..583214c 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];
--
cgit v1.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: 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
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 7 +++++--
OpenSim/Services/GridService/GridService.cs | 12 +++++++++++-
2 files changed, 16 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index 60bc86c..5e1ff79 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 aeff9b5..985d77b 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;
}
--
cgit v1.1
From 60fe3d48ee83f004861044c51537256c0c389478 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 18 Feb 2011 23:50:54 +0000
Subject: 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(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index c2f9c3a..3be97b5 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 e0af2d6..ee1e0be 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 dc0d4de..ebe0a72 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 d199e42..9142616 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());
--
cgit v1.1
From 9d668b09ca893c706745cd2b8fb9b7922b6eeee6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 19 Feb 2011 00:07:16 +0000
Subject: remove unused code to share services between scenes in
SceneSetupHelpers - this is done differently elsewhere
---
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 68 ++++++-------------------
1 file changed, 16 insertions(+), 52 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 9142616..3980c18 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();
--
cgit v1.1
From b3a1d8c7f787dd2ad24b925bfcdd08b676b3d8b3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 19 Feb 2011 00:11:08 +0000
Subject: Remove unused SceneSetupHelpers.DeleteObjectAsync().
Calling async code in automated tests is never a good idea - things become very fragile very quickly
---
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 19 -------------------
1 file changed, 19 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 3980c18..5be70bc 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();
- }
}
}
--
cgit v1.1
From 9e47018cfb42cc67a1d414e73396861b3a6b99ea Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 19 Feb 2011 00:14:13 +0000
Subject: 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.
---
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 19 -------------------
1 file changed, 19 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index 5e1ff79..fd2d6fa 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.
--
cgit v1.1