Merge branch 'dev' into syncstats

dsg
Robert Adams 2011-03-08 14:23:41 -08:00
commit d514c31cc2
49 changed files with 990 additions and 598 deletions

View File

@ -51,27 +51,55 @@ namespace OpenSim.Data.Null
//Console.WriteLine("[XXX] NullRegionData constructor"); //Console.WriteLine("[XXX] NullRegionData constructor");
} }
private delegate bool Matcher(string value);
public List<RegionData> Get(string regionName, UUID scopeID) public List<RegionData> Get(string regionName, UUID scopeID)
{ {
if (Instance != this) if (Instance != this)
return Instance.Get(regionName, scopeID); return Instance.Get(regionName, scopeID);
string cleanName = regionName.ToLower();
// Handle SQL wildcards
const string wildcard = "%";
bool wildcardPrefix = false;
bool wildcardSuffix = false;
if (cleanName.Equals(wildcard))
{
wildcardPrefix = wildcardSuffix = true;
cleanName = string.Empty;
}
else
{
if (cleanName.StartsWith(wildcard))
{
wildcardPrefix = true;
cleanName = cleanName.Substring(1);
}
if (regionName.EndsWith(wildcard))
{
wildcardSuffix = true;
cleanName = cleanName.Remove(cleanName.Length - 1);
}
}
Matcher queryMatch;
if (wildcardPrefix && wildcardSuffix)
queryMatch = delegate(string s) { return s.Contains(cleanName); };
else if (wildcardSuffix)
queryMatch = delegate(string s) { return s.StartsWith(cleanName); };
else if (wildcardPrefix)
queryMatch = delegate(string s) { return s.EndsWith(cleanName); };
else
queryMatch = delegate(string s) { return s.Equals(cleanName); };
// Find region data
List<RegionData> ret = new List<RegionData>(); List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values) foreach (RegionData r in m_regionData.Values)
{ {
if (regionName.Contains("%")) m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
{ if (queryMatch(r.RegionName.ToLower()))
string cleanname = regionName.Replace("%", "");
m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower());
if (r.RegionName.ToLower().Contains(cleanname.ToLower()))
ret.Add(r); ret.Add(r);
}
else
{
if (r.RegionName.ToLower() == regionName.ToLower())
ret.Add(r);
}
} }
if (ret.Count > 0) if (ret.Count > 0)

View File

@ -181,7 +181,6 @@ namespace OpenSim.Framework.Capabilities
RegisterRegionServiceHandlers(capsBase); RegisterRegionServiceHandlers(capsBase);
RegisterInventoryServiceHandlers(capsBase); RegisterInventoryServiceHandlers(capsBase);
} }
public void RegisterRegionServiceHandlers(string capsBase) public void RegisterRegionServiceHandlers(string capsBase)

View File

@ -250,7 +250,7 @@ namespace OpenSim.Framework
{ {
get get
{ {
//m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); // m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length);
try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); }
catch { } catch { }

View File

@ -785,7 +785,19 @@ namespace OpenSim.Framework.Servers.HttpServer
if (methodWasFound) if (methodWasFound)
{ {
xmlRprcRequest.Params.Add(request.Url); // Param[2] 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 try
{ {

View File

@ -459,10 +459,17 @@ namespace OpenSim.Framework
/// <param name="oldy">Old region y-coord</param> /// <param name="oldy">Old region y-coord</param>
/// <param name="newy">New region y-coord</param> /// <param name="newy">New region y-coord</param>
/// <returns></returns> /// <returns></returns>
public static bool IsOutsideView(uint oldx, uint newx, uint oldy, uint newy) public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy)
{ {
// Eventually this will be a function of the draw distance / camera position too. int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize);
return (((int)Math.Abs((int)(oldx - newx)) > 1) || ((int)Math.Abs((int)(oldy - newy)) > 1));
int startX = (int)oldx - dd;
int startY = (int)oldy - dd;
int endX = (int)oldx + dd;
int endY = (int)oldy + dd;
return (newx < startX || endX < newx || newy < startY || endY < newy);
} }
public static string FieldToString(byte[] bytes) public static string FieldToString(byte[] bytes)

View File

@ -845,7 +845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void HandleUseCircuitCode(object o) private void HandleUseCircuitCode(object o)
{ {
DateTime startTime = DateTime.Now; // DateTime startTime = DateTime.Now;
object[] array = (object[])o; object[] array = (object[])o;
UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1]; UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1];

View File

@ -92,9 +92,9 @@ namespace Flotsam.RegionModules.AssetCache
// Expiration is expressed in hours. // Expiration is expressed in hours.
private const double m_DefaultMemoryExpiration = 1.0; private const double m_DefaultMemoryExpiration = 1.0;
private const double m_DefaultFileExpiration = 48; private const double m_DefaultFileExpiration = 48;
private TimeSpan m_MemoryExpiration = TimeSpan.Zero; private TimeSpan m_MemoryExpiration = TimeSpan.FromHours(m_DefaultMemoryExpiration);
private TimeSpan m_FileExpiration = TimeSpan.Zero; private TimeSpan m_FileExpiration = TimeSpan.FromHours(m_DefaultFileExpiration);
private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.FromHours(m_DefaultFileExpiration);
private static int m_CacheDirectoryTiers = 1; private static int m_CacheDirectoryTiers = 1;
private static int m_CacheDirectoryTierLen = 3; private static int m_CacheDirectoryTierLen = 3;
@ -147,7 +147,7 @@ namespace Flotsam.RegionModules.AssetCache
} }
m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory); m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_CacheDirectory);
m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false); m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false);
m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration)); m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration));
@ -245,16 +245,7 @@ namespace Flotsam.RegionModules.AssetCache
private void UpdateMemoryCache(string key, AssetBase asset) private void UpdateMemoryCache(string key, AssetBase asset)
{ {
if (m_MemoryCacheEnabled) if (m_MemoryCacheEnabled)
{ m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration);
if (m_MemoryExpiration > TimeSpan.Zero)
{
m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration);
}
else
{
m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue);
}
}
} }
public void Cache(AssetBase asset) public void Cache(AssetBase asset)
@ -450,7 +441,7 @@ namespace Flotsam.RegionModules.AssetCache
private void CleanupExpiredFiles(object source, ElapsedEventArgs e) private void CleanupExpiredFiles(object source, ElapsedEventArgs e)
{ {
if (m_LogLevel >= 2) if (m_LogLevel >= 2)
m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString()); m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration);
// Purge all files last accessed prior to this point // Purge all files last accessed prior to this point
DateTime purgeLine = DateTime.Now - m_FileExpiration; DateTime purgeLine = DateTime.Now - m_FileExpiration;

View File

@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
} }
} }
m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId); m_log.DebugFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId);
// If we only found default textures, then the appearance is not cached // If we only found default textures, then the appearance is not cached
return (defonly ? false : true); return (defonly ? false : true);

View File

