diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index c495e02..55d7997 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -57,7 +57,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
57 | /// <summary> | 57 | /// <summary> |
58 | /// The file to load and save inventory if no filename has been specified | 58 | /// The file to load and save inventory if no filename has been specified |
59 | /// </summary> | 59 | /// </summary> |
60 | protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory_iar.tar.gz"; | 60 | protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory_iar.tar.gz"; |
61 | |||
62 | /// <value> | ||
63 | /// Pending save completions initiated from the console | ||
64 | /// </value> | ||
65 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); | ||
61 | 66 | ||
62 | /// <value> | 67 | /// <value> |
63 | /// All scenes that this module knows about | 68 | /// All scenes that this module knows about |
@@ -106,32 +111,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
106 | /// Trigger the inventory archive saved event. | 111 | /// Trigger the inventory archive saved event. |
107 | /// </summary> | 112 | /// </summary> |
108 | protected internal void TriggerInventoryArchiveSaved( | 113 | protected internal void TriggerInventoryArchiveSaved( |
109 | bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException) | 114 | Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, |
115 | Exception reportedException) | ||
110 | { | 116 | { |
111 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; | 117 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; |
112 | if (handlerInventoryArchiveSaved != null) | 118 | if (handlerInventoryArchiveSaved != null) |
113 | handlerInventoryArchiveSaved(succeeded, userInfo, invPath, saveStream, reportedException); | 119 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); |
114 | } | 120 | } |
115 | 121 | ||
116 | public void ArchiveInventory(string firstName, string lastName, string invPath, Stream saveStream) | 122 | public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream) |
117 | { | 123 | { |
118 | if (m_scenes.Count > 0) | 124 | if (m_scenes.Count > 0) |
119 | { | 125 | { |
120 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName); | 126 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName); |
121 | 127 | ||
122 | if (userInfo != null) | 128 | if (userInfo != null) |
123 | new InventoryArchiveWriteRequest(this, userInfo, invPath, saveStream).Execute(); | 129 | new InventoryArchiveWriteRequest(id, this, userInfo, invPath, saveStream).Execute(); |
124 | } | 130 | } |
125 | } | 131 | } |
126 | 132 | ||
127 | public void ArchiveInventory(string firstName, string lastName, string invPath, string savePath) | 133 | public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string savePath) |
128 | { | 134 | { |
129 | if (m_scenes.Count > 0) | 135 | if (m_scenes.Count > 0) |
130 | { | 136 | { |
131 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName); | 137 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName); |
132 | 138 | ||
133 | if (userInfo != null) | 139 | if (userInfo != null) |
134 | new InventoryArchiveWriteRequest(this, userInfo, invPath, savePath).Execute(); | 140 | new InventoryArchiveWriteRequest(id, this, userInfo, invPath, savePath).Execute(); |
135 | } | 141 | } |
136 | } | 142 | } |
137 | 143 | ||
@@ -215,13 +221,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
215 | m_log.InfoFormat( | 221 | m_log.InfoFormat( |
216 | "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}", | 222 | "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}", |
217 | savePath, invPath, firstName, lastName); | 223 | savePath, invPath, firstName, lastName); |
218 | 224 | ||
219 | ArchiveInventory(firstName, lastName, invPath, savePath); | 225 | Guid id = Guid.NewGuid(); |
220 | } | 226 | ArchiveInventory(id, firstName, lastName, invPath, savePath); |
227 | |||
228 | lock (m_pendingConsoleSaves) | ||
229 | m_pendingConsoleSaves.Add(id); | ||
230 | } | ||
221 | 231 | ||
222 | private void SaveInvConsoleCommandCompleted( | 232 | private void SaveInvConsoleCommandCompleted( |
223 | bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException) | 233 | Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, |
234 | Exception reportedException) | ||
224 | { | 235 | { |
236 | lock (m_pendingConsoleSaves) | ||
237 | { | ||
238 | if (m_pendingConsoleSaves.Contains(id)) | ||
239 | m_pendingConsoleSaves.Remove(id); | ||
240 | else | ||
241 | return; | ||
242 | } | ||
243 | |||
225 | if (succeeded) | 244 | if (succeeded) |
226 | { | 245 | { |
227 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name); | 246 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name); |