diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
5 files changed, 90 insertions, 150 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a1f1ea5..47c574a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -951,23 +951,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
951 | /// <param name="primLocalID"></param> | 951 | /// <param name="primLocalID"></param> |
952 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 952 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
953 | { | 953 | { |
954 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 954 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
955 | if (group != null) | 955 | if (part == null) |
956 | { | 956 | return; |
957 | bool fileChange = group.GetPartInventoryFileName(remoteClient, primLocalID); | 957 | |
958 | if (fileChange) | 958 | if (XferManager != null) |
959 | { | 959 | part.Inventory.RequestInventoryFile(remoteClient, XferManager); |
960 | if (XferManager != null) | ||
961 | { | ||
962 | group.RequestInventoryFile(remoteClient, primLocalID, XferManager); | ||
963 | } | ||
964 | } | ||
965 | } | ||
966 | else | ||
967 | { | ||
968 | m_log.ErrorFormat( | ||
969 | "[PRIM INVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID); | ||
970 | } | ||
971 | } | 960 | } |
972 | 961 | ||
973 | /// <summary> | 962 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d915807..deeb817 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1093,6 +1093,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1093 | { | 1093 | { |
1094 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | 1094 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); |
1095 | HeartbeatThread.Abort(); | 1095 | HeartbeatThread.Abort(); |
1096 | Watchdog.RemoveThread(HeartbeatThread.ManagedThreadId); | ||
1096 | HeartbeatThread = null; | 1097 | HeartbeatThread = null; |
1097 | } | 1098 | } |
1098 | m_lastUpdate = Util.EnvironmentTickCount(); | 1099 | m_lastUpdate = Util.EnvironmentTickCount(); |
@@ -4801,7 +4802,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4801 | if (m_firstHeartbeat) | 4802 | if (m_firstHeartbeat) |
4802 | return; | 4803 | return; |
4803 | 4804 | ||
4804 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4805 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 10000) |
4805 | StartTimer(); | 4806 | StartTimer(); |
4806 | } | 4807 | } |
4807 | 4808 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 6cc7231..50521c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -77,49 +77,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /// <summary> | 79 | /// <summary> |
80 | /// | ||
81 | /// </summary> | ||
82 | /// <param name="remoteClient"></param> | ||
83 | /// <param name="localID"></param> | ||
84 | public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) | ||
85 | { | ||
86 | SceneObjectPart part = GetChildPart(localID); | ||
87 | if (part != null) | ||
88 | { | ||
89 | return part.Inventory.GetInventoryFileName(remoteClient, localID); | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | m_log.ErrorFormat( | ||
94 | "[PRIM INVENTORY]: " + | ||
95 | "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", | ||
96 | localID, Name, UUID); | ||
97 | } | ||
98 | return false; | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// Return serialized inventory metadata for the given constituent prim | ||
103 | /// </summary> | ||
104 | /// <param name="localID"></param> | ||
105 | /// <param name="xferManager"></param> | ||
106 | public void RequestInventoryFile(IClientAPI client, uint localID, IXfer xferManager) | ||
107 | { | ||
108 | SceneObjectPart part = GetChildPart(localID); | ||
109 | if (part != null) | ||
110 | { | ||
111 | part.Inventory.RequestInventoryFile(client, xferManager); | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | m_log.ErrorFormat( | ||
116 | "[PRIM INVENTORY]: " + | ||
117 | "Couldn't find part {0} in object group {1}, {2} to request inventory data", | ||
118 | localID, Name, UUID); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | /// <summary> | ||
123 | /// Add an inventory item to a prim in this group. | 80 | /// Add an inventory item to a prim in this group. |
124 | /// </summary> | 81 | /// </summary> |
125 | /// <param name="remoteClient"></param> | 82 | /// <param name="remoteClient"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 8fcfcc5..9412e09 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -46,7 +46,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private string m_inventoryFileName = String.Empty; | 48 | private string m_inventoryFileName = String.Empty; |
49 | private int m_inventoryFileNameSerial = 0; | 49 | private byte[] m_inventoryFileData = new byte[0]; |
50 | private uint m_inventoryFileNameSerial = 0; | ||
50 | 51 | ||
51 | private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>(); | 52 | private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>(); |
52 | 53 | ||
@@ -930,39 +931,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
930 | return -1; | 931 | return -1; |
931 | } | 932 | } |
932 | 933 | ||
933 | public string GetInventoryFileName() | 934 | private bool CreateInventoryFileName() |
934 | { | 935 | { |
935 | if (m_inventoryFileName == String.Empty) | 936 | if (m_inventoryFileName == String.Empty || |
936 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; | 937 | m_inventoryFileNameSerial < m_inventorySerial) |
937 | if (m_inventoryFileNameSerial < m_inventorySerial) | ||
938 | { | 938 | { |
939 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; | 939 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; |
940 | } | 940 | m_inventoryFileNameSerial = m_inventorySerial; |
941 | return m_inventoryFileName; | ||
942 | } | ||
943 | |||
944 | /// <summary> | ||
945 | /// Return the name with which a client can request a xfer of this prim's inventory metadata | ||
946 | /// </summary> | ||
947 | /// <param name="client"></param> | ||
948 | /// <param name="localID"></param> | ||
949 | public bool GetInventoryFileName(IClientAPI client, uint localID) | ||
950 | { | ||
951 | // m_log.DebugFormat( | ||
952 | // "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", | ||
953 | // client.AgentId, Name, UUID); | ||
954 | |||
955 | if (m_inventorySerial > 0) | ||
956 | { | ||
957 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | ||
958 | Utils.StringToBytes(GetInventoryFileName())); | ||
959 | return true; | 941 | return true; |
960 | } | 942 | } |
961 | else | 943 | |
962 | { | 944 | return false; |
963 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | ||
964 | return false; | ||
965 | } | ||
966 | } | 945 | } |
967 | 946 | ||
968 | /// <summary> | 947 | /// <summary> |
@@ -971,78 +950,92 @@ namespace OpenSim.Region.Framework.Scenes | |||
971 | /// <param name="xferManager"></param> | 950 | /// <param name="xferManager"></param> |
972 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) | 951 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) |
973 | { | 952 | { |
974 | byte[] fileData = new byte[0]; | 953 | bool changed = CreateInventoryFileName(); |
975 | 954 | ||
976 | // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches | ||
977 | // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality | ||
978 | // isn't available (such as drag from prim inventory to agent inventory) | ||
979 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); | 955 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); |
980 | 956 | ||
957 | Items.LockItemsForRead(true); | ||
958 | |||
959 | if (m_inventorySerial == 0) // No inventory | ||
960 | { | ||
961 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | ||
962 | Items.LockItemsForRead(false); | ||
963 | return; | ||
964 | } | ||
965 | |||
966 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | ||
967 | Util.StringToBytes256(m_inventoryFileName)); | ||
968 | |||
969 | if (!changed) | ||
970 | { | ||
971 | if (m_inventoryFileData.Length > 2) | ||
972 | { | ||
973 | xferManager.AddNewFile(m_inventoryFileName, | ||
974 | m_inventoryFileData); | ||
975 | Items.LockItemsForRead(false); | ||
976 | return; | ||
977 | } | ||
978 | } | ||
979 | |||
981 | bool includeAssets = false; | 980 | bool includeAssets = false; |
982 | if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) | 981 | if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) |
983 | includeAssets = true; | 982 | includeAssets = true; |
984 | 983 | ||
985 | lock (m_items) | 984 | foreach (TaskInventoryItem item in m_items.Values) |
986 | { | 985 | { |
987 | foreach (TaskInventoryItem item in m_items.Values) | 986 | UUID ownerID = item.OwnerID; |
988 | { | 987 | uint everyoneMask = 0; |
989 | UUID ownerID = item.OwnerID; | 988 | uint baseMask = item.BasePermissions; |
990 | uint everyoneMask = 0; | 989 | uint ownerMask = item.CurrentPermissions; |
991 | uint baseMask = item.BasePermissions; | 990 | uint groupMask = item.GroupPermissions; |
992 | uint ownerMask = item.CurrentPermissions; | 991 | |
993 | uint groupMask = item.GroupPermissions; | 992 | invString.AddItemStart(); |
994 | 993 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | |
995 | invString.AddItemStart(); | 994 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); |
996 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 995 | |
997 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); | 996 | invString.AddPermissionsStart(); |
998 | 997 | ||
999 | invString.AddPermissionsStart(); | 998 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); |
1000 | 999 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); | |
1001 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); | 1000 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); |
1002 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); | 1001 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); |
1003 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); | 1002 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); |
1004 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); | 1003 | |
1005 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); | 1004 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); |
1006 | 1005 | invString.AddNameValueLine("owner_id", ownerID.ToString()); | |
1007 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); | 1006 | |
1008 | invString.AddNameValueLine("owner_id", ownerID.ToString()); | 1007 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); |
1009 | 1008 | ||
1010 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); | 1009 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); |
1011 | 1010 | invString.AddSectionEnd(); | |
1012 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); | 1011 | |
1013 | invString.AddSectionEnd(); | 1012 | if (includeAssets) |
1014 | 1013 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); | |
1015 | if (includeAssets) | 1014 | else |
1016 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); | 1015 | invString.AddNameValueLine("asset_id", UUID.Zero.ToString()); |
1017 | else | 1016 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); |
1018 | invString.AddNameValueLine("asset_id", UUID.Zero.ToString()); | 1017 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); |
1019 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); | 1018 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); |
1020 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); | 1019 | |
1021 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); | 1020 | invString.AddSaleStart(); |
1022 | 1021 | invString.AddNameValueLine("sale_type", "not"); | |
1023 | invString.AddSaleStart(); | 1022 | invString.AddNameValueLine("sale_price", "0"); |
1024 | invString.AddNameValueLine("sale_type", "not"); | 1023 | invString.AddSectionEnd(); |
1025 | invString.AddNameValueLine("sale_price", "0"); | 1024 | |
1026 | invString.AddSectionEnd(); | 1025 | invString.AddNameValueLine("name", item.Name + "|"); |
1027 | 1026 | invString.AddNameValueLine("desc", item.Description + "|"); | |
1028 | invString.AddNameValueLine("name", item.Name + "|"); | 1027 | |
1029 | invString.AddNameValueLine("desc", item.Description + "|"); | 1028 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); |
1030 | 1029 | invString.AddSectionEnd(); | |
1031 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); | ||
1032 | invString.AddSectionEnd(); | ||
1033 | } | ||
1034 | } | 1030 | } |
1035 | int count = m_items.Count; | ||
1036 | m_items.LockItemsForRead(false); | ||
1037 | 1031 | ||
1038 | fileData = Utils.StringToBytes(invString.BuildString); | 1032 | Items.LockItemsForRead(false); |
1039 | 1033 | ||
1040 | //m_log.Debug(Utils.BytesToString(fileData)); | 1034 | m_inventoryFileData = Utils.StringToBytes(invString.BuildString); |
1041 | //m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Utils.BytesToString(fileData)); | ||
1042 | 1035 | ||
1043 | if (fileData.Length > 2) | 1036 | if (m_inventoryFileData.Length > 2) |
1044 | { | 1037 | { |
1045 | xferManager.AddNewFile(m_inventoryFileName, fileData); | 1038 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); |
1046 | } | 1039 | } |
1047 | } | 1040 | } |
1048 | 1041 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index b44a010..40a73a9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
106 | g.ScheduleFullUpdateToAvatar(m_presence); | 106 | g.ScheduleFullUpdateToAvatar(m_presence); |
107 | } | 107 | } |
108 | 108 | ||
109 | while (m_partsUpdateQueue.Count > 0) | 109 | while (m_partsUpdateQueue.Count != null && m_partsUpdateQueue.Count > 0) |
110 | { | 110 | { |
111 | SceneObjectPart part = m_partsUpdateQueue.Dequeue(); | 111 | SceneObjectPart part = m_partsUpdateQueue.Dequeue(); |
112 | 112 | ||