aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
diff options
context:
space:
mode:
authorlcc2010-04-10 23:52:10 +0200
committerlcc2010-04-10 23:52:10 +0200
commit7ecd9b3f1ac4556125a35ab384224b2ca0401a11 (patch)
tree63151eb7e3693485af9db8947f2004f586062ca5 /OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
parentAdding ColdStart event (diff)
parentguarantee that a script engine's GetScriptErrors() will not be called (diff)
downloadopensim-SC-7ecd9b3f1ac4556125a35ab384224b2ca0401a11.zip
opensim-SC-7ecd9b3f1ac4556125a35ab384224b2ca0401a11.tar.gz
opensim-SC-7ecd9b3f1ac4556125a35ab384224b2ca0401a11.tar.bz2
opensim-SC-7ecd9b3f1ac4556125a35ab384224b2ca0401a11.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
resolved Conflicts: OpenSim/Region/Framework/Interfaces/ISnmpModule.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs76
1 files changed, 68 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 5d00917..d03b464 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -46,6 +46,8 @@ namespace OpenSim.Region.Framework.Scenes
46 46
47 private string m_inventoryFileName = String.Empty; 47 private string m_inventoryFileName = String.Empty;
48 private int m_inventoryFileNameSerial = 0; 48 private int m_inventoryFileNameSerial = 0;
49
50 private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>();
49 51
50 /// <value> 52 /// <value>
51 /// The part to which the inventory belongs. 53 /// The part to which the inventory belongs.
@@ -211,7 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
211 } 213 }
212 } 214 }
213 215
214 public ArrayList GetScriptErrors(UUID itemID) 216 private ArrayList GetScriptErrors(UUID itemID)
215 { 217 {
216 ArrayList ret = new ArrayList(); 218 ArrayList ret = new ArrayList();
217 219
@@ -270,7 +272,10 @@ namespace OpenSim.Region.Framework.Scenes
270 // item.Name, item.ItemID, Name, UUID); 272 // item.Name, item.ItemID, Name, UUID);
271 273
272 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 274 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
275 {
276 StoreScriptError(item.ItemID, "no permission");
273 return; 277 return;
278 }
274 279
275 m_part.AddFlag(PrimFlags.Scripted); 280 m_part.AddFlag(PrimFlags.Scripted);
276 281
@@ -285,6 +290,7 @@ namespace OpenSim.Region.Framework.Scenes
285 m_items.LockItemsForWrite(false); 290 m_items.LockItemsForWrite(false);
286 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 291 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
287 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); 292 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
293 StoreScriptErrors(item.ItemID, GetScriptErrors(item.ItemID));
288 m_part.ParentGroup.AddActiveScriptCount(1); 294 m_part.ParentGroup.AddActiveScriptCount(1);
289 m_part.ScheduleFullUpdate(); 295 m_part.ScheduleFullUpdate();
290 return; 296 return;
@@ -294,11 +300,13 @@ namespace OpenSim.Region.Framework.Scenes
294 { 300 {
295 if (null == asset) 301 if (null == asset)
296 { 302 {
303 string msg = String.Format("asset ID {0} could not be found", item.AssetID);
304 StoreScriptError(item.ItemID, msg);
297 m_log.ErrorFormat( 305 m_log.ErrorFormat(
298 "[PRIM INVENTORY]: " + 306 "[PRIM INVENTORY]: " +
299 "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", 307 "Couldn't start script {0}, {1} at {2} in {3} since {4}",
300 item.Name, item.ItemID, m_part.AbsolutePosition, 308 item.Name, item.ItemID, m_part.AbsolutePosition,
301 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); 309 m_part.ParentGroup.Scene.RegionInfo.RegionName, msg);
302 } 310 }
303 else 311 else
304 { 312 {
@@ -311,11 +319,16 @@ namespace OpenSim.Region.Framework.Scenes
311 string script = Utils.BytesToString(asset.Data); 319 string script = Utils.BytesToString(asset.Data);
312 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 320 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
313 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); 321 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
322 StoreScriptErrors(item.ItemID, GetScriptErrors(item.ItemID));
314 m_part.ParentGroup.AddActiveScriptCount(1); 323 m_part.ParentGroup.AddActiveScriptCount(1);
315 m_part.ScheduleFullUpdate(); 324 m_part.ScheduleFullUpdate();
316 } 325 }
317 }); 326 });
318 } 327 }
328 else
329 {
330 StoreScriptError(item.ItemID, "scripts disabled");
331 }
319 } 332 }
320 333
321 private void RestoreSavedScriptState(UUID oldID, UUID newID) 334 private void RestoreSavedScriptState(UUID oldID, UUID newID)
@@ -392,24 +405,71 @@ namespace OpenSim.Region.Framework.Scenes
392 else 405 else
393 { 406 {
394 m_items.LockItemsForRead(false); 407 m_items.LockItemsForRead(false);
408 string msg = String.Format("couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
409 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
410 StoreScriptError(itemId, msg);
395 m_log.ErrorFormat( 411 m_log.ErrorFormat(
396 "[PRIM INVENTORY]: " + 412 "[PRIM INVENTORY]: " +
397 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", 413 "Couldn't start script with ID {0} since it {1}", itemId, msg);
398 itemId, m_part.Name, m_part.UUID,
399 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
400 } 414 }
401 } 415 }
402 else 416 else
403 { 417 {
404 m_items.LockItemsForRead(false); 418 m_items.LockItemsForRead(false);
419 string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID);
420 StoreScriptError(itemId, msg);
405 m_log.ErrorFormat( 421 m_log.ErrorFormat(
406 "[PRIM INVENTORY]: " + 422 "[PRIM INVENTORY]: " +
407 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", 423 "Couldn't start script with ID {0} since it {1}", itemId, msg);
408 itemId, m_part.Name, m_part.UUID);
409 } 424 }
410 425
411 } 426 }
412 427
428 public ArrayList CreateScriptInstanceEr(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
429 {
430 ArrayList errors;
431
432 lock (m_scriptErrors)
433 {
434 m_scriptErrors.Remove(itemId);
435 }
436 CreateScriptInstance(itemId, startParam, postOnRez, engine, stateSource);
437 lock (m_scriptErrors)
438 {
439 while (!m_scriptErrors.TryGetValue(itemId, out errors))
440 {
441 if (!System.Threading.Monitor.Wait(m_scriptErrors, 15000))
442 {
443 m_log.ErrorFormat(
444 "[PRIM INVENTORY]: " +
445 "timedout waiting for script {0} errors", itemId);
446 if (!m_scriptErrors.TryGetValue(itemId, out errors))
447 {
448 errors = new ArrayList(1);
449 errors.Add("timedout waiting for errors");
450 }
451 break;
452 }
453 }
454 m_scriptErrors.Remove(itemId);
455 }
456 return errors;
457 }
458 private void StoreScriptErrors(UUID itemId, ArrayList errors)
459 {
460 lock (m_scriptErrors)
461 {
462 m_scriptErrors[itemId] = errors;
463 System.Threading.Monitor.PulseAll(m_scriptErrors);
464 }
465 }
466 private void StoreScriptError(UUID itemId, string message)
467 {
468 ArrayList errors = new ArrayList(1);
469 errors.Add(message);
470 StoreScriptErrors(itemId, errors);
471 }
472
413 /// <summary> 473 /// <summary>
414 /// Stop a script which is in this prim's inventory. 474 /// Stop a script which is in this prim's inventory.
415 /// </summary> 475 /// </summary>