@ -51,14 +51,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
m_scene.RegisterModuleInterface<IDialogModule>(this); m_scene.RegisterModuleInterface<IDialogModule>(this);
m_scene.AddCommand( m_scene.AddCommand(
this, "alert", "alert <first> <last> <message>", this, "alert", "alert <message>",
"Send an alert to a user", "Send an alert to everyone",
HandleAlertConsoleCommand); HandleAlertConsoleCommand);
m_scene.AddCommand( m_scene.AddCommand(
this, "alert general", "alert [general] <message>", this, "alert-user", "alert-user <first> <last> <message>",
"Send an alert to everyone", "Send an alert to a user",
"If keyword 'general' is omitted, then <message> must be surrounded by quotation marks.",
HandleAlertConsoleCommand); HandleAlertConsoleCommand);
} }
@ -178,54 +177,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene)
return; return;
bool isGeneral = false;
string firstName = string.Empty;
string lastName = string.Empty;
string message = string.Empty; string message = string.Empty;
if (cmdparams.Length > 1) if (cmdparams[0].ToLower().Equals("alert"))
{ {
firstName = cmdparams[1]; message = CombineParams(cmdparams, 1);
isGeneral = firstName.ToLower().Equals("general"); m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}",
}
if (cmdparams.Length == 2 && !isGeneral)
{
// alert "message"
message = cmdparams[1];
isGeneral = true;
}
else if (cmdparams.Length > 2 && isGeneral)
{
// alert general <message>
message = CombineParams(cmdparams, 2);
}
else if (cmdparams.Length > 3)
{
// alert <first> <last> <message>
lastName = cmdparams[2];
message = CombineParams(cmdparams, 3);
}
else
{
OpenSim.Framework.Console.MainConsole.Instance.Output(
"Usage: alert \"message\" | alert general <message> | alert <first> <last> <message>");
return;
}
if (isGeneral)
{
m_log.InfoFormat(
"[DIALOG]: Sending general alert in region {0} with message {1}",
m_scene.RegionInfo.RegionName, message); m_scene.RegionInfo.RegionName, message);
SendGeneralAlert(message); SendGeneralAlert(message);
} }
else else if (cmdparams.Length > 3)
{ {
string firstName = cmdparams[1];
string lastName = cmdparams[2];
message = CombineParams(cmdparams, 3);
m_log.InfoFormat( m_log.InfoFormat(
"[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
m_scene.RegionInfo.RegionName, firstName, lastName, message); m_scene.RegionInfo.RegionName, firstName, lastName, message);
SendAlertToUser(firstName, lastName, message, false); SendAlertToUser(firstName, lastName, message, false);
} }
else
{
OpenSim.Framework.Console.MainConsole.Instance.Output(
"Usage: alert <message> | alert-user <first> <last> <message>");
return;
}
} }
private string CombineParams(string[] commandParams, int pos) private string CombineParams(string[] commandParams, int pos)

View File

@ -55,7 +55,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
protected ManualResetEvent mre = new ManualResetEvent(false); protected ManualResetEvent mre = new ManualResetEvent(false);
/// <summary> /// <summary>
/// Stream of data representing a common IAR that can be reused in load tests. /// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test.
/// </summary>
protected byte[] m_iarStreamBytes;
/// <summary>
/// Stream of data representing a common IAR for load tests.
/// </summary> /// </summary>
protected MemoryStream m_iarStream; protected MemoryStream m_iarStream;
@ -79,12 +84,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
} }
[SetUp] [SetUp]
public void Init() public void SetUp()
{ {
ConstructDefaultIarForTestLoad(); m_iarStream = new MemoryStream(m_iarStreamBytes);
} }
protected void ConstructDefaultIarForTestLoad() [TestFixtureSetUp]
public void FixtureSetup()
{
ConstructDefaultIarBytesForTestLoad();
}
protected void ConstructDefaultIarBytesForTestLoad()
{ {
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
@ -107,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService)); tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService));
tar.Close(); tar.Close();
m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); m_iarStreamBytes = archiveWriteStream.ToArray();
} }
/// <summary> /// <summary>
@ -393,7 +404,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);

View File

