Merge branch 'master' of /home/opensim/var/repo/opensim
commit
2ae3e8cf39
|
@ -393,12 +393,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
llsdFolder.folder_id = invFolder.ID;
|
llsdFolder.folder_id = invFolder.ID;
|
||||||
llsdFolder.parent_id = invFolder.ParentID;
|
llsdFolder.parent_id = invFolder.ParentID;
|
||||||
llsdFolder.name = invFolder.Name;
|
llsdFolder.name = invFolder.Name;
|
||||||
|
llsdFolder.type = invFolder.Type;
|
||||||
if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type))
|
llsdFolder.preferred_type = -1;
|
||||||
llsdFolder.type = "-1";
|
|
||||||
else
|
|
||||||
llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type);
|
|
||||||
llsdFolder.preferred_type = "-1";
|
|
||||||
|
|
||||||
return llsdFolder;
|
return llsdFolder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
public UUID folder_id;
|
public UUID folder_id;
|
||||||
public UUID parent_id;
|
public UUID parent_id;
|
||||||
public string name;
|
public string name;
|
||||||
public string type;
|
public int type;
|
||||||
public string preferred_type;
|
public int preferred_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,9 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
TimeSpan timeTaken = DateTime.Now - m_startuptime;
|
TimeSpan timeTaken = DateTime.Now - m_startuptime;
|
||||||
|
|
||||||
m_log.InfoFormat("[STARTUP]: Startup took {0}m {1}s", timeTaken.Minutes, timeTaken.Seconds);
|
m_log.InfoFormat(
|
||||||
|
"[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS.",
|
||||||
|
timeTaken.Minutes, timeTaken.Seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -129,9 +129,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
OSHttpResponse response
|
OSHttpResponse response
|
||||||
= new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
|
= new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
|
||||||
|
|
||||||
byte[] buffer
|
byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
|
||||||
= server.DoHTTPGruntWork(
|
|
||||||
responsedata, new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
|
|
||||||
|
|
||||||
response.SendChunked = false;
|
response.SendChunked = false;
|
||||||
response.ContentLength64 = buffer.Length;
|
response.ContentLength64 = buffer.Length;
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace Flotsam.RegionModules.AssetCache
|
||||||
IConfig assetConfig = source.Configs["AssetCache"];
|
IConfig assetConfig = source.Configs["AssetCache"];
|
||||||
if (assetConfig == null)
|
if (assetConfig == null)
|
||||||
{
|
{
|
||||||
m_log.Warn(
|
m_log.Debug(
|
||||||
"[FLOTSAM ASSET CACHE]: AssetCache section missing from config (not copied config-include/FlotsamCache.ini.example? Using defaults.");
|
"[FLOTSAM ASSET CACHE]: AssetCache section missing from config (not copied config-include/FlotsamCache.ini.example? Using defaults.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -76,7 +76,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
private Dictionary<string, UrlData> m_UrlMap =
|
private Dictionary<string, UrlData> m_UrlMap =
|
||||||
new Dictionary<string, UrlData>();
|
new Dictionary<string, UrlData>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum number of external urls that can be set up by this module.
|
||||||
|
/// </summary>
|
||||||
private int m_TotalUrls = 100;
|
private int m_TotalUrls = 100;
|
||||||
|
|
||||||
private uint https_port = 0;
|
private uint https_port = 0;
|
||||||
|
@ -107,6 +109,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
{
|
{
|
||||||
https_port = (uint) config.Configs["Network"].GetInt("https_port",0);
|
https_port = (uint) config.Configs["Network"].GetInt("https_port",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IConfig llFunctionsConfig = config.Configs["LL-Functions"];
|
||||||
|
|
||||||
|
if (llFunctionsConfig != null)
|
||||||
|
m_TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", m_TotalUrls);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_log.Info("[LAND IN CONNECTOR]: Starting...");
|
// m_log.Info("[LAND IN CONNECTOR]: Starting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_log.Info("[NEIGHBOUR IN CONNECTOR]: Starting...");
|
// m_log.Info("[NEIGHBOUR IN CONNECTOR]: Starting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
|
|
@ -348,12 +348,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||||
|
|
||||||
if (m_friendsModule == null)
|
if (m_friendsModule == null)
|
||||||
m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");
|
m_log.Debug("[PERMISSIONS]: Friends module not found, friend permissions will not work");
|
||||||
|
|
||||||
m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
|
m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
|
||||||
|
|
||||||
if (m_groupsModule == null)
|
if (m_groupsModule == null)
|
||||||
m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
|
m_log.Debug("[PERMISSIONS]: Groups module not found, group permissions will not work");
|
||||||
|
|
||||||
m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
|
m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,12 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start all the scripts contained in this entity's inventory
|
/// Start all the scripts contained in this entity's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
|
/// <param name="startParam"></param>
|
||||||
|
/// <param name="postOnRez"></param>
|
||||||
|
/// <param name="engine"></param>
|
||||||
|
/// <param name="stateSource"></param>
|
||||||
|
/// <returns>Number of scripts started.</returns>
|
||||||
|
int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
|
||||||
|
|
||||||
ArrayList GetScriptErrors(UUID itemID);
|
ArrayList GetScriptErrors(UUID itemID);
|
||||||
void ResumeScripts();
|
void ResumeScripts();
|
||||||
|
@ -102,7 +107,11 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="postOnRez"></param>
|
/// <param name="postOnRez"></param>
|
||||||
/// <param name="engine"></param>
|
/// <param name="engine"></param>
|
||||||
/// <param name="stateSource"></param>
|
/// <param name="stateSource"></param>
|
||||||
void CreateScriptInstance(
|
/// <returns>
|
||||||
|
/// true if the script instance was valid for starting, false otherwise. This does not guarantee
|
||||||
|
/// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.)
|
||||||
|
/// </returns>
|
||||||
|
bool CreateScriptInstance(
|
||||||
TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource);
|
TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -113,7 +122,11 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="postOnRez"></param>
|
/// <param name="postOnRez"></param>
|
||||||
/// <param name="engine"></param>
|
/// <param name="engine"></param>
|
||||||
/// <param name="stateSource"></param>
|
/// <param name="stateSource"></param>
|
||||||
void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
|
/// <returns>
|
||||||
|
/// true if the script instance was valid for starting, false otherwise. This does not guarantee
|
||||||
|
/// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.)
|
||||||
|
/// </returns>
|
||||||
|
bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop a script which is in this prim's inventory.
|
/// Stop a script which is in this prim's inventory.
|
||||||
|
|
|
@ -60,19 +60,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates all the scripts in the scene which should be started.
|
/// Creates all the scripts in the scene which should be started.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CreateScriptInstances()
|
/// <returns>
|
||||||
|
/// Number of scripts that were valid for starting. This does not guarantee that all these scripts
|
||||||
|
/// were actually started, but just that the start could be attempt (e.g. the asset data for the script could be found)
|
||||||
|
/// </returns>
|
||||||
|
public int CreateScriptInstances()
|
||||||
{
|
{
|
||||||
m_log.Info("[PRIM INVENTORY]: Creating scripts in scene");
|
m_log.InfoFormat("[SCENE]: Initializing script instances in {0}", RegionInfo.RegionName);
|
||||||
|
|
||||||
|
int scriptsValidForStarting = 0;
|
||||||
|
|
||||||
EntityBase[] entities = Entities.GetEntities();
|
EntityBase[] entities = Entities.GetEntities();
|
||||||
foreach (EntityBase group in entities)
|
foreach (EntityBase group in entities)
|
||||||
{
|
{
|
||||||
if (group is SceneObjectGroup)
|
if (group is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
scriptsValidForStarting
|
||||||
|
+= ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
||||||
((SceneObjectGroup) group).ResumeScripts();
|
((SceneObjectGroup) group).ResumeScripts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat(
|
||||||
|
"[SCENE]: Initialized {0} script instances in {1}",
|
||||||
|
scriptsValidForStarting, RegionInfo.RegionName);
|
||||||
|
|
||||||
|
return scriptsValidForStarting;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -80,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void StartScripts()
|
public void StartScripts()
|
||||||
{
|
{
|
||||||
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
|
m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName);
|
||||||
|
|
||||||
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
|
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
|
||||||
|
|
||||||
|
|
|
@ -1474,11 +1474,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
LoginLock = false;
|
LoginLock = false;
|
||||||
EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
|
EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
|
||||||
|
|
||||||
// For RegionReady lockouts
|
// For RegionReady lockouts
|
||||||
if(LoginLock == false)
|
if (!LoginLock)
|
||||||
{
|
{
|
||||||
|
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
||||||
LoginsDisabled = false;
|
LoginsDisabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,16 +54,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start the scripts contained in all the prims in this group.
|
/// Start the scripts contained in all the prims in this group.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CreateScriptInstances(int startParam, bool postOnRez,
|
/// <param name="startParam"></param>
|
||||||
string engine, int stateSource)
|
/// <param name="postOnRez"></param>
|
||||||
|
/// <param name="engine"></param>
|
||||||
|
/// <param name="stateSource"></param>
|
||||||
|
/// <returns>
|
||||||
|
/// Number of scripts that were valid for starting. This does not guarantee that all these scripts
|
||||||
|
/// were actually started, but just that the start could be attempt (e.g. the asset data for the script could be found)
|
||||||
|
/// </returns>
|
||||||
|
public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
{
|
{
|
||||||
|
int scriptsStarted = 0;
|
||||||
|
|
||||||
// Don't start scripts if they're turned off in the region!
|
// Don't start scripts if they're turned off in the region!
|
||||||
if (!m_scene.RegionInfo.RegionSettings.DisableScripts)
|
if (!m_scene.RegionInfo.RegionSettings.DisableScripts)
|
||||||
{
|
{
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
|
scriptsStarted
|
||||||
|
+= parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return scriptsStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1625,7 +1625,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data",
|
"[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data",
|
||||||
Name, LocalId, id);
|
Name, UUID, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -217,14 +217,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
/// Start all the scripts contained in this prim's inventory
|
|
||||||
/// </summary>
|
|
||||||
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
|
||||||
{
|
{
|
||||||
|
int scriptsValidForStarting = 0;
|
||||||
|
|
||||||
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||||
foreach (TaskInventoryItem item in scripts)
|
foreach (TaskInventoryItem item in scripts)
|
||||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
if (CreateScriptInstance(item, startParam, postOnRez, engine, stateSource))
|
||||||
|
scriptsValidForStarting++;
|
||||||
|
|
||||||
|
return scriptsValidForStarting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList GetScriptErrors(UUID itemID)
|
public ArrayList GetScriptErrors(UUID itemID)
|
||||||
|
@ -264,61 +266,65 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// Start a script which is in this prim's inventory.
|
/// Start a script which is in this prim's inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <returns></returns>
|
/// <returns>true if the script instance was created, false otherwise</returns>
|
||||||
public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
|
public bool CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
|
// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
|
||||||
// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
|
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
m_part.AddFlag(PrimFlags.Scripted);
|
m_part.AddFlag(PrimFlags.Scripted);
|
||||||
|
|
||||||
if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
|
if (m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (stateSource == 2 && // Prim crossing
|
||||||
|
m_part.ParentGroup.Scene.m_trustBinaries)
|
||||||
{
|
{
|
||||||
if (stateSource == 2 && // Prim crossing
|
lock (m_items)
|
||||||
m_part.ParentGroup.Scene.m_trustBinaries)
|
|
||||||
{
|
{
|
||||||
lock (m_items)
|
m_items[item.ItemID].PermsMask = 0;
|
||||||
{
|
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
||||||
m_items[item.ItemID].PermsMask = 0;
|
|
||||||
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
|
||||||
m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
|
|
||||||
m_part.ParentGroup.AddActiveScriptCount(1);
|
|
||||||
m_part.ScheduleFullUpdate();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
|
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||||
if (null == asset)
|
m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
|
||||||
{
|
m_part.ParentGroup.AddActiveScriptCount(1);
|
||||||
m_log.ErrorFormat(
|
m_part.ScheduleFullUpdate();
|
||||||
"[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
|
return true;
|
||||||
item.Name, item.ItemID, m_part.AbsolutePosition,
|
}
|
||||||
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_part.ParentGroup.m_savedScriptState != null)
|
|
||||||
item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
|
|
||||||
|
|
||||||
lock (m_items)
|
AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
|
||||||
{
|
if (null == asset)
|
||||||
m_items[item.ItemID].OldItemID = item.OldItemID;
|
{
|
||||||
m_items[item.ItemID].PermsMask = 0;
|
m_log.ErrorFormat(
|
||||||
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
"[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
|
||||||
}
|
item.Name, item.ItemID, m_part.AbsolutePosition,
|
||||||
|
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
|
||||||
|
|
||||||
string script = Utils.BytesToString(asset.Data);
|
return false;
|
||||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
}
|
||||||
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
else
|
||||||
m_part.ParentGroup.AddActiveScriptCount(1);
|
{
|
||||||
m_part.ScheduleFullUpdate();
|
if (m_part.ParentGroup.m_savedScriptState != null)
|
||||||
|
item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
|
||||||
|
|
||||||
|
lock (m_items)
|
||||||
|
{
|
||||||
|
m_items[item.ItemID].OldItemID = item.OldItemID;
|
||||||
|
m_items[item.ItemID].PermsMask = 0;
|
||||||
|
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string script = Utils.BytesToString(asset.Data);
|
||||||
|
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||||
|
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
||||||
|
m_part.ParentGroup.AddActiveScriptCount(1);
|
||||||
|
m_part.ScheduleFullUpdate();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,22 +390,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return stateID;
|
return stateID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
/// Start a script which is in this prim's inventory.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="itemId">
|
|
||||||
/// A <see cref="UUID"/>
|
|
||||||
/// </param>
|
|
||||||
public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
|
|
||||||
{
|
{
|
||||||
TaskInventoryItem item = GetInventoryItem(itemId);
|
TaskInventoryItem item = GetInventoryItem(itemId);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
{
|
||||||
|
return CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
|
"[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
|
||||||
itemId, m_part.Name, m_part.UUID,
|
itemId, m_part.Name, m_part.UUID,
|
||||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -62,6 +62,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Control the printing of certain debug messages.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If DebugLevel >= 1, then we log every time that a script is started.
|
||||||
|
/// </remarks>
|
||||||
|
// public int DebugLevel { get; set; }
|
||||||
|
|
||||||
private SmartThreadPool m_ThreadPool;
|
private SmartThreadPool m_ThreadPool;
|
||||||
private int m_MaxScriptQueue;
|
private int m_MaxScriptQueue;
|
||||||
private Scene m_Scene;
|
private Scene m_Scene;
|
||||||
|
@ -216,9 +224,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
AppDomain.CurrentDomain.AssemblyResolve +=
|
AppDomain.CurrentDomain.AssemblyResolve +=
|
||||||
OnAssemblyResolve;
|
OnAssemblyResolve;
|
||||||
|
|
||||||
m_log.InfoFormat("[XEngine] Initializing scripts in region {0}",
|
|
||||||
scene.RegionInfo.RegionName);
|
|
||||||
m_Scene = scene;
|
m_Scene = scene;
|
||||||
|
m_log.InfoFormat("[XEngine]: Initializing scripts in region {0}", m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2);
|
m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2);
|
||||||
m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100);
|
m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100);
|
||||||
|
@ -321,8 +328,41 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
"Starts all stopped scripts."
|
"Starts all stopped scripts."
|
||||||
+ "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
|
+ "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
|
||||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
|
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
|
||||||
|
|
||||||
|
// MainConsole.Instance.Commands.AddCommand(
|
||||||
|
// "Debug", false, "debug xengine", "debug xengine [<level>]",
|
||||||
|
// "Turn on detailed xengine debugging.",
|
||||||
|
// "If level <= 0, then no extra logging is done.\n"
|
||||||
|
// + "If level >= 1, then we log every time that a script is started.",
|
||||||
|
// HandleDebugLevelCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change debug level
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="module"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
// private void HandleDebugLevelCommand(string module, string[] args)
|
||||||
|
// {
|
||||||
|
// if (args.Length == 3)
|
||||||
|
// {
|
||||||
|
// int newDebug;
|
||||||
|
// if (int.TryParse(args[2], out newDebug))
|
||||||
|
// {
|
||||||
|
// DebugLevel = newDebug;
|
||||||
|
// MainConsole.Instance.OutputFormat("Debug level set to {0}", newDebug);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (args.Length == 2)
|
||||||
|
// {
|
||||||
|
// MainConsole.Instance.OutputFormat("Current debug level is {0}", DebugLevel);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// MainConsole.Instance.Output("Usage: debug xengine 0..1");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parse the raw item id into a script instance from the command params if it's present.
|
/// Parse the raw item id into a script instance from the command params if it's present.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -825,8 +865,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
object[] o;
|
object[] o;
|
||||||
|
|
||||||
|
int scriptsStarted = 0;
|
||||||
|
|
||||||
while (m_CompileQueue.Dequeue(out o))
|
while (m_CompileQueue.Dequeue(out o))
|
||||||
DoOnRezScript(o);
|
{
|
||||||
|
if (DoOnRezScript(o))
|
||||||
|
{
|
||||||
|
scriptsStarted++;
|
||||||
|
|
||||||
|
// if (scriptsStarted % 50 == 0)
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
// NOTE: Despite having a lockless queue, this lock is required
|
// NOTE: Despite having a lockless queue, this lock is required
|
||||||
// to make sure there is never no compile thread while there
|
// to make sure there is never no compile thread while there
|
||||||
|
@ -1067,6 +1122,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
item.Name, startParam, postOnRez,
|
item.Name, startParam, postOnRez,
|
||||||
stateSource, m_MaxScriptQueue);
|
stateSource, m_MaxScriptQueue);
|
||||||
|
|
||||||
|
// if (DebugLevel >= 1)
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
|
"[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
|
||||||
part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
|
part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
|
||||||
|
@ -1659,14 +1715,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
FileMode.Open, FileAccess.Read))
|
FileMode.Open, FileAccess.Read))
|
||||||
{
|
{
|
||||||
tfs.Read(tdata, 0, tdata.Length);
|
tfs.Read(tdata, 0, tdata.Length);
|
||||||
tfs.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assem = new System.Text.ASCIIEncoding().GetString(tdata);
|
assem = new System.Text.ASCIIEncoding().GetString(tdata);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message);
|
m_log.ErrorFormat(
|
||||||
|
"[XEngine]: Unable to open script textfile {0}{1}, reason: {2}",
|
||||||
|
assemName, ".text", e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1683,16 +1740,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
|
using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
|
||||||
{
|
{
|
||||||
fs.Read(data, 0, data.Length);
|
fs.Read(data, 0, data.Length);
|
||||||
fs.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assem = System.Convert.ToBase64String(data);
|
assem = System.Convert.ToBase64String(data);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message);
|
m_log.ErrorFormat(
|
||||||
|
"[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1705,9 +1761,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
using (StreamReader msr = new StreamReader(mfs))
|
using (StreamReader msr = new StreamReader(mfs))
|
||||||
{
|
{
|
||||||
map = msr.ReadToEnd();
|
map = msr.ReadToEnd();
|
||||||
msr.Close();
|
|
||||||
}
|
}
|
||||||
mfs.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1743,6 +1797,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public bool SetXMLState(UUID itemID, string xml)
|
public bool SetXMLState(UUID itemID, string xml)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[XEngine]: Writing state for script item with ID {0}", itemID);
|
||||||
|
|
||||||
if (xml == String.Empty)
|
if (xml == String.Empty)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1803,14 +1859,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
using (FileStream fs = File.Create(path))
|
using (FileStream fs = File.Create(path))
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[XEngine]: Writing assembly file {0}", path);
|
||||||
|
|
||||||
fs.Write(filedata, 0, filedata.Length);
|
fs.Write(filedata, 0, filedata.Length);
|
||||||
fs.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// if there already exists a file at that location, it may be locked.
|
// if there already exists a file at that location, it may be locked.
|
||||||
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
|
m_log.ErrorFormat("[XEngine]: Error whilst writing assembly file {0}, {1}", path, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
string textpath = path + ".text";
|
string textpath = path + ".text";
|
||||||
|
@ -1820,16 +1877,43 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
using (StreamWriter sw = new StreamWriter(fs))
|
using (StreamWriter sw = new StreamWriter(fs))
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[XEngine]: Writing .text file {0}", textpath);
|
||||||
|
|
||||||
sw.Write(base64);
|
sw.Write(base64);
|
||||||
sw.Close();
|
|
||||||
}
|
}
|
||||||
fs.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// if there already exists a file at that location, it may be locked.
|
// if there already exists a file at that location, it may be locked.
|
||||||
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", textpath, ex.Message);
|
m_log.ErrorFormat("[XEngine]: Error whilst writing .text file {0}, {1}", textpath, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
|
||||||
|
if (mapL.Count > 0)
|
||||||
|
{
|
||||||
|
XmlElement mapE = (XmlElement)mapL[0];
|
||||||
|
|
||||||
|
string mappath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString());
|
||||||
|
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (FileStream mfs = File.Create(mappath))
|
||||||
|
{
|
||||||
|
using (StreamWriter msw = new StreamWriter(mfs))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[XEngine]: Writing linemap file {0}", mappath);
|
||||||
|
|
||||||
|
msw.Write(mapE.InnerText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
// if there already exists a file at that location, it may be locked.
|
||||||
|
m_log.ErrorFormat("[XEngine]: Linemap file {0} already exists! {1}", mappath, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1843,43 +1927,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
using (StreamWriter ssw = new StreamWriter(sfs))
|
using (StreamWriter ssw = new StreamWriter(sfs))
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[XEngine]: Writing state file {0}", statepath);
|
||||||
|
|
||||||
ssw.Write(stateE.OuterXml);
|
ssw.Write(stateE.OuterXml);
|
||||||
ssw.Close();
|
|
||||||
}
|
}
|
||||||
sfs.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// if there already exists a file at that location, it may be locked.
|
// if there already exists a file at that location, it may be locked.
|
||||||
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
|
m_log.ErrorFormat("[XEngine]: Error whilst writing state file {0}, {1}", statepath, ex.Message);
|
||||||
}
|
|
||||||
|
|
||||||
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
|
|
||||||
if (mapL.Count > 0)
|
|
||||||
{
|
|
||||||
XmlElement mapE = (XmlElement)mapL[0];
|
|
||||||
|
|
||||||
string mappath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString());
|
|
||||||
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (FileStream mfs = File.Create(mappath))
|
|
||||||
{
|
|
||||||
using (StreamWriter msw = new StreamWriter(mfs))
|
|
||||||
{
|
|
||||||
msw.Write(mapE.InnerText);
|
|
||||||
msw.Close();
|
|
||||||
}
|
|
||||||
mfs.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
// if there already exists a file at that location, it may be locked.
|
|
||||||
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", mappath, ex.Message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -31,5 +31,10 @@
|
||||||
<appender-ref ref="Console" />
|
<appender-ref ref="Console" />
|
||||||
<appender-ref ref="LogFileAppender" />
|
<appender-ref ref="LogFileAppender" />
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
|
<logger name="OpenSim.Region.ScriptEngine.XEngine">
|
||||||
|
<level value="WARN"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
</log4net>
|
</log4net>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -1169,6 +1169,8 @@
|
||||||
; Set this to 0 to have no limit imposed.
|
; Set this to 0 to have no limit imposed.
|
||||||
max_listens_per_script = 64
|
max_listens_per_script = 64
|
||||||
|
|
||||||
|
; Maximum number of external urls that scripts can set up in this simulator (e.g. via llRequestURL())
|
||||||
|
max_external_urls_per_simulator = 100
|
||||||
|
|
||||||
[DataSnapshot]
|
[DataSnapshot]
|
||||||
; The following set of configs pertains to search.
|
; The following set of configs pertains to search.
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
STARTUP COMPLETE
|
|
Loading…
Reference in New Issue