diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index b261b9f..7cb4862 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -86,6 +86,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
86 | /// </summary> | 86 | /// </summary> |
87 | private int m_StartDelay; | 87 | private int m_StartDelay; |
88 | 88 | ||
89 | private bool m_coopTermination; | ||
90 | |||
89 | private int m_IdleTimeout; | 91 | private int m_IdleTimeout; |
90 | private int m_StackSize; | 92 | private int m_StackSize; |
91 | private int m_SleepTime; | 93 | private int m_SleepTime; |
@@ -246,6 +248,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
246 | 248 | ||
247 | if (rawScriptStopStrategy == "co-op") | 249 | if (rawScriptStopStrategy == "co-op") |
248 | { | 250 | { |
251 | m_coopTermination = true; | ||
249 | ScriptClassName = "XEngineScript"; | 252 | ScriptClassName = "XEngineScript"; |
250 | ScriptBaseClassName = typeof(XEngineScriptBase).FullName; | 253 | ScriptBaseClassName = typeof(XEngineScriptBase).FullName; |
251 | ScriptBaseClassParameters = typeof(XEngineScriptBase).GetConstructor(new Type[] { typeof(WaitHandle) }).GetParameters(); | 254 | ScriptBaseClassParameters = typeof(XEngineScriptBase).GetConstructor(new Type[] { typeof(WaitHandle) }).GetParameters(); |
@@ -1139,7 +1142,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1139 | 1142 | ||
1140 | ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID); | 1143 | ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID); |
1141 | 1144 | ||
1142 | string assembly = ""; | 1145 | string assemblyPath = ""; |
1143 | 1146 | ||
1144 | Culture.SetCurrentCulture(); | 1147 | Culture.SetCurrentCulture(); |
1145 | 1148 | ||
@@ -1151,12 +1154,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1151 | { | 1154 | { |
1152 | lock (m_AddingAssemblies) | 1155 | lock (m_AddingAssemblies) |
1153 | { | 1156 | { |
1154 | m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); | 1157 | m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assemblyPath, out linemap); |
1155 | 1158 | ||
1156 | if (!m_AddingAssemblies.ContainsKey(assembly)) { | 1159 | if (!m_AddingAssemblies.ContainsKey(assemblyPath)) { |
1157 | m_AddingAssemblies[assembly] = 1; | 1160 | m_AddingAssemblies[assemblyPath] = 1; |
1158 | } else { | 1161 | } else { |
1159 | m_AddingAssemblies[assembly]++; | 1162 | m_AddingAssemblies[assemblyPath]++; |
1160 | } | 1163 | } |
1161 | } | 1164 | } |
1162 | 1165 | ||
@@ -1301,19 +1304,43 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1301 | m_ScriptFailCount++; | 1304 | m_ScriptFailCount++; |
1302 | lock (m_AddingAssemblies) | 1305 | lock (m_AddingAssemblies) |
1303 | { | 1306 | { |
1304 | m_AddingAssemblies[assembly]--; | 1307 | m_AddingAssemblies[assemblyPath]--; |
1305 | } | 1308 | } |
1306 | return false; | 1309 | return false; |
1307 | } | 1310 | } |
1308 | } | 1311 | } |
1309 | m_DomainScripts[appDomain].Add(itemID); | 1312 | m_DomainScripts[appDomain].Add(itemID); |
1310 | 1313 | ||
1314 | Assembly scriptAssembly = m_AppDomains[appDomain].Load(Path.GetFileNameWithoutExtension(assemblyPath)); | ||
1315 | bool recompile = false; | ||
1316 | |||
1317 | if (m_coopTermination) | ||
1318 | { | ||
1319 | Type scriptType = scriptAssembly.GetType("SecondLife.XEngineScript"); | ||
1320 | |||
1321 | if (scriptType == null) | ||
1322 | recompile = true; | ||
1323 | } | ||
1324 | else | ||
1325 | { | ||
1326 | Type scriptType = scriptAssembly.GetType("SecondLife.Script"); | ||
1327 | |||
1328 | if (scriptType == null) | ||
1329 | recompile = true; | ||
1330 | } | ||
1331 | |||
1332 | // If we are loading all scripts into the same AppDomain, then we can't reload the DLL in this | ||
1333 | // simulator session if the script halt strategy has been changed. Instead, we'll continue with | ||
1334 | // the existing DLL and the new one will be used in the next simulator session. | ||
1335 | if (recompile) | ||
1336 | m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, true, out assemblyPath, out linemap); | ||
1337 | |||
1311 | instance = new ScriptInstance(this, part, | 1338 | instance = new ScriptInstance(this, part, |
1312 | item, | 1339 | item, |
1313 | startParam, postOnRez, | 1340 | startParam, postOnRez, |
1314 | m_MaxScriptQueue); | 1341 | m_MaxScriptQueue); |
1315 | 1342 | ||
1316 | if (!instance.Load(m_AppDomains[appDomain], assembly, stateSource)) | 1343 | if (!instance.Load(m_AppDomains[appDomain], scriptAssembly, stateSource)) |
1317 | return false; | 1344 | return false; |
1318 | 1345 | ||
1319 | // if (DebugLevel >= 1) | 1346 | // if (DebugLevel >= 1) |
@@ -1345,11 +1372,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1345 | } | 1372 | } |
1346 | 1373 | ||
1347 | if (!m_Assemblies.ContainsKey(assetID)) | 1374 | if (!m_Assemblies.ContainsKey(assetID)) |
1348 | m_Assemblies[assetID] = assembly; | 1375 | m_Assemblies[assetID] = assemblyPath; |
1349 | 1376 | ||
1350 | lock (m_AddingAssemblies) | 1377 | lock (m_AddingAssemblies) |
1351 | { | 1378 | { |
1352 | m_AddingAssemblies[assembly]--; | 1379 | m_AddingAssemblies[assemblyPath]--; |
1353 | } | 1380 | } |
1354 | 1381 | ||
1355 | if (instance != null) | 1382 | if (instance != null) |