From 73c2162ff60850d96761aa07a1950dbbb2ec3e80 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Mon, 23 Nov 2009 19:51:40 +0100
Subject: Fixed nullrefs
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 66fb918..83208e9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -840,8 +840,12 @@ namespace OpenSim.Region.Framework.Scenes
public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
{
SceneObjectPart part = GetSceneObjectPart(localID);
- SceneObjectGroup group = part.ParentGroup;
- if (group != null)
+ SceneObjectGroup group = null;
+ if (part != null)
+ {
+ group = part.ParentGroup;
+ }
+ if (part != null && group != null)
{
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
if (item == null)
--
cgit v1.1
From d1147136946daf14724183b3191119be44ff8b16 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Tue, 24 Nov 2009 18:02:12 +0100
Subject: Drop all locking of part.TaskInventory in favour of a
ReaderWriterLockSlim lock handler. This gives us: - Faster prim inventory
actions. Multiple threads can read at once. - Fixes the known prim inventory
thread locks - In the event of a thread lock occurring, it will usually self
heal after sixty seconds with an error message in the console
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 38 +-
.../Framework/Scenes/SceneObjectPartInventory.cs | 390 +++++++++++----------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 16 +-
3 files changed, 235 insertions(+), 209 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cdec135..bbece2f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -389,12 +389,16 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes
+ /// Get the inventory list
///
public TaskInventoryDictionary TaskInventory
{
- get { return m_inventory.Items; }
- set { m_inventory.Items = value; }
+ get {
+ return m_inventory.Items;
+ }
+ set {
+ m_inventory.Items = value;
+ }
}
public uint ObjectFlags
@@ -2101,17 +2105,18 @@ namespace OpenSim.Region.Framework.Scenes
//Trys to fetch sound id from prim's inventory.
//Prim's inventory doesn't support non script items yet
- lock (TaskInventory)
+ TaskInventory.LockItemsForRead(true);
+
+ foreach (KeyValuePair item in TaskInventory)
{
- foreach (KeyValuePair item in TaskInventory)
+ if (item.Value.Name == sound)
{
- if (item.Value.Name == sound)
- {
- soundID = item.Value.ItemID;
- break;
- }
+ soundID = item.Value.ItemID;
+ break;
}
}
+
+ TaskInventory.LockItemsForRead(false);
}
List avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2457,17 +2462,16 @@ namespace OpenSim.Region.Framework.Scenes
if (!UUID.TryParse(sound, out soundID))
{
// search sound file from inventory
- lock (TaskInventory)
+ TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair item in TaskInventory)
{
- foreach (KeyValuePair item in TaskInventory)
+ if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
{
- if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
- {
- soundID = item.Value.ItemID;
- break;
- }
+ soundID = item.Value.ItemID;
+ break;
}
}
+ TaskInventory.LockItemsForRead(false);
}
if (soundID == UUID.Zero)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f4ca877..4dc709e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -80,7 +80,9 @@ namespace OpenSim.Region.Framework.Scenes
///
protected internal TaskInventoryDictionary Items
{
- get { return m_items; }
+ get {
+ return m_items;
+ }
set
{
m_items = value;
@@ -116,22 +118,25 @@ namespace OpenSim.Region.Framework.Scenes
/// Link number for the part
public void ResetInventoryIDs()
{
- lock (Items)
+ m_items.LockItemsForWrite(true);
+
+ if (0 == Items.Count)
{
- if (0 == Items.Count)
- return;
+ m_items.LockItemsForWrite(false);
+ return;
+ }
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
- IList items = new List(Items.Values);
- Items.Clear();
+ HasInventoryChanged = true;
+ m_part.ParentGroup.HasGroupChanged = true;
+ IList items = new List(Items.Values);
+ Items.Clear();
- foreach (TaskInventoryItem item in items)
- {
- item.ResetIDs(m_part.UUID);
- Items.Add(item.ItemID, item);
- }
+ foreach (TaskInventoryItem item in items)
+ {
+ item.ResetIDs(m_part.UUID);
+ Items.Add(item.ItemID, item);
}
+ m_items.LockItemsForWrite(false);
}
///
@@ -140,25 +145,25 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ChangeInventoryOwner(UUID ownerId)
{
- lock (Items)
+ m_items.LockItemsForWrite(true);
+ if (0 == Items.Count)
{
- if (0 == Items.Count)
- {
- return;
- }
+ m_items.LockItemsForWrite(false);
+ return;
+ }
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
- IList items = new List(Items.Values);
- foreach (TaskInventoryItem item in items)
+ HasInventoryChanged = true;
+ m_part.ParentGroup.HasGroupChanged = true;
+ IList items = new List(Items.Values);
+ foreach (TaskInventoryItem item in items)
+ {
+ if (ownerId != item.OwnerID)
{
- if (ownerId != item.OwnerID)
- {
- item.LastOwnerID = item.OwnerID;
- item.OwnerID = ownerId;
- }
+ item.LastOwnerID = item.OwnerID;
+ item.OwnerID = ownerId;
}
}
+ m_items.LockItemsForWrite(false);
}
///
@@ -167,24 +172,24 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ChangeInventoryGroup(UUID groupID)
{
- lock (Items)
+ m_items.LockItemsForWrite(true);
+ if (0 == Items.Count)
{
- if (0 == Items.Count)
- {
- return;
- }
+ m_items.LockItemsForWrite(false);
+ return;
+ }
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
- IList items = new List(Items.Values);
- foreach (TaskInventoryItem item in items)
+ HasInventoryChanged = true;
+ m_part.ParentGroup.HasGroupChanged = true;
+ IList items = new List(Items.Values);
+ foreach (TaskInventoryItem item in items)
+ {
+ if (groupID != item.GroupID)
{
- if (groupID != item.GroupID)
- {
- item.GroupID = groupID;
- }
+ item.GroupID = groupID;
}
}
+ m_items.LockItemsForWrite(false);
}
///
@@ -192,14 +197,14 @@ namespace OpenSim.Region.Framework.Scenes
///
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
{
- lock (m_items)
+ Items.LockItemsForRead(true);
+ IList items = new List(Items.Values);
+ Items.LockItemsForRead(false);
+ foreach (TaskInventoryItem item in items)
{
- foreach (TaskInventoryItem item in Items.Values)
+ if ((int)InventoryType.LSL == item.InvType)
{
- if ((int)InventoryType.LSL == item.InvType)
- {
- CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
- }
+ CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
}
}
}
@@ -209,17 +214,20 @@ namespace OpenSim.Region.Framework.Scenes
///
public void RemoveScriptInstances()
{
- lock (Items)
+ Items.LockItemsForRead(true);
+ IList items = new List(Items.Values);
+ Items.LockItemsForRead(false);
+
+ foreach (TaskInventoryItem item in items)
{
- foreach (TaskInventoryItem item in Items.Values)
+ if ((int)InventoryType.LSL == item.InvType)
{
- if ((int)InventoryType.LSL == item.InvType)
- {
- RemoveScriptInstance(item.ItemID);
- m_part.RemoveScriptEvents(item.ItemID);
- }
+ RemoveScriptInstance(item.ItemID);
+ m_part.RemoveScriptEvents(item.ItemID);
}
}
+
+
}
///
@@ -244,8 +252,10 @@ namespace OpenSim.Region.Framework.Scenes
if (stateSource == 1 && // Prim crossing
m_part.ParentGroup.Scene.m_trustBinaries)
{
+ m_items.LockItemsForWrite(true);
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
+ m_items.LockItemsForWrite(false);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
@@ -266,8 +276,10 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID);
+ m_items.LockItemsForWrite(true);
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
+ m_items.LockItemsForWrite(false);
string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
@@ -302,20 +314,22 @@ namespace OpenSim.Region.Framework.Scenes
///
public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
{
- lock (m_items)
+ m_items.LockItemsForRead(true);
+ if (m_items.ContainsKey(itemId))
{
- if (m_items.ContainsKey(itemId))
- {
- CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
- }
- else
- {
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: " +
- "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}",
- itemId, m_part.Name, m_part.UUID);
- }
+ TaskInventoryItem item = m_items[itemId];
+ m_items.LockItemsForRead(false);
+ CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
}
+ else
+ {
+ m_items.LockItemsForRead(false);
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}",
+ itemId, m_part.Name, m_part.UUID);
+ }
+
}
///
@@ -346,11 +360,16 @@ namespace OpenSim.Region.Framework.Scenes
///
private bool InventoryContainsName(string name)
{
- foreach (TaskInventoryItem item in Items.Values)
+ m_items.LockItemsForRead(true);
+ foreach (TaskInventoryItem item in m_items.Values)
{
if (item.Name == name)
+ {
+ m_items.LockItemsForRead(false);
return true;
+ }
}
+ m_items.LockItemsForRead(false);
return false;
}
@@ -392,7 +411,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
{
+ m_items.LockItemsForRead(true);
List il = new List(m_items.Values);
+ m_items.LockItemsForRead(false);
foreach (TaskInventoryItem i in il)
{
if (i.Name == item.Name)
@@ -429,15 +450,14 @@ namespace OpenSim.Region.Framework.Scenes
item.ParentPartID = m_part.UUID;
item.Name = name;
- lock (m_items)
- {
- m_items.Add(item.ItemID, item);
-
+ m_items.LockItemsForWrite(true);
+ m_items.Add(item.ItemID, item);
+ m_items.LockItemsForWrite(false);
if (allowedDrop)
m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
else
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
- }
+
m_inventorySerial++;
//m_inventorySerial += 2;
@@ -454,14 +474,13 @@ namespace OpenSim.Region.Framework.Scenes
///
public void RestoreInventoryItems(ICollection items)
{
- lock (m_items)
+ m_items.LockItemsForWrite(true);
+ foreach (TaskInventoryItem item in items)
{
- foreach (TaskInventoryItem item in items)
- {
- m_items.Add(item.ItemID, item);
- m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
- }
+ m_items.Add(item.ItemID, item);
+ m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
}
+ m_items.LockItemsForWrite(false);
m_inventorySerial++;
}
@@ -474,8 +493,9 @@ namespace OpenSim.Region.Framework.Scenes
public TaskInventoryItem GetInventoryItem(UUID itemId)
{
TaskInventoryItem item;
+ m_items.LockItemsForRead(true);
m_items.TryGetValue(itemId, out item);
-
+ m_items.LockItemsForRead(false);
return item;
}
@@ -487,45 +507,45 @@ namespace OpenSim.Region.Framework.Scenes
/// false if the item did not exist, true if the update occurred successfully
public bool UpdateInventoryItem(TaskInventoryItem item)
{
- lock (m_items)
+ m_items.LockItemsForWrite(true);
+
+ if (m_items.ContainsKey(item.ItemID))
{
- if (m_items.ContainsKey(item.ItemID))
+ item.ParentID = m_part.UUID;
+ item.ParentPartID = m_part.UUID;
+ item.Flags = m_items[item.ItemID].Flags;
+ if (item.AssetID == UUID.Zero)
{
- item.ParentID = m_part.UUID;
- item.ParentPartID = m_part.UUID;
- item.Flags = m_items[item.ItemID].Flags;
- if (item.AssetID == UUID.Zero)
- {
- item.AssetID = m_items[item.ItemID].AssetID;
- }
- else if ((InventoryType)item.Type == InventoryType.Notecard)
- {
- ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
+ item.AssetID = m_items[item.ItemID].AssetID;
+ }
+ else if ((InventoryType)item.Type == InventoryType.Notecard)
+ {
+ ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
- if (presence != null)
- {
- presence.ControllingClient.SendAgentAlertMessage(
- "Notecard saved", false);
- }
+ if (presence != null)
+ {
+ presence.ControllingClient.SendAgentAlertMessage(
+ "Notecard saved", false);
}
+ }
- m_items[item.ItemID] = item;
- m_inventorySerial++;
- m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
-
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
+ m_items[item.ItemID] = item;
+ m_inventorySerial++;
+ m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
- return true;
- }
- else
- {
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: " +
- "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
- item.ItemID, m_part.Name, m_part.UUID);
- }
+ HasInventoryChanged = true;
+ m_part.ParentGroup.HasGroupChanged = true;
+ m_items.LockItemsForWrite(false);
+ return true;
+ }
+ else
+ {
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
+ item.ItemID, m_part.Name, m_part.UUID);
}
+ m_items.LockItemsForWrite(false);
return false;
}
@@ -538,51 +558,54 @@ namespace OpenSim.Region.Framework.Scenes
/// in this prim's inventory.
public int RemoveInventoryItem(UUID itemID)
{
- lock (m_items)
+ m_items.LockItemsForRead(true);
+
+ if (m_items.ContainsKey(itemID))
{
- if (m_items.ContainsKey(itemID))
+ int type = m_items[itemID].InvType;
+ m_items.LockItemsForRead(false);
+ if (type == 10) // Script
{
- int type = m_items[itemID].InvType;
- if (type == 10) // Script
- {
- m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
- }
- m_items.Remove(itemID);
- m_inventorySerial++;
- m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
-
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
+ m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
+ }
+ m_items.LockItemsForWrite(true);
+ m_items.Remove(itemID);
+ m_items.LockItemsForWrite(false);
+ m_inventorySerial++;
+ m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
- int scriptcount = 0;
- lock (m_items)
- {
- foreach (TaskInventoryItem item in m_items.Values)
- {
- if (item.Type == 10)
- {
- scriptcount++;
- }
- }
- }
+ HasInventoryChanged = true;
+ m_part.ParentGroup.HasGroupChanged = true;
- if (scriptcount <= 0)
+ int scriptcount = 0;
+ m_items.LockItemsForRead(true);
+ foreach (TaskInventoryItem item in m_items.Values)
+ {
+ if (item.Type == 10)
{
- m_part.RemFlag(PrimFlags.Scripted);
+ scriptcount++;
}
-
- m_part.ScheduleFullUpdate();
-
- return type;
}
- else
+ m_items.LockItemsForRead(false);
+
+
+ if (scriptcount <= 0)
{
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: " +
- "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
- itemID, m_part.Name, m_part.UUID);
+ m_part.RemFlag(PrimFlags.Scripted);
}
+
+ m_part.ScheduleFullUpdate();
+
+ return type;
+ }
+ else
+ {
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
+ itemID, m_part.Name, m_part.UUID);
}
+ m_items.LockItemsForWrite(false);
return -1;
}
@@ -635,52 +658,53 @@ namespace OpenSim.Region.Framework.Scenes
// isn't available (such as drag from prim inventory to agent inventory)
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
- lock (m_items)
+ m_items.LockItemsForRead(true);
+
+ foreach (TaskInventoryItem item in m_items.Values)
{
- foreach (TaskInventoryItem item in m_items.Values)
- {
- UUID ownerID = item.OwnerID;
- uint everyoneMask = 0;
- uint baseMask = item.BasePermissions;
- uint ownerMask = item.CurrentPermissions;
+ UUID ownerID = item.OwnerID;
+ uint everyoneMask = 0;
+ uint baseMask = item.BasePermissions;
+ uint ownerMask = item.CurrentPermissions;
- invString.AddItemStart();
- invString.AddNameValueLine("item_id", item.ItemID.ToString());
- invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
+ invString.AddItemStart();
+ invString.AddNameValueLine("item_id", item.ItemID.ToString());
+ invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
- invString.AddPermissionsStart();
+ invString.AddPermissionsStart();
- invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
- invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
- invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0));
- invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
- invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
+ invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
+ invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
+ invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0));
+ invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
+ invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
- invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
- invString.AddNameValueLine("owner_id", ownerID.ToString());
+ invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
+ invString.AddNameValueLine("owner_id", ownerID.ToString());
- invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
+ invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
- invString.AddNameValueLine("group_id", item.GroupID.ToString());
- invString.AddSectionEnd();
+ invString.AddNameValueLine("group_id", item.GroupID.ToString());
+ invString.AddSectionEnd();
- invString.AddNameValueLine("asset_id", item.AssetID.ToString());
- invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
- invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
- invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
+ invString.AddNameValueLine("asset_id", item.AssetID.ToString());
+ invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
+ invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
+ invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
- invString.AddSaleStart();
- invString.AddNameValueLine("sale_type", "not");
- invString.AddNameValueLine("sale_price", "0");
- invString.AddSectionEnd();
+ invString.AddSaleStart();
+ invString.AddNameValueLine("sale_type", "not");
+ invString.AddNameValueLine("sale_price", "0");
+ invString.AddSectionEnd();
- invString.AddNameValueLine("name", item.Name + "|");
- invString.AddNameValueLine("desc", item.Description + "|");
+ invString.AddNameValueLine("name", item.Name + "|");
+ invString.AddNameValueLine("desc", item.Description + "|");
- invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
- invString.AddSectionEnd();
- }
+ invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
+ invString.AddSectionEnd();
}
+ int count = m_items.Count;
+ m_items.LockItemsForRead(false);
fileData = Utils.StringToBytes(invString.BuildString);
@@ -689,6 +713,7 @@ namespace OpenSim.Region.Framework.Scenes
if (fileData.Length > 2)
{
+ m_log.Debug("Sending task inventory list of " + count.ToString() + " items to client " + client.AgentId.ToString());
xferManager.AddNewFile(m_inventoryFileName, fileData);
}
}
@@ -701,10 +726,9 @@ namespace OpenSim.Region.Framework.Scenes
{
if (HasInventoryChanged)
{
- lock (Items)
- {
- datastore.StorePrimInventory(m_part.UUID, Items.Values);
- }
+ Items.LockItemsForRead(true);
+ datastore.StorePrimInventory(m_part.UUID, Items.Values);
+ Items.LockItemsForRead(false);
HasInventoryChanged = false;
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4e5fee1..4c8c94f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1615,21 +1615,19 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
if (part != null)
{
+ part.TaskInventory.LockItemsForRead(true);
TaskInventoryDictionary taskIDict = part.TaskInventory;
if (taskIDict != null)
{
- lock (taskIDict)
+ foreach (UUID taskID in taskIDict.Keys)
{
- foreach (UUID taskID in taskIDict.Keys)
- {
- UnRegisterControlEventsToScript(LocalId, taskID);
- taskIDict[taskID].PermsMask &= ~(
- 2048 | //PERMISSION_CONTROL_CAMERA
- 4); // PERMISSION_TAKE_CONTROLS
- }
+ UnRegisterControlEventsToScript(LocalId, taskID);
+ taskIDict[taskID].PermsMask &= ~(
+ 2048 | //PERMISSION_CONTROL_CAMERA
+ 4); // PERMISSION_TAKE_CONTROLS
}
-
}
+ part.TaskInventory.LockItemsForRead(false);
// Reset sit target.
if (part.GetAvatarOnSitTarget() == UUID)
part.SetAvatarOnSitTarget(UUID.Zero);
--
cgit v1.1
From 8383bde76880fc94a6644422d45baa28252b0231 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Tue, 24 Nov 2009 18:18:19 +0100
Subject: Removed some extra debug chatter
---
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 4dc709e..abb04cd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -713,7 +713,6 @@ namespace OpenSim.Region.Framework.Scenes
if (fileData.Length > 2)
{
- m_log.Debug("Sending task inventory list of " + count.ToString() + " items to client " + client.AgentId.ToString());
xferManager.AddNewFile(m_inventoryFileName, fileData);
}
}
--
cgit v1.1
From 88ead9ee63fe87b16d7c24b3a38bf6567f3166f6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 24 Nov 2009 17:28:38 +0000
Subject: pass all command parameters to load/save oar, not just the filename
unfortunately, these commands cannot yet be properly relocated to the region
modules due to deficiencies in the region module infrastructure
---
OpenSim/Region/Framework/Scenes/SceneManager.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index dfaa7ea..c2e3370 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -241,24 +241,24 @@ namespace OpenSim.Region.Framework.Scenes
/// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets
/// as well as the details of the prims themselves.
///
- ///
- public void SaveCurrentSceneToArchive(string filename)
+ ///
+ public void SaveCurrentSceneToArchive(string[] cmdparams)
{
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface();
if (archiver != null)
- archiver.ArchiveRegion(filename);
+ archiver.HandleSaveOarConsoleCommand(string.Empty, cmdparams);
}
///
/// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload
/// their assets to the asset service.
///
- ///
- public void LoadArchiveToCurrentScene(string filename)
+ ///
+ public void LoadArchiveToCurrentScene(string[] cmdparams)
{
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface();
if (archiver != null)
- archiver.DearchiveRegion(filename);
+ archiver.HandleLoadOarConsoleCommand(string.Empty, cmdparams);
}
public string SaveCurrentSceneMapToXmlString()
--
cgit v1.1
From abddb60b8d0aba7b68e2494957aedfec66a772cc Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Wed, 25 Nov 2009 02:51:11 -0500
Subject: * Attempt number 1 to stop the repeating crouch animation that
sometimes happens. * This tries to address it by correcting one potential bug
where it never resets the falltimer. * This tries to address it by telling
Physics that we're not flying this step.. instead of waiting until the next
step when the next agent update comes along.
---
OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 6 ++++++
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +++
2 files changed, 9 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 2e4c260..da1104a 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -200,7 +200,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
else if (move.Z < 0f)
{
if (actor != null && actor.IsColliding)
+ {
+ //Console.WriteLine("LAND");
return "LAND";
+ }
else
return "HOVER_DOWN";
}
@@ -249,7 +252,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f;
if (landElapsed <= FALL_DELAY)
+ {
+ m_animTickFall = 0;
return "LAND";
+ }
}
m_animTickFall = 0;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5604e3d..33717b1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1445,7 +1445,10 @@ namespace OpenSim.Region.Framework.Scenes
// nesting this check because LengthSquared() is expensive and we don't
// want to do it every step when flying.
if ((Velocity.LengthSquared() <= LAND_VELOCITYMAG_MAX))
+ {
StopFlying();
+ m_physicsActor.Flying = false;
+ }
}
}
--
cgit v1.1
From a642968fd548e7bb7f3e47e937e209526226d0c0 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Wed, 25 Nov 2009 04:00:52 -0500
Subject: * Reverting last commit.. because it just made it worse.
---
OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 6 ------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ---
2 files changed, 9 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index da1104a..2e4c260 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -200,10 +200,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
else if (move.Z < 0f)
{
if (actor != null && actor.IsColliding)
- {
- //Console.WriteLine("LAND");
return "LAND";
- }
else
return "HOVER_DOWN";
}
@@ -252,10 +249,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f;
if (landElapsed <= FALL_DELAY)
- {
- m_animTickFall = 0;
return "LAND";
- }
}
m_animTickFall = 0;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 33717b1..5604e3d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1445,10 +1445,7 @@ namespace OpenSim.Region.Framework.Scenes
// nesting this check because LengthSquared() is expensive and we don't
// want to do it every step when flying.
if ((Velocity.LengthSquared() <= LAND_VELOCITYMAG_MAX))
- {
StopFlying();
- m_physicsActor.Flying = false;
- }
}
}
--
cgit v1.1
From a3755d831d016d7c4fb75c900663b63a2e6d28c4 Mon Sep 17 00:00:00 2001
From: OpenSim Master
Date: Wed, 25 Nov 2009 10:55:33 -0800
Subject: Patch: Fix a bug in LAND animation when the TickCount wraps into
negative numbers by Mic Bowman Signed-off-by: Teravus Ovares (Dan Olivares)
---
OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 2e4c260..b37249d 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -247,8 +247,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
else if (m_movementAnimation == "LAND")
{
float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f;
-
- if (landElapsed <= FALL_DELAY)
+ if ((m_animTickFall != 0) && (landElapsed <= FALL_DELAY))
return "LAND";
}
--
cgit v1.1
From b9d22aa8213b62eb0c368b345ccfc105367c1aba Mon Sep 17 00:00:00 2001
From: CasperW
Date: Thu, 26 Nov 2009 01:59:08 +0100
Subject: Add nudge right and left to avatar movement (faster reaction times
when stepping left or right.)
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4c8c94f..9b04422 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes
protected RegionInfo m_regionInfo;
protected ulong crossingFromRegion;
- private readonly Vector3[] Dir_Vectors = new Vector3[9];
+ private readonly Vector3[] Dir_Vectors = new Vector3[11];
private bool m_isNudging = false;
// Position of agent's camera in world (region cordinates)
@@ -236,6 +236,8 @@ namespace OpenSim.Region.Framework.Scenes
DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS,
DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG,
+ DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS,
+ DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG,
DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
}
@@ -722,12 +724,14 @@ namespace OpenSim.Region.Framework.Scenes
Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
- Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
+ Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE
+ Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE
+ Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
}
private Vector3[] GetWalkDirectionVectors()
{
- Vector3[] vector = new Vector3[9];
+ Vector3[] vector = new Vector3[11];
vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK
vector[2] = Vector3.UnitY; //LEFT
@@ -736,13 +740,15 @@ namespace OpenSim.Region.Framework.Scenes
vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
- vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
+ vector[8] = Vector3.UnitY; //LEFT_NUDGE
+ vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
+ vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
return vector;
}
private bool[] GetDirectionIsNudge()
{
- bool[] isNudge = new bool[9];
+ bool[] isNudge = new bool[11];
isNudge[0] = false; //FORWARD
isNudge[1] = false; //BACK
isNudge[2] = false; //LEFT
@@ -751,7 +757,9 @@ namespace OpenSim.Region.Framework.Scenes
isNudge[5] = false; //DOWN
isNudge[6] = true; //FORWARD_NUDGE
isNudge[7] = true; //BACK_NUDGE
- isNudge[8] = true; //DOWN_Nudge
+ isNudge[8] = true; //LEFT_NUDGE
+ isNudge[9] = true; //RIGHT_NUDGE
+ isNudge[10] = true; //DOWN_Nudge
return isNudge;
}
--
cgit v1.1
From 63b6b9cdce6382e2285b1a9d76e68a0ac10602ef Mon Sep 17 00:00:00 2001
From: CasperW
Date: Thu, 26 Nov 2009 02:35:27 +0100
Subject: Added animation support for my last commit
---
OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 4 ++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 30a95ce..2c4a4b0 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -158,8 +158,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
// Check control flags
bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS);
bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG);
- bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS;
- bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG;
+ bool heldLeft = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS);
+ bool heldRight = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG);
//bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT;
//bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT;
bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9b04422..a1bb244 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -742,7 +742,7 @@ namespace OpenSim.Region.Framework.Scenes
vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
vector[8] = Vector3.UnitY; //LEFT_NUDGE
vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
- vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
+ vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE
return vector;
}
--
cgit v1.1
From 88842edc95bafeb9f3b2f2ea0ab09394028a0916 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 12:08:20 +0000
Subject: Remove GetAssemblyName and friends from the SE interface. It's now
handled internally
---
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 93 ++--------------------
.../Framework/Scenes/SceneObjectPartInventory.cs | 30 -------
2 files changed, 5 insertions(+), 118 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 3cec77f..9a6f2b8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes
public string GetStateSnapshot()
{
- //m_log.Debug(" >>> GetStateSnapshot <<<");
-
- List assemblies = new List();
Dictionary states = new Dictionary();
foreach (SceneObjectPart part in m_parts.Values)
{
- foreach (string a in part.Inventory.GetScriptAssemblies())
- {
- if (a != "" && !assemblies.Contains(a))
- assemblies.Add(a);
- }
-
foreach (KeyValuePair s in part.Inventory.GetScriptStates())
- {
states[s.Key] = s.Value;
- }
}
- if (states.Count < 1 || assemblies.Count < 1)
+ if (states.Count < 1)
return "";
XmlDocument xmldoc = new XmlDocument();
@@ -342,94 +331,21 @@ namespace OpenSim.Region.Framework.Scenes
xmldoc.AppendChild(rootElement);
- XmlElement wrapper = xmldoc.CreateElement("", "Assemblies",
- "");
- rootElement.AppendChild(wrapper);
-
- foreach (string assembly in assemblies)
- {
- string fn = Path.GetFileName(assembly);
- if (fn == String.Empty)
- continue;
-
- String filedata = String.Empty;
-
- if (File.Exists(assembly+".text"))
- {
- FileInfo tfi = new FileInfo(assembly+".text");
-
- if (tfi == null)
- continue;
-
- Byte[] tdata = new Byte[tfi.Length];
-
- try
- {
- FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read);
- tfs.Read(tdata, 0, tdata.Length);
- tfs.Close();
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message);
- }
-
- filedata = new System.Text.ASCIIEncoding().GetString(tdata);
- }
- else
- {
- FileInfo fi = new FileInfo(assembly);
-
- if (fi == null)
- continue;
-
- Byte[] data = new Byte[fi.Length];
-
- try
- {
- FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
- fs.Read(data, 0, data.Length);
- fs.Close();
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
- }
-
- filedata = System.Convert.ToBase64String(data);
- }
- XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
- XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
- assemblyName.Value = fn;
- assemblyData.Attributes.Append(assemblyName);
-
- assemblyData.InnerText = filedata;
-
- wrapper.AppendChild(assemblyData);
- }
-
- wrapper = xmldoc.CreateElement("", "ScriptStates",
+ XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
"");
rootElement.AppendChild(wrapper);
foreach (KeyValuePair state in states)
{
- XmlElement stateData = xmldoc.CreateElement("", "State", "");
-
- XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", "");
- stateID.Value = state.Key.ToString();
- stateData.Attributes.Append(stateID);
-
XmlDocument sdoc = new XmlDocument();
sdoc.LoadXml(state.Value);
- XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
+ XmlNodeList rootL = sdoc.GetElementsByTagName("State");
XmlNode rootNode = rootL[0];
XmlNode newNode = xmldoc.ImportNode(rootNode, true);
- stateData.AppendChild(newNode);
- wrapper.AppendChild(stateData);
+ wrapper.AppendChild(newNode);
}
return xmldoc.InnerXml;
@@ -437,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SetState(string objXMLData, UUID RegionID)
{
+m_log.Debug("SetState called with " + objXMLData);
if (objXMLData == String.Empty)
return;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f4ca877..7f49ced 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -857,36 +857,6 @@ namespace OpenSim.Region.Framework.Scenes
return ret;
}
- public string[] GetScriptAssemblies()
- {
- IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces();
-
- List ret = new List();
- if (engines == null) // No engine at all
- return new string[0];
-
- foreach (TaskInventoryItem item in m_items.Values)
- {
- if (item.InvType == (int)InventoryType.LSL)
- {
- foreach (IScriptModule e in engines)
- {
- if (e != null)
- {
- string n = e.GetAssemblyName(item.ItemID);
- if (n != String.Empty)
- {
- if (!ret.Contains(n))
- ret.Add(n);
- break;
- }
- }
- }
- }
- }
- return ret.ToArray();
- }
-
public Dictionary GetScriptStates()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces();
--
cgit v1.1
From 05fc504ff3698ec472c582f26a9ddfdd0ce2c8f6 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 12:16:42 +0000
Subject: Remove the old remoting-type interregion code for prim/script
crossing
---
OpenSim/Region/Framework/Scenes/Scene.cs | 99 ----------------------
.../Framework/Scenes/SceneCommunicationService.cs | 72 ----------------
2 files changed, 171 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f444e51..0ee818d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2381,103 +2381,6 @@ namespace OpenSim.Region.Framework.Scenes
return successYN;
}
- ///
- /// Handle a scene object that is crossing into this region from another.
- /// NOTE: Unused as of 2009-02-09. Soon to be deleted.
- ///
- ///
- ///
- ///
- ///
- ///
- public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod)
- {
- if (XMLMethod == 0)
- {
- m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID);
- SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
- if (sceneObject.IsAttachment)
- sceneObject.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom;
-
- return AddSceneObject(sceneObject);
- }
- else if ((XMLMethod == 100) && m_allowScriptCrossings)
- {
- m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor");
-
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(objXMLData);
-
- XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
- if (rootL.Count == 1)
- {
- XmlNode rootNode = rootL[0];
- if (rootNode != null)
- {
- XmlNodeList partL = rootNode.ChildNodes;
-
- foreach (XmlNode part in partL)
- {
- XmlNodeList nodeL = part.ChildNodes;
-
- switch (part.Name)
- {
- case "Assemblies":
- foreach (XmlNode asm in nodeL)
- {
- string fn = asm.Attributes.GetNamedItem("Filename").Value;
-
- Byte[] filedata = Convert.FromBase64String(asm.InnerText);
- string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
- path = Path.Combine(path, fn);
-
- if (!File.Exists(path))
- {
- FileStream fs = File.Create(path);
- fs.Write(filedata, 0, filedata.Length);
- fs.Close();
- }
- }
- break;
- case "ScriptStates":
- foreach (XmlNode st in nodeL)
- {
- string id = st.Attributes.GetNamedItem("UUID").Value;
- UUID uuid = new UUID(id);
- XmlNode state = st.ChildNodes[0];
-
- XmlDocument sdoc = new XmlDocument();
- XmlNode sxmlnode = sdoc.CreateNode(
- XmlNodeType.XmlDeclaration,
- "", "");
- sdoc.AppendChild(sxmlnode);
-
- XmlNode newnode = sdoc.ImportNode(state, true);
- sdoc.AppendChild(newnode);
-
- string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
- spath = Path.Combine(spath, uuid.ToString());
- FileStream sfs = File.Create(spath + ".state");
- ASCIIEncoding enc = new ASCIIEncoding();
- Byte[] buf = enc.GetBytes(sdoc.InnerXml);
- sfs.Write(buf, 0, buf.Length);
- sfs.Close();
- }
- break;
- }
- }
- }
- }
-
- SceneObjectPart RootPrim = GetSceneObjectPart(primID);
- RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
-
- return true;
- }
-
- return true;
- }
-
public bool IncomingCreateObject(ISceneObject sog)
{
//m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
@@ -3350,7 +3253,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
//m_eventManager.OnRegionUp += OtherRegionUp;
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
- m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
m_sceneGridService.KiPrimitive += SendKillObject;
@@ -3374,7 +3276,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.KiPrimitive -= SendKillObject;
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
- m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
//m_eventManager.OnRegionUp -= OtherRegionUp;
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 76c6cab..3892769 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -85,7 +85,6 @@ namespace OpenSim.Region.Framework.Scenes
///
/// A Prim will arrive shortly
///
- public event ExpectPrimDelegate OnExpectPrim;
public event CloseAgentConnection OnCloseAgentConnection;
///
@@ -116,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
- private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
//private RegionUp handlerRegionUp = null; // OnRegionUp;
@@ -147,30 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
/// Thrown if region registration fails.
public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
{
- //m_interregionCommsOut = comms_out;
-
- //m_regionInfo = regionInfos;
- //m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
- //regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
-
- //if (regionCommsHost != null)
- //{
- // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
-
- // regionCommsHost.debugRegionName = regionInfos.RegionName;
- // regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
- // regionCommsHost.OnExpectUser += NewUserConnection;
- // regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
- // regionCommsHost.OnCloseAgentConnection += CloseConnection;
- // regionCommsHost.OnRegionUp += newRegionUp;
- // regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
- // regionCommsHost.OnLogOffUser += GridLogOffUser;
- // regionCommsHost.OnGetLandData += FetchLandData;
- //}
- //else
- //{
- // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
- //}
}
///
@@ -179,31 +153,6 @@ namespace OpenSim.Region.Framework.Scenes
///
public void Close()
{
-
- //if (regionCommsHost != null)
- //{
- // regionCommsHost.OnLogOffUser -= GridLogOffUser;
- // regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
- // regionCommsHost.OnRegionUp -= newRegionUp;
- // regionCommsHost.OnExpectUser -= NewUserConnection;
- // regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
- // regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
- // regionCommsHost.OnCloseAgentConnection -= CloseConnection;
- // regionCommsHost.OnGetLandData -= FetchLandData;
-
- // try
- // {
- // m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
- // }
- // catch (Exception e)
- // {
- // m_log.ErrorFormat(
- // "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
- // m_regionInfo.RegionName, e);
- // }
-
- // regionCommsHost = null;
- //}
}
#region CommsManager Event handlers
@@ -263,27 +212,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- ///
- /// We have a new prim from a neighbor
- ///
- /// unique ID for the primative
- /// XML2 encoded data of the primative
- /// An Int that represents the version of the XMLMethod
- /// True if the prim was accepted, false if it was not
- protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
- {
- handlerExpectPrim = OnExpectPrim;
- if (handlerExpectPrim != null)
- {
- return handlerExpectPrim(primID, objXMLData, XMLMethod);
- }
- else
- {
- return false;
- }
-
- }
-
protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical)
{
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
--
cgit v1.1
From ac2fcbe224d4877dccc4d73e9c58771e40a4ae1c Mon Sep 17 00:00:00 2001
From: CasperW
Date: Thu, 26 Nov 2009 15:17:44 +0100
Subject: Improvements to rAdmin admin_shutdown and admin_restart. Both methods
can now accept a parameter of noticetype = dialog in order to display a blue
persistant dropdown instead of a short notice. Added an optional and
configurable delay to the restart method, defaulting at 30 seconds as before.
Both methods can also accept a noticetype = none dialog in order to act
silently.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4ffa1a2..be1d4bf 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -873,6 +873,15 @@ namespace OpenSim.Region.Framework.Scenes
/// float indicating duration before restart.
public virtual void Restart(float seconds)
{
+ Restart(seconds, true);
+ }
+
+ ///
+ /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
+ ///
+ /// float indicating duration before restart.
+ public virtual void Restart(float seconds, bool showDialog)
+ {
// notifications are done in 15 second increments
// so .. if the number of seconds is less then 15 seconds, it's not really a restart request
// It's a 'Cancel restart' request.
@@ -893,8 +902,11 @@ namespace OpenSim.Region.Framework.Scenes
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
m_restartTimer.Start();
- m_dialogModule.SendNotificationToUsersInRegion(
- UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes");
+ if (showDialog)
+ {
+ m_dialogModule.SendNotificationToUsersInRegion(
+ UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + (seconds / 60).ToString() + " Minutes");
+ }
}
}
--
cgit v1.1
From 22c325aa5ae06b897e5eb10404c0aa3727f8237b Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 12:08:20 +0000
Subject: Remove GetAssemblyName and friends from the SE interface. It's now
handled internally
---
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 93 ++--------------------
.../Framework/Scenes/SceneObjectPartInventory.cs | 30 -------
2 files changed, 5 insertions(+), 118 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 3cec77f..9a6f2b8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes
public string GetStateSnapshot()
{
- //m_log.Debug(" >>> GetStateSnapshot <<<");
-
- List assemblies = new List();
Dictionary states = new Dictionary();
foreach (SceneObjectPart part in m_parts.Values)
{
- foreach (string a in part.Inventory.GetScriptAssemblies())
- {
- if (a != "" && !assemblies.Contains(a))
- assemblies.Add(a);
- }
-
foreach (KeyValuePair s in part.Inventory.GetScriptStates())
- {
states[s.Key] = s.Value;
- }
}
- if (states.Count < 1 || assemblies.Count < 1)
+ if (states.Count < 1)
return "";
XmlDocument xmldoc = new XmlDocument();
@@ -342,94 +331,21 @@ namespace OpenSim.Region.Framework.Scenes
xmldoc.AppendChild(rootElement);
- XmlElement wrapper = xmldoc.CreateElement("", "Assemblies",
- "");
- rootElement.AppendChild(wrapper);
-
- foreach (string assembly in assemblies)
- {
- string fn = Path.GetFileName(assembly);
- if (fn == String.Empty)
- continue;
-
- String filedata = String.Empty;
-
- if (File.Exists(assembly+".text"))
- {
- FileInfo tfi = new FileInfo(assembly+".text");
-
- if (tfi == null)
- continue;
-
- Byte[] tdata = new Byte[tfi.Length];
-
- try
- {
- FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read);
- tfs.Read(tdata, 0, tdata.Length);
- tfs.Close();
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message);
- }
-
- filedata = new System.Text.ASCIIEncoding().GetString(tdata);
- }
- else
- {
- FileInfo fi = new FileInfo(assembly);
-
- if (fi == null)
- continue;
-
- Byte[] data = new Byte[fi.Length];
-
- try
- {
- FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
- fs.Read(data, 0, data.Length);
- fs.Close();
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
- }
-
- filedata = System.Convert.ToBase64String(data);
- }
- XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
- XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
- assemblyName.Value = fn;
- assemblyData.Attributes.Append(assemblyName);
-
- assemblyData.InnerText = filedata;
-
- wrapper.AppendChild(assemblyData);
- }
-
- wrapper = xmldoc.CreateElement("", "ScriptStates",
+ XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
"");
rootElement.AppendChild(wrapper);
foreach (KeyValuePair state in states)
{
- XmlElement stateData = xmldoc.CreateElement("", "State", "");
-
- XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", "");
- stateID.Value = state.Key.ToString();
- stateData.Attributes.Append(stateID);
-
XmlDocument sdoc = new XmlDocument();
sdoc.LoadXml(state.Value);
- XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
+ XmlNodeList rootL = sdoc.GetElementsByTagName("State");
XmlNode rootNode = rootL[0];
XmlNode newNode = xmldoc.ImportNode(rootNode, true);
- stateData.AppendChild(newNode);
- wrapper.AppendChild(stateData);
+ wrapper.AppendChild(newNode);
}
return xmldoc.InnerXml;
@@ -437,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SetState(string objXMLData, UUID RegionID)
{
+m_log.Debug("SetState called with " + objXMLData);
if (objXMLData == String.Empty)
return;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index abb04cd..2ef8258 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -880,36 +880,6 @@ namespace OpenSim.Region.Framework.Scenes
return ret;
}
- public string[] GetScriptAssemblies()
- {
- IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces();
-
- List ret = new List();
- if (engines == null) // No engine at all
- return new string[0];
-
- foreach (TaskInventoryItem item in m_items.Values)
- {
- if (item.InvType == (int)InventoryType.LSL)
- {
- foreach (IScriptModule e in engines)
- {
- if (e != null)
- {
- string n = e.GetAssemblyName(item.ItemID);
- if (n != String.Empty)
- {
- if (!ret.Contains(n))
- ret.Add(n);
- break;
- }
- }
- }
- }
- }
- return ret.ToArray();
- }
-
public Dictionary GetScriptStates()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces();
--
cgit v1.1
From a27d33cb634c78425eaa34cb5efd113e131baa51 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 12:16:42 +0000
Subject: Remove the old remoting-type interregion code for prim/script
crossing
---
OpenSim/Region/Framework/Scenes/Scene.cs | 99 ----------------------
.../Framework/Scenes/SceneCommunicationService.cs | 72 ----------------
2 files changed, 171 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index be1d4bf..f932659 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2393,103 +2393,6 @@ namespace OpenSim.Region.Framework.Scenes
return successYN;
}
- ///
- /// Handle a scene object that is crossing into this region from another.
- /// NOTE: Unused as of 2009-02-09. Soon to be deleted.
- ///
- ///
- ///
- ///
- ///
- ///
- public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod)
- {
- if (XMLMethod == 0)
- {
- m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID);
- SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
- if (sceneObject.IsAttachment)
- sceneObject.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom;
-
- return AddSceneObject(sceneObject);
- }
- else if ((XMLMethod == 100) && m_allowScriptCrossings)
- {
- m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor");
-
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(objXMLData);
-
- XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
- if (rootL.Count == 1)
- {
- XmlNode rootNode = rootL[0];
- if (rootNode != null)
- {
- XmlNodeList partL = rootNode.ChildNodes;
-
- foreach (XmlNode part in partL)
- {
- XmlNodeList nodeL = part.ChildNodes;
-
- switch (part.Name)
- {
- case "Assemblies":
- foreach (XmlNode asm in nodeL)
- {
- string fn = asm.Attributes.GetNamedItem("Filename").Value;
-
- Byte[] filedata = Convert.FromBase64String(asm.InnerText);
- string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
- path = Path.Combine(path, fn);
-
- if (!File.Exists(path))
- {
- FileStream fs = File.Create(path);
- fs.Write(filedata, 0, filedata.Length);
- fs.Close();
- }
- }
- break;
- case "ScriptStates":
- foreach (XmlNode st in nodeL)
- {
- string id = st.Attributes.GetNamedItem("UUID").Value;
- UUID uuid = new UUID(id);
- XmlNode state = st.ChildNodes[0];
-
- XmlDocument sdoc = new XmlDocument();
- XmlNode sxmlnode = sdoc.CreateNode(
- XmlNodeType.XmlDeclaration,
- "", "");
- sdoc.AppendChild(sxmlnode);
-
- XmlNode newnode = sdoc.ImportNode(state, true);
- sdoc.AppendChild(newnode);
-
- string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
- spath = Path.Combine(spath, uuid.ToString());
- FileStream sfs = File.Create(spath + ".state");
- ASCIIEncoding enc = new ASCIIEncoding();
- Byte[] buf = enc.GetBytes(sdoc.InnerXml);
- sfs.Write(buf, 0, buf.Length);
- sfs.Close();
- }
- break;
- }
- }
- }
- }
-
- SceneObjectPart RootPrim = GetSceneObjectPart(primID);
- RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
-
- return true;
- }
-
- return true;
- }
-
public bool IncomingCreateObject(ISceneObject sog)
{
//m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
@@ -3362,7 +3265,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
//m_eventManager.OnRegionUp += OtherRegionUp;
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
- m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
m_sceneGridService.KiPrimitive += SendKillObject;
@@ -3386,7 +3288,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.KiPrimitive -= SendKillObject;
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
- m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
//m_eventManager.OnRegionUp -= OtherRegionUp;
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 76c6cab..3892769 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -85,7 +85,6 @@ namespace OpenSim.Region.Framework.Scenes
///
/// A Prim will arrive shortly
///
- public event ExpectPrimDelegate OnExpectPrim;
public event CloseAgentConnection OnCloseAgentConnection;
///
@@ -116,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
- private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
//private RegionUp handlerRegionUp = null; // OnRegionUp;
@@ -147,30 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
/// Thrown if region registration fails.
public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
{
- //m_interregionCommsOut = comms_out;
-
- //m_regionInfo = regionInfos;
- //m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
- //regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
-
- //if (regionCommsHost != null)
- //{
- // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
-
- // regionCommsHost.debugRegionName = regionInfos.RegionName;
- // regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
- // regionCommsHost.OnExpectUser += NewUserConnection;
- // regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
- // regionCommsHost.OnCloseAgentConnection += CloseConnection;
- // regionCommsHost.OnRegionUp += newRegionUp;
- // regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
- // regionCommsHost.OnLogOffUser += GridLogOffUser;
- // regionCommsHost.OnGetLandData += FetchLandData;
- //}
- //else
- //{
- // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
- //}
}
///
@@ -179,31 +153,6 @@ namespace OpenSim.Region.Framework.Scenes
///
public void Close()
{
-
- //if (regionCommsHost != null)
- //{
- // regionCommsHost.OnLogOffUser -= GridLogOffUser;
- // regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
- // regionCommsHost.OnRegionUp -= newRegionUp;
- // regionCommsHost.OnExpectUser -= NewUserConnection;
- // regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
- // regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
- // regionCommsHost.OnCloseAgentConnection -= CloseConnection;
- // regionCommsHost.OnGetLandData -= FetchLandData;
-
- // try
- // {
- // m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
- // }
- // catch (Exception e)
- // {
- // m_log.ErrorFormat(
- // "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
- // m_regionInfo.RegionName, e);
- // }
-
- // regionCommsHost = null;
- //}
}
#region CommsManager Event handlers
@@ -263,27 +212,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- ///
- /// We have a new prim from a neighbor
- ///
- /// unique ID for the primative
- /// XML2 encoded data of the primative
- /// An Int that represents the version of the XMLMethod
- /// True if the prim was accepted, false if it was not
- protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
- {
- handlerExpectPrim = OnExpectPrim;
- if (handlerExpectPrim != null)
- {
- return handlerExpectPrim(primID, objXMLData, XMLMethod);
- }
- else
- {
- return false;
- }
-
- }
-
protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical)
{
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
--
cgit v1.1
From 9d63f90467dbc60622a49f564a56fdd20de90f51 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 17:03:09 +0000
Subject: Remove the old (Remoting) region crossing code. Fix the new code to
pass script state and assembly again properly. Reintroduce respecting tht
TrustBinaries flag. Changes the interregion protocol! No version bump because
it was broken anyway, so with a version mismatch it will simply stay broken,
but not crash. Region corssing still doesn't work because there is still
monkey business with both rezzed prims being pushed across a border and
attached prims when walking across a border. Teleport is untested by may
work.
---
.../Scenes/AsyncSceneObjectGroupDeleter.cs | 5 --
OpenSim/Region/Framework/Scenes/Scene.cs | 2 +-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 99 ++++++++--------------
.../Region/Framework/Scenes/SceneObjectGroup.cs | 11 ---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 --
.../Framework/Scenes/SceneObjectPartInventory.cs | 25 ------
6 files changed, 36 insertions(+), 111 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 5b571c7..9a7863b 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
if (left > 0)
{
x = m_inventoryDeletes.Dequeue();
- if (!x.objectGroup.CanBeDeleted())
- {
- m_inventoryDeletes.Enqueue(x);
- return true;
- }
m_log.DebugFormat(
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0ee818d..eb8567f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -618,7 +618,7 @@ namespace OpenSim.Region.Framework.Scenes
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
m_persistAfter *= 10000000;
- m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine");
+ m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
IConfig packetConfig = m_config.Configs["PacketPool"];
if (packetConfig != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 9a6f2b8..5a06bdb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -351,12 +351,29 @@ namespace OpenSim.Region.Framework.Scenes
return xmldoc.InnerXml;
}
- public void SetState(string objXMLData, UUID RegionID)
+ public void SetState(string objXMLData, IScene ins)
{
-m_log.Debug("SetState called with " + objXMLData);
+ if (!(ins is Scene))
+ return;
+
+ Scene s = (Scene)ins;
+
if (objXMLData == String.Empty)
return;
+ IScriptModule scriptModule = null;
+
+ foreach (IScriptModule sm in s.RequestModuleInterfaces())
+ {
+ if (sm.ScriptEngineName == s.DefaultScriptEngine)
+ scriptModule = sm;
+ else if (scriptModule == null)
+ scriptModule = sm;
+ }
+
+ if (scriptModule == null)
+ return;
+
XmlDocument doc = new XmlDocument();
try
{
@@ -374,69 +391,23 @@ m_log.Debug("SetState called with " + objXMLData);
}
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
- if (rootL.Count == 1)
+ if (rootL.Count != 1)
+ return;
+
+ XmlElement rootE = (XmlElement)rootL[0];
+
+ XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
+ if (dataL.Count != 1)
+ return;
+
+ XmlElement dataE = (XmlElement)dataL[0];
+
+ foreach (XmlNode n in dataE.ChildNodes)
{
- XmlNode rootNode = rootL[0];
- if (rootNode != null)
- {
- XmlNodeList partL = rootNode.ChildNodes;
-
- foreach (XmlNode part in partL)
- {
- XmlNodeList nodeL = part.ChildNodes;
-
- switch (part.Name)
- {
- case "Assemblies":
- foreach (XmlNode asm in nodeL)
- {
- string fn = asm.Attributes.GetNamedItem("Filename").Value;
-
- Byte[] filedata = Convert.FromBase64String(asm.InnerText);
- string path = Path.Combine("ScriptEngines", RegionID.ToString());
- path = Path.Combine(path, fn);
-
- if (!File.Exists(path))
- {
- FileStream fs = File.Create(path);
- fs.Write(filedata, 0, filedata.Length);
- fs.Close();
-
- Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
- fs = File.Create(path+".text");
- fs.Write(textbytes, 0, textbytes.Length);
- fs.Close();
- }
- }
- break;
- case "ScriptStates":
- foreach (XmlNode st in nodeL)
- {
- string id = st.Attributes.GetNamedItem("UUID").Value;
- UUID uuid = new UUID(id);
- XmlNode state = st.ChildNodes[0];
-
- XmlDocument sdoc = new XmlDocument();
- XmlNode sxmlnode = sdoc.CreateNode(
- XmlNodeType.XmlDeclaration,
- "", "");
- sdoc.AppendChild(sxmlnode);
-
- XmlNode newnode = sdoc.ImportNode(state, true);
- sdoc.AppendChild(newnode);
-
- string spath = Path.Combine("ScriptEngines", RegionID.ToString());
- spath = Path.Combine(spath, uuid.ToString());
- FileStream sfs = File.Create(spath + ".state");
- System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
- Byte[] buf = enc.GetBytes(sdoc.InnerXml);
- sfs.Write(buf, 0, buf.Length);
- sfs.Close();
- }
- break;
- }
- }
- }
+ XmlElement stateE = (XmlElement)n;
+ UUID itemID = new UUID(stateE.GetAttribute("UUID"));
+
+ scriptModule.SetXMLState(itemID, n.OuterXml);
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index bcc9b37..6ec2a01 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3341,17 +3341,6 @@ namespace OpenSim.Region.Framework.Scenes
}
#endregion
- public bool CanBeDeleted()
- {
- foreach (SceneObjectPart part in Children.Values)
- {
- if (!part.CanBeDeleted())
- return false;
- }
-
- return true;
- }
-
public double GetUpdatePriority(IClientAPI client)
{
switch (Scene.UpdatePrioritizationScheme)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6f1b458..b6916f2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3797,10 +3797,5 @@ namespace OpenSim.Region.Framework.Scenes
Inventory.ApplyNextOwnerPermissions();
}
-
- public bool CanBeDeleted()
- {
- return Inventory.CanBeDeleted();
- }
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 7f49ced..7a0d7b7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -886,30 +886,5 @@ namespace OpenSim.Region.Framework.Scenes
}
return ret;
}
-
- public bool CanBeDeleted()
- {
- if (!ContainsScripts())
- return true;
-
- IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces();
-
- if (engines == null) // No engine at all
- return true;
-
- foreach (TaskInventoryItem item in m_items.Values)
- {
- if (item.InvType == (int)InventoryType.LSL)
- {
- foreach (IScriptModule e in engines)
- {
- if (!e.CanBeDeleted(item.ItemID))
- return false;
- }
- }
- }
-
- return true;
- }
}
}
--
cgit v1.1
From d39c300d11109553b75ca761d26dda278c0ad7dd Mon Sep 17 00:00:00 2001
From: Jeff Lee
Date: Sun, 22 Nov 2009 18:10:46 -0500
Subject: Added osGetRegionStats() function, to return a number of sim
statistics
---
OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++++
OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 11 +++++++++++
2 files changed, 16 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index eb8567f..2558757 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -387,6 +387,11 @@ namespace OpenSim.Region.Framework.Scenes
{
get { return StatsReporter.getLastReportedSimFPS(); }
}
+
+ public float[] SimulatorStats
+ {
+ get { return StatsReporter.getLastReportedSimStats(); }
+ }
public string DefaultScriptEngine
{
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index ee288b3..56c6ed6 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_fps = 0;
// saved last reported value so there is something available for llGetRegionFPS
private float lastReportedSimFPS = 0;
+ private float[] lastReportedSimStats = new float[21];
private float m_pfps = 0;
private int m_agentUpdates = 0;
@@ -259,6 +260,11 @@ namespace OpenSim.Region.Framework.Scenes
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
+
+ for (int i = 0; i < 21; i++)
+ {
+ lastReportedSimStats[i] = sb[i].StatValue;
+ }
SimStats simStats
= new SimStats(
@@ -438,6 +444,11 @@ namespace OpenSim.Region.Framework.Scenes
{
return lastReportedSimFPS;
}
+
+ public float[] getLastReportedSimStats()
+ {
+ return lastReportedSimStats;
+ }
public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
{
--
cgit v1.1