aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorOren Hurvitz2015-08-07 16:35:32 +0300
committerOren Hurvitz2015-08-11 08:44:27 +0100
commit59da146e9dd678aea2e0bd3e16ef178c183754a0 (patch)
tree4b6cfebfd3d0a41cc51dcd2eac377ce9cfbe8d2c /OpenSim/Region/ScriptEngine/Shared
parentWhen scripts are sleeping, don't count that as execution time (diff)
downloadopensim-SC-59da146e9dd678aea2e0bd3e16ef178c183754a0.zip
opensim-SC-59da146e9dd678aea2e0bd3e16ef178c183754a0.tar.gz
opensim-SC-59da146e9dd678aea2e0bd3e16ef178c183754a0.tar.bz2
opensim-SC-59da146e9dd678aea2e0bd3e16ef178c183754a0.tar.xz
When the user stops a script, have it remain stopped
Previously the script state was never saved for a !Running script, so upon region restart the script would be Running again. The use of the 'StayStopped' flag is needed because all scripts are automatically stopped when the region shuts down, but in that case we shouldn't save in their state that they're !Running.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs21
1 files changed, 18 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index c6512ba..6541256 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -126,7 +126,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
126 } 126 }
127 } 127 }
128 128
129 public bool Running { get; set; } 129 public bool Running
130 {
131 get { return m_running; }
132
133 set
134 {
135 m_running = value;
136 if (m_running)
137 StayStopped = false;
138 }
139 }
140 private bool m_running;
130 141
131 public bool Suspended 142 public bool Suspended
132 { 143 {
@@ -158,6 +169,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
158 169
159 public string State { get; set; } 170 public string State { get; set; }
160 171
172 public bool StayStopped { get; set; }
173
161 public IScriptEngine Engine { get; private set; } 174 public IScriptEngine Engine { get; private set; }
162 175
163 public UUID AppDomain { get; set; } 176 public UUID AppDomain { get; set; }
@@ -1077,7 +1090,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1077 1090
1078 public void SaveState() 1091 public void SaveState()
1079 { 1092 {
1080 if (!Running) 1093 if (!Running && !StayStopped)
1081 return; 1094 return;
1082 1095
1083 // We cannot call this inside the EventQueue lock since it will currently take AsyncCommandManager.staticLock. 1096 // We cannot call this inside the EventQueue lock since it will currently take AsyncCommandManager.staticLock.
@@ -1089,7 +1102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1089 lock (EventQueue) 1102 lock (EventQueue)
1090 { 1103 {
1091 // Check again to avoid a race with a thread in Stop() 1104 // Check again to avoid a race with a thread in Stop()
1092 if (!Running) 1105 if (!Running && !StayStopped)
1093 return; 1106 return;
1094 1107
1095 // If we're currently in an event, just tell it to save upon return 1108 // If we're currently in an event, just tell it to save upon return
@@ -1130,6 +1143,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1130 //} 1143 //}
1131 m_CurrentStateHash = hash; 1144 m_CurrentStateHash = hash;
1132 } 1145 }
1146
1147 StayStopped = false;
1133 } 1148 }
1134 } 1149 }
1135 1150