@ -284,9 +284,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; 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; return;
} }
@ -317,14 +318,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentCircuit.Id0 = currentAgentCircuit.Id0; agentCircuit.Id0 = currentAgentCircuit.Id0;
} }
if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
// brand new agent, let's create a new caps seed // brand new agent, let's create a new caps seed
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
} }
string reason = String.Empty;
// Let's create an agent there if one doesn't exist yet. // Let's create an agent there if one doesn't exist yet.
bool logout = false; bool logout = false;
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
@ -337,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// OK, it got this agent. Let's close some child agents // OK, it got this agent. Let's close some child agents
sp.CloseChildAgents(newRegionX, newRegionY); sp.CloseChildAgents(newRegionX, newRegionY);
IClientIPEndpoint ipepClient; IClientIPEndpoint ipepClient;
if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
#region IP Translation for NAT #region IP Translation for NAT
@ -448,7 +447,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{ {
Thread.Sleep(5000); Thread.Sleep(5000);
sp.Close(); sp.Close();
@ -522,14 +521,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return region; return region;
} }
protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
{ {
return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY);
} }
protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
{ {
return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY);
} }
protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) protected virtual bool IsOutsideRegion(Scene s, Vector3 pos)
@ -778,7 +777,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 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"); agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
if (r == null) if (r == null)
@ -1045,7 +1045,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_regionInfo != null) if (m_regionInfo != null)
{ {
neighbours = RequestNeighbours(sp.Scene, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
} }
else else
{ {
@ -1272,8 +1272,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="pRegionLocX"></param> /// <param name="pRegionLocX"></param>
/// <param name="pRegionLocY"></param> /// <param name="pRegionLocY"></param>
/// <returns></returns> /// <returns></returns>
protected List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
{ {
Scene pScene = avatar.Scene;
m_log.DebugFormat("[ENTITY TRANSFER MODULE] Request neighbors for {0} at {1}/{2}", m_log.DebugFormat("[ENTITY TRANSFER MODULE] Request neighbors for {0} at {1}/{2}",
pScene.RegionInfo.RegionName, pRegionLocX, pRegionLocY); pScene.RegionInfo.RegionName, pRegionLocX, pRegionLocY);
RegionInfo m_regionInfo = pScene.RegionInfo; RegionInfo m_regionInfo = pScene.RegionInfo;
@ -1283,10 +1284,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Border[] eastBorders = pScene.EastBorders.ToArray(); Border[] eastBorders = pScene.EastBorders.ToArray();
Border[] westBorders = pScene.WestBorders.ToArray(); Border[] westBorders = pScene.WestBorders.ToArray();
// Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
// clear what should be done with a "far view" given that megaregions already extended the
// view to include everything in the megaregion
if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1)
{ {
return pScene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance;
int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2);
int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2);
int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
List<GridRegion> neighbours =
avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
return neighbours;
} }
else else
{ {

View File

@ -130,9 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return region; return region;
} }
protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
{ {
if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
return true; return true;
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);

View File

@ -148,6 +148,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_Scene.InventoryService.GetItem(item); item = m_Scene.InventoryService.GetItem(item);
if (item.Owner != remoteClient.AgentId)
return UUID.Zero;
if (item != null) if (item != null)
{ {
if ((InventoryType)item.InvType == InventoryType.Notecard) if ((InventoryType)item.InvType == InventoryType.Notecard)
@ -524,6 +527,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (item != null) if (item != null)
{ {
item.Owner = remoteClient.AgentId;
AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString());
if (rezAsset != null) if (rezAsset != null)

View File

@ -271,7 +271,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
m_presenceUpdates[presence.UUID] = presence; m_presenceUpdates[presence.UUID] = presence;
} }
m_log.DebugFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString()); //m_log.DebugFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString());
} }
public void SendUpdates() public void SendUpdates()

View File

@ -752,7 +752,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID); data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID);
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data)); SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data));
m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString()); //m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg); SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg);
} }
} }
@ -1271,8 +1271,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
HashSet<SyncConnector> newlist = new HashSet<SyncConnector>(currentlist); HashSet<SyncConnector> newlist = new HashSet<SyncConnector>(currentlist);
newlist.Remove(syncConnector); newlist.Remove(syncConnector);
if (newlist.Count == 0)
{
m_synced = false;
}
m_syncConnectors = newlist; m_syncConnectors = newlist;
} }
} }
public void StopAllSyncConnectors() public void StopAllSyncConnectors()
@ -1520,7 +1526,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID partUUID = data["UUID"].AsUUID(); UUID partUUID = data["UUID"].AsUUID();
string bucketName = data["Bucket"].AsString(); string bucketName = data["Bucket"].AsString();
m_log.DebugFormat("{0}: HandleUpdatedBucketProperties {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName); //m_log.DebugFormat("{0}: HandleUpdatedBucketProperties {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName);
/* Commented out since OSDMap is now passed all the way through to the unpacker. /* Commented out since OSDMap is now passed all the way through to the unpacker.
* Previous implementation is to create a SOP and copy the values into same and copy them out later. * Previous implementation is to create a SOP and copy the values into same and copy them out later.

View File

@ -257,15 +257,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false; 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) if (destination == null)
return false; return false;
foreach (Scene s in m_sceneList) foreach (Scene s in m_sceneList)
{ {
if (s.RegionInfo.RegionID == destination.RegionID) 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"); //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
return false; return false;

View File

@ -192,15 +192,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false; return false;
// Try local first // Try local first
if (m_localBackend.UpdateAgent(destination, cAgentData)) if (m_localBackend.IsLocalRegion(destination.RegionHandle))
return true; return m_localBackend.UpdateAgent(destination, cAgentData);
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
return m_remoteConnector.UpdateAgent(destination, cAgentData);
return false;
return m_remoteConnector.UpdateAgent(destination, cAgentData);
} }
public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)
@ -210,15 +205,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false; return false;
// Try local first // Try local first
if (m_localBackend.UpdateAgent(destination, cAgentData)) if (m_localBackend.IsLocalRegion(destination.RegionHandle))
return true; return m_localBackend.UpdateAgent(destination, cAgentData);
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
return m_remoteConnector.UpdateAgent(destination, cAgentData);
return false;
return m_remoteConnector.UpdateAgent(destination, cAgentData);
} }
public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
@ -240,18 +230,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) if (destination == null)
return false; return false;
// Try local first // Try local first
if (m_localBackend.QueryAccess(destination, id, position)) if (m_localBackend.QueryAccess(destination, id, position, out reason))
return true; return true;
// else do the remote thing // else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
return m_remoteConnector.QueryAccess(destination, id, position); return m_remoteConnector.QueryAccess(destination, id, position, out reason);
return false; return false;

View File

@ -50,7 +50,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDArray = OpenMetaverse.StructuredData.OSDArray; using OSDArray = OpenMetaverse.StructuredData.OSDArray;
using OSDMap = OpenMetaverse.StructuredData.OSDMap; using OSDMap = OpenMetaverse.StructuredData.OSDMap;
namespace OpenSim.Region.CoreModules.Media.Moap namespace OpenSim.Region.CoreModules.World.Media.Moap
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
public class MoapModule : INonSharedRegionModule, IMoapModule public class MoapModule : INonSharedRegionModule, IMoapModule
@ -225,27 +225,65 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return me; return me;
} }
/// <summary>
/// Set the media entry on the face of the given part.
/// </summary>
/// <param name="part">/param>
/// <param name="face"></param>
/// <param name="me">If null, then the media entry is cleared.</param>
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
{ {
// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
CheckFaceParam(part, face); CheckFaceParam(part, face);
if (null == part.Shape.Media) if (null == part.Shape.Media)
part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); {
if (me == null)
return;
else
part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
}
lock (part.Shape.Media) lock (part.Shape.Media)
part.Shape.Media[face] = me; part.Shape.Media[face] = me;
UpdateMediaUrl(part, UUID.Zero); UpdateMediaUrl(part, UUID.Zero);
SetPartMediaFlags(part, face, me != null);
//part.ScheduleFullUpdate(); //part.ScheduleFullUpdate();
part.ScheduleFullUpdate(new List<SceneObjectPartProperties>(){SceneObjectPartProperties.MediaUrl}); part.ScheduleFullUpdate(new List<SceneObjectPartProperties>() { SceneObjectPartProperties.MediaUrl, SceneObjectPartProperties.Shape});
part.TriggerScriptChangedEvent(Changed.MEDIA); part.TriggerScriptChangedEvent(Changed.MEDIA);
} }
/// <summary>
/// Clear the media entry from the face of the given part.
/// </summary>
/// <param name="part"></param>
/// <param name="face"></param>
public void ClearMediaEntry(SceneObjectPart part, int face) public void ClearMediaEntry(SceneObjectPart part, int face)
{ {
SetMediaEntry(part, face, null); SetMediaEntry(part, face, null);
} }
/// <summary>
/// Set the media flags on the texture face of the given part.
/// </summary>
/// <remarks>
/// The fact that we need a separate function to do what should be a simple one line operation is BUTT UGLY.
/// </remarks>
/// <param name="part"></param>
/// <param name="face"></param>
/// <param name="flag"></param>
protected void SetPartMediaFlags(SceneObjectPart part, int face, bool flag)
{
Primitive.TextureEntry te = part.Shape.Textures;
Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
teFace.MediaFlags = flag;
part.Shape.Textures = te;
}
/// <summary> /// <summary>
/// Sets or gets per face media textures. /// Sets or gets per face media textures.
/// </summary> /// </summary>
@ -334,7 +372,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
} }
// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); // m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
//
// for (int i = 0; i < omu.FaceMedia.Length; i++) // for (int i = 0; i < omu.FaceMedia.Length; i++)
// { // {
// MediaEntry me = omu.FaceMedia[i]; // MediaEntry me = omu.FaceMedia[i];
@ -369,10 +407,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
// FIXME: Race condition here since some other texture entry manipulator may overwrite/get // FIXME: Race condition here since some other texture entry manipulator may overwrite/get
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
// directly. // directly.
Primitive.TextureEntry te = part.Shape.Textures; SetPartMediaFlags(part, i, true);
Primitive.TextureEntryFace face = te.CreateFace((uint)i);
face.MediaFlags = true;
part.Shape.Textures = te;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}", // "[MOAP]: Media flags for face {0} is {1}",
// i, part.Shape.Textures.FaceTextures[i].MediaFlags); // i, part.Shape.Textures.FaceTextures[i].MediaFlags);
@ -381,6 +416,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap
} }
else else
{ {
// m_log.DebugFormat("[MOAP]: Setting existing media list for {0}", part.Name);
// We need to go through the media textures one at a time to make sure that we have permission // We need to go through the media textures one at a time to make sure that we have permission
// to change them // to change them
@ -402,8 +439,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
if (null == media[i]) if (null == media[i])
continue; continue;
Primitive.TextureEntryFace face = te.CreateFace((uint)i); SetPartMediaFlags(part, i, true);
face.MediaFlags = true;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}", // "[MOAP]: Media flags for face {0} is {1}",

View File

@ -0,0 +1,103 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.World.Media.Moap;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
{
[TestFixture]
public class MoapTests
{
protected TestScene m_scene;
protected MoapModule m_module;
[SetUp]
public void SetUp()
{
m_module = new MoapModule();
m_scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(m_scene, m_module);
}
[Test]
public void TestClearMediaUrl()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
MediaEntry me = new MediaEntry();
m_module.SetMediaEntry(part, 1, me);
m_module.ClearMediaEntry(part, 1);
Assert.That(part.Shape.Media[1], Is.EqualTo(null));
// Although we've cleared one face, other faces may still be present. So we need to check for an
// update media url version
Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000001/" + UUID.Zero));
// By changing media flag to false, the face texture once again becomes identical to the DefaultTexture.
// Therefore, when libOMV reserializes it, it disappears and we are left with no face texture in this slot.
// Not at all confusing, eh?
Assert.That(part.Shape.Textures.FaceTextures[1], Is.Null);
}
[Test]
public void TestSetMediaUrl()
{
TestHelper.InMethod();
string homeUrl = "opensimulator.org";
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
MediaEntry me = new MediaEntry() { HomeURL = homeUrl };
m_module.SetMediaEntry(part, 1, me);
Assert.That(part.Shape.Media[1].HomeURL, Is.EqualTo(homeUrl));
Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000000/" + UUID.Zero));
Assert.That(part.Shape.Textures.FaceTextures[1].MediaFlags, Is.True);
}
}
}

View File

@ -482,6 +482,8 @@ namespace OpenSim.Region.Framework.Scenes
// Passing something to another avatar or a an object will already // Passing something to another avatar or a an object will already
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item); item = InventoryService.GetItem(item);
if (item.Owner != remoteClient.AgentId)
return;
if (item != null) if (item != null)
{ {

View File

@ -83,6 +83,13 @@ namespace OpenSim.Region.Framework.Scenes
public bool m_useFlySlow; public bool m_useFlySlow;
public bool m_usePreJump; public bool m_usePreJump;
public bool m_seeIntoRegionFromNeighbor; public bool m_seeIntoRegionFromNeighbor;
protected float m_defaultDrawDistance = 255.0f;
public float DefaultDrawDistance
{
get { return m_defaultDrawDistance; }
}
// TODO: need to figure out how allow client agents but deny // TODO: need to figure out how allow client agents but deny
// root agents when ACL denies access to root agent // root agents when ACL denies access to root agent
public bool m_strictAccessControl = true; public bool m_strictAccessControl = true;
@ -129,7 +136,16 @@ namespace OpenSim.Region.Framework.Scenes
protected ICapabilitiesModule m_capsModule; protected ICapabilitiesModule m_capsModule;
// Central Update Loop // Central Update Loop
protected int m_fps = 10; protected int m_fps = 10;
protected uint m_frame;
/// <summary>
/// Current scene frame number
/// </summary>
public uint Frame
{
get;
protected set;
}
protected float m_timespan = 0.089f; protected float m_timespan = 0.089f;
protected DateTime m_lastupdate = DateTime.UtcNow; protected DateTime m_lastupdate = DateTime.UtcNow;
@ -1027,15 +1043,13 @@ namespace OpenSim.Region.Framework.Scenes
// //
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.Configs["Startup"];
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
//Animation states //Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
// TODO: Change default to true once the feature is supported // TODO: Change default to true once the feature is supported
m_usePreJump = startupConfig.GetBoolean("enableprejump", false); m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
m_maxNonphys = 256f;
m_maxPhys = 256f;
/*
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0) if (RegionInfo.NonphysPrimMax > 0)
{ {
@ -1048,7 +1062,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_maxPhys = RegionInfo.PhysPrimMax; m_maxPhys = RegionInfo.PhysPrimMax;
} }
*/
// Here, if clamping is requested in either global or // Here, if clamping is requested in either global or
// local config, it will be used // local config, it will be used
@ -1422,7 +1435,7 @@ namespace OpenSim.Region.Framework.Scenes
// This is the method that shuts down the scene. // This is the method that shuts down the scene.
public override void Close() public override void Close()
{ {
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", m_regionName); m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
m_restartTimer.Stop(); m_restartTimer.Stop();
m_restartTimer.Close(); m_restartTimer.Close();
@ -1449,7 +1462,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_heartbeatTimer.Close(); //m_heartbeatTimer.Close();
shuttingdown = true; shuttingdown = true;
m_log.DebugFormat("[SCENE ({0})]: Persisting changed objects", m_regionName); m_log.Debug("[SCENE]: Persisting changed objects for region " + m_regionName);
EntityBase[] entities = GetEntities(); EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities) foreach (EntityBase entity in entities)
{ {
@ -1617,7 +1630,8 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
Update(); while (!shuttingdown)
Update();
m_lastUpdate = Util.EnvironmentTickCount(); m_lastUpdate = Util.EnvironmentTickCount();
m_firstHeartbeat = false; m_firstHeartbeat = false;
@ -1634,228 +1648,204 @@ namespace OpenSim.Region.Framework.Scenes
Watchdog.RemoveThread(); Watchdog.RemoveThread();
} }
/// <summary>
/// Performs per-frame updates on the scene, this should be the central scene loop
/// </summary>
public override void Update() public override void Update()
{ {
float physicsFPS; TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
int maintc; 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; // Check if any objects have reached their targets
physicsFPS = 0f; CheckAtTargets();
maintc = Util.EnvironmentTickCount(); // Update SceneObjectGroups that have scheduled themselves for updates
int tmpFrameMS = maintc; // Objects queue their updates onto all scene presences
tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; if (Frame % m_update_objects == 0)
m_sceneGraph.UpdateObjectGroups();
// Increment the frame counter // Run through all ScenePresences looking for updates
++m_frame; // Presence updates and queued object updates for each presence are sent to clients
if (IsSyncedClient())
try
{ {
// Check if any objects have reached their targets // If it's a client manager, just send prim updates
CheckAtTargets(); // This will get fixed later to only send to locally logged in presences rather than all presences
// but requires pulling apart the concept of a client from the concept of a presence/avatar
// Update SceneObjectGroups that have scheduled themselves for updates ForEachScenePresence(delegate(ScenePresence sp) { sp.SendPrimUpdates(); });
// Objects queue their updates onto all scene presences if(Frame % 20 == 0)
if (m_frame % m_update_objects == 0) RegionSyncClientModule.SendCoarseLocations();
m_sceneGraph.UpdateObjectGroups(); // make border crossing work in the CMs
m_sceneGraph.ForEachScenePresence(delegate(ScenePresence sp)
// Run through all ScenePresences looking for updates {
// Presence updates and queued object updates for each presence are sent to clients
// If it's a client manager, just send prim updates
// This will get fixed later to only send to locally logged in presences rather than all presences
// but requires pulling apart the concept of a client from the concept of a presence/avatar
if (IsSyncedClient())
{
ForEachScenePresence(delegate(ScenePresence sp) { sp.SendPrimUpdates(); });
if(m_frame % 20 == 0)
RegionSyncClientModule.SendCoarseLocations();
// make border crossing work in the CMs
m_sceneGraph.ForEachScenePresence(delegate(ScenePresence sp)
{
if (!sp.IsChildAgent) if (!sp.IsChildAgent)
{ {
// Check that we have a physics actor or we're sitting on something // Check that we have a physics actor or we're sitting on something
if (sp.ParentID == 0 && sp.PhysicsActor != null || sp.ParentID != 0) if (sp.ParentID == 0 && sp.PhysicsActor != null || sp.ParentID != 0)
{ {
sp.CheckForBorderCrossing(); sp.CheckForBorderCrossing();
}
} }
}); }
} });
else
{
if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences();
}
// REGION SYNC
// If this is a synced server, send updates to client managers at this time
// This batches updates, but the client manager will forward on to clients without
// additional delay
if (IsSyncedServer())
{
m_regionSyncServerModule.SendUpdates();
}
//SYMMETRIC SYNC
//NOTE: If it is configured as symmetric sync in opensim.ini, the above IsSyncedServer() or IsSyncedClient() should all return false
if (RegionSyncModule != null)
{
RegionSyncModule.SendSceneUpdates();
}
//end of SYMMETRIC SYNC
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
// Do not simulate physics locally if this is a synced client
//if (!IsSyncedClient())
if (IsSyncedServer() || IsPhysEngineActor())
{
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
m_sceneGraph.UpdatePreparePhysics();
}
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
// Do not simulate physics locally if this is a synced client
//if (!IsSyncedClient())
if (IsSyncedServer() || IsPhysEngineActor())
{
if (m_frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateScenePresenceMovement();
}
// Perform the main physics update. This will do the actual work of moving objects and avatars according to their
// velocity
int tmpPhysicsMS = Util.EnvironmentTickCount();
// Do not simulate physics locally if this is a synced client
//if (!IsSyncedClient())
if (IsSyncedServer() || IsPhysEngineActor())
{
if (m_frame % m_update_physics == 0)
{
if (m_physics_enabled)
physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
if (SynchronizeScene != null)
SynchronizeScene(this);
}
}
physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
// Delete temp-on-rez stuff
if (m_frame % 1000 == 0 && !m_cleaningTemps)
{
int tmpTempOnRezMS = Util.EnvironmentTickCount();
m_cleaningTemps = true;
Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
}
if (RegionStatus != RegionStatus.SlaveScene)
{
if (m_frame % m_update_events == 0)
{
int evMS = Util.EnvironmentTickCount();
UpdateEvents();
eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
}
if (m_frame % m_update_backup == 0)
{
int backMS = Util.EnvironmentTickCount();
UpdateStorageBackup();
backupMS = Util.EnvironmentTickCountSubtract(backMS);
}
if (m_frame % m_update_terrain == 0)
{
int terMS = Util.EnvironmentTickCount();
UpdateTerrain();
terrainMS = Util.EnvironmentTickCountSubtract(terMS);
}
//if (m_frame % m_update_land == 0)
//{
// int ldMS = Util.EnvironmentTickCount();
// UpdateLand();
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
//}
frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
lastCompletedFrame = Util.EnvironmentTickCount();
// if (m_frame%m_update_avatars == 0)
// UpdateInWorldTime();
StatsReporter.AddPhysicsFPS(physicsFPS);
StatsReporter.AddTimeDilation(TimeDilation);
StatsReporter.AddFPS(1);
StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
StatsReporter.addFrameMS(frameMS);
StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
StatsReporter.addOtherMS(otherMS);
StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
}
if (LoginsDisabled && m_frame == 20)
{
// In 99.9% of cases it is a bad idea to manually force garbage collection. However,
// this is a rare case where we know we have just went through a long cycle of heap
// allocations, and there is no more work to be done until someone logs in
GC.Collect();
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<INeighbourService>(), RegionInfo);
}
}
} }
catch (NotImplementedException) else
{ {
throw; if (Frame % m_update_presences == 0)
} m_sceneGraph.UpdatePresences();
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); // REGION SYNC
maintc = (int)(m_timespan * 1000) - maintc; // If this is a synced server, send updates to client managers at this time
// This batches updates, but the client manager will forward on to clients without
// additional delay
if (IsSyncedServer())
{
m_regionSyncServerModule.SendUpdates();
}
if (maintc > 0) //SYMMETRIC SYNC
Thread.Sleep(maintc);
// Tell the watchdog that this thread is still alive //NOTE: If it is configured as symmetric sync in opensim.ini, the above IsSyncedServer() or IsSyncedClient() should all return false
Watchdog.UpdateThread(); if (RegionSyncModule != null)
{
RegionSyncModule.SendSceneUpdates();
}
//end of SYMMETRIC SYNC
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
if ((Frame % m_update_physics == 0) && m_physics_enabled && (IsSyncedServer() || IsPhysEngineActor()))
m_sceneGraph.UpdatePreparePhysics();
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
// Apply any pending avatar force input to the avatar's velocity
if (Frame % m_update_entitymovement == 0 && (IsSyncedServer() || IsPhysEngineActor()))
m_sceneGraph.UpdateScenePresenceMovement();
// Perform the main physics update. This will do the actual work of moving objects and avatars according to their
// velocity
int tmpPhysicsMS = Util.EnvironmentTickCount();
if (Frame % m_update_physics == 0 && (IsSyncedServer() || IsPhysEngineActor()))
{
if (m_physics_enabled)
physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
if (SynchronizeScene != null)
SynchronizeScene(this);
}
physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
// Delete temp-on-rez stuff
if (Frame % 1000 == 0 && !m_cleaningTemps)
{
int tmpTempOnRezMS = Util.EnvironmentTickCount();
m_cleaningTemps = true;
Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
}
if (RegionStatus != RegionStatus.SlaveScene)
{
if (Frame % m_update_events == 0)
{
int evMS = Util.EnvironmentTickCount();
UpdateEvents();
eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
}
if (Frame % m_update_backup == 0)
{
int backMS = Util.EnvironmentTickCount();
UpdateStorageBackup();
backupMS = Util.EnvironmentTickCountSubtract(backMS);
}
if (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);
//}
frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
lastCompletedFrame = Util.EnvironmentTickCount();
// if (Frame%m_update_avatars == 0)
// UpdateInWorldTime();
StatsReporter.AddPhysicsFPS(physicsFPS);
StatsReporter.AddTimeDilation(TimeDilation);
StatsReporter.AddFPS(1);
StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
StatsReporter.addFrameMS(frameMS);
StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
StatsReporter.addOtherMS(otherMS);
StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
}
if (LoginsDisabled && Frame == 20)
{
// In 99.9% of cases it is a bad idea to manually force garbage collection. However,
// this is a rare case where we know we have just went through a long cycle of heap
// allocations, and there is no more work to be done until someone logs in
GC.Collect();
IConfig startupConfig = m_config.Configs["Startup"];
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
{
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsDisabled = false;
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
}
}
} }
catch (NotImplementedException)
{
throw;
}
catch (AccessViolationException e)
{
m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
}
//catch (NullReferenceException e)
//{
// m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
//}
catch (InvalidOperationException e)
{
m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
}
catch (Exception e)
{
m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
}
finally
{
m_lastupdate = DateTime.UtcNow;
}
maintc = Util.EnvironmentTickCountSubtract(maintc);
maintc = (int)(m_timespan * 1000) - maintc;
if (maintc > 0)
Thread.Sleep(maintc);
// Tell the watchdog that this thread is still alive
Watchdog.UpdateThread();
} }
public void GetCoarseLocations(out List<UUID> ids, out List<Vector3> locations) public void GetCoarseLocations(out List<UUID> ids, out List<Vector3> locations)
@ -3565,7 +3555,7 @@ namespace OpenSim.Region.Framework.Scenes
// If there is a CAPS handler, remove it now. // If there is a CAPS handler, remove it now.
// A Synced server region will not have a CAPS handler for its presences // A Synced server region will not have a CAPS handler for its presences
if(CapsModule.GetCapsHandlerForUser(agentID) != null) if(CapsModule != null && CapsModule.GetCapsHandlerForUser(agentID) != null)
CapsModule.RemoveCapsHandler(agentID); CapsModule.RemoveCapsHandler(agentID);
// REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
@ -3777,7 +3767,7 @@ namespace OpenSim.Region.Framework.Scenes
// TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
// Don't disable this log message - it's too helpful // Don't disable this log message - it's too helpful
m_log.InfoFormat( m_log.DebugFormat(
"[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})",
RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
agent.AgentID, agent.circuitcode, teleportFlags); agent.AgentID, agent.circuitcode, teleportFlags);
@ -3843,8 +3833,11 @@ namespace OpenSim.Region.Framework.Scenes
RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
agent.AgentID, agent.circuitcode); agent.AgentID, agent.circuitcode);
CapsModule.NewUserConnection(agent); if (CapsModule != null)
CapsModule.AddCapsHandler(agent.AgentID); {
CapsModule.NewUserConnection(agent);
CapsModule.AddCapsHandler(agent.AgentID);
}
} }
else else
{ {
@ -3859,7 +3852,9 @@ namespace OpenSim.Region.Framework.Scenes
agent.AgentID, RegionInfo.RegionName); agent.AgentID, RegionInfo.RegionName);
sp.AdjustKnownSeeds(); sp.AdjustKnownSeeds();
CapsModule.NewUserConnection(agent);
if (CapsModule != null)
CapsModule.NewUserConnection(agent);
} }
} }
@ -4347,15 +4342,15 @@ namespace OpenSim.Region.Framework.Scenes
public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
Vector3 lookat, uint teleportFlags) Vector3 lookat, uint teleportFlags)
{ {
GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1);
if (regionInfo == null) if (regions == null || regions.Count == 0)
{ {
// can't find the region: Tell viewer and abort // can't find the region: Tell viewer and abort
remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
return; return;
} }
RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags);
} }
/// <summary> /// <summary>
@ -5508,8 +5503,9 @@ namespace OpenSim.Region.Framework.Scenes
// from logging into the region, teleporting into the region // from logging into the region, teleporting into the region
// or corssing the broder walking, but will NOT prevent // or corssing the broder walking, but will NOT prevent
// child agent creation, thereby emulating the SL behavior. // 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; return true;
} }
} }

