diff options
author | Sean McNamara | 2011-02-28 15:08:35 -0500 |
---|---|---|
committer | Sean McNamara | 2011-02-28 15:08:35 -0500 |
commit | 60989521a6a60bb5610784936797df0683a55527 (patch) | |
tree | 51fd99afe41459221ff74a78be965001ff680df9 /OpenSim/Region/CoreModules | |
parent | Fix small bug with remove region; update settings docs. (diff) | |
parent | Fix a few little things (diff) | |
download | opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.zip opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.tar.gz opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.tar.bz2 opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.tar.xz |
Merge git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
5 files changed, 40 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 6ed4867..9adb68b 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -92,9 +92,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
92 | // Expiration is expressed in hours. | 92 | // Expiration is expressed in hours. |
93 | private const double m_DefaultMemoryExpiration = 1.0; | 93 | private const double m_DefaultMemoryExpiration = 1.0; |
94 | private const double m_DefaultFileExpiration = 48; | 94 | private const double m_DefaultFileExpiration = 48; |
95 | private TimeSpan m_MemoryExpiration = TimeSpan.Zero; | 95 | private TimeSpan m_MemoryExpiration = TimeSpan.FromHours(m_DefaultMemoryExpiration); |
96 | private TimeSpan m_FileExpiration = TimeSpan.Zero; | 96 | private TimeSpan m_FileExpiration = TimeSpan.FromHours(m_DefaultFileExpiration); |
97 | private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; | 97 | private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.FromHours(m_DefaultFileExpiration); |
98 | 98 | ||
99 | private static int m_CacheDirectoryTiers = 1; | 99 | private static int m_CacheDirectoryTiers = 1; |
100 | private static int m_CacheDirectoryTierLen = 3; | 100 | private static int m_CacheDirectoryTierLen = 3; |
@@ -147,7 +147,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
147 | } | 147 | } |
148 | 148 | ||
149 | m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); | 149 | m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); |
150 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory); | 150 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_CacheDirectory); |
151 | 151 | ||
152 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false); | 152 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false); |
153 | m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration)); | 153 | m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration)); |
@@ -245,16 +245,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
245 | private void UpdateMemoryCache(string key, AssetBase asset) | 245 | private void UpdateMemoryCache(string key, AssetBase asset) |
246 | { | 246 | { |
247 | if (m_MemoryCacheEnabled) | 247 | if (m_MemoryCacheEnabled) |
248 | { | 248 | m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration); |
249 | if (m_MemoryExpiration > TimeSpan.Zero) | ||
250 | { | ||
251 | m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration); | ||
252 | } | ||
253 | else | ||
254 | { | ||
255 | m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue); | ||
256 | } | ||
257 | } | ||
258 | } | 249 | } |
259 | 250 | ||
260 | public void Cache(AssetBase asset) | 251 | public void Cache(AssetBase asset) |
@@ -450,7 +441,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
450 | private void CleanupExpiredFiles(object source, ElapsedEventArgs e) | 441 | private void CleanupExpiredFiles(object source, ElapsedEventArgs e) |
451 | { | 442 | { |
452 | if (m_LogLevel >= 2) | 443 | if (m_LogLevel >= 2) |
453 | m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString()); | 444 | m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration); |
454 | 445 | ||
455 | // Purge all files last accessed prior to this point | 446 | // Purge all files last accessed prior to this point |
456 | DateTime purgeLine = DateTime.Now - m_FileExpiration; | 447 | DateTime purgeLine = DateTime.Now - m_FileExpiration; |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index f8ce444..08ac624 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId); | 170 | m_log.DebugFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId); |
171 | 171 | ||
172 | // If we only found default textures, then the appearance is not cached | 172 | // If we only found default textures, then the appearance is not cached |
173 | return (defonly ? false : true); | 173 | return (defonly ? false : true); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 98aa563..95c771e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
318 | agentCircuit.Id0 = currentAgentCircuit.Id0; | 318 | agentCircuit.Id0 = currentAgentCircuit.Id0; |
319 | } | 319 | } |
320 | 320 | ||
321 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 321 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
322 | { | 322 | { |
323 | // brand new agent, let's create a new caps seed | 323 | // brand new agent, let's create a new caps seed |
324 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 324 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
@@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
336 | // OK, it got this agent. Let's close some child agents | 336 | // OK, it got this agent. Let's close some child agents |
337 | sp.CloseChildAgents(newRegionX, newRegionY); | 337 | sp.CloseChildAgents(newRegionX, newRegionY); |
338 | IClientIPEndpoint ipepClient; | 338 | IClientIPEndpoint ipepClient; |
339 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 339 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
340 | { | 340 | { |
341 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 341 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); |
342 | #region IP Translation for NAT | 342 | #region IP Translation for NAT |
@@ -447,7 +447,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
447 | 447 | ||
448 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 448 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
449 | 449 | ||
450 | if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 450 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
451 | { | 451 | { |
452 | Thread.Sleep(5000); | 452 | Thread.Sleep(5000); |
453 | sp.Close(); | 453 | sp.Close(); |
@@ -521,14 +521,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
521 | return region; | 521 | return region; |
522 | } | 522 | } |
523 | 523 | ||
524 | protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 524 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) |
525 | { | 525 | { |
526 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | 526 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); |
527 | } | 527 | } |
528 | 528 | ||
529 | protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 529 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
530 | { | 530 | { |
531 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | 531 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); |
532 | } | 532 | } |
533 | 533 | ||
534 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) | 534 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) |
@@ -1045,7 +1045,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1045 | 1045 | ||
1046 | if (m_regionInfo != null) | 1046 | if (m_regionInfo != null) |
1047 | { | 1047 | { |
1048 | neighbours = RequestNeighbours(sp.Scene, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 1048 | neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
1049 | } | 1049 | } |
1050 | else | 1050 | else |
1051 | { | 1051 | { |
@@ -1272,8 +1272,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1272 | /// <param name="pRegionLocX"></param> | 1272 | /// <param name="pRegionLocX"></param> |
1273 | /// <param name="pRegionLocY"></param> | 1273 | /// <param name="pRegionLocY"></param> |
1274 | /// <returns></returns> | 1274 | /// <returns></returns> |
1275 | protected List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) | 1275 | protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) |
1276 | { | 1276 | { |
1277 | Scene pScene = avatar.Scene; | ||
1277 | RegionInfo m_regionInfo = pScene.RegionInfo; | 1278 | RegionInfo m_regionInfo = pScene.RegionInfo; |
1278 | 1279 | ||
1279 | Border[] northBorders = pScene.NorthBorders.ToArray(); | 1280 | Border[] northBorders = pScene.NorthBorders.ToArray(); |
@@ -1281,10 +1282,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1281 | Border[] eastBorders = pScene.EastBorders.ToArray(); | 1282 | Border[] eastBorders = pScene.EastBorders.ToArray(); |
1282 | Border[] westBorders = pScene.WestBorders.ToArray(); | 1283 | Border[] westBorders = pScene.WestBorders.ToArray(); |
1283 | 1284 | ||
1284 | // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. | 1285 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't |
1286 | // clear what should be done with a "far view" given that megaregions already extended the | ||
1287 | // view to include everything in the megaregion | ||
1285 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) | 1288 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) |
1286 | { | 1289 | { |
1287 | return pScene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); | 1290 | int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; |
1291 | |||
1292 | int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); | ||
1293 | int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); | ||
1294 | |||
1295 | int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); | ||
1296 | int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); | ||
1297 | |||
1298 | List<GridRegion> neighbours = | ||
1299 | avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); | ||
1300 | |||
1301 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | ||
1302 | return neighbours; | ||
1288 | } | 1303 | } |
1289 | else | 1304 | else |
1290 | { | 1305 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 35dcd95..79e76b4 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -130,9 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
130 | return region; | 130 | return region; |
131 | } | 131 | } |
132 | 132 | ||
133 | protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 133 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
134 | { | 134 | { |
135 | if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 135 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
136 | return true; | 136 | return true; |
137 | 137 | ||
138 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 138 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 7bb8789..798547a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -148,6 +148,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
148 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 148 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
149 | item = m_Scene.InventoryService.GetItem(item); | 149 | item = m_Scene.InventoryService.GetItem(item); |
150 | 150 | ||
151 | if (item.Owner != remoteClient.AgentId) | ||
152 | return UUID.Zero; | ||
153 | |||
151 | if (item != null) | 154 | if (item != null) |
152 | { | 155 | { |
153 | if ((InventoryType)item.InvType == InventoryType.Notecard) | 156 | if ((InventoryType)item.InvType == InventoryType.Notecard) |
@@ -524,6 +527,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
524 | 527 | ||
525 | if (item != null) | 528 | if (item != null) |
526 | { | 529 | { |
530 | item.Owner = remoteClient.AgentId; | ||
531 | |||
527 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 532 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
528 | 533 | ||
529 | if (rezAsset != null) | 534 | if (rezAsset != null) |