diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rwxr-xr-x | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index cd5308d..0ccc683 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -182,7 +182,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
182 | 182 | ||
183 | private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue(); | 183 | private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue(); |
184 | IWorkItemResult m_CurrentCompile = null; | 184 | IWorkItemResult m_CurrentCompile = null; |
185 | private Dictionary<UUID, int> m_CompileDict = new Dictionary<UUID, int>(); | 185 | private Dictionary<UUID, ScriptCompileInfo> m_CompileDict = new Dictionary<UUID, ScriptCompileInfo>(); |
186 | 186 | ||
187 | private ScriptEngineConsoleCommands m_consoleCommands; | 187 | private ScriptEngineConsoleCommands m_consoleCommands; |
188 | 188 | ||
@@ -236,6 +236,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
236 | get { return m_ConfigSource; } | 236 | get { return m_ConfigSource; } |
237 | } | 237 | } |
238 | 238 | ||
239 | private class ScriptCompileInfo | ||
240 | { | ||
241 | public List<EventParams> eventList = new List<EventParams>(); | ||
242 | } | ||
243 | |||
239 | /// <summary> | 244 | /// <summary> |
240 | /// Event fired after the script engine has finished removing a script. | 245 | /// Event fired after the script engine has finished removing a script. |
241 | /// </summary> | 246 | /// </summary> |
@@ -1009,7 +1014,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1009 | { | 1014 | { |
1010 | lock (m_CompileDict) | 1015 | lock (m_CompileDict) |
1011 | { | 1016 | { |
1012 | m_CompileDict[itemID] = 0; | 1017 | // m_log.DebugFormat("[XENGINE]: Set compile dict for {0}", itemID); |
1018 | m_CompileDict[itemID] = new ScriptCompileInfo(); | ||
1013 | } | 1019 | } |
1014 | 1020 | ||
1015 | DoOnRezScript(parms); | 1021 | DoOnRezScript(parms); |
@@ -1017,7 +1023,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1017 | else | 1023 | else |
1018 | { | 1024 | { |
1019 | lock (m_CompileDict) | 1025 | lock (m_CompileDict) |
1020 | m_CompileDict[itemID] = 0; | 1026 | m_CompileDict[itemID] = new ScriptCompileInfo(); |
1027 | // m_log.DebugFormat("[XENGINE]: Set compile dict for {0} delayed", itemID); | ||
1021 | 1028 | ||
1022 | // This must occur after the m_CompileDict so that an existing compile thread cannot hit the check | 1029 | // This must occur after the m_CompileDict so that an existing compile thread cannot hit the check |
1023 | // in DoOnRezScript() before m_CompileDict has been updated. | 1030 | // in DoOnRezScript() before m_CompileDict has been updated. |
@@ -1135,7 +1142,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1135 | { | 1142 | { |
1136 | if (!m_CompileDict.ContainsKey(itemID)) | 1143 | if (!m_CompileDict.ContainsKey(itemID)) |
1137 | return false; | 1144 | return false; |
1138 | m_CompileDict.Remove(itemID); | ||
1139 | } | 1145 | } |
1140 | 1146 | ||
1141 | // Get the asset ID of the script, so we can check if we | 1147 | // Get the asset ID of the script, so we can check if we |
@@ -1150,6 +1156,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1150 | m_log.ErrorFormat("[Script]: SceneObjectPart with localID {0} unavailable. Script NOT started.", localID); | 1156 | m_log.ErrorFormat("[Script]: SceneObjectPart with localID {0} unavailable. Script NOT started.", localID); |
1151 | m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n"; | 1157 | m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n"; |
1152 | m_ScriptFailCount++; | 1158 | m_ScriptFailCount++; |
1159 | lock (m_CompileDict) | ||
1160 | m_CompileDict.Remove(itemID); | ||
1153 | return false; | 1161 | return false; |
1154 | } | 1162 | } |
1155 | 1163 | ||
@@ -1158,6 +1166,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1158 | { | 1166 | { |
1159 | m_ScriptErrorMessage += "Can't find script inventory item.\n"; | 1167 | m_ScriptErrorMessage += "Can't find script inventory item.\n"; |
1160 | m_ScriptFailCount++; | 1168 | m_ScriptFailCount++; |
1169 | lock (m_CompileDict) | ||
1170 | m_CompileDict.Remove(itemID); | ||
1161 | return false; | 1171 | return false; |
1162 | } | 1172 | } |
1163 | 1173 | ||
@@ -1275,6 +1285,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1275 | // e.Message.ToString()); | 1285 | // e.Message.ToString()); |
1276 | // } | 1286 | // } |
1277 | 1287 | ||
1288 | lock (m_CompileDict) | ||
1289 | m_CompileDict.Remove(itemID); | ||
1278 | return false; | 1290 | return false; |
1279 | } | 1291 | } |
1280 | } | 1292 | } |
@@ -1345,6 +1357,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1345 | { | 1357 | { |
1346 | m_AddingAssemblies[assemblyPath]--; | 1358 | m_AddingAssemblies[assemblyPath]--; |
1347 | } | 1359 | } |
1360 | lock (m_CompileDict) | ||
1361 | m_CompileDict.Remove(itemID); | ||
1348 | return false; | 1362 | return false; |
1349 | } | 1363 | } |
1350 | } | 1364 | } |
@@ -1402,6 +1416,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1402 | assemblyName.FullName, World.Name), | 1416 | assemblyName.FullName, World.Name), |
1403 | e2); | 1417 | e2); |
1404 | 1418 | ||
1419 | lock (m_CompileDict) | ||
1420 | m_CompileDict.Remove(itemID); | ||
1405 | return false; | 1421 | return false; |
1406 | } | 1422 | } |
1407 | 1423 | ||
@@ -1451,6 +1467,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1451 | assemblyName.FullName, World.Name), | 1467 | assemblyName.FullName, World.Name), |
1452 | e2); | 1468 | e2); |
1453 | 1469 | ||
1470 | lock (m_CompileDict) | ||
1471 | m_CompileDict.Remove(itemID); | ||
1454 | return false; | 1472 | return false; |
1455 | } | 1473 | } |
1456 | 1474 | ||
@@ -1478,7 +1496,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1478 | 1496 | ||
1479 | if(!instance.Load(scriptObj, coopSleepHandle, assemblyPath, | 1497 | if(!instance.Load(scriptObj, coopSleepHandle, assemblyPath, |
1480 | Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript)) | 1498 | Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript)) |
1481 | return false; | 1499 | { |
1500 | lock (m_CompileDict) | ||
1501 | m_CompileDict.Remove(itemID); | ||
1502 | return false; | ||
1503 | } | ||
1482 | 1504 | ||
1483 | // if (DebugLevel >= 1) | 1505 | // if (DebugLevel >= 1) |
1484 | // m_log.DebugFormat( | 1506 | // m_log.DebugFormat( |
@@ -1518,7 +1540,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1518 | } | 1540 | } |
1519 | 1541 | ||
1520 | if (instance != null) | 1542 | if (instance != null) |
1543 | { | ||
1521 | instance.Init(); | 1544 | instance.Init(); |
1545 | lock (m_CompileDict) | ||
1546 | { | ||
1547 | foreach (EventParams pp in m_CompileDict[itemID].eventList) | ||
1548 | instance.PostEvent(pp); | ||
1549 | } | ||
1550 | } | ||
1551 | lock (m_CompileDict) | ||
1552 | m_CompileDict.Remove(itemID); | ||
1522 | 1553 | ||
1523 | bool runIt; | 1554 | bool runIt; |
1524 | if (m_runFlags.TryGetValue(itemID, out runIt)) | 1555 | if (m_runFlags.TryGetValue(itemID, out runIt)) |
@@ -1742,6 +1773,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1742 | instance.PostEvent(p); | 1773 | instance.PostEvent(p); |
1743 | result = true; | 1774 | result = true; |
1744 | } | 1775 | } |
1776 | else | ||
1777 | { | ||
1778 | lock (m_CompileDict) | ||
1779 | { | ||
1780 | if (m_CompileDict.ContainsKey(itemID)) | ||
1781 | { | ||
1782 | m_CompileDict[itemID].eventList.Add(p); | ||
1783 | result = true; | ||
1784 | } | ||
1785 | } | ||
1786 | } | ||
1745 | } | 1787 | } |
1746 | } | 1788 | } |
1747 | 1789 | ||
@@ -1763,6 +1805,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1763 | instance.PostEvent(p); | 1805 | instance.PostEvent(p); |
1764 | return true; | 1806 | return true; |
1765 | } | 1807 | } |
1808 | lock (m_CompileDict) | ||
1809 | { | ||
1810 | if (m_CompileDict.ContainsKey(itemID)) | ||
1811 | { | ||
1812 | m_CompileDict[itemID].eventList.Add(p); | ||
1813 | return true; | ||
1814 | } | ||
1815 | } | ||
1766 | return false; | 1816 | return false; |
1767 | } | 1817 | } |
1768 | 1818 | ||