diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
11 files changed, 69 insertions, 270 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/Tests/TextureSenderTests.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/Tests/TextureSenderTests.cs deleted file mode 100644 index efa275c..0000000 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/Tests/TextureSenderTests.cs +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using NUnit.Framework; | ||
30 | using NUnit.Framework.SyntaxHelpers; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Tests.Common; | ||
34 | using OpenSim.Tests.Common.Mock; | ||
35 | |||
36 | namespace OpenSim.Region.CoreModules.Agent.TextureSender | ||
37 | { | ||
38 | [TestFixture] | ||
39 | public class UserTextureSenderTests | ||
40 | { | ||
41 | public UUID uuid1; | ||
42 | public UUID uuid2; | ||
43 | public UUID uuid3; | ||
44 | public UUID uuid4; | ||
45 | public int npackets, testsize; | ||
46 | public TestClient client; | ||
47 | public TextureSender ts; | ||
48 | public static Random random = new Random(); | ||
49 | |||
50 | [TestFixtureSetUp] | ||
51 | public void Init() | ||
52 | { | ||
53 | AgentCircuitData agent = new AgentCircuitData(); | ||
54 | agent.AgentID = UUID.Random(); | ||
55 | agent.firstname = "testfirstname"; | ||
56 | agent.lastname = "testlastname"; | ||
57 | agent.SessionID = UUID.Zero; | ||
58 | agent.SecureSessionID = UUID.Zero; | ||
59 | agent.circuitcode = 123; | ||
60 | agent.BaseFolder = UUID.Zero; | ||
61 | agent.InventoryFolder = UUID.Zero; | ||
62 | agent.startpos = Vector3.Zero; | ||
63 | agent.CapsPath = "http://wibble.com"; | ||
64 | client = new TestClient(agent, null); | ||
65 | ts = new TextureSender(client, 0, 0); | ||
66 | testsize = random.Next(5000,15000); | ||
67 | npackets = CalculateNumPackets(testsize); | ||
68 | uuid1 = UUID.Random(); | ||
69 | uuid2 = UUID.Random(); | ||
70 | uuid3 = UUID.Random(); | ||
71 | uuid4 = UUID.Random(); | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// Test sending package | ||
76 | /// </summary> | ||
77 | [Test] | ||
78 | public void T010_SendPkg() | ||
79 | { | ||
80 | TestHelper.InMethod(); | ||
81 | // Normal sending | ||
82 | AssetBase abase = new AssetBase(uuid1, "asset one"); | ||
83 | byte[] abdata = new byte[testsize]; | ||
84 | random.NextBytes(abdata); | ||
85 | abase.Data = abdata; | ||
86 | bool isdone = false; | ||
87 | ts.TextureReceived(abase); | ||
88 | for (int i = 0; i < npackets; i++) { | ||
89 | isdone = ts.SendTexturePacket(); | ||
90 | } | ||
91 | |||
92 | Assert.That(isdone,Is.False); | ||
93 | isdone = ts.SendTexturePacket(); | ||
94 | Assert.That(isdone,Is.True); | ||
95 | } | ||
96 | |||
97 | [Test] | ||
98 | public void T011_UpdateReq() | ||
99 | { | ||
100 | TestHelper.InMethod(); | ||
101 | // Test packet number start | ||
102 | AssetBase abase = new AssetBase(uuid2, "asset two"); | ||
103 | byte[] abdata = new byte[testsize]; | ||
104 | random.NextBytes(abdata); | ||
105 | abase.Data = abdata; | ||
106 | |||
107 | bool isdone = false; | ||
108 | ts.TextureReceived(abase); | ||
109 | ts.UpdateRequest(0,3); | ||
110 | |||
111 | for (int i = 0; i < npackets-3; i++) { | ||
112 | isdone = ts.SendTexturePacket(); | ||
113 | } | ||
114 | |||
115 | Assert.That(isdone,Is.False); | ||
116 | isdone = ts.SendTexturePacket(); | ||
117 | Assert.That(isdone,Is.True); | ||
118 | |||
119 | // Test discard level | ||
120 | abase = new AssetBase(uuid3, "asset three"); | ||
121 | abdata = new byte[testsize]; | ||
122 | random.NextBytes(abdata); | ||
123 | abase.Data = abdata; | ||
124 | isdone = false; | ||
125 | ts.TextureReceived(abase); | ||
126 | ts.UpdateRequest(-1,0); | ||
127 | |||
128 | Assert.That(ts.SendTexturePacket(),Is.True); | ||
129 | |||
130 | abase = new AssetBase(uuid4, "asset four"); | ||
131 | abdata = new byte[testsize]; | ||
132 | random.NextBytes(abdata); | ||
133 | abase.Data = abdata; | ||
134 | isdone = false; | ||
135 | ts.TextureReceived(abase); | ||
136 | ts.UpdateRequest(0,5); | ||
137 | |||
138 | for (int i = 0; i < npackets-5; i++) { | ||
139 | isdone = ts.SendTexturePacket(); | ||
140 | } | ||
141 | Assert.That(isdone,Is.False); | ||
142 | isdone = ts.SendTexturePacket(); | ||
143 | Assert.That(isdone,Is.True); | ||
144 | } | ||
145 | |||
146 | [Test] | ||
147 | public void T999_FinishStatus() | ||
148 | { | ||
149 | TestHelper.InMethod(); | ||
150 | // Of the 4 assets "sent", only 2 sent the first part. | ||
151 | Assert.That(client.sentdatapkt.Count,Is.EqualTo(2)); | ||
152 | |||
153 | // Sum of all packets sent: | ||
154 | int totalpkts = (npackets) + (npackets - 2) + (npackets - 4); | ||
155 | Assert.That(client.sentpktpkt.Count,Is.EqualTo(totalpkts)); | ||
156 | } | ||
157 | |||
158 | /// <summary> | ||
159 | /// Calculate the number of packets that will be required to send the texture loaded into this sender | ||
160 | /// This is actually the number of 1000 byte packets not including an initial 600 byte packet... | ||
161 | /// Borrowed from TextureSender.cs | ||
162 | /// </summary> | ||
163 | /// <param name="length"></param> | ||
164 | /// <returns></returns> | ||
165 | private int CalculateNumPackets(int length) | ||
166 | { | ||
167 | int numPackets = 0; | ||
168 | |||
169 | if (length > 600) | ||
170 | { | ||
171 | //over 600 bytes so split up file | ||
172 | int restData = (length - 600); | ||
173 | int restPackets = ((restData + 999) / 1000); | ||
174 | numPackets = restPackets; | ||
175 | } | ||
176 | |||
177 | return numPackets; | ||
178 | } | ||
179 | } | ||
180 | } | ||
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 66ca7c2..1add0ab 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | |||
@@ -155,14 +155,6 @@ namespace OpenSim.Region.CoreModules.Asset | |||
155 | private int m_hitCount; | 155 | private int m_hitCount; |
156 | 156 | ||
157 | /// <summary> | 157 | /// <summary> |
158 | /// Initialize asset cache module with default parameters. | ||
159 | /// </summary> | ||
160 | public void Initialize() | ||
161 | { | ||
162 | Initialize(DefaultMaxSize, DefaultMaxCount, DefaultExpirationTime); | ||
163 | } | ||
164 | |||
165 | /// <summary> | ||
166 | /// Initialize asset cache module, with custom parameters. | 158 | /// Initialize asset cache module, with custom parameters. |
167 | /// </summary> | 159 | /// </summary> |
168 | /// <param name="maximalSize"> | 160 | /// <param name="maximalSize"> |
@@ -174,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
174 | /// <param name="expirationTime"> | 166 | /// <param name="expirationTime"> |
175 | /// Asset's expiration time. | 167 | /// Asset's expiration time. |
176 | /// </param> | 168 | /// </param> |
177 | public void Initialize(long maximalSize, int maximalCount, TimeSpan expirationTime) | 169 | protected void Initialize(long maximalSize, int maximalCount, TimeSpan expirationTime) |
178 | { | 170 | { |
179 | if (maximalSize <= 0 || maximalCount <= 0) | 171 | if (maximalSize <= 0 || maximalCount <= 0) |
180 | { | 172 | { |
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index 0a7e736..7da5e7a 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | |||
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
44 | LogManager.GetLogger( | 44 | LogManager.GetLogger( |
45 | MethodBase.GetCurrentMethod().DeclaringType); | 45 | MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | private bool m_Enabled = false; | 47 | private bool m_Enabled; |
48 | private Cache m_Cache = new Cache(CacheMedium.Memory, | 48 | private Cache m_Cache; |
49 | CacheStrategy.Aggressive, | ||
50 | CacheFlags.AllowUpdate); | ||
51 | 49 | ||
52 | public string Name | 50 | public string Name |
53 | { | 51 | { |
@@ -77,6 +75,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
77 | return; | 75 | return; |
78 | } | 76 | } |
79 | 77 | ||
78 | m_Cache = new Cache(CacheMedium.Memory, CacheStrategy.Aggressive, CacheFlags.AllowUpdate); | ||
80 | m_Enabled = true; | 79 | m_Enabled = true; |
81 | 80 | ||
82 | m_log.Info("[ASSET CACHE]: Core asset cache enabled"); | 81 | m_log.Info("[ASSET CACHE]: Core asset cache enabled"); |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 5ca4178..c6af806 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -61,24 +61,23 @@ namespace Flotsam.RegionModules.AssetCache | |||
61 | LogManager.GetLogger( | 61 | LogManager.GetLogger( |
62 | MethodBase.GetCurrentMethod().DeclaringType); | 62 | MethodBase.GetCurrentMethod().DeclaringType); |
63 | 63 | ||
64 | private bool m_Enabled = false; | 64 | private bool m_Enabled; |
65 | 65 | ||
66 | private const string m_ModuleName = "FlotsamAssetCache"; | 66 | private const string m_ModuleName = "FlotsamAssetCache"; |
67 | private const string m_DefaultCacheDirectory = m_ModuleName; | 67 | private const string m_DefaultCacheDirectory = m_ModuleName; |
68 | private string m_CacheDirectory = m_DefaultCacheDirectory; | 68 | private string m_CacheDirectory = m_DefaultCacheDirectory; |
69 | 69 | ||
70 | 70 | private readonly List<char> m_InvalidChars = new List<char>(); | |
71 | private List<char> m_InvalidChars = new List<char>(); | ||
72 | 71 | ||
73 | private int m_LogLevel = 1; | 72 | private int m_LogLevel = 1; |
74 | private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests | 73 | private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests |
75 | 74 | ||
76 | private static ulong m_Requests = 0; | 75 | private static ulong m_Requests; |
77 | private static ulong m_RequestsForInprogress = 0; | 76 | private static ulong m_RequestsForInprogress; |
78 | private static ulong m_DiskHits = 0; | 77 | private static ulong m_DiskHits; |
79 | private static ulong m_MemoryHits = 0; | 78 | private static ulong m_MemoryHits; |
80 | private static double m_HitRateMemory = 0.0; | 79 | private static double m_HitRateMemory; |
81 | private static double m_HitRateFile = 0.0; | 80 | private static double m_HitRateFile; |
82 | 81 | ||
83 | #if WAIT_ON_INPROGRESS_REQUESTS | 82 | #if WAIT_ON_INPROGRESS_REQUESTS |
84 | private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); | 83 | private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); |
@@ -87,7 +86,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
87 | private List<string> m_CurrentlyWriting = new List<string>(); | 86 | private List<string> m_CurrentlyWriting = new List<string>(); |
88 | #endif | 87 | #endif |
89 | 88 | ||
90 | private ExpiringCache<string, AssetBase> m_MemoryCache = new ExpiringCache<string, AssetBase>(); | 89 | private ExpiringCache<string, AssetBase> m_MemoryCache; |
91 | private bool m_MemoryCacheEnabled = true; | 90 | private bool m_MemoryCacheEnabled = true; |
92 | 91 | ||
93 | // Expiration is expressed in hours. | 92 | // Expiration is expressed in hours. |
@@ -101,12 +100,12 @@ namespace Flotsam.RegionModules.AssetCache | |||
101 | private static int m_CacheDirectoryTierLen = 3; | 100 | private static int m_CacheDirectoryTierLen = 3; |
102 | private static int m_CacheWarnAt = 30000; | 101 | private static int m_CacheWarnAt = 30000; |
103 | 102 | ||
104 | private System.Timers.Timer m_CachCleanTimer = new System.Timers.Timer(); | 103 | private System.Timers.Timer m_CacheCleanTimer; |
105 | 104 | ||
106 | private IAssetService m_AssetService = null; | 105 | private IAssetService m_AssetService; |
107 | private List<Scene> m_Scenes = new List<Scene>(); | 106 | private List<Scene> m_Scenes = new List<Scene>(); |
108 | 107 | ||
109 | private bool m_DeepScanBeforePurge = false; | 108 | private bool m_DeepScanBeforePurge; |
110 | 109 | ||
111 | public FlotsamAssetCache() | 110 | public FlotsamAssetCache() |
112 | { | 111 | { |
@@ -128,14 +127,15 @@ namespace Flotsam.RegionModules.AssetCache | |||
128 | { | 127 | { |
129 | IConfig moduleConfig = source.Configs["Modules"]; | 128 | IConfig moduleConfig = source.Configs["Modules"]; |
130 | 129 | ||
131 | |||
132 | if (moduleConfig != null) | 130 | if (moduleConfig != null) |
133 | { | 131 | { |
134 | string name = moduleConfig.GetString("AssetCaching", ""); | 132 | string name = moduleConfig.GetString("AssetCaching", String.Empty); |
135 | 133 | ||
136 | if (name == Name) | 134 | if (name == Name) |
137 | { | 135 | { |
136 | m_MemoryCache = new ExpiringCache<string, AssetBase>(); | ||
138 | m_Enabled = true; | 137 | m_Enabled = true; |
138 | |||
139 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} enabled", this.Name); | 139 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} enabled", this.Name); |
140 | 140 | ||
141 | IConfig assetConfig = source.Configs["AssetCache"]; | 141 | IConfig assetConfig = source.Configs["AssetCache"]; |
@@ -163,21 +163,11 @@ namespace Flotsam.RegionModules.AssetCache | |||
163 | m_FileExpirationCleanupTimer = TimeSpan.FromHours(assetConfig.GetDouble("FileCleanupTimer", m_DefaultFileExpiration)); | 163 | m_FileExpirationCleanupTimer = TimeSpan.FromHours(assetConfig.GetDouble("FileCleanupTimer", m_DefaultFileExpiration)); |
164 | if ((m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero)) | 164 | if ((m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero)) |
165 | { | 165 | { |
166 | m_CachCleanTimer.Interval = m_FileExpirationCleanupTimer.TotalMilliseconds; | 166 | m_CacheCleanTimer = new System.Timers.Timer(m_FileExpirationCleanupTimer.TotalMilliseconds); |
167 | m_CachCleanTimer.AutoReset = true; | 167 | m_CacheCleanTimer.AutoReset = true; |
168 | m_CachCleanTimer.Elapsed += CleanupExpiredFiles; | 168 | m_CacheCleanTimer.Elapsed += CleanupExpiredFiles; |
169 | m_CachCleanTimer.Enabled = true; | 169 | lock (m_CacheCleanTimer) |
170 | lock (m_CachCleanTimer) | 170 | m_CacheCleanTimer.Start(); |
171 | { | ||
172 | m_CachCleanTimer.Start(); | ||
173 | } | ||
174 | } | ||
175 | else | ||
176 | { | ||
177 | lock (m_CachCleanTimer) | ||
178 | { | ||
179 | m_CachCleanTimer.Enabled = false; | ||
180 | } | ||
181 | } | 171 | } |
182 | 172 | ||
183 | m_CacheDirectoryTiers = assetConfig.GetInt("CacheDirectoryTiers", 1); | 173 | m_CacheDirectoryTiers = assetConfig.GetInt("CacheDirectoryTiers", 1); |
@@ -208,7 +198,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
208 | MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the file and/or memory cache", HandleConsoleCommand); | 198 | MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the file and/or memory cache", HandleConsoleCommand); |
209 | MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand); | 199 | MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand); |
210 | MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand); | 200 | MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand); |
211 | |||
212 | } | 201 | } |
213 | } | 202 | } |
214 | } | 203 | } |
@@ -313,12 +302,8 @@ namespace Flotsam.RegionModules.AssetCache | |||
313 | 302 | ||
314 | } | 303 | } |
315 | 304 | ||
316 | ThreadPool.QueueUserWorkItem( | 305 | Util.FireAndForget( |
317 | delegate | 306 | delegate { WriteFileCache(filename, asset); }); |
318 | { | ||
319 | WriteFileCache(filename, asset); | ||
320 | } | ||
321 | ); | ||
322 | } | 307 | } |
323 | } | 308 | } |
324 | catch (Exception e) | 309 | catch (Exception e) |
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 4869f5d..1365e69 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs | |||
@@ -45,11 +45,13 @@ namespace OpenSim.Region.CoreModules.Asset | |||
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private bool m_Enabled = false; | 48 | private bool m_Enabled; |
49 | private ICache m_Cache = new GlynnTucker.Cache.SimpleMemoryCache(); | 49 | private ICache m_Cache; |
50 | private ulong m_Hits; | ||
51 | private ulong m_Requests; | ||
50 | 52 | ||
51 | // Instrumentation | 53 | // Instrumentation |
52 | private uint m_DebugRate = 0; | 54 | private uint m_DebugRate; |
53 | 55 | ||
54 | public Type ReplaceableInterface | 56 | public Type ReplaceableInterface |
55 | { | 57 | { |
@@ -72,6 +74,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
72 | 74 | ||
73 | if (name == Name) | 75 | if (name == Name) |
74 | { | 76 | { |
77 | m_Cache = new GlynnTucker.Cache.SimpleMemoryCache(); | ||
75 | m_Enabled = true; | 78 | m_Enabled = true; |
76 | 79 | ||
77 | m_log.Info("[ASSET CACHE]: GlynnTucker asset cache enabled"); | 80 | m_log.Info("[ASSET CACHE]: GlynnTucker asset cache enabled"); |
@@ -80,7 +83,6 @@ namespace OpenSim.Region.CoreModules.Asset | |||
80 | IConfig cacheConfig = source.Configs["AssetCache"]; | 83 | IConfig cacheConfig = source.Configs["AssetCache"]; |
81 | if (cacheConfig != null) | 84 | if (cacheConfig != null) |
82 | m_DebugRate = (uint)cacheConfig.GetInt("DebugRate", 0); | 85 | m_DebugRate = (uint)cacheConfig.GetInt("DebugRate", 0); |
83 | |||
84 | } | 86 | } |
85 | } | 87 | } |
86 | } | 88 | } |
@@ -117,24 +119,6 @@ namespace OpenSim.Region.CoreModules.Asset | |||
117 | m_Cache.AddOrUpdate(asset.ID, asset); | 119 | m_Cache.AddOrUpdate(asset.ID, asset); |
118 | } | 120 | } |
119 | 121 | ||
120 | private ulong m_Hits = 0; | ||
121 | private ulong m_Requests = 0; | ||
122 | private void Debug(Object asset) | ||
123 | { | ||
124 | // Temporary instrumentation to measure the hit/miss rate | ||
125 | if (m_DebugRate > 0) | ||
126 | { | ||
127 | m_Requests++; | ||
128 | if (asset != null) | ||
129 | m_Hits++; | ||
130 | |||
131 | if ((m_Requests % m_DebugRate) == 0) | ||
132 | m_log.DebugFormat("[ASSET CACHE]: Hit Rate {0} / {1} == {2}%", m_Hits, m_Requests, ((float)m_Hits / m_Requests) * 100); | ||
133 | |||
134 | } | ||
135 | // End instrumentation | ||
136 | } | ||
137 | |||
138 | public AssetBase Get(string id) | 122 | public AssetBase Get(string id) |
139 | { | 123 | { |
140 | Object asset = null; | 124 | Object asset = null; |
@@ -156,5 +140,20 @@ namespace OpenSim.Region.CoreModules.Asset | |||
156 | { | 140 | { |
157 | m_Cache.Clear(); | 141 | m_Cache.Clear(); |
158 | } | 142 | } |
143 | |||
144 | private void Debug(Object asset) | ||
145 | { | ||
146 | // Temporary instrumentation to measure the hit/miss rate | ||
147 | if (m_DebugRate > 0) | ||
148 | { | ||
149 | ++m_Requests; | ||
150 | if (asset != null) | ||
151 | ++m_Hits; | ||
152 | |||
153 | if ((m_Requests % m_DebugRate) == 0) | ||
154 | m_log.DebugFormat("[ASSET CACHE]: Hit Rate {0} / {1} == {2}%", m_Hits, m_Requests, ((float)m_Hits / (float)m_Requests) * 100.0f); | ||
155 | } | ||
156 | // End instrumentation | ||
157 | } | ||
159 | } | 158 | } |
160 | } | 159 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 66a9b5a..cd59bdb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -224,11 +224,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
224 | 224 | ||
225 | foreach (Scene s in m_scenes) | 225 | foreach (Scene s in m_scenes) |
226 | { | 226 | { |
227 | s.ForEachScenePresence(delegate(ScenePresence presence) | 227 | s.ForEachScenePresence( |
228 | { | 228 | delegate(ScenePresence presence) |
229 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, | 229 | { |
230 | c.Type, message, sourceType); | 230 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); |
231 | }); | 231 | } |
232 | ); | ||
232 | } | 233 | } |
233 | } | 234 | } |
234 | 235 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 4896edf..3bb162e 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -756,7 +756,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
756 | 756 | ||
757 | public void sendRegionHandshakeToAll() | 757 | public void sendRegionHandshakeToAll() |
758 | { | 758 | { |
759 | m_scene.Broadcast(sendRegionHandshake); | 759 | m_scene.ForEachClient(sendRegionHandshake); |
760 | } | 760 | } |
761 | 761 | ||
762 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) | 762 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d2b5cb1..53c64cb 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -147,9 +147,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
147 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | 147 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; |
148 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 148 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
149 | 149 | ||
150 | if (m_scene.Entities.ContainsKey(client.AgentId)) | 150 | EntityBase presenceEntity; |
151 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | ||
151 | { | 152 | { |
152 | SendLandUpdate((ScenePresence)m_scene.Entities[client.AgentId], true); | 153 | SendLandUpdate((ScenePresence)presenceEntity, true); |
153 | SendParcelOverlay(client); | 154 | SendParcelOverlay(client); |
154 | } | 155 | } |
155 | } | 156 | } |
@@ -1061,7 +1062,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1061 | { | 1062 | { |
1062 | land.LandData.OwnerID = ownerID; | 1063 | land.LandData.OwnerID = ownerID; |
1063 | 1064 | ||
1064 | m_scene.Broadcast(SendParcelOverlay); | 1065 | m_scene.ForEachClient(SendParcelOverlay); |
1065 | land.SendLandUpdateToClient(remote_client); | 1066 | land.SendLandUpdateToClient(remote_client); |
1066 | } | 1067 | } |
1067 | } | 1068 | } |
@@ -1083,7 +1084,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1083 | land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 1084 | land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
1084 | else | 1085 | else |
1085 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 1086 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
1086 | m_scene.Broadcast(SendParcelOverlay); | 1087 | m_scene.ForEachClient(SendParcelOverlay); |
1087 | land.SendLandUpdateToClient(remote_client); | 1088 | land.SendLandUpdateToClient(remote_client); |
1088 | } | 1089 | } |
1089 | } | 1090 | } |
@@ -1107,7 +1108,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1107 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 1108 | land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
1108 | land.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 1109 | land.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
1109 | land.LandData.IsGroupOwned = false; | 1110 | land.LandData.IsGroupOwned = false; |
1110 | m_scene.Broadcast(SendParcelOverlay); | 1111 | m_scene.ForEachClient(SendParcelOverlay); |
1111 | land.SendLandUpdateToClient(remote_client); | 1112 | land.SendLandUpdateToClient(remote_client); |
1112 | } | 1113 | } |
1113 | } | 1114 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index b9b7da5..bfe85f1 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -139,10 +139,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
139 | } | 139 | } |
140 | else | 140 | else |
141 | { | 141 | { |
142 | //Normal Calculations | 142 | // Normal Calculations |
143 | return Convert.ToInt32( | 143 | return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.objectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); |
144 | Math.Round((Convert.ToDecimal(LandData.Area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * | ||
145 | Convert.ToDecimal(m_scene.RegionInfo.RegionSettings.ObjectBonus))); ; | ||
146 | } | 144 | } |
147 | } | 145 | } |
148 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) | 146 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) |
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs index 6499915..d8c5ed9 100644 --- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs | |||
@@ -81,8 +81,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
81 | 81 | ||
82 | public void RegionLoaded(Scene scene) | 82 | public void RegionLoaded(Scene scene) |
83 | { | 83 | { |
84 | if (!enabledYN) | 84 | if (enabledYN) |
85 | return; | 85 | RegionLoadedDoWork(scene); |
86 | } | ||
87 | |||
88 | private void RegionLoadedDoWork(Scene scene) | ||
89 | { | ||
86 | /* | 90 | /* |
87 | // For testing on a single instance | 91 | // For testing on a single instance |
88 | if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000) | 92 | if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 4fb4c51..4e40084 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1095,7 +1095,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1095 | // The reason is so we don't cause the thread to freeze waiting | 1095 | // The reason is so we don't cause the thread to freeze waiting |
1096 | // for the 1 second it costs to start a thread manually. | 1096 | // for the 1 second it costs to start a thread manually. |
1097 | if (!threadrunning) | 1097 | if (!threadrunning) |
1098 | ThreadPool.QueueUserWorkItem(new WaitCallback(this.StartThread)); | 1098 | Util.FireAndForget(this.StartThread); |
1099 | 1099 | ||
1100 | lock (m_rootAgents) | 1100 | lock (m_rootAgents) |
1101 | { | 1101 | { |