aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-03-12 00:21:52 +0000
committerJustin Clark-Casey (justincc)2011-03-12 00:21:52 +0000
commit367ed585e0f4a7e4d540230c586531abd75e2228 (patch)
treebfce0afef3d038bc39e32d84e17f9deb40a86164 /OpenSim
parentUpdate/simplify test running instructions (diff)
downloadopensim-SC_OLD-367ed585e0f4a7e4d540230c586531abd75e2228.zip
opensim-SC_OLD-367ed585e0f4a7e4d540230c586531abd75e2228.tar.gz
opensim-SC_OLD-367ed585e0f4a7e4d540230c586531abd75e2228.tar.bz2
opensim-SC_OLD-367ed585e0f4a7e4d540230c586531abd75e2228.tar.xz
introduce iar load checks which make sure archive.xml comes first, then inventory nodes, then assets
this is necessary for correct loading. "save iar" always saves in this order so there shouldn't be any problems - these checks are to give better feedback to other systems that may construct IARs.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs33
1 files changed, 32 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 7d50e51..4d97c0a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -111,6 +111,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
111 /// A list of the inventory nodes loaded. If folders were loaded then only the root folders are 111 /// A list of the inventory nodes loaded. If folders were loaded then only the root folders are
112 /// returned 112 /// returned
113 /// </returns> 113 /// </returns>
114 /// <exception cref="System.Exception">Thrown if load fails.</exception>
114 public HashSet<InventoryNodeBase> Execute() 115 public HashSet<InventoryNodeBase> Execute()
115 { 116 {
116 try 117 try
@@ -143,15 +144,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
143 144
144 byte[] data; 145 byte[] data;
145 TarArchiveReader.TarEntryType entryType; 146 TarArchiveReader.TarEntryType entryType;
147 bool controlFileLoaded = false, assetsLoaded = false, inventoryNodesLoaded = false;
146 148
147 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 149 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
148 { 150 {
149 if (filePath == ArchiveConstants.CONTROL_FILE_PATH) 151 if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
150 { 152 {
151 LoadControlFile(filePath, data); 153 LoadControlFile(filePath, data);
154 controlFileLoaded = true;
152 } 155 }
153 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 156 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
154 { 157 {
158 if (!controlFileLoaded)
159 throw new Exception(
160 string.Format(
161 "The IAR you are trying to load does not list {0} before {1}. Aborting load",
162 ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH));
163
164 if (!inventoryNodesLoaded)
165 throw new Exception(
166 string.Format(
167 "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
168 ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
169
155 if (LoadAsset(filePath, data)) 170 if (LoadAsset(filePath, data))
156 successfulAssetRestores++; 171 successfulAssetRestores++;
157 else 172 else
@@ -160,10 +175,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
160 if ((successfulAssetRestores) % 50 == 0) 175 if ((successfulAssetRestores) % 50 == 0)
161 m_log.DebugFormat( 176 m_log.DebugFormat(
162 "[INVENTORY ARCHIVER]: Loaded {0} assets...", 177 "[INVENTORY ARCHIVER]: Loaded {0} assets...",
163 successfulAssetRestores); 178 successfulAssetRestores);
179
180 assetsLoaded = true;
164 } 181 }
165 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) 182 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
166 { 183 {
184 if (!controlFileLoaded)
185 throw new Exception(
186 string.Format(
187 "The IAR you are trying to load does not list {0} before {1}. Aborting load",
188 ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH));
189
190 if (assetsLoaded)
191 throw new Exception(
192 string.Format(
193 "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
194 ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
195
167 filePath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length); 196 filePath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
168 197
169 // Trim off the file portion if we aren't already dealing with a directory path 198 // Trim off the file portion if we aren't already dealing with a directory path
@@ -188,6 +217,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
188 loadedNodes.Add(item); 217 loadedNodes.Add(item);
189 } 218 }
190 } 219 }
220
221 inventoryNodesLoaded = true;
191 } 222 }
192 } 223 }
193 224