let engines Suspend and resume scripts return false if script not on that engine

master
UbitUmarov 2020-05-25 14:41:59 +01:00
parent 5f52de2578
commit 66eb8a2c2e
5 changed files with 23 additions and 32 deletions

View File

@ -70,13 +70,13 @@ namespace OpenSim.Region.Framework.Interfaces
/// Suspends a script. /// Suspends a script.
/// </summary> /// </summary>
/// <param name="itemID">The item ID of the script.</param> /// <param name="itemID">The item ID of the script.</param>
void SuspendScript(UUID itemID); bool SuspendScript(UUID itemID);
/// <summary> /// <summary>
/// Resumes a script. /// Resumes a script.
/// </summary> /// </summary>
/// <param name="itemID">The item ID of the script.</param> /// <param name="itemID">The item ID of the script.</param>
void ResumeScript(UUID itemID); bool ResumeScript(UUID itemID);
ArrayList GetScriptErrors(UUID itemID); ArrayList GetScriptErrors(UUID itemID);

View File

@ -410,10 +410,6 @@ namespace OpenSim.Region.Framework.Scenes
Rezzed = DateTime.UtcNow; Rezzed = DateTime.UtcNow;
Description = String.Empty; Description = String.Empty;
PseudoCRC = (int)DateTime.UtcNow.Ticks; // random could be as good; fallbak if not on region db PseudoCRC = (int)DateTime.UtcNow.Ticks; // random could be as good; fallbak if not on region db
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
// the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
m_inventory = new SceneObjectPartInventory(this); m_inventory = new SceneObjectPartInventory(this);
LastColSoundSentTime = Util.EnvironmentTickCount(); LastColSoundSentTime = Util.EnvironmentTickCount();
} }
@ -449,7 +445,6 @@ namespace OpenSim.Region.Framework.Scenes
APIDActive = false; APIDActive = false;
Flags = 0; Flags = 0;
CreateSelected = true; CreateSelected = true;
PseudoCRC = (int)DateTime.UtcNow.Ticks; // random could be as good
TrimPermissions(); TrimPermissions();
AggregateInnerPerms(); AggregateInnerPerms();
} }

View File

@ -388,10 +388,13 @@ namespace OpenSim.Region.Framework.Scenes
if (textureEntry.FaceTextures != null) if (textureEntry.FaceTextures != null)
{ {
// Loop through the rest of the texture faces (a non-null face means the face is different from DefaultTexture) // Loop through the rest of the texture faces (a non-null face means the face is different from DefaultTexture)
int nsides = part.GetNumberOfSides();
foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures) foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures)
{ {
if (texture != null) if (texture != null)
RecordTextureEntryAssetUuids(texture); RecordTextureEntryAssetUuids(texture);
if(--nsides <= 0)
break;
} }
} }
} }
@ -646,7 +649,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
private void RecordTextureEntryAssetUuids(Primitive.TextureEntryFace texture) private void RecordTextureEntryAssetUuids(Primitive.TextureEntryFace texture)
{ {
GatheredUuids[texture.TextureID] = (sbyte)AssetType.Texture; if (texture.TextureID != UUID.Zero)
GatheredUuids[texture.TextureID] = (sbyte)AssetType.Texture;
if (texture.MaterialID != UUID.Zero) if (texture.MaterialID != UUID.Zero)
AddForInspection(texture.MaterialID); AddForInspection(texture.MaterialID);

View File

@ -1466,6 +1466,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
return m_OSSL_Functions.osClearObjectAnimations(); return m_OSSL_Functions.osClearObjectAnimations();
} }
} }
} }

View File

@ -2460,38 +2460,31 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return (float)si.ExecutionTime.GetSumTime().TotalMilliseconds; return (float)si.ExecutionTime.GetSumTime().TotalMilliseconds;
} }
public void SuspendScript(UUID itemID) public bool SuspendScript(UUID itemID)
{ {
// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID); // m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
instance.Suspend();
// else
// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads); m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return false;
instance.Suspend();
return true;
} }
public void ResumeScript(UUID itemID) public bool ResumeScript(UUID itemID)
{ {
// m_log.DebugFormat("[XEngine]: Received request to resume script with ID {0}", itemID); // m_log.DebugFormat("[XEngine]: Received request to resume script with ID {0}", itemID);
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance != null) if (instance != null)
{
instance.Resume(); instance.Resume();
// else return true;
// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); }
return false;
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
} }
public bool HasScript(UUID itemID, out bool running) public bool HasScript(UUID itemID, out bool running)