Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim

arthursv
Diva Canto 2009-08-15 08:21:15 -07:00
commit dd8b9d5810
5 changed files with 337 additions and 29 deletions

View File

@ -77,7 +77,6 @@ what it is today.
* Intimidated * Intimidated
* Jeremy Bongio (IBM) * Jeremy Bongio (IBM)
* jhurliman * jhurliman
* Mike Osias (IBM)
* John R Sohn (XenReborn) * John R Sohn (XenReborn)
* jonc * jonc
* Junta Kohime * Junta Kohime
@ -91,6 +90,7 @@ what it is today.
* maimedleech * maimedleech
* Mic Bowman * Mic Bowman
* Michelle Argus * Michelle Argus
* Mike Osias (IBM)
* Mike Pitman (IBM) * Mike Pitman (IBM)
* mikkopa/_someone - RealXtend * mikkopa/_someone - RealXtend
* Mircea Kitsune * Mircea Kitsune
@ -119,9 +119,11 @@ what it is today.
* Xantor * Xantor
* Y. Nitta * Y. Nitta
* YZh * YZh
* Zackary Geers aka Kunnis Basiat
* Zha Ewry * Zha Ewry
LSL Devs LSL Devs
* Alondria * Alondria

View File

@ -1038,6 +1038,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Send out simstats data to all clients
/// </summary>
/// <param name="stats">Stats on the Simulator's performance</param>
private void SendSimStatsPackets(SimStats stats) private void SendSimStatsPackets(SimStats stats)
{ {
List<ScenePresence> StatSendAgents = GetScenePresences(); List<ScenePresence> StatSendAgents = GetScenePresences();
@ -1050,6 +1054,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Recount SceneObjectPart in parcel aabb
/// </summary>
private void UpdateLand() private void UpdateLand()
{ {
if (LandChannel != null) if (LandChannel != null)
@ -1061,11 +1068,17 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Update the terrain if it needs to be updated.
/// </summary>
private void UpdateTerrain() private void UpdateTerrain()
{ {
EventManager.TriggerTerrainTick(); EventManager.TriggerTerrainTick();
} }
/// <summary>
/// Back up queued up changes
/// </summary>
private void UpdateStorageBackup() private void UpdateStorageBackup()
{ {
if (!m_backingup) if (!m_backingup)
@ -1078,6 +1091,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Sends out the OnFrame event to the modules
/// </summary>
private void UpdateEvents() private void UpdateEvents()
{ {
m_eventManager.TriggerOnFrame(); m_eventManager.TriggerOnFrame();
@ -1133,6 +1149,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Synchronous force backup. For deletes and links/unlinks
/// </summary>
/// <param name="group">Object to be backed up</param>
public void ForceSceneObjectBackup(SceneObjectGroup group) public void ForceSceneObjectBackup(SceneObjectGroup group)
{ {
if (group != null) if (group != null)
@ -1141,6 +1161,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Return object to avatar Message
/// </summary>
/// <param name="agentID">Avatar Unique Id</param>
/// <param name="objectName">Name of object returned</param>
/// <param name="location">Location of object returned</param>
/// <param name="reason">Reasion for object return</param>
public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason) public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason)
{ {
lock (m_returns) lock (m_returns)
@ -1167,6 +1194,9 @@ namespace OpenSim.Region.Framework.Scenes
#region Load Terrain #region Load Terrain
/// <summary>
/// Store the terrain in the persistant data store
/// </summary>
public void SaveTerrain() public void SaveTerrain()
{ {
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
@ -1269,6 +1299,10 @@ namespace OpenSim.Region.Framework.Scenes
#region Load Land #region Load Land
/// <summary>
/// Loads all Parcel data from the datastore for region identified by regionID
/// </summary>
/// <param name="regionID">Unique Identifier of the Region to load parcel data for</param>
public void loadAllLandObjectsFromStorage(UUID regionID) public void loadAllLandObjectsFromStorage(UUID regionID)
{ {
m_log.Info("[SCENE]: Loading land objects from storage"); m_log.Info("[SCENE]: Loading land objects from storage");
@ -1322,6 +1356,20 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
} }
/// <summary>
/// Gets a new rez location based on the raycast and the size of the object that is being rezzed.
/// </summary>
/// <param name="RayStart"></param>
/// <param name="RayEnd"></param>
/// <param name="RayTargetID"></param>
/// <param name="rot"></param>
/// <param name="bypassRayCast"></param>
/// <param name="RayEndIsIntersection"></param>
/// <param name="frontFacesOnly"></param>
/// <param name="scale"></param>
/// <param name="FaceCenter"></param>
/// <returns></returns>
public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
{ {
Vector3 pos = Vector3.Zero; Vector3 pos = Vector3.Zero;
@ -1412,6 +1460,19 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Create a New SceneObjectGroup/Part by raycasting
/// </summary>
/// <param name="ownerID"></param>
/// <param name="groupID"></param>
/// <param name="RayEnd"></param>
/// <param name="rot"></param>
/// <param name="shape"></param>
/// <param name="bypassRaycast"></param>
/// <param name="RayStart"></param>
/// <param name="RayTargetID"></param>
/// <param name="RayEndIsIntersection"></param>
public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape,
byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, byte bypassRaycast, Vector3 RayStart, UUID RayTargetID,
byte RayEndIsIntersection) byte RayEndIsIntersection)
@ -1829,6 +1890,12 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
/// <summary>
/// Attachment rezzing
/// </summary>
/// <param name="userID">Agent Unique ID</param>
/// <param name="itemID">Object ID</param>
/// <returns>False</returns>
public virtual bool IncomingCreateObject(UUID userID, UUID itemID) public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
{ {
ScenePresence sp = GetScenePresence(userID); ScenePresence sp = GetScenePresence(userID);
@ -1841,6 +1908,13 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
/// <summary>
/// Adds a Scene Object group to the Scene.
/// Verifies that the creator of the object is not banned from the simulator.
/// Checks if the item is an Attachment
/// </summary>
/// <param name="sceneObject"></param>
/// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
public bool AddSceneObject(SceneObjectGroup sceneObject) public bool AddSceneObject(SceneObjectGroup sceneObject)
{ {
// If the user is banned, we won't let any of their objects // If the user is banned, we won't let any of their objects
@ -1933,6 +2007,10 @@ namespace OpenSim.Region.Framework.Scenes
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods
/// <summary>
/// Adding a New Client and Create a Presence for it.
/// </summary>
/// <param name="client"></param>
public override void AddNewClient(IClientAPI client) public override void AddNewClient(IClientAPI client)
{ {
SubscribeToClientEvents(client); SubscribeToClientEvents(client);
@ -1977,6 +2055,10 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
} }
/// <summary>
/// Register for events from the client
/// </summary>
/// <param name="client">The IClientAPI of the connected client</param>
protected virtual void SubscribeToClientEvents(IClientAPI client) protected virtual void SubscribeToClientEvents(IClientAPI client)
{ {
client.OnRegionHandShakeReply += SendLayerData; client.OnRegionHandShakeReply += SendLayerData;
@ -2070,8 +2152,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Teleport an avatar to their home region /// Teleport an avatar to their home region
/// </summary> /// </summary>
/// <param name="agentId"></param> /// <param name="agentId">The avatar's Unique ID</param>
/// <param name="client"></param> /// <param name="client">The IClientAPI for the client</param>
public virtual void TeleportClientHome(UUID agentId, IClientAPI client) public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
{ {
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
@ -2099,6 +2181,21 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Duplicates object specified by localID at position raycasted against RayTargetObject using
/// RayEnd and RayStart to determine what the angle of the ray is
/// </summary>
/// <param name="localID">ID of object to duplicate</param>
/// <param name="dupeFlags"></param>
/// <param name="AgentID">Agent doing the duplication</param>
/// <param name="GroupID">Group of new object</param>
/// <param name="RayTargetObj">The target of the Ray</param>
/// <param name="RayEnd">The ending of the ray (farthest away point)</param>
/// <param name="RayStart">The Beginning of the ray (closest point)</param>
/// <param name="BypassRaycast">Bool to bypass raycasting</param>
/// <param name="RayEndIsIntersection">The End specified is the place to add the object</param>
/// <param name="CopyCenters">Position the object at the center of the face that it's colliding with</param>
/// <param name="CopyRotates">Rotate the object the same as the localID object</param>
public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart,
bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates)
@ -2170,6 +2267,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Sets the Home Point. The GridService uses this to know where to put a user when they log-in
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="regionHandle"></param>
/// <param name="position"></param>
/// <param name="lookAt"></param>
/// <param name="flags"></param>
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
{ {
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId);
@ -2340,6 +2445,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Removes region from an avatar's known region list. This coincides with child agents. For each child agent, there will be a known region entry.
///
/// </summary>
/// <param name="avatarID"></param>
/// <param name="regionslst"></param>
public void HandleRemoveKnownRegionsFromAvatar(UUID avatarID, List<ulong> regionslst) public void HandleRemoveKnownRegionsFromAvatar(UUID avatarID, List<ulong> regionslst)
{ {
ScenePresence av = GetScenePresence(avatarID); ScenePresence av = GetScenePresence(avatarID);
@ -2355,12 +2466,19 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Closes all endpoints with the circuitcode provided.
/// </summary>
/// <param name="circuitcode">Circuit Code of the endpoint to close</param>
public override void CloseAllAgents(uint circuitcode) public override void CloseAllAgents(uint circuitcode)
{ {
// Called by ClientView to kill all circuit codes // Called by ClientView to kill all circuit codes
ClientManager.CloseAllAgents(circuitcode); ClientManager.CloseAllAgents(circuitcode);
} }
/// <summary>
/// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
/// </summary>
public void NotifyMyCoarseLocationChange() public void NotifyMyCoarseLocationChange()
{ {
ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
@ -2455,9 +2573,10 @@ namespace OpenSim.Region.Framework.Scenes
/// The return bool should allow for connections to be refused, but as not all calling paths /// The return bool should allow for connections to be refused, but as not all calling paths
/// take proper notice of it let, we allowed banned users in still. /// take proper notice of it let, we allowed banned users in still.
/// </summary> /// </summary>
/// <param name="regionHandle"></param> /// <param name="agent">CircuitData of the agent who is connecting</param>
/// <param name="agent"></param> /// <param name="reason">Outputs the reason for the false response on this string</param>
/// <param name="reason"></param> /// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns>
public bool NewUserConnection(AgentCircuitData agent, out string reason) public bool NewUserConnection(AgentCircuitData agent, out string reason)
{ {
// Don't disable this log message - it's too helpful // Don't disable this log message - it's too helpful
@ -2530,6 +2649,13 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
/// <summary>
/// Verifies that the user has a session on the Grid
/// </summary>
/// <param name="agent">Circuit Data of the Agent we're verifying</param>
/// <param name="reason">Outputs the reason for the false response on this string</param>
/// <returns>True if the user has a session on the grid. False if it does not. False will
/// also return a reason.</returns>
public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason)
{ {
reason = String.Empty; reason = String.Empty;
@ -2542,6 +2668,13 @@ namespace OpenSim.Region.Framework.Scenes
return result; return result;
} }
/// <summary>
/// Verify if the user can connect to this region. Checks the banlist and ensures that the region is set for public access
/// </summary>
/// <param name="agent">The circuit data for the agent</param>
/// <param name="reason">outputs the reason to this string</param>
/// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns>
protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason)
{ {
reason = String.Empty; reason = String.Empty;
@ -2600,16 +2733,32 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
/// <summary>
/// Update an AgentCircuitData object with new information
/// </summary>
/// <param name="data">Information to update the AgentCircuitData with</param>
public void UpdateCircuitData(AgentCircuitData data) public void UpdateCircuitData(AgentCircuitData data)
{ {
m_authenticateHandler.UpdateAgentData(data); m_authenticateHandler.UpdateAgentData(data);
} }
/// <summary>
/// Change the Circuit Code for the user's Circuit Data
/// </summary>
/// <param name="oldcc">The old Circuit Code. Must match a previous circuit code</param>
/// <param name="newcc">The new Circuit Code. Must not be an already existing circuit code</param>
/// <returns>True if we successfully changed it. False if we did not</returns>
public bool ChangeCircuitCode(uint oldcc, uint newcc) public bool ChangeCircuitCode(uint oldcc, uint newcc)
{ {
return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc);
} }
/// <summary>
/// The Grid has requested that we log-off a user. Log them off.
/// </summary>
/// <param name="AvatarID">Unique ID of the avatar to log-off</param>
/// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param>
/// <param name="message">message to display to the user. Reason for being logged off</param>
public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
{ {
ScenePresence loggingOffUser = null; ScenePresence loggingOffUser = null;
@ -2675,6 +2824,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// We've got an update about an agent that sees into this region,
/// send it to ScenePresence for processing It's the full data.
/// </summary>
/// <param name="cAgentData">Agent that contains all of the relevant things about an agent.
/// Appearance, animations, position, etc.</param>
/// <returns>true if we handled it.</returns>
public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -2692,6 +2848,12 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
/// <summary>
/// We've got an update about an agent that sees into this region,
/// send it to ScenePresence for processing It's only positional data
/// </summary>
/// <param name="cAgentData">AgentPosition that contains agent positional data so we can know what to send</param>
/// <returns>true if we handled it.</returns>
public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData)
{ {
//m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);

View File

@ -48,6 +48,9 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List<ulong> regionlst); public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List<ulong> regionlst);
/// <summary>
/// Class that Region communications runs through
/// </summary>
public class SceneCommunicationService //one instance per region public class SceneCommunicationService //one instance per region
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -60,15 +63,46 @@ namespace OpenSim.Region.Framework.Scenes
protected List<UUID> m_agentsInTransit; protected List<UUID> m_agentsInTransit;
/// <summary>
/// An agent is crossing into this region
/// </summary>
public event AgentCrossing OnAvatarCrossingIntoRegion; public event AgentCrossing OnAvatarCrossingIntoRegion;
/// <summary>
/// A user will arrive shortly, set up appropriate credentials so it can connect
/// </summary>
public event ExpectUserDelegate OnExpectUser; public event ExpectUserDelegate OnExpectUser;
/// <summary>
/// A Prim will arrive shortly
/// </summary>
public event ExpectPrimDelegate OnExpectPrim; public event ExpectPrimDelegate OnExpectPrim;
public event CloseAgentConnection OnCloseAgentConnection; public event CloseAgentConnection OnCloseAgentConnection;
/// <summary>
/// A new prim has arrived
/// </summary>
public event PrimCrossing OnPrimCrossingIntoRegion; public event PrimCrossing OnPrimCrossingIntoRegion;
/// <summary>
/// A New Region is up and available
/// </summary>
public event RegionUp OnRegionUp; public event RegionUp OnRegionUp;
/// <summary>
/// We have a child agent for this avatar and we're getting a status update about it
/// </summary>
public event ChildAgentUpdate OnChildAgentUpdate; public event ChildAgentUpdate OnChildAgentUpdate;
//public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
/// <summary>
/// Time to log one of our users off. Grid Service sends this mostly
/// </summary>
public event LogOffUser OnLogOffUser; public event LogOffUser OnLogOffUser;
/// <summary>
/// A region wants land data from us!
/// </summary>
public event GetLandData OnGetLandData; public event GetLandData OnGetLandData;
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
@ -123,11 +157,20 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Returns a region with the name closest to string provided
/// </summary>
/// <param name="name">Partial Region Name for matching</param>
/// <returns>Region Information for the region</returns>
public RegionInfo RequestClosestRegion(string name) public RegionInfo RequestClosestRegion(string name)
{ {
return m_commsProvider.GridService.RequestClosestRegion(name); return m_commsProvider.GridService.RequestClosestRegion(name);
} }
/// <summary>
/// This region is shutting down, de-register all events!
/// De-Register region from Grid!
/// </summary>
public void Close() public void Close()
{ {
if (regionCommsHost != null) if (regionCommsHost != null)
@ -159,10 +202,9 @@ namespace OpenSim.Region.Framework.Scenes
#region CommsManager Event handlers #region CommsManager Event handlers
/// <summary> /// <summary>
/// /// A New User will arrive shortly, Informs the scene that there's a new user on the way
/// </summary> /// </summary>
/// <param name="regionHandle"></param> /// <param name="agent">Data we need to ensure that the agent can connect</param>
/// <param name="agent"></param>
/// ///
protected void NewUserConnection(AgentCircuitData agent) protected void NewUserConnection(AgentCircuitData agent)
{ {
@ -174,6 +216,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// The Grid has requested us to log-off the user
/// </summary>
/// <param name="AgentID">Unique ID of agent to log-off</param>
/// <param name="RegionSecret">The secret string that the region establishes with the grid when registering</param>
/// <param name="message">The message to send to the user that tells them why they were logged off</param>
protected void GridLogOffUser(UUID AgentID, UUID RegionSecret, string message) protected void GridLogOffUser(UUID AgentID, UUID RegionSecret, string message)
{ {
handlerLogOffUser = OnLogOffUser; handlerLogOffUser = OnLogOffUser;
@ -183,6 +231,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// A New Region is now available. Inform the scene that there is a new region available.
/// </summary>
/// <param name="region">Information about the new region that is available</param>
/// <returns>True if the event was handled</returns>
protected bool newRegionUp(RegionInfo region) protected bool newRegionUp(RegionInfo region)
{ {
handlerRegionUp = OnRegionUp; handlerRegionUp = OnRegionUp;
@ -194,6 +247,11 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
/// <summary>
/// Inform the scene that we've got an update about a child agent that we have
/// </summary>
/// <param name="cAgentData"></param>
/// <returns></returns>
protected bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData) protected bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData)
{ {
handlerChildAgentUpdate = OnChildAgentUpdate; handlerChildAgentUpdate = OnChildAgentUpdate;
@ -204,6 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
protected void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) protected void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{ {
handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion; handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion;
@ -213,6 +272,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// We have a new prim from a neighbor
/// </summary>
/// <param name="primID">unique ID for the primative</param>
/// <param name="objXMLData">XML2 encoded data of the primative</param>
/// <param name="XMLMethod">An Int that represents the version of the XMLMethod</param>
/// <returns>True if the prim was accepted, false if it was not</returns>
protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod) protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
{ {
handlerExpectPrim = OnExpectPrim; handlerExpectPrim = OnExpectPrim;

View File

@ -38,6 +38,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup; using OpenSim.Tests.Common.Setup;
using System.Threading;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {
@ -55,56 +56,130 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestSimpleNotNeighboursTeleport() public void TestSimpleNotNeighboursTeleport()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
ThreadRunResults results = new ThreadRunResults();
results.Result = false;
results.Message = "Test did not run";
TestRunning testClass = new TestRunning(results);
Thread testThread = new Thread(testClass.run);
try
{
// Seems kind of redundant to start a thread and then join it, however.. We need to protect against
// A thread abort exception in the simulator code.
testThread.Start();
testThread.Join();
}
catch (ThreadAbortException)
{
}
Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message);
// Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
}
}
public class ThreadRunResults
{
public bool Result = false;
public string Message = string.Empty;
}
public class TestRunning
{
public ThreadRunResults results;
public TestRunning(ThreadRunResults t)
{
results = t;
}
public void run(object o)
{
//results.Result = true;
log4net.Config.XmlConfigurator.Configure(); log4net.Config.XmlConfigurator.Configure();
UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
TestCommunicationsManager cm = new TestCommunicationsManager(); TestCommunicationsManager cm = new TestCommunicationsManager();
// shared module // shared module
ISharedRegionModule interregionComms = new RESTInterregionComms(); ISharedRegionModule interregionComms = new RESTInterregionComms();
Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm);
SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
sceneA.RegisterRegionWithGrid(); sceneA.RegisterRegionWithGrid();
Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm);
SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
sceneB.RegisterRegionWithGrid(); sceneB.RegisterRegionWithGrid();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId);
ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl);
if (!results.Result)
{
results.Message = "Incorrect caps object path set up in sceneA";
return;
}
/*
Assert.That( Assert.That(
sceneACapsModule.GetCapsPath(agentId), sceneACapsModule.GetCapsPath(agentId),
Is.EqualTo(client.CapsSeedUrl), Is.EqualTo(client.CapsSeedUrl),
"Incorrect caps object path set up in sceneA"); "Incorrect caps object path set up in sceneA");
*/
// FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
client.TeleportTargetScene = sceneB;
client.TeleportTargetScene = sceneB;
client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
results.Result = (sceneB.GetScenePresence(agentId) != null);
if (!results.Result)
{
results.Message = "Client does not have an agent in sceneB";
return;
}
//Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
results.Result = (sceneA.GetScenePresence(agentId) == null);
if (!results.Result)
{
results.Message = "Client still had an agent in sceneA";
return;
}
ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>();
results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort +
"/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl);
if (!results.Result)
{
results.Message = "Incorrect caps object path set up in sceneB";
return;
}
// Temporary assertion - caps url construction should at least be doable through a method. // Temporary assertion - caps url construction should at least be doable through a method.
/*
Assert.That( Assert.That(
"http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
Is.EqualTo(client.CapsSeedUrl), Is.EqualTo(client.CapsSeedUrl),
"Incorrect caps object path set up in sceneB"); "Incorrect caps object path set up in sceneB");
*/
// This assertion will currently fail since we don't remove the caps paths when no longer needed // This assertion will currently fail since we don't remove the caps paths when no longer needed
//Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");
// TODO: Check that more of everything is as it should be // TODO: Check that more of everything is as it should be
// TODO: test what happens if we try to teleport to a region that doesn't exist // TODO: test what happens if we try to teleport to a region that doesn't exist
} }
} }

View File

@ -40,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
/// <summary> /// <summary>
/// Scene presence tests /// Scene presence tests
/// </summary> /// </summary>
/// Commented out XEngineTests that don't do anything
/*
[TestFixture] [TestFixture]
public class XEngineTest public class XEngineTest
{ {
@ -65,4 +67,5 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
xengine.RegionLoaded(scene); xengine.RegionLoaded(scene);
} }
} }
*/
} }