View File

@ -213,9 +213,10 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i)
{ {
ScenePresence sp = presences[i]; ScenePresence sp = presences[i];
// If this presence is a child agent, we don't want its coarse locations // If this presence is a child agent, we don't want its coarse locations
if (sp.IsChildAgent) if (sp.IsChildAgent)
return; continue;
if (sp.ParentID != 0) if (sp.ParentID != 0)
{ {

View File

@ -166,7 +166,7 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_physActor; } get { return m_physActor; }
set set
{ {
m_log.DebugFormat("[SCENE OBJECT PART]: PhysActor set to {0} for {1} {2}", value, Name, UUID); //m_log.DebugFormat("[SCENE OBJECT PART]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
m_physActor = value; m_physActor = value;
} }
} }
@ -5450,6 +5450,7 @@ namespace OpenSim.Region.Framework.Scenes
localPart.EveryoneMask = updatedPart.EveryoneMask; localPart.EveryoneMask = updatedPart.EveryoneMask;
localPart.NextOwnerMask = updatedPart.NextOwnerMask; localPart.NextOwnerMask = updatedPart.NextOwnerMask;
localPart.Flags = updatedPart.Flags; localPart.Flags = updatedPart.Flags;
localPart.LocalFlags = updatedPart.LocalFlags;
//We will update CollisionSound with special care so that it does not lead to ScheduleFullUpdate of this part, to make the actor think it just made an update and //We will update CollisionSound with special care so that it does not lead to ScheduleFullUpdate of this part, to make the actor think it just made an update and
//need to propogate that update to other actors. //need to propogate that update to other actors.
@ -5512,7 +5513,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart localPart = this; SceneObjectPart localPart = this;
PhysicsActor pa = localPart.PhysActor; PhysicsActor pa = localPart.PhysActor;
m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString()); //m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString());
lock (m_bucketUpdateLocks[bucketName]) lock (m_bucketUpdateLocks[bucketName])
{ {
@ -5830,8 +5831,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (updatedProperties != null && updatedProperties.Count > 0) if (updatedProperties != null && updatedProperties.Count > 0)
{ {
m_log.DebugFormat("{0}: Tainting bucket for properties {1}", //m_log.DebugFormat("{0}: Tainting bucket for properties {1}",
"[SCENE OBJECT PART]", updatedProperties.ToString()); // "[SCENE OBJECT PART]", updatedProperties.ToString());
foreach (SceneObjectPartProperties property in updatedProperties) foreach (SceneObjectPartProperties property in updatedProperties)
{ {
TaintBucketSyncInfo(property); TaintBucketSyncInfo(property);

View File

@ -658,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
Utils.LongToUInts(handle, out x, out y); Utils.LongToUInts(handle, out x, out y);
x = x / Constants.RegionSize; x = x / Constants.RegionSize;
y = y / Constants.RegionSize; y = y / Constants.RegionSize;
if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY))
{ {
old.Add(handle); old.Add(handle);
} }
@ -732,6 +732,7 @@ namespace OpenSim.Region.Framework.Scenes
private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
{ {
m_DrawDistance = world.DefaultDrawDistance;
m_rootRegionHandle = reginfo.RegionHandle; m_rootRegionHandle = reginfo.RegionHandle;
m_controllingClient = client; m_controllingClient = client;
m_firstname = m_controllingClient.FirstName; m_firstname = m_controllingClient.FirstName;
@ -1206,7 +1207,9 @@ namespace OpenSim.Region.Framework.Scenes
if (m_agentTransfer != null) if (m_agentTransfer != null)
m_agentTransfer.EnableChildAgents(this); m_agentTransfer.EnableChildAgents(this);
else 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<IFriendsModule>(); IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (friendsModule != null) if (friendsModule != null)
@ -1355,7 +1358,11 @@ namespace OpenSim.Region.Framework.Scenes
m_CameraUpAxis = agentData.CameraUpAxis; m_CameraUpAxis = agentData.CameraUpAxis;
// The Agent's Draw distance setting // The Agent's Draw distance setting
m_DrawDistance = agentData.Far; // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the
// region's draw distance.
// m_DrawDistance = agentData.Far;
m_DrawDistance = Scene.DefaultDrawDistance;
// Check if Client has camera in 'follow cam' or 'build' mode. // Check if Client has camera in 'follow cam' or 'build' mode.
Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation);
@ -2524,7 +2531,7 @@ namespace OpenSim.Region.Framework.Scenes
// If we are using the the cached appearance then send it out to everyone // If we are using the the cached appearance then send it out to everyone
if (cachedappearance) if (cachedappearance)
{ {
m_log.InfoFormat("[SCENE PRESENCE]: baked textures are in the cache for {0}", Name); m_log.DebugFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
// If the avatars baked textures are all in the cache, then we have a // If the avatars baked textures are all in the cache, then we have a
// complete appearance... send it out, if not, then we'll send it when // complete appearance... send it out, if not, then we'll send it when
@ -2762,8 +2769,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Border Crossing Methods #region Border Crossing Methods
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
/// <remarks>
/// Also removes the avatar from the physical scene if transit has started.
/// </remarks>
public void CheckForBorderCrossing() public void CheckForBorderCrossing()
{ {
if (IsChildAgent) if (IsChildAgent)
@ -2831,7 +2841,6 @@ namespace OpenSim.Region.Framework.Scenes
neighbor = HaveNeighbor(Cardinals.N, ref fix); neighbor = HaveNeighbor(Cardinals.N, ref fix);
} }
// Makes sure avatar does not end up outside region // Makes sure avatar does not end up outside region
if (neighbor <= 0) if (neighbor <= 0)
{ {
@ -2886,6 +2895,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
else 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 // This constant has been inferred from experimentation
// I'm not sure what this value should be, so I tried a few values. // I'm not sure what this value should be, so I tried a few values.
timeStep = 0.04f; timeStep = 0.04f;
@ -2897,6 +2913,15 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Checks whether this region has a neighbour in the given direction.
/// </summary>
/// <param name="car"></param>
/// <param name="fix"></param>
/// <returns>
/// 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.
/// </returns>
protected int HaveNeighbor(Cardinals car, ref int[] fix) protected int HaveNeighbor(Cardinals car, ref int[] fix)
{ {
uint neighbourx = m_regionInfo.RegionLocX; uint neighbourx = m_regionInfo.RegionLocX;
@ -3003,7 +3028,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
//m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY))
{ {
byebyeRegions.Add(handle); byebyeRegions.Add(handle);
} }
@ -3079,7 +3104,12 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 offset = new Vector3(shiftx, shifty, 0f); Vector3 offset = new Vector3(shiftx, shifty, 0f);
m_DrawDistance = cAgentData.Far; // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the
// region's draw distance.
// m_DrawDistance = cAgentData.Far;
m_DrawDistance = Scene.DefaultDrawDistance;
if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!!
m_pos = cAgentData.Position + offset; m_pos = cAgentData.Position + offset;
@ -3229,7 +3259,11 @@ namespace OpenSim.Region.Framework.Scenes
m_CameraLeftAxis = cAgent.LeftAxis; m_CameraLeftAxis = cAgent.LeftAxis;
m_CameraUpAxis = cAgent.UpAxis; m_CameraUpAxis = cAgent.UpAxis;
m_DrawDistance = cAgent.Far; // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the
// region's draw distance.
// m_DrawDistance = cAgent.Far;
m_DrawDistance = Scene.DefaultDrawDistance;
if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgent.Throttles); ControllingClient.SetChildAgentThrottle(cAgent.Throttles);

View File

@ -330,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
//SYMMETRIC SYNC //SYMMETRIC SYNC
//m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags); m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags);
//m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp); //m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp);
//m_SOPXmlProcessors.Add("LastUpdateActorID", ProcessLastUpdateActorID); //m_SOPXmlProcessors.Add("LastUpdateActorID", ProcessLastUpdateActorID);
m_SOPXmlProcessors.Add("IsAttachment", ProcessIsAttachment); m_SOPXmlProcessors.Add("IsAttachment", ProcessIsAttachment);
@ -718,13 +718,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{ {
obj.LastUpdateActorID = reader.ReadElementContentAsString("LastUpdateActorID", string.Empty); obj.LastUpdateActorID = reader.ReadElementContentAsString("LastUpdateActorID", string.Empty);
} }
* */
private static void ProcessLocalFlags(SceneObjectPart obj, XmlTextReader reader) private static void ProcessLocalFlags(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.LocalFlags = Util.ReadEnum<PrimFlags>(reader, "LocalFlags"); obj.LocalFlags = Util.ReadEnum<PrimFlags>(reader, "LocalFlags");
} }
* */
private static void ProcessIsAttachment(SceneObjectPart obj, XmlTextReader reader) private static void ProcessIsAttachment(SceneObjectPart obj, XmlTextReader reader)
{ {
@ -1273,7 +1274,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
//SYMMETRIC SYNC: also serialize SceneObjectPart:LocalFlags, so that it can be propogated across actors //SYMMETRIC SYNC: also serialize SceneObjectPart:LocalFlags, so that it can be propogated across actors
WriteFlags(writer, "Flags", sop.Flags.ToString(), options); WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
//WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options); WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options);
//end SYMMETRIC SYNC //end SYMMETRIC SYNC
WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());

View File

@ -0,0 +1,174 @@
/*
* 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
{
/// <summary>
/// Attachment tests
/// </summary>
[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);
}
[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();
}
}
}

View File

@ -40,6 +40,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.Framework.EntityTransfer;
using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
@ -116,9 +117,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
agent.child = true; agent.child = true;
if (scene.PresenceService == null)
Console.WriteLine("Presence Service is null");
scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
string reason; string reason;
@ -176,25 +174,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(neighbours.Count, Is.EqualTo(2)); 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] [Test]
public void T013_TestRemoveNeighbourRegion() public void T013_TestRemoveNeighbourRegion()
{ {
@ -212,23 +191,35 @@ namespace OpenSim.Region.Framework.Scenes.Tests
*/ */
} }
// I'm commenting this test, because this is not supposed to happen here /// <summary>
//[Test] /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
public void T020_TestMakeRootAgent() /// </summary>
/// <remarks>
/// Please note that unlike the other tests here, this doesn't rely on structures
/// </remarks>
[Test]
public void TestChildAgentEstablished()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
ScenePresence presence = scene.GetScenePresence(agent1); UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
Assert.That(presence.IsChildAgent, Is.False, "Starts out as a root agent");
presence.MakeChildAgent(); TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
Assert.That(presence.IsChildAgent, Is.True, "Did not change to child agent after MakeChildAgent"); TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
// Accepts 0 but rejects Constants.RegionSize IConfigSource configSource = new IniConfigSource();
Vector3 pos = new Vector3(0,unchecked(Constants.RegionSize-1),0); configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
presence.MakeRootAgent(pos,true); EntityTransferModule etm = new EntityTransferModule();
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"); SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);
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 it does not represent // I'm commenting this test because it does not represent
@ -334,60 +325,23 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
} }
[Test] public void fixNullPresence()
public void T030_TestAddAttachments()
{ {
TestHelper.InMethod(); string firstName = "testfirstname";
ScenePresence presence = scene.GetScenePresence(agent1); 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();
presence.AddAttachment(sog1); acd1 = agent;
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()
{
if (MainServer.Instance != null) MainServer.Instance.Stop();
} }
public static string GetRandomCapsObjectPath() public static string GetRandomCapsObjectPath()

View File

@ -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
{
/// <summary>
/// Scene presence tests
/// </summary>
[TestFixture]
public class SceneTests
{
/// <summary>
/// Very basic scene update test. Should become more elaborate with time.
/// </summary>
[Test]
public void TestUpdateScene()
{
TestHelper.InMethod();
Scene scene = SceneSetupHelpers.SetupScene();
scene.Update();
Assert.That(scene.Frame, Is.EqualTo(1));
}
}
}

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")]
public class LindenUDPInfoModule : ISharedRegionModule public class LindenUDPInfoModule : ISharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();

View File

@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private static string m_freeSwitchUrlResetPassword; private static string m_freeSwitchUrlResetPassword;
private uint m_freeSwitchServicePort; private uint m_freeSwitchServicePort;
private string m_openSimWellKnownHTTPAddress; private string m_openSimWellKnownHTTPAddress;
private string m_freeSwitchContext; // private string m_freeSwitchContext;
private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
@ -144,7 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_freeSwitchDefaultWellKnownIP = map["DefaultWellKnownIP"].AsString(); m_freeSwitchDefaultWellKnownIP = map["DefaultWellKnownIP"].AsString();
m_freeSwitchDefaultTimeout = map["DefaultTimeout"].AsInteger(); m_freeSwitchDefaultTimeout = map["DefaultTimeout"].AsInteger();
m_freeSwitchUrlResetPassword = String.Empty; m_freeSwitchUrlResetPassword = String.Empty;
m_freeSwitchContext = map["Context"].AsString(); // m_freeSwitchContext = map["Context"].AsString();
if (String.IsNullOrEmpty(m_freeSwitchRealm) || if (String.IsNullOrEmpty(m_freeSwitchRealm) ||
String.IsNullOrEmpty(m_freeSwitchAPIPrefix)) String.IsNullOrEmpty(m_freeSwitchAPIPrefix))
@ -662,7 +662,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
resp.Append("</buddies><groups></groups></body></level0></response>"); resp.Append("</buddies><groups></groups></body></level0></response>");
response["str_response_string"] = resp.ToString(); response["str_response_string"] = resp.ToString();
Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); // Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
//m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],"")); //m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],""));
return response; return response;
@ -671,9 +671,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request) public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request)
{ {
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called"); m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called");
string requestbody = (string)request["body"]; // string requestbody = (string)request["body"];
string uri = (string)request["uri"]; // string uri = (string)request["uri"];
string contenttype = (string)request["content-type"]; // string contenttype = (string)request["content-type"];
Hashtable requestBody = ParseRequestBody((string)request["body"]); Hashtable requestBody = ParseRequestBody((string)request["body"]);

View File

@ -712,7 +712,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
GroupMembershipData data = null; GroupMembershipData data = null;
bool foundData = false; // bool foundData = false;
OSDMap UserGroupMemberInfo; OSDMap UserGroupMemberInfo;
if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo))

View File

@ -681,10 +681,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// //
CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 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); m_host.AddScriptLPS(1);
UUID agentId = new UUID(); UUID agentId = new UUID();
@ -693,25 +694,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentId); ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null) if (presence != null)
{ {
// agent must be over owners land to avoid abuse // For osTeleportAgent, agent must be over owners land to avoid abuse
if (m_host.OwnerID // For osTeleportOwner, this restriction isn't necessary
if (relaxRestrictions ||
m_host.OwnerID
== World.LandChannel.GetLandObject( == World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) 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<GridRegion> 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, World.RequestTeleportLocation(presence.ControllingClient, regionName,
new Vector3((float)position.x, (float)position.y, (float)position.z), 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); new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
@ -728,10 +717,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// //
CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 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)); ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
@ -742,8 +732,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentId); ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null) if (presence != null)
{ {
// agent must be over owners land to avoid abuse // For osTeleportAgent, agent must be over owners land to avoid abuse
if (m_host.OwnerID // For osTeleportOwner, this restriction isn't necessary
if (relaxRestrictions ||
m_host.OwnerID
== World.LandChannel.GetLandObject( == World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{ {
@ -766,7 +758,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 // Threat level None because this is what can already be done with the World Map in the viewer
CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); 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) public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
@ -778,7 +770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); 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. // Functions that get information from the agent itself.

View File

@ -115,15 +115,15 @@ namespace OpenSim.Server.Handlers.Grid
case "get_region_flags": case "get_region_flags":
return GetRegionFlags(request); return GetRegionFlags(request);
} }
m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[GRID HANDLER]: Exception {0}", e); m_log.ErrorFormat("[GRID HANDLER]: Exception {0} {1}", e.Message, e.StackTrace);
} }
return FailureResult(); return FailureResult();
} }
#region Method-specific handlers #region Method-specific handlers

