aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs8
-rw-r--r--OpenSim/Capabilities/LLSDInventoryFolder.cs4
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs4
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs112
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs146
17 files changed, 241 insertions, 130 deletions
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index 849cad2..515637e 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -393,12 +393,8 @@ namespace OpenSim.Capabilities.Handlers
393 llsdFolder.folder_id = invFolder.ID; 393 llsdFolder.folder_id = invFolder.ID;
394 llsdFolder.parent_id = invFolder.ParentID; 394 llsdFolder.parent_id = invFolder.ParentID;
395 llsdFolder.name = invFolder.Name; 395 llsdFolder.name = invFolder.Name;
396 396 llsdFolder.type = invFolder.Type;
397 if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type)) 397 llsdFolder.preferred_type = -1;
398 llsdFolder.type = "-1";
399 else
400 llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type);
401 llsdFolder.preferred_type = "-1";
402 398
403 return llsdFolder; 399 return llsdFolder;
404 } 400 }
diff --git a/OpenSim/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Capabilities/LLSDInventoryFolder.cs
index 3c216e9..d085430 100644
--- a/OpenSim/Capabilities/LLSDInventoryFolder.cs
+++ b/OpenSim/Capabilities/LLSDInventoryFolder.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Framework.Capabilities
35 public UUID folder_id; 35 public UUID folder_id;
36 public UUID parent_id; 36 public UUID parent_id;
37 public string name; 37 public string name;
38 public string type; 38 public int type;
39 public string preferred_type; 39 public int preferred_type;
40 } 40 }
41} 41}
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 87d04f8..264625d 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -320,7 +320,9 @@ namespace OpenSim.Framework.Servers
320 320
321 TimeSpan timeTaken = DateTime.Now - m_startuptime; 321 TimeSpan timeTaken = DateTime.Now - m_startuptime;
322 322
323 m_log.InfoFormat("[STARTUP]: Startup took {0}m {1}s", timeTaken.Minutes, timeTaken.Seconds); 323 m_log.InfoFormat(
324 "[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS.",
325 timeTaken.Minutes, timeTaken.Seconds);
324 } 326 }
325 327
326 /// <summary> 328 /// <summary>
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index 2995421..35a8dee 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -129,9 +129,7 @@ namespace OpenSim.Framework.Servers.HttpServer
129 OSHttpResponse response 129 OSHttpResponse response
130 = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); 130 = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
131 131
132 byte[] buffer 132 byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
133 = server.DoHTTPGruntWork(
134 responsedata, new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
135 133
136 response.SendChunked = false; 134 response.SendChunked = false;
137 response.ContentLength64 = buffer.Length; 135 response.ContentLength64 = buffer.Length;
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 7054825..7d7176f 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -143,7 +143,7 @@ namespace Flotsam.RegionModules.AssetCache
143 IConfig assetConfig = source.Configs["AssetCache"]; 143 IConfig assetConfig = source.Configs["AssetCache"];
144 if (assetConfig == null) 144 if (assetConfig == null)
145 { 145 {
146 m_log.Warn( 146 m_log.Debug(
147 "[FLOTSAM ASSET CACHE]: AssetCache section missing from config (not copied config-include/FlotsamCache.ini.example? Using defaults."); 147 "[FLOTSAM ASSET CACHE]: AssetCache section missing from config (not copied config-include/FlotsamCache.ini.example? Using defaults.");
148 } 148 }
149 else 149 else
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 1865ab8..56c3c7d 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -77,7 +77,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
77 private Dictionary<string, UrlData> m_UrlMap = 77 private Dictionary<string, UrlData> m_UrlMap =
78 new Dictionary<string, UrlData>(); 78 new Dictionary<string, UrlData>();
79 79
80 80 /// <summary>
81 /// Maximum number of external urls that can be set up by this module.
82 /// </summary>
81 private int m_TotalUrls = 5000; 83 private int m_TotalUrls = 5000;
82 84
83 private uint https_port = 0; 85 private uint https_port = 0;
@@ -108,6 +110,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
108 { 110 {
109 https_port = (uint) config.Configs["Network"].GetInt("https_port",0); 111 https_port = (uint) config.Configs["Network"].GetInt("https_port",0);
110 } 112 }
113
114 IConfig llFunctionsConfig = config.Configs["LL-Functions"];
115
116 if (llFunctionsConfig != null)
117 m_TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", m_TotalUrls);
111 } 118 }
112 119
113 public void PostInitialise() 120 public void PostInitialise()
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index c8f45f6..2f3c350 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
75 if (!m_Enabled) 75 if (!m_Enabled)
76 return; 76 return;
77 77
78 m_log.Info("[LAND IN CONNECTOR]: Starting..."); 78// m_log.Info("[LAND IN CONNECTOR]: Starting...");
79 } 79 }
80 80
81 public void Close() 81 public void Close()
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
index 3fd89b9..b544ab3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
74 if (!m_Enabled) 74 if (!m_Enabled)
75 return; 75 return;
76 76
77 m_log.Info("[NEIGHBOUR IN CONNECTOR]: Starting..."); 77// m_log.Info("[NEIGHBOUR IN CONNECTOR]: Starting...");
78 } 78 }
79 79
80 public void Close() 80 public void Close()
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 9a542a3..f3d38bc 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -348,12 +348,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
348 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 348 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
349 349
350 if (m_friendsModule == null) 350 if (m_friendsModule == null)
351 m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work"); 351 m_log.Debug("[PERMISSIONS]: Friends module not found, friend permissions will not work");
352 352
353 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); 353 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
354 354
355 if (m_groupsModule == null) 355 if (m_groupsModule == null)
356 m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); 356 m_log.Debug("[PERMISSIONS]: Groups module not found, group permissions will not work");
357 357
358 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); 358 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
359 359
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index c605fc1..4f0e100 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -81,7 +81,12 @@ namespace OpenSim.Region.Framework.Interfaces
81 /// <summary> 81 /// <summary>
82 /// Start all the scripts contained in this entity's inventory 82 /// Start all the scripts contained in this entity's inventory
83 /// </summary> 83 /// </summary>
84 void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); 84 /// <param name="startParam"></param>
85 /// <param name="postOnRez"></param>
86 /// <param name="engine"></param>
87 /// <param name="stateSource"></param>
88 /// <returns>Number of scripts started.</returns>
89 int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
85 90
86 ArrayList GetScriptErrors(UUID itemID); 91 ArrayList GetScriptErrors(UUID itemID);
87 void ResumeScripts(); 92 void ResumeScripts();
@@ -102,7 +107,11 @@ namespace OpenSim.Region.Framework.Interfaces
102 /// <param name="postOnRez"></param> 107 /// <param name="postOnRez"></param>
103 /// <param name="engine"></param> 108 /// <param name="engine"></param>
104 /// <param name="stateSource"></param> 109 /// <param name="stateSource"></param>
105 void CreateScriptInstance( 110 /// <returns>
111 /// true if the script instance was valid for starting, false otherwise. This does not guarantee
112 /// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.)
113 /// </returns>
114 bool CreateScriptInstance(
106 TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource); 115 TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource);
107 116
108 /// <summary> 117 /// <summary>
@@ -113,7 +122,11 @@ namespace OpenSim.Region.Framework.Interfaces
113 /// <param name="postOnRez"></param> 122 /// <param name="postOnRez"></param>
114 /// <param name="engine"></param> 123 /// <param name="engine"></param>
115 /// <param name="stateSource"></param> 124 /// <param name="stateSource"></param>
116 void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource); 125 /// <returns>
126 /// true if the script instance was valid for starting, false otherwise. This does not guarantee
127 /// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.)
128 /// </returns>
129 bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
117 130
118 ArrayList CreateScriptInstanceEr(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource); 131 ArrayList CreateScriptInstanceEr(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
119 132
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e1281a6..98b8fcc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -60,19 +60,32 @@ namespace OpenSim.Region.Framework.Scenes
60 /// <summary> 60 /// <summary>
61 /// Creates all the scripts in the scene which should be started. 61 /// Creates all the scripts in the scene which should be started.
62 /// </summary> 62 /// </summary>
63 public void CreateScriptInstances() 63 /// <returns>
64 /// Number of scripts that were valid for starting. This does not guarantee that all these scripts
65 /// were actually started, but just that the start could be attempt (e.g. the asset data for the script could be found)
66 /// </returns>
67 public int CreateScriptInstances()
64 { 68 {
65 m_log.Info("[PRIM INVENTORY]: Creating scripts in scene"); 69 m_log.InfoFormat("[SCENE]: Initializing script instances in {0}", RegionInfo.RegionName);
70
71 int scriptsValidForStarting = 0;
66 72
67 EntityBase[] entities = Entities.GetEntities(); 73 EntityBase[] entities = Entities.GetEntities();
68 foreach (EntityBase group in entities) 74 foreach (EntityBase group in entities)
69 { 75 {
70 if (group is SceneObjectGroup) 76 if (group is SceneObjectGroup)
71 { 77 {
72 ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); 78 scriptsValidForStarting
79 += ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
73 ((SceneObjectGroup) group).ResumeScripts(); 80 ((SceneObjectGroup) group).ResumeScripts();
74 } 81 }
75 } 82 }
83
84 m_log.InfoFormat(
85 "[SCENE]: Initialized {0} script instances in {1}",
86 scriptsValidForStarting, RegionInfo.RegionName);
87
88 return scriptsValidForStarting;
76 } 89 }
77 90
78 /// <summary> 91 /// <summary>
@@ -80,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
80 /// </summary> 93 /// </summary>
81 public void StartScripts() 94 public void StartScripts()
82 { 95 {
83 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); 96 m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName);
84 97
85 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); 98 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
86 99
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 85bae9a..757ac9f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1522,11 +1522,11 @@ namespace OpenSim.Region.Framework.Scenes
1522 LoginLock = false; 1522 LoginLock = false;
1523 EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); 1523 EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
1524 } 1524 }
1525 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1526 1525
1527 // For RegionReady lockouts 1526 // For RegionReady lockouts
1528 if(LoginLock == false) 1527 if (!LoginLock)
1529 { 1528 {
1529 m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1530 LoginsDisabled = false; 1530 LoginsDisabled = false;
1531 } 1531 }
1532 1532
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 2effa25..1038111 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -54,16 +54,28 @@ namespace OpenSim.Region.Framework.Scenes
54 /// <summary> 54 /// <summary>
55 /// Start the scripts contained in all the prims in this group. 55 /// Start the scripts contained in all the prims in this group.
56 /// </summary> 56 /// </summary>
57 public void CreateScriptInstances(int startParam, bool postOnRez, 57 /// <param name="startParam"></param>
58 string engine, int stateSource) 58 /// <param name="postOnRez"></param>
59 /// <param name="engine"></param>
60 /// <param name="stateSource"></param>
61 /// <returns>
62 /// Number of scripts that were valid for starting. This does not guarantee that all these scripts
63 /// were actually started, but just that the start could be attempt (e.g. the asset data for the script could be found)
64 /// </returns>
65 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
59 { 66 {
67 int scriptsStarted = 0;
68
60 // Don't start scripts if they're turned off in the region! 69 // Don't start scripts if they're turned off in the region!
61 if (!m_scene.RegionInfo.RegionSettings.DisableScripts) 70 if (!m_scene.RegionInfo.RegionSettings.DisableScripts)
62 { 71 {
63 SceneObjectPart[] parts = m_parts.GetArray(); 72 SceneObjectPart[] parts = m_parts.GetArray();
64 for (int i = 0; i < parts.Length; i++) 73 for (int i = 0; i < parts.Length; i++)
65 parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource); 74 scriptsStarted
75 += parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
66 } 76 }
77
78 return scriptsStarted;
67 } 79 }
68 80
69 /// <summary> 81 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8ed58a6..88afee7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1824,8 +1824,9 @@ namespace OpenSim.Region.Framework.Scenes
1824 part.ClearUpdateSchedule(); 1824 part.ClearUpdateSchedule();
1825 if (part == m_rootPart) 1825 if (part == m_rootPart)
1826 { 1826 {
1827 if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || 1827 if (!IsAttachment
1828 (AttachmentPoint < 31) || (AttachmentPoint > 38)) 1828 || AttachedAvatar == avatar.ControllingClient.AgentId
1829 || !HasPrivateAttachmentPoint)
1829 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); 1830 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId });
1830 } 1831 }
1831 } 1832 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c1fe6a3..f1e781c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2059,7 +2059,7 @@ namespace OpenSim.Region.Framework.Scenes
2059 else 2059 else
2060 m_log.WarnFormat( 2060 m_log.WarnFormat(
2061 "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", 2061 "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data",
2062 Name, LocalId, id); 2062 Name, UUID, id);
2063 } 2063 }
2064 2064
2065 /// <summary> 2065 /// <summary>
@@ -5026,8 +5026,9 @@ namespace OpenSim.Region.Framework.Scenes
5026 if (ParentGroup.IsDeleted) 5026 if (ParentGroup.IsDeleted)
5027 return; 5027 return;
5028 5028
5029 if (ParentGroup.IsAttachment && ((ParentGroup.RootPart != this) || 5029 if (ParentGroup.IsAttachment
5030 ((ParentGroup.AttachedAvatar != remoteClient.AgentId) && (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38)))) 5030 && (ParentGroup.RootPart != this
5031 || ParentGroup.AttachedAvatar != remoteClient.AgentId && ParentGroup.HasPrivateAttachmentPoint))
5031 return; 5032 return;
5032 5033
5033 // Causes this thread to dig into the Client Thread Data. 5034 // Causes this thread to dig into the Client Thread Data.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 81477e7..14ef0fb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -260,14 +260,16 @@ namespace OpenSim.Region.Framework.Scenes
260 Items.LockItemsForRead(false); 260 Items.LockItemsForRead(false);
261 } 261 }
262 262
263 /// <summary> 263 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
264 /// Start all the scripts contained in this prim's inventory
265 /// </summary>
266 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
267 { 264 {
265 int scriptsValidForStarting = 0;
266
268 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); 267 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
269 foreach (TaskInventoryItem item in scripts) 268 foreach (TaskInventoryItem item in scripts)
270 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); 269 if (CreateScriptInstance(item, startParam, postOnRez, engine, stateSource))
270 scriptsValidForStarting++;
271
272 return scriptsValidForStarting;
271 } 273 }
272 274
273 public ArrayList GetScriptErrors(UUID itemID) 275 public ArrayList GetScriptErrors(UUID itemID)
@@ -310,8 +312,8 @@ namespace OpenSim.Region.Framework.Scenes
310 /// Start a script which is in this prim's inventory. 312 /// Start a script which is in this prim's inventory.
311 /// </summary> 313 /// </summary>
312 /// <param name="item"></param> 314 /// <param name="item"></param>
313 /// <returns></returns> 315 /// <returns>true if the script instance was created, false otherwise</returns>
314 public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource) 316 public bool CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
315 { 317 {
316// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", 318// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
317// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); 319// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
@@ -319,61 +321,70 @@ namespace OpenSim.Region.Framework.Scenes
319 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 321 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
320 { 322 {
321 StoreScriptError(item.ItemID, "no permission"); 323 StoreScriptError(item.ItemID, "no permission");
322 return; 324 return false;
323 } 325 }
324 326
325 m_part.AddFlag(PrimFlags.Scripted); 327 m_part.AddFlag(PrimFlags.Scripted);
326 328
327 if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) 329 if (m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
330 return false;
331
332 if (stateSource == 2 && // Prim crossing
333 m_part.ParentGroup.Scene.m_trustBinaries)
328 { 334 {
329 if (stateSource == 2 && // Prim crossing 335 m_items.LockItemsForWrite(true);
330 m_part.ParentGroup.Scene.m_trustBinaries) 336 m_items[item.ItemID].PermsMask = 0;
331 { 337 m_items[item.ItemID].PermsGranter = UUID.Zero;
332 m_items.LockItemsForWrite(true); 338 m_items.LockItemsForWrite(false);
333 m_items[item.ItemID].PermsMask = 0; 339 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
334 m_items[item.ItemID].PermsGranter = UUID.Zero; 340 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
335 m_items.LockItemsForWrite(false); 341 StoreScriptErrors(item.ItemID, null);
336 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 342 m_part.ParentGroup.AddActiveScriptCount(1);
337 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); 343 m_part.ScheduleFullUpdate();
338 StoreScriptErrors(item.ItemID, null); 344 return true;
339 m_part.ParentGroup.AddActiveScriptCount(1); 345 }
340 m_part.ScheduleFullUpdate();
341 return;
342 }
343 346
344 AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); 347 AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
345 if (null == asset) 348 if (null == asset)
346 { 349 {
347 string msg = String.Format("asset ID {0} could not be found", item.AssetID); 350 m_log.ErrorFormat(
348 StoreScriptError(item.ItemID, msg); 351 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
349 m_log.ErrorFormat( 352 item.Name, item.ItemID, m_part.AbsolutePosition,
353 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
354
355 return false;
356 }
357 else
358 {
359 if (m_part.ParentGroup.m_savedScriptState != null)
360 item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
361
362 string msg = String.Format("asset ID {0} could not be found", item.AssetID);
363 StoreScriptError(item.ItemID, msg);
364 m_log.ErrorFormat(
350 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", 365 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
351 item.Name, item.ItemID, m_part.AbsolutePosition, 366 item.Name, item.ItemID, m_part.AbsolutePosition,
352 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); 367 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
353 }
354 else
355 {
356 if (m_part.ParentGroup.m_savedScriptState != null)
357 item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
358 368
359 m_items.LockItemsForWrite(true); 369 m_items.LockItemsForWrite(true);
360 370
361 m_items[item.ItemID].OldItemID = item.OldItemID; 371 m_items[item.ItemID].OldItemID = item.OldItemID;
362 m_items[item.ItemID].PermsMask = 0; 372 m_items[item.ItemID].PermsMask = 0;
363 m_items[item.ItemID].PermsGranter = UUID.Zero; 373 m_items[item.ItemID].PermsGranter = UUID.Zero;
364 374
365 m_items.LockItemsForWrite(false); 375 m_items.LockItemsForWrite(false);
366 376
367 string script = Utils.BytesToString(asset.Data); 377 string script = Utils.BytesToString(asset.Data);
368 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 378 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
369 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); 379 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
370 StoreScriptErrors(item.ItemID, null); 380 StoreScriptErrors(item.ItemID, null);
371 if (!item.ScriptRunning) 381 if (!item.ScriptRunning)
372 m_part.ParentGroup.Scene.EventManager.TriggerStopScript( 382 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(
373 m_part.LocalId, item.ItemID); 383 m_part.LocalId, item.ItemID);
374 m_part.ParentGroup.AddActiveScriptCount(1); 384 m_part.ParentGroup.AddActiveScriptCount(1);
375 m_part.ScheduleFullUpdate(); 385 m_part.ScheduleFullUpdate();
376 } 386
387 return true;
377 } 388 }
378 } 389 }
379 390
@@ -446,7 +457,7 @@ namespace OpenSim.Region.Framework.Scenes
446 /// <param name="itemId"> 457 /// <param name="itemId">
447 /// A <see cref="UUID"/> 458 /// A <see cref="UUID"/>
448 /// </param> 459 /// </param>
449 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 460 public bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
450 { 461 {
451 lock (m_scriptErrors) 462 lock (m_scriptErrors)
452 { 463 {
@@ -454,6 +465,7 @@ namespace OpenSim.Region.Framework.Scenes
454 m_scriptErrors.Remove(itemId); 465 m_scriptErrors.Remove(itemId);
455 } 466 }
456 CreateScriptInstanceInternal(itemId, startParam, postOnRez, engine, stateSource); 467 CreateScriptInstanceInternal(itemId, startParam, postOnRez, engine, stateSource);
468 return true;
457 } 469 }
458 470
459 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 471 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index eeb125e..01021c9 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -63,6 +63,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
63 { 63 {
64 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 64 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
65 65
66 /// <summary>
67 /// Control the printing of certain debug messages.
68 /// </summary>
69 /// <remarks>
70 /// If DebugLevel >= 1, then we log every time that a script is started.
71 /// </remarks>
72// public int DebugLevel { get; set; }
73
66 private SmartThreadPool m_ThreadPool; 74 private SmartThreadPool m_ThreadPool;
67 private int m_MaxScriptQueue; 75 private int m_MaxScriptQueue;
68 private Scene m_Scene; 76 private Scene m_Scene;
@@ -284,9 +292,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
284 AppDomain.CurrentDomain.AssemblyResolve += 292 AppDomain.CurrentDomain.AssemblyResolve +=
285 OnAssemblyResolve; 293 OnAssemblyResolve;
286 294
287 m_log.InfoFormat("[XEngine] Initializing scripts in region {0}",
288 scene.RegionInfo.RegionName);
289 m_Scene = scene; 295 m_Scene = scene;
296 m_log.InfoFormat("[XEngine]: Initializing scripts in region {0}", m_Scene.RegionInfo.RegionName);
290 297
291 m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2); 298 m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2);
292 m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100); 299 m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100);
@@ -389,9 +396,42 @@ namespace OpenSim.Region.ScriptEngine.XEngine
389 "Starts all stopped scripts." 396 "Starts all stopped scripts."
390 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", 397 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
391 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); 398 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
399
400// MainConsole.Instance.Commands.AddCommand(
401// "Debug", false, "debug xengine", "debug xengine [<level>]",
402// "Turn on detailed xengine debugging.",
403// "If level <= 0, then no extra logging is done.\n"
404// + "If level >= 1, then we log every time that a script is started.",
405// HandleDebugLevelCommand);
392 } 406 }
393 407
394 /// <summary> 408 /// <summary>
409 /// Change debug level
410 /// </summary>
411 /// <param name="module"></param>
412 /// <param name="args"></param>
413// private void HandleDebugLevelCommand(string module, string[] args)
414// {
415// if (args.Length == 3)
416// {
417// int newDebug;
418// if (int.TryParse(args[2], out newDebug))
419// {
420// DebugLevel = newDebug;
421// MainConsole.Instance.OutputFormat("Debug level set to {0}", newDebug);
422// }
423// }
424// else if (args.Length == 2)
425// {
426// MainConsole.Instance.OutputFormat("Current debug level is {0}", DebugLevel);
427// }
428// else
429// {
430// MainConsole.Instance.Output("Usage: debug xengine 0..1");
431// }
432// }
433
434 /// <summary>
395 /// Parse the raw item id into a script instance from the command params if it's present. 435 /// Parse the raw item id into a script instance from the command params if it's present.
396 /// </summary> 436 /// </summary>
397 /// <param name="cmdparams"></param> 437 /// <param name="cmdparams"></param>
@@ -892,8 +932,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
892 } 932 }
893 933
894 object[] o; 934 object[] o;
935
936 int scriptsStarted = 0;
937
895 while (m_CompileQueue.Dequeue(out o)) 938 while (m_CompileQueue.Dequeue(out o))
896 DoOnRezScript(o); 939 {
940 if (DoOnRezScript(o))
941 {
942 scriptsStarted++;
943
944// if (scriptsStarted % 50 == 0)
945// m_log.DebugFormat(
946// "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
947 }
948 }
949
950// m_log.DebugFormat(
951// "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
897 952
898 // NOTE: Despite having a lockless queue, this lock is required 953 // NOTE: Despite having a lockless queue, this lock is required
899 // to make sure there is never no compile thread while there 954 // to make sure there is never no compile thread while there
@@ -1749,14 +1804,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1749 FileMode.Open, FileAccess.Read)) 1804 FileMode.Open, FileAccess.Read))
1750 { 1805 {
1751 tfs.Read(tdata, 0, tdata.Length); 1806 tfs.Read(tdata, 0, tdata.Length);
1752 tfs.Close();
1753 } 1807 }
1754 1808
1755 assem = new System.Text.ASCIIEncoding().GetString(tdata); 1809 assem = new System.Text.ASCIIEncoding().GetString(tdata);
1756 } 1810 }
1757 catch (Exception e) 1811 catch (Exception e)
1758 { 1812 {
1759 m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message); 1813 m_log.ErrorFormat(
1814 "[XEngine]: Unable to open script textfile {0}{1}, reason: {2}",
1815 assemName, ".text", e.Message);
1760 } 1816 }
1761 } 1817 }
1762 } 1818 }
@@ -1773,16 +1829,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1773 using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read)) 1829 using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
1774 { 1830 {
1775 fs.Read(data, 0, data.Length); 1831 fs.Read(data, 0, data.Length);
1776 fs.Close();
1777 } 1832 }
1778 1833
1779 assem = System.Convert.ToBase64String(data); 1834 assem = System.Convert.ToBase64String(data);
1780 } 1835 }
1781 catch (Exception e) 1836 catch (Exception e)
1782 { 1837 {
1783 m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message); 1838 m_log.ErrorFormat(
1839 "[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message);
1784 } 1840 }
1785
1786 } 1841 }
1787 } 1842 }
1788 1843
@@ -1795,9 +1850,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1795 using (StreamReader msr = new StreamReader(mfs)) 1850 using (StreamReader msr = new StreamReader(mfs))
1796 { 1851 {
1797 map = msr.ReadToEnd(); 1852 map = msr.ReadToEnd();
1798 msr.Close();
1799 } 1853 }
1800 mfs.Close();
1801 } 1854 }
1802 } 1855 }
1803 1856
@@ -1833,6 +1886,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1833 1886
1834 public bool SetXMLState(UUID itemID, string xml) 1887 public bool SetXMLState(UUID itemID, string xml)
1835 { 1888 {
1889// m_log.DebugFormat("[XEngine]: Writing state for script item with ID {0}", itemID);
1890
1836 if (xml == String.Empty) 1891 if (xml == String.Empty)
1837 return false; 1892 return false;
1838 1893
@@ -1893,14 +1948,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1893 { 1948 {
1894 using (FileStream fs = File.Create(path)) 1949 using (FileStream fs = File.Create(path))
1895 { 1950 {
1951// m_log.DebugFormat("[XEngine]: Writing assembly file {0}", path);
1952
1896 fs.Write(filedata, 0, filedata.Length); 1953 fs.Write(filedata, 0, filedata.Length);
1897 fs.Close();
1898 } 1954 }
1899 } 1955 }
1900 catch (IOException ex) 1956 catch (IOException ex)
1901 { 1957 {
1902 // if there already exists a file at that location, it may be locked. 1958 // if there already exists a file at that location, it may be locked.
1903 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); 1959 m_log.ErrorFormat("[XEngine]: Error whilst writing assembly file {0}, {1}", path, ex.Message);
1904 } 1960 }
1905 1961
1906 string textpath = path + ".text"; 1962 string textpath = path + ".text";
@@ -1910,16 +1966,43 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1910 { 1966 {
1911 using (StreamWriter sw = new StreamWriter(fs)) 1967 using (StreamWriter sw = new StreamWriter(fs))
1912 { 1968 {
1969// m_log.DebugFormat("[XEngine]: Writing .text file {0}", textpath);
1970
1913 sw.Write(base64); 1971 sw.Write(base64);
1914 sw.Close();
1915 } 1972 }
1916 fs.Close();
1917 } 1973 }
1918 } 1974 }
1919 catch (IOException ex) 1975 catch (IOException ex)
1920 { 1976 {
1921 // if there already exists a file at that location, it may be locked. 1977 // if there already exists a file at that location, it may be locked.
1922 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", textpath, ex.Message); 1978 m_log.ErrorFormat("[XEngine]: Error whilst writing .text file {0}, {1}", textpath, ex.Message);
1979 }
1980 }
1981
1982 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
1983 if (mapL.Count > 0)
1984 {
1985 XmlElement mapE = (XmlElement)mapL[0];
1986
1987 string mappath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString());
1988 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
1989
1990 try
1991 {
1992 using (FileStream mfs = File.Create(mappath))
1993 {
1994 using (StreamWriter msw = new StreamWriter(mfs))
1995 {
1996 // m_log.DebugFormat("[XEngine]: Writing linemap file {0}", mappath);
1997
1998 msw.Write(mapE.InnerText);
1999 }
2000 }
2001 }
2002 catch (IOException ex)
2003 {
2004 // if there already exists a file at that location, it may be locked.
2005 m_log.ErrorFormat("[XEngine]: Linemap file {0} already exists! {1}", mappath, ex.Message);
1923 } 2006 }
1924 } 2007 }
1925 } 2008 }
@@ -1933,43 +2016,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1933 { 2016 {
1934 using (StreamWriter ssw = new StreamWriter(sfs)) 2017 using (StreamWriter ssw = new StreamWriter(sfs))
1935 { 2018 {
2019// m_log.DebugFormat("[XEngine]: Writing state file {0}", statepath);
2020
1936 ssw.Write(stateE.OuterXml); 2021 ssw.Write(stateE.OuterXml);
1937 ssw.Close();
1938 } 2022 }
1939 sfs.Close();
1940 } 2023 }
1941 } 2024 }
1942 catch (IOException ex) 2025 catch (IOException ex)
1943 { 2026 {
1944 // if there already exists a file at that location, it may be locked. 2027 // if there already exists a file at that location, it may be locked.
1945 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message); 2028 m_log.ErrorFormat("[XEngine]: Error whilst writing state file {0}, {1}", statepath, ex.Message);
1946 }
1947
1948 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
1949 if (mapL.Count > 0)
1950 {
1951 XmlElement mapE = (XmlElement)mapL[0];
1952
1953 string mappath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString());
1954 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
1955
1956 try
1957 {
1958 using (FileStream mfs = File.Create(mappath))
1959 {
1960 using (StreamWriter msw = new StreamWriter(mfs))
1961 {
1962 msw.Write(mapE.InnerText);
1963 msw.Close();
1964 }
1965 mfs.Close();
1966 }
1967 }
1968 catch (IOException ex)
1969 {
1970 // if there already exists a file at that location, it may be locked.
1971 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", mappath, ex.Message);
1972 }
1973 } 2029 }
1974 2030
1975 return true; 2031 return true;