diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Data/Null/NullEstateData.cs | 28 | ||||
-rwxr-xr-x | OpenSim/Framework/Monitoring/Stats/CounterStat.cs | 21 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/Stats/Stat.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 66 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | 44 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 23 | ||||
-rw-r--r-- | OpenSim/Tests/Clients/Assets/AssetsClient.cs | 21 |
8 files changed, 189 insertions, 35 deletions
diff --git a/OpenSim/Data/Null/NullEstateData.cs b/OpenSim/Data/Null/NullEstateData.cs index d64136d..1df397d 100755 --- a/OpenSim/Data/Null/NullEstateData.cs +++ b/OpenSim/Data/Null/NullEstateData.cs | |||
@@ -42,6 +42,22 @@ namespace OpenSim.Data.Null | |||
42 | 42 | ||
43 | // private string m_connectionString; | 43 | // private string m_connectionString; |
44 | 44 | ||
45 | private Dictionary<uint, EstateSettings> m_knownEstates = new Dictionary<uint, EstateSettings>(); | ||
46 | private EstateSettings m_estate = null; | ||
47 | |||
48 | private EstateSettings GetEstate() | ||
49 | { | ||
50 | if (m_estate == null) | ||
51 | { | ||
52 | // This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase). | ||
53 | // The estate info is pretty empty so don't try banning anyone. | ||
54 | m_estate = new EstateSettings(); | ||
55 | m_estate.EstateID = 1; | ||
56 | m_estate.OnSave += StoreEstateSettings; | ||
57 | } | ||
58 | return m_estate; | ||
59 | } | ||
60 | |||
45 | protected virtual Assembly Assembly | 61 | protected virtual Assembly Assembly |
46 | { | 62 | { |
47 | get { return GetType().Assembly; } | 63 | get { return GetType().Assembly; } |
@@ -68,21 +84,18 @@ namespace OpenSim.Data.Null | |||
68 | 84 | ||
69 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | 85 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) |
70 | { | 86 | { |
71 | // This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase). | 87 | return GetEstate(); |
72 | // The estate info is pretty empty so don't try banning anyone. | ||
73 | EstateSettings oneEstate = new EstateSettings(); | ||
74 | oneEstate.EstateID = 1; | ||
75 | return oneEstate; | ||
76 | } | 88 | } |
77 | 89 | ||
78 | public void StoreEstateSettings(EstateSettings es) | 90 | public void StoreEstateSettings(EstateSettings es) |
79 | { | 91 | { |
92 | m_estate = es; | ||
80 | return; | 93 | return; |
81 | } | 94 | } |
82 | 95 | ||
83 | public EstateSettings LoadEstateSettings(int estateID) | 96 | public EstateSettings LoadEstateSettings(int estateID) |
84 | { | 97 | { |
85 | return new EstateSettings(); | 98 | return GetEstate(); |
86 | } | 99 | } |
87 | 100 | ||
88 | public EstateSettings CreateNewEstate() | 101 | public EstateSettings CreateNewEstate() |
@@ -93,13 +106,14 @@ namespace OpenSim.Data.Null | |||
93 | public List<EstateSettings> LoadEstateSettingsAll() | 106 | public List<EstateSettings> LoadEstateSettingsAll() |
94 | { | 107 | { |
95 | List<EstateSettings> allEstateSettings = new List<EstateSettings>(); | 108 | List<EstateSettings> allEstateSettings = new List<EstateSettings>(); |
96 | allEstateSettings.Add(new EstateSettings()); | 109 | allEstateSettings.Add(GetEstate()); |
97 | return allEstateSettings; | 110 | return allEstateSettings; |
98 | } | 111 | } |
99 | 112 | ||
100 | public List<int> GetEstatesAll() | 113 | public List<int> GetEstatesAll() |
101 | { | 114 | { |
102 | List<int> result = new List<int>(); | 115 | List<int> result = new List<int>(); |
116 | result.Add((int)GetEstate().EstateID); | ||
103 | return result; | 117 | return result; |
104 | } | 118 | } |
105 | 119 | ||
diff --git a/OpenSim/Framework/Monitoring/Stats/CounterStat.cs b/OpenSim/Framework/Monitoring/Stats/CounterStat.cs index caea30d..04442c3 100755 --- a/OpenSim/Framework/Monitoring/Stats/CounterStat.cs +++ b/OpenSim/Framework/Monitoring/Stats/CounterStat.cs | |||
@@ -224,5 +224,26 @@ public class CounterStat : Stat | |||
224 | } | 224 | } |
225 | } | 225 | } |
226 | } | 226 | } |
227 | |||
228 | // CounterStat is a basic stat plus histograms | ||
229 | public override OSDMap ToOSDMap() | ||
230 | { | ||
231 | // Get the foundational instance | ||
232 | OSDMap map = base.ToOSDMap(); | ||
233 | |||
234 | map["StatType"] = "CounterStat"; | ||
235 | |||
236 | // If there are any histograms, add a new field that is an array of histograms as OSDMaps | ||
237 | if (m_histograms.Count > 0) | ||
238 | { | ||
239 | OSDArray histos = new OSDArray(); | ||
240 | foreach (EventHistogram histo in m_histograms.Values) | ||
241 | { | ||
242 | histos.Add(histo.GetHistogramAsOSDMap()); | ||
243 | } | ||
244 | map.Add("Histograms", histos); | ||
245 | } | ||
246 | return map; | ||
247 | } | ||
227 | } | 248 | } |
228 | } | 249 | } |
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index c57ee0c..9629b6e 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs | |||
@@ -242,6 +242,7 @@ namespace OpenSim.Framework.Monitoring | |||
242 | ret.Add("Description", OSD.FromString(Description)); | 242 | ret.Add("Description", OSD.FromString(Description)); |
243 | ret.Add("UnitName", OSD.FromString(UnitName)); | 243 | ret.Add("UnitName", OSD.FromString(UnitName)); |
244 | ret.Add("Value", OSD.FromReal(Value)); | 244 | ret.Add("Value", OSD.FromReal(Value)); |
245 | ret.Add("StatType", "Stat"); // used by overloading classes to denote type of stat | ||
245 | 246 | ||
246 | return ret; | 247 | return ret; |
247 | } | 248 | } |
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 12d3a75..a5b54c9 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -30,6 +30,8 @@ using System.Collections.Generic; | |||
30 | using System.Linq; | 30 | using System.Linq; |
31 | using System.Text; | 31 | using System.Text; |
32 | 32 | ||
33 | using OpenMetaverse.StructuredData; | ||
34 | |||
33 | namespace OpenSim.Framework.Monitoring | 35 | namespace OpenSim.Framework.Monitoring |
34 | { | 36 | { |
35 | /// <summary> | 37 | /// <summary> |
@@ -168,6 +170,70 @@ namespace OpenSim.Framework.Monitoring | |||
168 | } | 170 | } |
169 | } | 171 | } |
170 | 172 | ||
173 | // Creates an OSDMap of the format: | ||
174 | // { categoryName: { | ||
175 | // containerName: { | ||
176 | // statName: { | ||
177 | // "Name": name, | ||
178 | // "ShortName": shortName, | ||
179 | // ... | ||
180 | // }, | ||
181 | // statName: { | ||
182 | // "Name": name, | ||
183 | // "ShortName": shortName, | ||
184 | // ... | ||
185 | // }, | ||
186 | // ... | ||
187 | // }, | ||
188 | // containerName: { | ||
189 | // ... | ||
190 | // }, | ||
191 | // ... | ||
192 | // }, | ||
193 | // categoryName: { | ||
194 | // ... | ||
195 | // }, | ||
196 | // ... | ||
197 | // } | ||
198 | // The passed in parameters will filter the categories, containers and stats returned. If any of the | ||
199 | // parameters are either EmptyOrNull or the AllSubCommand value, all of that type will be returned. | ||
200 | // Case matters. | ||
201 | public static OSDMap GetStatsAsOSDMap(string pCategoryName, string pContainerName, string pStatName) | ||
202 | { | ||
203 | OSDMap map = new OSDMap(); | ||
204 | |||
205 | foreach (string catName in RegisteredStats.Keys) | ||
206 | { | ||
207 | // Do this category if null spec, "all" subcommand or category name matches passed parameter. | ||
208 | // Skip category if none of the above. | ||
209 | if (!(String.IsNullOrEmpty(pCategoryName) || pCategoryName == AllSubCommand || pCategoryName == catName)) | ||
210 | continue; | ||
211 | |||
212 | OSDMap contMap = new OSDMap(); | ||
213 | foreach (string contName in RegisteredStats[catName].Keys) | ||
214 | { | ||
215 | if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName)) | ||
216 | continue; | ||
217 | |||
218 | OSDMap statMap = new OSDMap(); | ||
219 | |||
220 | SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName]; | ||
221 | foreach (string statName in theStats.Keys) | ||
222 | { | ||
223 | if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName)) | ||
224 | continue; | ||
225 | |||
226 | statMap.Add(statName, theStats[statName].ToOSDMap()); | ||
227 | } | ||
228 | |||
229 | contMap.Add(contName, statMap); | ||
230 | } | ||
231 | map.Add(catName, contMap); | ||
232 | } | ||
233 | |||
234 | return map; | ||
235 | } | ||
236 | |||
171 | // /// <summary> | 237 | // /// <summary> |
172 | // /// Start collecting statistics related to assets. | 238 | // /// Start collecting statistics related to assets. |
173 | // /// Should only be called once. | 239 | // /// Should only be called once. |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index eca576d..cf95463 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -64,11 +64,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
64 | 64 | ||
65 | private Scene m_scene; | 65 | private Scene m_scene; |
66 | private bool m_persistBakedTextures; | 66 | private bool m_persistBakedTextures; |
67 | private string m_URL; | ||
67 | 68 | ||
68 | private IBakedTextureModule m_BakedTextureModule; | 69 | private IBakedTextureModule m_BakedTextureModule; |
69 | 70 | ||
70 | public void Initialise(IConfigSource source) | 71 | public void Initialise(IConfigSource source) |
71 | { | 72 | { |
73 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
74 | if (config == null) | ||
75 | return; | ||
76 | |||
77 | m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); | ||
78 | |||
72 | IConfig appearanceConfig = source.Configs["Appearance"]; | 79 | IConfig appearanceConfig = source.Configs["Appearance"]; |
73 | if (appearanceConfig != null) | 80 | if (appearanceConfig != null) |
74 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 81 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
@@ -280,23 +287,28 @@ namespace OpenSim.Region.ClientStack.Linden | |||
280 | 287 | ||
281 | public void RegisterCaps(UUID agentID, Caps caps) | 288 | public void RegisterCaps(UUID agentID, Caps caps) |
282 | { | 289 | { |
283 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( | 290 | UUID capID = UUID.Random(); |
284 | caps, m_scene.AssetService, m_persistBakedTextures); | ||
285 | 291 | ||
286 | 292 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | |
287 | 293 | if (m_URL == "localhost") | |
288 | caps.RegisterHandler( | 294 | { |
289 | "UploadBakedTexture", | 295 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( |
290 | new RestStreamHandler( | 296 | caps, m_scene.AssetService, m_persistBakedTextures); |
291 | "POST", | ||
292 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | ||
293 | avatarhandler.UploadBakedTexture, | ||
294 | "UploadBakedTexture", | ||
295 | agentID.ToString())); | ||
296 | |||
297 | |||
298 | |||
299 | 297 | ||
298 | caps.RegisterHandler( | ||
299 | "UploadBakedTexture", | ||
300 | new RestStreamHandler( | ||
301 | "POST", | ||
302 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | ||
303 | avatarhandler.UploadBakedTexture, | ||
304 | "UploadBakedTexture", | ||
305 | agentID.ToString())); | ||
306 | |||
307 | } | ||
308 | else | ||
309 | { | ||
310 | caps.RegisterHandler("UploadBakedTexture", m_URL); | ||
311 | } | ||
300 | } | 312 | } |
301 | } | 313 | } |
302 | } \ No newline at end of file | 314 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 389c2c6..2594b1b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4703,10 +4703,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4703 | // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); | 4703 | // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); |
4704 | } | 4704 | } |
4705 | 4705 | ||
4706 | // Subscribe for physics collision events if needed for scripts and sounds | 4706 | /// <summary> |
4707 | /// Subscribe for physics collision events if needed for scripts and sounds | ||
4708 | /// </summary> | ||
4707 | public void SubscribeForCollisionEvents() | 4709 | public void SubscribeForCollisionEvents() |
4708 | { | 4710 | { |
4709 | if (PhysActor != null) | 4711 | PhysicsActor pa = PhysActor; |
4712 | |||
4713 | if (pa != null) | ||
4710 | { | 4714 | { |
4711 | if ( | 4715 | if ( |
4712 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || | 4716 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || |
@@ -4724,20 +4728,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4724 | (CollisionSound != UUID.Zero) | 4728 | (CollisionSound != UUID.Zero) |
4725 | ) | 4729 | ) |
4726 | { | 4730 | { |
4727 | if (!PhysActor.SubscribedEvents()) | 4731 | if (!pa.SubscribedEvents()) |
4728 | { | 4732 | { |
4729 | // If not already subscribed for event, set up for a collision event. | 4733 | // If not already subscribed for event, set up for a collision event. |
4730 | PhysActor.OnCollisionUpdate += PhysicsCollision; | 4734 | pa.OnCollisionUpdate += PhysicsCollision; |
4731 | PhysActor.SubscribeEvents(1000); | 4735 | pa.SubscribeEvents(1000); |
4732 | } | 4736 | } |
4733 | } | 4737 | } |
4734 | else | 4738 | else |
4735 | { | 4739 | { |
4736 | // There is no need to be subscribed to collisions so, if subscribed, remove subscription | 4740 | // There is no need to be subscribed to collisions so, if subscribed, remove subscription |
4737 | if (PhysActor.SubscribedEvents()) | 4741 | if (pa.SubscribedEvents()) |
4738 | { | 4742 | { |
4739 | PhysActor.OnCollisionUpdate -= PhysicsCollision; | 4743 | pa.OnCollisionUpdate -= PhysicsCollision; |
4740 | PhysActor.UnSubscribeEvents(); | 4744 | pa.UnSubscribeEvents(); |
4741 | } | 4745 | } |
4742 | } | 4746 | } |
4743 | } | 4747 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 8da06d1..3646c98 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -242,7 +242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
242 | if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") | 242 | if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") |
243 | { | 243 | { |
244 | m_coopTermination = true; | 244 | m_coopTermination = true; |
245 | m_coopSleepHandle = new AutoResetEvent(false); | 245 | m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
@@ -1221,4 +1221,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1221 | Suspended = false; | 1221 | Suspended = false; |
1222 | } | 1222 | } |
1223 | } | 1223 | } |
1224 | } | 1224 | |
1225 | /// <summary> | ||
1226 | /// Xengine event wait handle. | ||
1227 | /// </summary> | ||
1228 | /// <remarks> | ||
1229 | /// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that | ||
1230 | /// when scripts are running in different AppDomains the lease does not expire. | ||
1231 | /// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this, | ||
1232 | /// proper remoting sponsorship needs to be implemented across the board. | ||
1233 | /// </remarks> | ||
1234 | public class XEngineEventWaitHandle : EventWaitHandle | ||
1235 | { | ||
1236 | public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {} | ||
1237 | |||
1238 | public override Object InitializeLifetimeService() | ||
1239 | { | ||
1240 | return null; | ||
1241 | } | ||
1242 | } | ||
1243 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Clients/Assets/AssetsClient.cs b/OpenSim/Tests/Clients/Assets/AssetsClient.cs index dd168a1..26d740b 100644 --- a/OpenSim/Tests/Clients/Assets/AssetsClient.cs +++ b/OpenSim/Tests/Clients/Assets/AssetsClient.cs | |||
@@ -82,7 +82,16 @@ namespace OpenSim.Tests.Clients.AssetsClient | |||
82 | m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid); | 82 | m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid); |
83 | } | 83 | } |
84 | 84 | ||
85 | Thread.Sleep(20 * 1000); | 85 | for (int i = 0; i < 500; i++) |
86 | { | ||
87 | var x = i; | ||
88 | ThreadPool.QueueUserWorkItem(delegate | ||
89 | { | ||
90 | Dummy(x); | ||
91 | }); | ||
92 | } | ||
93 | |||
94 | Thread.Sleep(30 * 1000); | ||
86 | m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived); | 95 | m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived); |
87 | } | 96 | } |
88 | 97 | ||
@@ -92,8 +101,16 @@ namespace OpenSim.Tests.Clients.AssetsClient | |||
92 | m_MaxThreadID = Thread.CurrentThread.ManagedThreadId; | 101 | m_MaxThreadID = Thread.CurrentThread.ManagedThreadId; |
93 | int max1, max2; | 102 | int max1, max2; |
94 | ThreadPool.GetAvailableThreads(out max1, out max2); | 103 | ThreadPool.GetAvailableThreads(out max1, out max2); |
95 | m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3})", id, m_MaxThreadID, max1, max2); | 104 | m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3}) {4}", id, m_MaxThreadID, max1, max2, DateTime.Now.ToString("hh:mm:ss")); |
96 | m_NReceived++; | 105 | m_NReceived++; |
97 | } | 106 | } |
107 | |||
108 | private static void Dummy(int i) | ||
109 | { | ||
110 | int max1, max2; | ||
111 | ThreadPool.GetAvailableThreads(out max1, out max2); | ||
112 | m_log.InfoFormat("[ASSET CLIENT]: ({0}) Hello! {1} - {2} {3}", i, max1, max2, DateTime.Now.ToString("hh:mm:ss")); | ||
113 | Thread.Sleep(2000); | ||
114 | } | ||
98 | } | 115 | } |
99 | } | 116 | } |