View File

@ -341,10 +341,17 @@ namespace OpenSim.Server.Handlers.Simulation
GridRegion destination = new GridRegion(); GridRegion destination = new GridRegion();
destination.RegionID = regionID; 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["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) protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)

View File

@ -71,7 +71,7 @@ namespace OpenSim.Services.AuthenticationService
string hashed = Util.Md5Hash(password + ":" + string hashed = Util.Md5Hash(password + ":" +
data.Data["passwordSalt"].ToString()); 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) if (data.Data["passwordHash"].ToString() == hashed)
{ {

View File

@ -185,7 +185,7 @@ namespace OpenSim.Services.Connectors.Simulation
} }
// unreachable // unreachable
return true; // return true;
} }
/// <summary> /// <summary>
@ -256,8 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation
/// <summary> /// <summary>
/// </summary> /// </summary>
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); // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
IPEndPoint ext = destination.ExternalEndPoint; IPEndPoint ext = destination.ExternalEndPoint;
@ -272,7 +274,11 @@ namespace OpenSim.Services.Connectors.Simulation
try try
{ {
OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); 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 (!success)
{ {
if (result.ContainsKey("Message")) if (result.ContainsKey("Message"))
@ -283,8 +289,17 @@ 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"); 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; return true;
} }
reason = result["Message"];
} }
else
{
reason = "Communications failure";
}
return false;
} }
return success; return success;
} }
catch (Exception e) catch (Exception e)

