aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs62
1 files changed, 37 insertions, 25 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
index fd77cd0..2e48095 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -82,6 +82,35 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
82 Monitor.Pulse(this); 82 Monitor.Pulse(this);
83 } 83 }
84 } 84 }
85
86 /// <summary>
87 /// Get an asset synchronously, potentially using an asynchronous callback. If the
88 /// asynchronous callback is used, we will wait for it to complete.
89 /// </summary>
90 /// <param name="uuid"></param>
91 /// <returns></returns>
92 protected AssetBase GetAsset(LLUUID uuid)
93 {
94 m_waitingForObjectAsset = true;
95 m_scene.AssetCache.GetAsset(uuid, AssetRequestCallback, true);
96
97 // The asset cache callback can either
98 //
99 // 1. Complete on the same thread (if the asset is already in the cache) or
100 // 2. Come in via a different thread (if we need to go fetch it).
101 //
102 // The code below handles both these alternatives.
103 lock (this)
104 {
105 if (m_waitingForObjectAsset)
106 {
107 Monitor.Wait(this);
108 m_waitingForObjectAsset = false;
109 }
110 }
111
112 return m_requestedObjectAsset;
113 }
85 114
86 /// <summary> 115 /// <summary>
87 /// Get all the asset uuids associated with a given object. This includes both those directly associated with 116 /// Get all the asset uuids associated with a given object. This includes both those directly associated with
@@ -116,44 +145,27 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
116 assetUuids[texture.TextureID] = 1; 145 assetUuids[texture.TextureID] = 1;
117 } 146 }
118 } 147 }
119
120 foreach (TaskInventoryItem tii in part.TaskInventory.Values) 148 foreach (TaskInventoryItem tii in part.TaskInventory.Values)
121 { 149 {
122 if (!assetUuids.ContainsKey(tii.AssetID)) 150 if (!assetUuids.ContainsKey(tii.AssetID))
123 { 151 {
124 assetUuids[tii.AssetID] = 1; 152 assetUuids[tii.AssetID] = 1;
125 153
126 if (tii.Type != (int)InventoryType.Object) 154 if ((int)InventoryType.Object == tii.Type)
127 { 155 {
128 m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tii.AssetID, part.UUID); 156 AssetBase objectAsset = GetAsset(tii.AssetID);
129 }
130 else
131 {
132 m_waitingForObjectAsset = true;
133 m_scene.AssetCache.GetAsset(tii.AssetID, AssetRequestCallback, true);
134
135 // The asset cache callback can either
136 //
137 // 1. Complete on the same thread (if the asset is already in the cache) or
138 // 2. Come in via a different thread (if we need to go fetch it).
139 //
140 // The code below handles both these alternatives.
141 lock (this)
142 {
143 if (m_waitingForObjectAsset)
144 {
145 Monitor.Wait(this);
146 m_waitingForObjectAsset = false;
147 }
148 }
149 157
150 if (null != m_requestedObjectAsset) 158 if (null != objectAsset)
151 { 159 {
152 string xml = Helpers.FieldToUTF8String(m_requestedObjectAsset.Data); 160 string xml = Helpers.FieldToUTF8String(objectAsset.Data);
153 SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml); 161 SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml);
154 GetSceneObjectAssetUuids(sog, assetUuids); 162 GetSceneObjectAssetUuids(sog, assetUuids);
155 } 163 }
156 } 164 }
165 else
166 {
167 m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tii.AssetID, part.UUID);
168 }
157 } 169 }
158 } 170 }
159 } 171 }