aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2012-09-25 20:04:10 -0700
committerDiva Canto2012-09-25 20:04:10 -0700
commit7d2cd0d9359164e36c7a963c2d0afa7563761045 (patch)
tree2fce9b317a97da4abad4d0c4b5eaf06bf6d1fbe9
parentTOS module. WARNING: migration in GridUser table. (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-7d2cd0d9359164e36c7a963c2d0afa7563761045.zip
opensim-SC-7d2cd0d9359164e36c7a963c2d0afa7563761045.tar.gz
opensim-SC-7d2cd0d9359164e36c7a963c2d0afa7563761045.tar.bz2
opensim-SC-7d2cd0d9359164e36c7a963c2d0afa7563761045.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs138
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs233
-rw-r--r--bin/OpenSim.ini.example100
4 files changed, 248 insertions, 234 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index b557ffe..0271738 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -57,39 +57,36 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// Return a xfer uploader if one does not already exist. 60 /// Return the xfer uploader for the given transaction.
61 /// </summary> 61 /// </summary>
62 /// <remarks>
63 /// If an uploader does not already exist for this transaction then it is created, otherwise the existing
64 /// uploader is returned.
65 /// </remarks>
62 /// <param name="transactionID"></param> 66 /// <param name="transactionID"></param>
63 /// <param name="assetID"> 67 /// <returns>The asset xfer uploader</returns>
64 /// We must transfer the new asset ID into the uploader on creation, otherwise 68 public AssetXferUploader RequestXferUploader(UUID transactionID)
65 /// we can see race conditions with other threads which can retrieve an item before it is updated with the new
66 /// asset id.
67 /// </param>
68 /// <returns>
69 /// The xfer uploader requested. Null if one is already in existence.
70 /// FIXME: This is a bizarre thing to do, and is probably meant to signal an error condition if multiple
71 /// transfers are made. Needs to be corrected.
72 /// </returns>
73 public AssetXferUploader RequestXferUploader(UUID transactionID, UUID assetID)
74 { 69 {
70 AssetXferUploader uploader;
71
75 lock (XferUploaders) 72 lock (XferUploaders)
76 { 73 {
77 if (!XferUploaders.ContainsKey(transactionID)) 74 if (!XferUploaders.ContainsKey(transactionID))
78 { 75 {
79 AssetXferUploader uploader = new AssetXferUploader(this, m_Scene, assetID, m_dumpAssetsToFile); 76 uploader = new AssetXferUploader(this, m_Scene, transactionID, m_dumpAssetsToFile);
80 77
81// m_log.DebugFormat( 78// m_log.DebugFormat(
82// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID); 79// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID);
83 80
84 XferUploaders.Add(transactionID, uploader); 81 XferUploaders.Add(transactionID, uploader);
85 82 }
86 return uploader; 83 else
84 {
85 uploader = XferUploaders[transactionID];
87 } 86 }
88 } 87 }
89 88
90 m_log.WarnFormat("[AGENT ASSETS TRANSACTIONS]: Ignoring request for asset xfer uploader {0} since it already exists", transactionID); 89 return uploader;
91
92 return null;
93 } 90 }
94 91
95 public void HandleXfer(ulong xferID, uint packetID, byte[] data) 92 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
@@ -151,115 +148,28 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
151 string description, string name, sbyte invType, 148 string description, string name, sbyte invType,
152 sbyte type, byte wearableType, uint nextOwnerMask) 149 sbyte type, byte wearableType, uint nextOwnerMask)
153 { 150 {
154 AssetXferUploader uploader = null; 151 AssetXferUploader uploader = RequestXferUploader(transactionID);
155
156 lock (XferUploaders)
157 {
158 if (XferUploaders.ContainsKey(transactionID))
159 uploader = XferUploaders[transactionID];
160 }
161 152
162 if (uploader != null) 153 uploader.RequestCreateInventoryItem(
163 uploader.RequestCreateInventoryItem( 154 remoteClient, folderID, callbackID,
164 remoteClient, transactionID, folderID, 155 description, name, invType, type, wearableType, nextOwnerMask);
165 callbackID, description, name, invType, type,
166 wearableType, nextOwnerMask);
167 else
168 m_log.ErrorFormat(
169 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to create inventory item {1} from {2}",
170 transactionID, name, remoteClient.Name);
171 }
172
173 /// <summary>
174 /// Get an uploaded asset. If the data is successfully retrieved,
175 /// the transaction will be removed.
176 /// </summary>
177 /// <param name="transactionID"></param>
178 /// <returns>The asset if the upload has completed, null if it has not.</returns>
179 private AssetBase GetTransactionAsset(UUID transactionID)
180 {
181 lock (XferUploaders)
182 {
183 if (XferUploaders.ContainsKey(transactionID))
184 {
185 AssetXferUploader uploader = XferUploaders[transactionID];
186 AssetBase asset = uploader.GetAssetData();
187 RemoveXferUploader(transactionID);
188
189 return asset;
190 }
191 }
192
193 return null;
194 } 156 }
195 157
196 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, 158 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
197 SceneObjectPart part, UUID transactionID, 159 SceneObjectPart part, UUID transactionID,
198 TaskInventoryItem item) 160 TaskInventoryItem item)
199 { 161 {
200 AssetXferUploader uploader = null; 162 AssetXferUploader uploader = RequestXferUploader(transactionID);
201
202 lock (XferUploaders)
203 {
204 if (XferUploaders.ContainsKey(transactionID))
205 uploader = XferUploaders[transactionID];
206 }
207
208 if (uploader != null)
209 {
210 AssetBase asset = GetTransactionAsset(transactionID);
211
212 // Only legacy viewers use this, and they prefer CAPS, which
213 // we have, so this really never runs.
214 // Allow it, but only for "safe" types.
215 if ((InventoryType)item.InvType != InventoryType.Notecard &&
216 (InventoryType)item.InvType != InventoryType.LSL)
217 return;
218 163
219 if (asset != null) 164 uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
220 {
221// m_log.DebugFormat(
222// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
223// item.Name, part.Name, transactionID);
224
225 asset.FullID = UUID.Random();
226 asset.Name = item.Name;
227 asset.Description = item.Description;
228 asset.Type = (sbyte)item.Type;
229 item.AssetID = asset.FullID;
230
231 m_Scene.AssetService.Store(asset);
232 }
233 }
234 else
235 {
236 m_log.ErrorFormat(
237 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update task inventory item {1} in {2}",
238 transactionID, item.Name, part.Name);
239 }
240 } 165 }
241 166
242 public void RequestUpdateInventoryItem(IClientAPI remoteClient, 167 public void RequestUpdateInventoryItem(IClientAPI remoteClient,
243 UUID transactionID, InventoryItemBase item) 168 UUID transactionID, InventoryItemBase item)
244 { 169 {
245 AssetXferUploader uploader = null; 170 AssetXferUploader uploader = RequestXferUploader(transactionID);
246
247 lock (XferUploaders)
248 {
249 if (XferUploaders.ContainsKey(transactionID))
250 uploader = XferUploaders[transactionID];
251 }
252 171
253 if (uploader != null) 172 uploader.RequestUpdateInventoryItem(remoteClient, item);
254 {
255 uploader.RequestUpdateInventoryItem(remoteClient, transactionID, item);
256 }
257 else
258 {
259 m_log.ErrorFormat(
260 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update inventory item {1} for {2}",
261 transactionID, item.Name, remoteClient.Name);
262 }
263 } 173 }
264 } 174 }
265} 175} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 7081989..73d1f72 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) 215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
216 { 216 {
217 m_log.DebugFormat( 217 m_log.DebugFormat(
218 "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}", 218 "[ASSET TRANSACTION MODULE] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
219 item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName); 219 item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
220 220
221 AgentAssetTransactions transactions = 221 AgentAssetTransactions transactions =
@@ -274,13 +274,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
274 } 274 }
275 275
276 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 276 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
277 AssetXferUploader uploader = transactions.RequestXferUploader(transaction, assetID); 277 AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
278 278 uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
279 if (uploader != null)
280 {
281 uploader.Initialise(remoteClient, assetID, transaction, type,
282 data, storeLocal, tempFile);
283 }
284 } 279 }
285 280
286 /// <summary> 281 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index ec4dfd0..8add4bb 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -41,38 +41,74 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 /// <summary> 43 /// <summary>
44 /// Upload state.
45 /// </summary>
46 /// <remarks>
47 /// New -> Uploading -> Complete
48 /// </remarks>
49 private enum UploadState
50 {
51 New,
52 Uploading,
53 Complete
54 }
55
56 /// <summary>
44 /// Reference to the object that holds this uploader. Used to remove ourselves from it's list if we 57 /// Reference to the object that holds this uploader. Used to remove ourselves from it's list if we
45 /// are performing a delayed update. 58 /// are performing a delayed update.
46 /// </summary> 59 /// </summary>
47 AgentAssetTransactions m_transactions; 60 AgentAssetTransactions m_transactions;
48 61
62 private UploadState m_uploadState = UploadState.New;
63
49 private AssetBase m_asset; 64 private AssetBase m_asset;
50 private UUID InventFolder = UUID.Zero; 65 private UUID InventFolder = UUID.Zero;
51 private sbyte invType = 0; 66 private sbyte invType = 0;
52 67
53 private bool m_createItem = false; 68 private bool m_createItem;
54 private uint m_createItemCallback = 0; 69 private uint m_createItemCallback;
55 private bool m_updateItem = false; 70
71 private bool m_updateItem;
56 private InventoryItemBase m_updateItemData; 72 private InventoryItemBase m_updateItemData;
57 73
74 private bool m_updateTaskItem;
75 private TaskInventoryItem m_updateTaskItemData;
76
58 private string m_description = String.Empty; 77 private string m_description = String.Empty;
59 private bool m_dumpAssetToFile; 78 private bool m_dumpAssetToFile;
60 private bool m_finished = false;
61 private string m_name = String.Empty; 79 private string m_name = String.Empty;
62 private bool m_storeLocal; 80// private bool m_storeLocal;
63 private uint nextPerm = 0; 81 private uint nextPerm = 0;
64 private IClientAPI ourClient; 82 private IClientAPI ourClient;
65 private UUID TransactionID = UUID.Zero; 83
84 private UUID m_transactionID;
85
66 private sbyte type = 0; 86 private sbyte type = 0;
67 private byte wearableType = 0; 87 private byte wearableType = 0;
68 public ulong XferID; 88 public ulong XferID;
69 private Scene m_Scene; 89 private Scene m_Scene;
70 90
71 public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, UUID assetID, bool dumpAssetToFile) 91 /// <summary>
92 /// AssetXferUploader constructor
93 /// </summary>
94 /// <param name='transactions'>/param>
95 /// <param name='scene'></param>
96 /// <param name='transactionID'></param>
97 /// <param name='dumpAssetToFile'>
98 /// If true then when the asset is uploaded it is dumped to a file with the format
99 /// String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
100 /// now.Year, now.Month, now.Day, now.Hour, now.Minute,
101 /// now.Second, m_asset.Name, m_asset.Type);
102 /// for debugging purposes.
103 /// </param>
104 public AssetXferUploader(
105 AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile)
72 { 106 {
107 m_asset = new AssetBase();
108
73 m_transactions = transactions; 109 m_transactions = transactions;
110 m_transactionID = transactionID;
74 m_Scene = scene; 111 m_Scene = scene;
75 m_asset = new AssetBase() { FullID = assetID };
76 m_dumpAssetToFile = dumpAssetToFile; 112 m_dumpAssetToFile = dumpAssetToFile;
77 } 113 }
78 114
@@ -118,30 +154,50 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
118 } 154 }
119 155
120 /// <summary> 156 /// <summary>
121 /// Initialise asset transfer from the client 157 /// Start asset transfer from the client
122 /// </summary> 158 /// </summary>
123 /// <param name="xferID"></param> 159 /// <param name="remoteClient"></param>
124 /// <param name="packetID"></param> 160 /// <param name="assetID"></param>
125 /// <param name="data"></param> 161 /// <param name="transaction"></param>
126 public void Initialise(IClientAPI remoteClient, UUID assetID, 162 /// <param name="type"></param>
127 UUID transaction, sbyte type, byte[] data, bool storeLocal, 163 /// <param name="data">
128 bool tempFile) 164 /// Optional data. If present then the asset is created immediately with this data
165 /// rather than requesting an upload from the client. The data must be longer than 2 bytes.
166 /// </param>
167 /// <param name="storeLocal"></param>
168 /// <param name="tempFile"></param>
169 public void StartUpload(
170 IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal,
171 bool tempFile)
129 { 172 {
130// m_log.DebugFormat( 173// m_log.DebugFormat(
131// "[ASSET XFER UPLOADER]: Initialised xfer from {0}, asset {1}, transaction {2}, type {3}, storeLocal {4}, tempFile {5}, already received data length {6}", 174// "[ASSET XFER UPLOADER]: Initialised xfer from {0}, asset {1}, transaction {2}, type {3}, storeLocal {4}, tempFile {5}, already received data length {6}",
132// remoteClient.Name, assetID, transaction, type, storeLocal, tempFile, data.Length); 175// remoteClient.Name, assetID, transaction, type, storeLocal, tempFile, data.Length);
133 176
177 lock (this)
178 {
179 if (m_uploadState != UploadState.New)
180 {
181 m_log.WarnFormat(
182 "[ASSET XFER UPLOADER]: Tried to start upload of asset {0}, transaction {1} for {2} but this is already in state {3}. Aborting.",
183 assetID, transaction, remoteClient.Name, m_uploadState);
184
185 return;
186 }
187
188 m_uploadState = UploadState.Uploading;
189 }
190
134 ourClient = remoteClient; 191 ourClient = remoteClient;
135 m_asset.Name = "blank"; 192
136 m_asset.Description = "empty"; 193 m_asset.FullID = assetID;
137 m_asset.Type = type; 194 m_asset.Type = type;
138 m_asset.CreatorID = remoteClient.AgentId.ToString(); 195 m_asset.CreatorID = remoteClient.AgentId.ToString();
139 m_asset.Data = data; 196 m_asset.Data = data;
140 m_asset.Local = storeLocal; 197 m_asset.Local = storeLocal;
141 m_asset.Temporary = tempFile; 198 m_asset.Temporary = tempFile;
142 199
143 TransactionID = transaction; 200// m_storeLocal = storeLocal;
144 m_storeLocal = storeLocal;
145 201
146 if (m_asset.Data.Length > 2) 202 if (m_asset.Data.Length > 2)
147 { 203 {
@@ -166,36 +222,35 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
166 222
167 protected void SendCompleteMessage() 223 protected void SendCompleteMessage()
168 { 224 {
169 ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true,
170 m_asset.FullID);
171
172 // We must lock in order to avoid a race with a separate thread dealing with an inventory item or create 225 // We must lock in order to avoid a race with a separate thread dealing with an inventory item or create
173 // message from other client UDP. 226 // message from other client UDP.
174 lock (this) 227 lock (this)
175 { 228 {
176 m_finished = true; 229 m_uploadState = UploadState.Complete;
230
231 ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID);
232
177 if (m_createItem) 233 if (m_createItem)
178 { 234 {
179 DoCreateItem(m_createItemCallback); 235 CompleteCreateItem(m_createItemCallback);
180 } 236 }
181 else if (m_updateItem) 237 else if (m_updateItem)
182 { 238 {
183 StoreAssetForItemUpdate(m_updateItemData); 239 CompleteItemUpdate(m_updateItemData);
184
185 // Remove ourselves from the list of transactions if completion was delayed until the transaction
186 // was complete.
187 // TODO: Should probably do the same for create item.
188 m_transactions.RemoveXferUploader(TransactionID);
189 } 240 }
190 else if (m_storeLocal) 241 else if (m_updateTaskItem)
191 { 242 {
192 m_Scene.AssetService.Store(m_asset); 243 CompleteTaskItemUpdate(m_updateTaskItemData);
193 } 244 }
245// else if (m_storeLocal)
246// {
247// m_Scene.AssetService.Store(m_asset);
248// }
194 } 249 }
195 250
196 m_log.DebugFormat( 251 m_log.DebugFormat(
197 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}", 252 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
198 m_asset.FullID, TransactionID); 253 m_asset.FullID, m_transactionID);
199 254
200 if (m_dumpAssetToFile) 255 if (m_dumpAssetToFile)
201 { 256 {
@@ -223,40 +278,37 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
223 } 278 }
224 279
225 public void RequestCreateInventoryItem(IClientAPI remoteClient, 280 public void RequestCreateInventoryItem(IClientAPI remoteClient,
226 UUID transactionID, UUID folderID, uint callbackID, 281 UUID folderID, uint callbackID,
227 string description, string name, sbyte invType, 282 string description, string name, sbyte invType,
228 sbyte type, byte wearableType, uint nextOwnerMask) 283 sbyte type, byte wearableType, uint nextOwnerMask)
229 { 284 {
230 if (TransactionID == transactionID) 285 InventFolder = folderID;
286 m_name = name;
287 m_description = description;
288 this.type = type;
289 this.invType = invType;
290 this.wearableType = wearableType;
291 nextPerm = nextOwnerMask;
292 m_asset.Name = name;
293 m_asset.Description = description;
294 m_asset.Type = type;
295
296 // We must lock to avoid a race with a separate thread uploading the asset.
297 lock (this)
231 { 298 {
232 InventFolder = folderID; 299 if (m_uploadState == UploadState.Complete)
233 m_name = name;
234 m_description = description;
235 this.type = type;
236 this.invType = invType;
237 this.wearableType = wearableType;
238 nextPerm = nextOwnerMask;
239 m_asset.Name = name;
240 m_asset.Description = description;
241 m_asset.Type = type;
242
243 // We must lock to avoid a race with a separate thread uploading the asset.
244 lock (this)
245 { 300 {
246 if (m_finished) 301 CompleteCreateItem(callbackID);
247 { 302 }
248 DoCreateItem(callbackID); 303 else
249 } 304 {
250 else 305 m_createItem = true; //set flag so the inventory item is created when upload is complete
251 { 306 m_createItemCallback = callbackID;
252 m_createItem = true; //set flag so the inventory item is created when upload is complete
253 m_createItemCallback = callbackID;
254 }
255 } 307 }
256 } 308 }
257 } 309 }
258 310
259 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item) 311 public void RequestUpdateInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
260 { 312 {
261 // We must lock to avoid a race with a separate thread uploading the asset. 313 // We must lock to avoid a race with a separate thread uploading the asset.
262 lock (this) 314 lock (this)
@@ -271,9 +323,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
271 item.AssetID = m_asset.FullID; 323 item.AssetID = m_asset.FullID;
272 m_Scene.InventoryService.UpdateItem(item); 324 m_Scene.InventoryService.UpdateItem(item);
273 325
274 if (m_finished) 326 if (m_uploadState == UploadState.Complete)
275 { 327 {
276 StoreAssetForItemUpdate(item); 328 CompleteItemUpdate(item);
277 } 329 }
278 else 330 else
279 { 331 {
@@ -287,20 +339,59 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
287 } 339 }
288 } 340 }
289 341
342 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, TaskInventoryItem taskItem)
343 {
344 // We must lock to avoid a race with a separate thread uploading the asset.
345 lock (this)
346 {
347 m_asset.Name = taskItem.Name;
348 m_asset.Description = taskItem.Description;
349 m_asset.Type = (sbyte)taskItem.Type;
350 taskItem.AssetID = m_asset.FullID;
351
352 if (m_uploadState == UploadState.Complete)
353 {
354 CompleteTaskItemUpdate(taskItem);
355 }
356 else
357 {
358 m_updateTaskItem = true;
359 m_updateTaskItemData = taskItem;
360 }
361 }
362 }
363
290 /// <summary> 364 /// <summary>
291 /// Store the asset for the given item. 365 /// Store the asset for the given item when it has been uploaded.
292 /// </summary> 366 /// </summary>
293 /// <param name="item"></param> 367 /// <param name="item"></param>
294 private void StoreAssetForItemUpdate(InventoryItemBase item) 368 private void CompleteItemUpdate(InventoryItemBase item)
295 { 369 {
296// m_log.DebugFormat( 370// m_log.DebugFormat(
297// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}", 371// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}",
298// m_asset.FullID, item.Name, ourClient.Name); 372// m_asset.FullID, item.Name, ourClient.Name);
299 373
300 m_Scene.AssetService.Store(m_asset); 374 m_Scene.AssetService.Store(m_asset);
375
376 m_transactions.RemoveXferUploader(m_transactionID);
301 } 377 }
302 378
303 private void DoCreateItem(uint callbackID) 379 /// <summary>
380 /// Store the asset for the given task item when it has been uploaded.
381 /// </summary>
382 /// <param name="taskItem"></param>
383 private void CompleteTaskItemUpdate(TaskInventoryItem taskItem)
384 {
385// m_log.DebugFormat(
386// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}",
387// m_asset.FullID, taskItem.Name, ourClient.Name);
388
389 m_Scene.AssetService.Store(m_asset);
390
391 m_transactions.RemoveXferUploader(m_transactionID);
392 }
393
394 private void CompleteCreateItem(uint callbackID)
304 { 395 {
305 m_Scene.AssetService.Store(m_asset); 396 m_Scene.AssetService.Store(m_asset);
306 397
@@ -326,20 +417,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
326 ourClient.SendInventoryItemCreateUpdate(item, callbackID); 417 ourClient.SendInventoryItemCreateUpdate(item, callbackID);
327 else 418 else
328 ourClient.SendAlertMessage("Unable to create inventory item"); 419 ourClient.SendAlertMessage("Unable to create inventory item");
329 }
330
331 /// <summary>
332 /// Get the asset data uploaded in this transfer.
333 /// </summary>
334 /// <returns>null if the asset has not finished uploading</returns>
335 public AssetBase GetAssetData()
336 {
337 if (m_finished)
338 {
339 return m_asset;
340 }
341 420
342 return null; 421 m_transactions.RemoveXferUploader(m_transactionID);
343 } 422 }
344 } 423 }
345} 424} \ No newline at end of file
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index a602dcc..22b39ce 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1,19 +1,23 @@
1;; This is the main configuration file for OpenSimulator. If it's named OpenSim.ini 1;; This is the main configuration file for OpenSimulator.
2;; then it will be loaded by OpenSimulator. If it's named OpenSim.ini.example then 2;; If it's named OpenSim.ini then it will be loaded by OpenSimulator.
3;; you will need to copy it to OpenSim.ini first (if that file does not already exist) 3;; If it's named OpenSim.ini.example then you will need to copy it to
4;; OpenSim.ini first (if that file does not already exist)
4;; 5;;
5;; If you are copying, then once you have copied OpenSim.ini.example to OpenSim.ini you will 6;; If you are copying, then once you have copied OpenSim.ini.example to
6;; need to pick an architecture in the [Architecture] section at the end of this file. 7;; OpenSim.ini you will need to pick an architecture in the [Architecture]
8;; section at the end of this file.
7;; 9;;
8;; The settings in this file are in the form "<key> = <value>". For example, save_crashes = false 10;; The settings in this file are in the form "<key> = <value>". For example,
9;; in the [Startup] section below. 11;; save_crashes = false in the [Startup] section below.
10;; 12;;
11;; All settings are initially commented out and the default value used, as found in 13;; All settings are initially commented out and the default value used, as
12;; OpenSimDefaults.ini. To change a setting, first uncomment it by deleting the initial semicolon (;) 14;; found in OpenSimDefaults.ini. To change a setting, first uncomment it by
13;; and then change the value. This will override the value in OpenSimDefaults.ini 15;; deleting the initial semicolon (;) and then change the value. This will
16;; override the value in OpenSimDefaults.ini
14;; 17;;
15;; If you want to find out what configuration OpenSimulator has finished with once all the configuration 18;; If you want to find out what configuration OpenSimulator has finished with
16;; files are loaded then type "config show" on the region console command line. 19;; once all the configuration files are loaded then type "config show" on the
20;; region console command line.
17;; 21;;
18;; 22;;
19;; NOTES FOR DEVELOPERS REGARDING THE FORMAT OF THIS FILE 23;; NOTES FOR DEVELOPERS REGARDING THE FORMAT OF THIS FILE
@@ -26,13 +30,16 @@
26;; formatted as: 30;; formatted as:
27;; {option} {depends on} {question to ask} {choices} default value 31;; {option} {depends on} {question to ask} {choices} default value
28;; Any text comments following the declaration, up to the next blank line. 32;; Any text comments following the declaration, up to the next blank line.
29;; will be copied to the generated file (NOTE: generation is not yet implemented) 33;; will be copied to the generated file (NOTE: generation is not yet
34;; implemented)
35;;
30;; A * in the choices list will allow an empty entry. 36;; A * in the choices list will allow an empty entry.
31;; An empty question will set the default if the dependencies are 37;; An empty question will set the default if the dependencies are
32;; satisfied. 38;; satisfied.
33;; 39;;
34;; ; denotes a commented out option. 40;; ; denotes a commented out option.
35;; Any options added to OpenSim.ini.example should be initially commented out. 41;; Any options added to OpenSim.ini.example should be initially commented
42;; out.
36 43
37 44
38[Startup] 45[Startup]
@@ -47,9 +54,12 @@
47 ;# {save_crashes} {} {Save crashes to disk?} {true false} false 54 ;# {save_crashes} {} {Save crashes to disk?} {true false} false
48 ;; Set this to true if you want to log crashes to disk 55 ;; Set this to true if you want to log crashes to disk
49 ;; this can be useful when submitting bug reports. 56 ;; this can be useful when submitting bug reports.
50 ;; However, this will only log crashes within OpenSimulator that cause the entire program to exit 57 ;; However, this will only log crashes within OpenSimulator that cause the
51 ;; It will not log crashes caused by virtual machine failures, which includes mono and ODE failures. 58 ;; entire program to exit
52 ;; You will need to capture these native stack traces by recording the session log itself. 59 ;; It will not log crashes caused by virtual machine failures, which
60 ;; includes mono and ODE failures.
61 ;; You will need to capture these native stack traces by recording the
62 ;; session log itself.
53 ; save_crashes = false 63 ; save_crashes = false
54 64
55 ;# {crash_dir} {save_crashes:true} {Directory to save crashes to?} {} crashes 65 ;# {crash_dir} {save_crashes:true} {Directory to save crashes to?} {} crashes
@@ -88,35 +98,46 @@
88 ; allow_regionless = false 98 ; allow_regionless = false
89 99
90 ;# {NonPhysicalPrimMin} {} {Minimum size of nonphysical prims?} {} 0.001 100 ;# {NonPhysicalPrimMin} {} {Minimum size of nonphysical prims?} {} 0.001
91 ;; Minimum size for non-physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMin!). 101 ;; Minimum size for non-physical prims. Affects resizing of existing
102 ;; prims. This can be overriden in the region config file (as
103 ;; NonPhysicalPrimMin!).
92 ; NonPhysicalPrimMin = 0.001 104 ; NonPhysicalPrimMin = 0.001
93 105
94 ;# {NonPhysicalPrimMax} {} {Maximum size of nonphysical prims?} {} 256 106 ;# {NonPhysicalPrimMax} {} {Maximum size of nonphysical prims?} {} 256
95 ;; Maximum size for non-physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMax!). 107 ;; Maximum size for non-physical prims. Affects resizing of existing
108 ;; prims. This can be overriden in the region config file (as
109 ;; NonPhysicalPrimMax!).
96 ; NonPhysicalPrimMax = 256 110 ; NonPhysicalPrimMax = 256
97 111
98 ;# {PhysicalPrimMin} {} {Minimum size of physical prims?} {} 10 112 ;# {PhysicalPrimMin} {} {Minimum size of physical prims?} {} 10
99 ;; Maximum size where a prim can be physical. Affects resizing of existing prims. This can be overriden in the region config file. 113 ;; Maximum size where a prim can be physical. Affects resizing of
114 ;; existing prims. This can be overriden in the region config file.
100 ; PhysicalPrimMin = 0.01 115 ; PhysicalPrimMin = 0.01
101 116
102 ;# {PhysicalPrimMax} {} {Maximum size of physical prims?} {} 10 117 ;# {PhysicalPrimMax} {} {Maximum size of physical prims?} {} 10
103 ;; Maximum size where a prim can be physical. Affects resizing of existing prims. This can be overriden in the region config file. 118 ;; Maximum size where a prim can be physical. Affects resizing of
119 ;; existing prims. This can be overriden in the region config file.
104 ; PhysicalPrimMax = 10 120 ; PhysicalPrimMax = 10
105 121
106 ;# {ClampPrimSize} {} {Clamp viewer rezzed prims to max sizes?} {true false} false 122 ;# {ClampPrimSize} {} {Clamp viewer rezzed prims to max sizes?} {true false} false
107 ;; If a viewer attempts to rez a prim larger than the non-physical or physical prim max, clamp the dimensions to the appropriate maximum 123 ;; If a viewer attempts to rez a prim larger than the non-physical or
124 ;; physical prim max, clamp the dimensions to the appropriate maximum
108 ;; This can be overriden in the region config file. 125 ;; This can be overriden in the region config file.
109 ; ClampPrimSize = false 126 ; ClampPrimSize = false
110 127
111 ;# {LinksetPrims} {} {Max prims an object will hold?} {} 0 128 ;# {LinksetPrims} {} {Max prims an object will hold?} {} 0
112 ;; Maximum number of prims allowable in a linkset. Affects creating new linksets. Ignored if less than or equal to zero. 129 ;; Maximum number of prims allowable in a linkset. Affects creating new
130 ;; linksets. Ignored if less than or equal to zero.
113 ;; This can be overriden in the region config file. 131 ;; This can be overriden in the region config file.
114 ; LinksetPrims = 0 132 ; LinksetPrims = 0
115 133
116 ;# {AllowScriptCrossing} {} {Allow scripts to cross into this region} {true false} true 134 ;# {AllowScriptCrossing} {} {Allow scripts to cross into this region} {true false} true
117 ;; Allow scripts to keep running when they cross region boundaries, rather than being restarted. State is reloaded on the destination region. 135 ;; Allow scripts to keep running when they cross region boundaries, rather
118 ;; This only applies when crossing to a region running in a different simulator. 136 ;; than being restarted. State is reloaded on the destination region.
119 ;; For crossings where the regions are on the same simulator the script is always kept running. 137 ;; This only applies when crossing to a region running in a different
138 ;; simulator.
139 ;; For crossings where the regions are on the same simulator the script is
140 ;; always kept running.
120 ; AllowScriptCrossing = true 141 ; AllowScriptCrossing = true
121 142
122 ;# {TrustBinaries} {AllowScriptCrossing:true} {Accept compiled binary script code? (DANGEROUS!)} {true false} false 143 ;# {TrustBinaries} {AllowScriptCrossing:true} {Accept compiled binary script code? (DANGEROUS!)} {true false} false
@@ -186,7 +207,8 @@
186 ;# {physics} {} {Select physics engine} {OpenDynamicsEngine BulletSim basicphysics POS} OpenDynamicsEngine 207 ;# {physics} {} {Select physics engine} {OpenDynamicsEngine BulletSim basicphysics POS} OpenDynamicsEngine
187 ;; OpenDynamicsEngine is by some distance the most developed physics engine 208 ;; OpenDynamicsEngine is by some distance the most developed physics engine
188 ;; BulletSim is incomplete and experimental but in active development 209 ;; BulletSim is incomplete and experimental but in active development
189 ;; basicphysics effectively does not model physics at all, making all objects phantom 210 ;; basicphysics effectively does not model physics at all, making all
211 ;; objects phantom
190 ;; Default is OpenDynamicsEngine 212 ;; Default is OpenDynamicsEngine
191 ; physics = OpenDynamicsEngine 213 ; physics = OpenDynamicsEngine
192 ; physics = BulletSim 214 ; physics = BulletSim
@@ -229,8 +251,9 @@
229 ;# {simple_build_permissions} {} {Allow building in parcel by access list (no groups)} {true false} false 251 ;# {simple_build_permissions} {} {Allow building in parcel by access list (no groups)} {true false} false
230 ;; More control over permissions 252 ;; More control over permissions
231 ;; This is definitely not SL! 253 ;; This is definitely not SL!
232 ;; Provides a simple control for land owners to give build rights to specific avatars 254 ;; Provides a simple control for land owners to give build rights to
233 ;; in publicly accessible parcels that disallow object creation in general. 255 ;; specific avatars in publicly accessible parcels that disallow object
256 ;; creation in general.
234 ;; Owners specific avatars by adding them to the Access List of the parcel 257 ;; Owners specific avatars by adding them to the Access List of the parcel
235 ;; without having to use the Groups feature 258 ;; without having to use the Groups feature
236 ; simple_build_permissions = false 259 ; simple_build_permissions = false
@@ -266,11 +289,14 @@
266 ; DrawPrimOnMapTile = true 289 ; DrawPrimOnMapTile = true
267 290
268 ;# {HttpProxy} {} {Proxy URL for llHTTPRequest and dynamic texture loading} {} http://proxy.com:8080 291 ;# {HttpProxy} {} {Proxy URL for llHTTPRequest and dynamic texture loading} {} http://proxy.com:8080
269 ;; Http proxy setting for llHTTPRequest and dynamic texture loading, if required 292 ;; Http proxy setting for llHTTPRequest and dynamic texture loading, if
293 ;; required
270 ; HttpProxy = "http://proxy.com:8080" 294 ; HttpProxy = "http://proxy.com:8080"
271 295
272 ;# {HttpProxyExceptions} {HttpProxy} {Set of regular expressions defining URL that should not be proxied} {} 296 ;# {HttpProxyExceptions} {HttpProxy} {Set of regular expressions defining URL that should not be proxied} {}
273 ;; If you're using HttpProxy, then you can set HttpProxyExceptions to a list of regular expressions for URLs that you don't want to go through the proxy 297 ;; If you're using HttpProxy, then you can set HttpProxyExceptions to a
298 ;; list of regular expressions for URLs that you don't want to go through
299 ;; the proxy.
274 ;; For example, servers inside your firewall. 300 ;; For example, servers inside your firewall.
275 ;; Separate patterns with a ';' 301 ;; Separate patterns with a ';'
276 ; HttpProxyExceptions = ".mydomain.com;localhost" 302 ; HttpProxyExceptions = ".mydomain.com;localhost"
@@ -289,13 +315,15 @@
289 ; SpawnPointRouting = closest 315 ; SpawnPointRouting = closest
290 316
291 ;# {TelehubAllowLandmark} {} {Allow users with landmarks to override telehub routing} {true false} false 317 ;# {TelehubAllowLandmark} {} {Allow users with landmarks to override telehub routing} {true false} false
292 ;; TelehubAllowLandmark allows users with landmarks to override telehub routing and land at the landmark coordinates when set to true 318 ;; TelehubAllowLandmark allows users with landmarks to override telehub
319 ;; routing and land at the landmark coordinates when set to true
293 ;; default is false 320 ;; default is false
294 ; TelehubAllowLandmark = false 321 ; TelehubAllowLandmark = false
295 322
296 ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {} 323 ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {}
297 ;; Bar (|) separated list of viewers which may gain access to the regions. 324 ;; Bar (|) separated list of viewers which may gain access to the regions.
298 ;; One can use a substring of the viewer name to enable only certain versions 325 ;; One can use a substring of the viewer name to enable only certain
326 ;; versions
299 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" 327 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
300 ;; - "Imprudence" has access 328 ;; - "Imprudence" has access
301 ;; - "Imprudence 1.3" has access 329 ;; - "Imprudence 1.3" has access
@@ -304,7 +332,8 @@
304 332
305 ;# {BannedClients} {} {Bar (|) separated list of banned clients} {} 333 ;# {BannedClients} {} {Bar (|) separated list of banned clients} {}
306 ;# Bar (|) separated list of viewers which may not gain access to the regions. 334 ;# Bar (|) separated list of viewers which may not gain access to the regions.
307 ;; One can use a Substring of the viewer name to disable only certain versions 335 ;; One can use a Substring of the viewer name to disable only certain
336 ;; versions
308 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" 337 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
309 ;; - "Imprudence" has no access 338 ;; - "Imprudence" has no access
310 ;; - "Imprudence 1.3" has no access 339 ;; - "Imprudence 1.3" has no access
@@ -450,7 +479,8 @@
450[SimulatorFeatures] 479[SimulatorFeatures]
451 480
452 ;# {MapImageServerURI} {} {URL for the map server} {} 481 ;# {MapImageServerURI} {} {URL for the map server} {}
453 ; Experimental new information sent in SimulatorFeatures cap for Kokua viewers 482 ; Experimental new information sent in SimulatorFeatures cap for Kokua
483 ; viewers
454 ; meant to override the MapImage and search server url given at login, and varying 484 ; meant to override the MapImage and search server url given at login, and varying
455 ; on a sim-basis. 485 ; on a sim-basis.
456 ; Viewers that don't understand it, will ignore it 486 ; Viewers that don't understand it, will ignore it