View File

@ -271,6 +271,7 @@ namespace OpenSim.Services.GridService
{ {
List<GridRegion> rinfos = new List<GridRegion>(); List<GridRegion> rinfos = new List<GridRegion>();
RegionData region = m_Database.Get(regionID, scopeID); RegionData region = m_Database.Get(regionID, scopeID);
if (region != null) if (region != null)
{ {
// Not really? Maybe? // Not really? Maybe?
@ -278,15 +279,24 @@ namespace OpenSim.Services.GridService
region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID);
foreach (RegionData rdata in rdatas) foreach (RegionData rdata in rdatas)
{
if (rdata.RegionID != regionID) if (rdata.RegionID != regionID)
{ {
int flags = Convert.ToInt32(rdata.Data["flags"]); int flags = Convert.ToInt32(rdata.Data["flags"]);
if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
rinfos.Add(RegionData2RegionInfo(rdata)); 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; return rinfos;
} }

View File

@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
m_Check4096 = gridConfig.GetBoolean("Check4096", true); 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); m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);

View File

@ -253,7 +253,7 @@ namespace OpenSim.Services.HypergridService
TravelingAgentInfo travel = m_TravelingAgents[sessionID]; TravelingAgentInfo travel = m_TravelingAgents[sessionID];
return travel.GridExternalName == thisGridExternalName; return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower();
} }
public bool VerifyClient(UUID sessionID, string reportedIP) public bool VerifyClient(UUID sessionID, string reportedIP)

View File

@ -60,7 +60,7 @@ namespace OpenSim.Services.Interfaces
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); 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);
/// <summary> /// <summary>
/// Message from receiving region to departing region, telling it got contacted by the client. /// Message from receiving region to departing region, telling it got contacted by the client.

View File

@ -567,8 +567,11 @@ namespace OpenSim.Tests.Common.Mock
agentData.lastname = m_lastName; agentData.lastname = m_lastName;
ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>(); ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
agentData.CapsPath = capsModule.GetCapsPath(m_agentId); if (capsModule != null)
agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId)); {
agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
}
return agentData; return agentData;
} }

View File

@ -132,24 +132,11 @@ namespace OpenSim.Tests.Common.Setup
public static TestScene SetupScene( public static TestScene SetupScene(
string name, UUID id, uint x, uint y, String realServices) string name, UUID id, uint x, uint y, String realServices)
{ {
bool newScene = false;
Console.WriteLine("Setting up test scene {0}", name); 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 // 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"); RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
regInfo.RegionName = name; regInfo.RegionName = name;
regInfo.RegionID = id; regInfo.RegionID = id;
@ -164,50 +151,27 @@ namespace OpenSim.Tests.Common.Setup
TestScene testScene = new TestScene( TestScene testScene = new TestScene(
regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); 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(); IRegionModule godsModule = new GodsModule();
godsModule.Initialise(testScene, new IniConfigSource()); godsModule.Initialise(testScene, new IniConfigSource());
testScene.AddModule(godsModule.Name, godsModule); testScene.AddModule(godsModule.Name, godsModule);
realServices = realServices.ToLower(); realServices = realServices.ToLower();
// IConfigSource config = new IniConfigSource();
// If we have a brand new scene, need to initialize shared region modules if (realServices.Contains("asset"))
if ((m_assetService == null && m_inventoryService == null) || newScene) StartAssetService(testScene, true);
{
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
else else
{ StartAssetService(testScene, false);
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);
} // 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_inventoryService.PostInitialise();
m_assetService.PostInitialise(); m_assetService.PostInitialise();
@ -504,12 +468,10 @@ namespace OpenSim.Tests.Common.Setup
TestClient client = new TestClient(agentData, scene); TestClient client = new TestClient(agentData, scene);
scene.AddNewClient(client); scene.AddNewClient(client);
// Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
// inventory, etc.)
//scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
ScenePresence scp = scene.GetScenePresence(agentData.AgentID); 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; return client;
} }
@ -543,24 +505,5 @@ namespace OpenSim.Tests.Common.Setup
return part; return part;
} }
/// <summary>
/// Delete a scene object asynchronously
/// </summary>
/// <param name="scene"></param>
/// <param name="part"></param>
/// <param name="action"></param>
/// <param name="destinationId"></param>
/// <param name="client"></param>
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<uint>() { part.LocalId }, UUID.Zero, action, destinationId);
sogd.InventoryDeQueueAndDelete();
}
} }
} }

Binary file not shown.

Binary file not shown.

View File

@ -94,6 +94,13 @@
; Warning! Don't use this with regions that have existing content!, This will likely break them ; Warning! Don't use this with regions that have existing content!, This will likely break them
CombineContiguousRegions = false CombineContiguousRegions = false
; Extend the region's draw distance; 255m is the default which includes
; one neighbor on each side of the current region, 767m would go three
; neighbors on each side for a total of 49 regions in view. Warning, unless
; all the regions have the same drawdistance, you will end up with strange
; effects because the agents that get closed may be inconsistent.
; DefaultDrawDistance = 255.0
; If you have only one region in an instance, or to avoid the many bugs ; If you have only one region in an instance, or to avoid the many bugs
; that you can trigger in modules by restarting a region, set this to ; that you can trigger in modules by restarting a region, set this to
; true to make the entire instance exit instead of restarting the region. ; true to make the entire instance exit instead of restarting the region.

View File

@ -72,7 +72,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
AssetService = "OpenSim.Services.AssetService.dll:AssetService" AssetService = "OpenSim.Services.AssetService.dll:AssetService"
;; Directory for map tile images of linked regions ;; Directory for map tile images of linked regions
; MapTileDirectory = "./" ; MapTileDirectory = "./maptiles"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegionName> = "<flags>" ;; The syntax is: Region_<RegionName> = "<flags>"

View File

@ -43,7 +43,7 @@
;AllowHypergridMapSearch = true ;AllowHypergridMapSearch = true
;; Directory for map tile images of linked regions ;; Directory for map tile images of linked regions
; MapTileDirectory = "./" ; MapTileDirectory = "./maptiles"
[AvatarService] [AvatarService]
; ;

View File

@ -70,7 +70,7 @@
; Check4096 = true ; Check4096 = true
;; Directory for map tile images of remote regions ;; Directory for map tile images of remote regions
; MapTileDirectory = "./" ; MapTileDirectory = "./maptiles"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegioName> = "<flags>" ;; The syntax is: Region_<RegioName> = "<flags>"

View File

@ -2962,6 +2962,7 @@
<Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/>
<Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/> <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/>
<Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/> <Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/>
<Match path="World/Media/Moap/Tests" pattern="*.cs" recurse="true"/>
<Match path="World/Serialiser/Tests" pattern="*.cs" recurse="true"/> <Match path="World/Serialiser/Tests" pattern="*.cs" recurse="true"/>
<Match path="World/Terrain/Tests" pattern="*.cs" recurse="true"/> <Match path="World/Terrain/Tests" pattern="*.cs" recurse="true"/>
<Match path="ServiceConnectorsOut/Grid/Tests" pattern="*.cs" recurse="true"/> <Match path="ServiceConnectorsOut/Grid/Tests" pattern="*.cs" recurse="true"/>