aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2012-09-22 21:14:15 +0100
committerUbitUmarov2012-09-22 21:14:15 +0100
commit11e05217df2de7ce7da581a2332ee4871f75a527 (patch)
tree2ec4e2bdf1d9f85f02089e029832c31b8872f189
parentremoved AssetUploaderWithCost, fixing AssetUploader. add parsing of some (diff)
downloadopensim-SC_OLD-11e05217df2de7ce7da581a2332ee4871f75a527.zip
opensim-SC_OLD-11e05217df2de7ce7da581a2332ee4871f75a527.tar.gz
opensim-SC_OLD-11e05217df2de7ce7da581a2332ee4871f75a527.tar.bz2
opensim-SC_OLD-11e05217df2de7ce7da581a2332ee4871f75a527.tar.xz
report asset upload errors the right away
-rw-r--r--OpenSim/Capabilities/LLSDAssetUploadComplete.cs2
-rw-r--r--OpenSim/Capabilities/LLSDAssetUploadResponse.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs80
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs24
4 files changed, 87 insertions, 29 deletions
diff --git a/OpenSim/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs
index ab6cee5..596a556 100644
--- a/OpenSim/Capabilities/LLSDAssetUploadComplete.cs
+++ b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs
@@ -30,12 +30,14 @@ using OpenMetaverse;
30 30
31namespace OpenSim.Framework.Capabilities 31namespace OpenSim.Framework.Capabilities
32{ 32{
33
33 [LLSDType("MAP")] 34 [LLSDType("MAP")]
34 public class LLSDAssetUploadComplete 35 public class LLSDAssetUploadComplete
35 { 36 {
36 public string new_asset = String.Empty; 37 public string new_asset = String.Empty;
37 public UUID new_inventory_item = UUID.Zero; 38 public UUID new_inventory_item = UUID.Zero;
38 public string state = String.Empty; 39 public string state = String.Empty;
40 public LLSDAssetUploadError error = null;
39 //public bool success = false; 41 //public bool success = false;
40 42
41 public LLSDAssetUploadComplete() 43 public LLSDAssetUploadComplete()
diff --git a/OpenSim/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
index 18285b5..7c4bc97 100644
--- a/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
+++ b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
@@ -26,10 +26,18 @@
26 */ 26 */
27 27
28using System; 28using System;
29using OpenMetaverse;
29 30
30namespace OpenSim.Framework.Capabilities 31namespace OpenSim.Framework.Capabilities
31{ 32{
32 [OSDMap] 33 [OSDMap]
34 public class LLSDAssetUploadError
35 {
36 public string message = String.Empty;
37 public UUID identifier = UUID.Zero;
38 }
39
40 [OSDMap]
33 public class LLSDAssetUploadResponsePricebrkDown 41 public class LLSDAssetUploadResponsePricebrkDown
34 { 42 {
35 public int mesh_streaming; 43 public int mesh_streaming;
@@ -56,11 +64,13 @@ namespace OpenSim.Framework.Capabilities
56 public string state = String.Empty; 64 public string state = String.Empty;
57 public int upload_price = 0; 65 public int upload_price = 0;
58 public LLSDAssetUploadResponseData data = null; 66 public LLSDAssetUploadResponseData data = null;
67 public LLSDAssetUploadError error = null;
59 public LLSDAssetUploadResponse() 68 public LLSDAssetUploadResponse()
60 { 69 {
61 } 70 }
62 } 71 }
63 72
73
64 [OSDMap] 74 [OSDMap]
65 public class LLSDNewFileAngentInventoryVariablePriceReplyResponse 75 public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
66 { 76 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index b64453a..a934113 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.Linden
55{ 55{
56 public delegate void UpLoadedAsset( 56 public delegate void UpLoadedAsset(
57 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, 57 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
58 byte[] data, string inventoryType, string assetType, int cost); 58 byte[] data, string inventoryType, string assetType, int cost, ref string error);
59 59
60 public delegate UUID UpdateItem(UUID itemID, byte[] data); 60 public delegate UUID UpdateItem(UUID itemID, byte[] data);
61 61
@@ -455,11 +455,14 @@ namespace OpenSim.Region.ClientStack.Linden
455 { 455 {
456 case FileAgentInventoryState.processRequest: 456 case FileAgentInventoryState.processRequest:
457 case FileAgentInventoryState.processUpload: 457 case FileAgentInventoryState.processUpload:
458 if (client != null) 458 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
459 client.SendAgentAlertMessage("Unable to upload asset. Processing previus request", false); 459 resperror.message = "Uploader busy processing previus request";
460 resperror.identifier = UUID.Zero;
461
460 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 462 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
461 errorResponse.uploader = ""; 463 errorResponse.uploader = "";
462 errorResponse.state = "error"; 464 errorResponse.state = "error";
465 errorResponse.error = resperror;
463 return errorResponse; 466 return errorResponse;
464 break; 467 break;
465 case FileAgentInventoryState.waitUpload: 468 case FileAgentInventoryState.waitUpload:
@@ -489,12 +492,15 @@ namespace OpenSim.Region.ClientStack.Linden
489 { 492 {
490 if (avatar.UserLevel < m_levelUpload) 493 if (avatar.UserLevel < m_levelUpload)
491 { 494 {
492 if (client != null) 495 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
493 client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); 496 resperror.message = "Insufficient permissions to upload";
497 resperror.identifier = UUID.Zero;
498
494 499
495 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 500 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
496 errorResponse.uploader = ""; 501 errorResponse.uploader = "";
497 errorResponse.state = "error"; 502 errorResponse.state = "error";
503 errorResponse.error = resperror;
498 lock (m_ModelCost) 504 lock (m_ModelCost)
499 m_FileAgentInventoryState = FileAgentInventoryState.idle; 505 m_FileAgentInventoryState = FileAgentInventoryState.idle;
500 return errorResponse; 506 return errorResponse;
@@ -518,11 +524,15 @@ namespace OpenSim.Region.ClientStack.Linden
518 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, 524 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
519 meshcostdata, out error)) 525 meshcostdata, out error))
520 { 526 {
521 client.SendAgentAlertMessage(error, false); 527 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
528 resperror.message = error;
529 resperror.identifier = UUID.Zero;
522 530
523 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 531 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
524 errorResponse.uploader = ""; 532 errorResponse.uploader = "";
525 errorResponse.state = "error"; 533 errorResponse.state = "error";
534 errorResponse.error = resperror;
535
526 lock (m_ModelCost) 536 lock (m_ModelCost)
527 m_FileAgentInventoryState = FileAgentInventoryState.idle; 537 m_FileAgentInventoryState = FileAgentInventoryState.idle;
528 return errorResponse; 538 return errorResponse;
@@ -539,11 +549,14 @@ namespace OpenSim.Region.ClientStack.Linden
539 { 549 {
540 if (!mm.UploadCovered(client.AgentId, (int)cost)) 550 if (!mm.UploadCovered(client.AgentId, (int)cost))
541 { 551 {
542 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 552 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
553 resperror.message = "Insuficient funds";
554 resperror.identifier = UUID.Zero;
543 555
544 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 556 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
545 errorResponse.uploader = ""; 557 errorResponse.uploader = "";
546 errorResponse.state = "error"; 558 errorResponse.state = "error";
559 errorResponse.error = resperror;
547 lock (m_ModelCost) 560 lock (m_ModelCost)
548 m_FileAgentInventoryState = FileAgentInventoryState.idle; 561 m_FileAgentInventoryState = FileAgentInventoryState.idle;
549 return errorResponse; 562 return errorResponse;
@@ -607,8 +620,9 @@ namespace OpenSim.Region.ClientStack.Linden
607 /// <param name="data"></param> 620 /// <param name="data"></param>
608 public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, 621 public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
609 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 622 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
610 string assetType, int cost) 623 string assetType, int cost, ref string error)
611 { 624 {
625
612 lock (m_ModelCost) 626 lock (m_ModelCost)
613 m_FileAgentInventoryState = FileAgentInventoryState.processUpload; 627 m_FileAgentInventoryState = FileAgentInventoryState.processUpload;
614 628
@@ -619,17 +633,13 @@ namespace OpenSim.Region.ClientStack.Linden
619 sbyte assType = 0; 633 sbyte assType = 0;
620 sbyte inType = 0; 634 sbyte inType = 0;
621 635
622 IClientAPI client = null;
623
624 IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); 636 IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>();
625 if (mm != null) 637 if (mm != null)
626 { 638 {
627 // make sure client still has enougth credit 639 // make sure client still has enougth credit
628 if (!mm.UploadCovered(m_HostCapsObj.AgentID, (int)cost)) 640 if (!mm.UploadCovered(m_HostCapsObj.AgentID, (int)cost))
629 { 641 {
630 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); 642 error = "Insufficient funds.";
631 if (client != null)
632 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
633 return; 643 return;
634 } 644 }
635 } 645 }
@@ -668,6 +678,25 @@ namespace OpenSim.Region.ClientStack.Linden
668 List<Vector3> positions = new List<Vector3>(); 678 List<Vector3> positions = new List<Vector3>();
669 List<Quaternion> rotations = new List<Quaternion>(); 679 List<Quaternion> rotations = new List<Quaternion>();
670 OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); 680 OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
681
682 // compare and get updated information
683
684 bool mismatchError = true;
685
686 while (mismatchError)
687 {
688 mismatchError = false;
689 }
690
691 if (mismatchError)
692 {
693 error = "Upload and fee estimation information don't match";
694 lock (m_ModelCost)
695 m_FileAgentInventoryState = FileAgentInventoryState.idle;
696
697 return;
698 }
699
671 OSDArray instance_list = (OSDArray)request["instance_list"]; 700 OSDArray instance_list = (OSDArray)request["instance_list"];
672 OSDArray mesh_list = (OSDArray)request["mesh_list"]; 701 OSDArray mesh_list = (OSDArray)request["mesh_list"];
673 OSDArray texture_list = (OSDArray)request["texture_list"]; 702 OSDArray texture_list = (OSDArray)request["texture_list"];
@@ -1240,7 +1269,8 @@ namespace OpenSim.Region.ClientStack.Linden
1240 private string m_invType = String.Empty; 1269 private string m_invType = String.Empty;
1241 private string m_assetType = String.Empty; 1270 private string m_assetType = String.Empty;
1242 private int m_cost; 1271 private int m_cost;
1243 1272 private string m_error = String.Empty;
1273
1244 private Timer m_timeoutTimer = new Timer(); 1274 private Timer m_timeoutTimer = new Timer();
1245 1275
1246 1276
@@ -1278,12 +1308,13 @@ namespace OpenSim.Region.ClientStack.Linden
1278 UUID inv = inventoryItemID; 1308 UUID inv = inventoryItemID;
1279 string res = String.Empty; 1309 string res = String.Empty;
1280 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 1310 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
1311/*
1281 uploadComplete.new_asset = newAssetID.ToString(); 1312 uploadComplete.new_asset = newAssetID.ToString();
1282 uploadComplete.new_inventory_item = inv; 1313 uploadComplete.new_inventory_item = inv;
1283 uploadComplete.state = "complete"; 1314 uploadComplete.state = "complete";
1284 1315
1285 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); 1316 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
1286 1317*/
1287 m_timeoutTimer.Stop(); 1318 m_timeoutTimer.Stop();
1288 httpListener.RemoveStreamHandler("POST", uploaderPath); 1319 httpListener.RemoveStreamHandler("POST", uploaderPath);
1289 1320
@@ -1301,8 +1332,25 @@ namespace OpenSim.Region.ClientStack.Linden
1301 handlerUpLoad = OnUpLoad; 1332 handlerUpLoad = OnUpLoad;
1302 if (handlerUpLoad != null) 1333 if (handlerUpLoad != null)
1303 { 1334 {
1304 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost); 1335 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost, ref m_error);
1305 } 1336 }
1337 if(m_error == String.Empty)
1338 {
1339 uploadComplete.new_asset = newAssetID.ToString();
1340 uploadComplete.new_inventory_item = inv;
1341 uploadComplete.state = "complete";
1342 }
1343 else
1344 {
1345 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
1346 resperror.message = m_error;
1347 resperror.identifier = inv;
1348
1349 uploadComplete.error = resperror;
1350 uploadComplete.state = "failed";
1351 }
1352
1353 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
1306 return res; 1354 return res;
1307 } 1355 }
1308 1356
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index 830c46d..7a80c72 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden
105 resources.instance_list == null || 105 resources.instance_list == null ||
106 resources.instance_list.Array.Count == 0) 106 resources.instance_list.Array.Count == 0)
107 { 107 {
108 error = "Unable to upload mesh model. missing information."; 108 error = "missing model information.";
109 return false; 109 return false;
110 } 110 }
111 111
@@ -113,7 +113,7 @@ namespace OpenSim.Region.ClientStack.Linden
113 113
114 if( numberInstances > ObjectLinkedPartsMax ) 114 if( numberInstances > ObjectLinkedPartsMax )
115 { 115 {
116 error = "upload failed: Model whould have two many linked prims"; 116 error = "Model whould have more than " + ObjectLinkedPartsMax.ToString() + " linked prims";
117 return false; 117 return false;
118 } 118 }
119 119
@@ -186,15 +186,13 @@ namespace OpenSim.Region.ClientStack.Linden
186 186
187 if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin) 187 if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin)
188 { 188 {
189// error = " upload fail: Model contains parts with a dimension lower than 0.001. Please adjust scaling";
190// return false;
191 skipedSmall++; 189 skipedSmall++;
192 continue; 190 continue;
193 } 191 }
194 192
195 if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax) 193 if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax)
196 { 194 {
197 error = "upload fail: Model contains parts larger than maximum allowed. Please adjust scaling"; 195 error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale";
198 return false; 196 return false;
199 } 197 }
200 198
@@ -204,7 +202,7 @@ namespace OpenSim.Region.ClientStack.Linden
204 202
205 if (mesh >= numberMeshs) 203 if (mesh >= numberMeshs)
206 { 204 {
207 error = "Unable to upload mesh model. incoerent information."; 205 error = "Incoerent model information.";
208 return false; 206 return false;
209 } 207 }
210 208
@@ -233,7 +231,7 @@ namespace OpenSim.Region.ClientStack.Linden
233 231
234 if (skipedSmall >0 && skipedSmall > numberInstances / 2) 232 if (skipedSmall >0 && skipedSmall > numberInstances / 2)
235 { 233 {
236 error = "Upload failed: Model contains too much prims smaller than minimum size to ignore"; 234 error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() + "m";
237 return false; 235 return false;
238 } 236 }
239 237
@@ -279,14 +277,14 @@ namespace OpenSim.Region.ClientStack.Linden
279 277
280 if (data == null || data.Length == 0) 278 if (data == null || data.Length == 0)
281 { 279 {
282 error = "Unable to upload mesh model. missing information."; 280 error = "Missing model information.";
283 return false; 281 return false;
284 } 282 }
285 283
286 OSD meshOsd = null; 284 OSD meshOsd = null;
287 int start = 0; 285 int start = 0;
288 286
289 error = "Unable to upload mesh model. Invalid data"; 287 error = "Invalid model data";
290 288
291 using (MemoryStream ms = new MemoryStream(data)) 289 using (MemoryStream ms = new MemoryStream(data))
292 { 290 {
@@ -334,13 +332,13 @@ namespace OpenSim.Region.ClientStack.Linden
334 332
335 if (submesh_offset < 0 || hulls_size == 0) 333 if (submesh_offset < 0 || hulls_size == 0)
336 { 334 {
337 error = "Unable to upload mesh model. missing physics_convex block"; 335 error = "Missing physics_convex block";
338 return false; 336 return false;
339 } 337 }
340 338
341 if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls)) 339 if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls))
342 { 340 {
343 error = "Unable to upload mesh model. bad physics_convex block"; 341 error = "Bad physics_convex block";
344 return false; 342 return false;
345 } 343 }
346 344
@@ -360,7 +358,7 @@ namespace OpenSim.Region.ClientStack.Linden
360 358
361 if (submesh_offset < 0 || highlod_size <= 0) 359 if (submesh_offset < 0 || highlod_size <= 0)
362 { 360 {
363 error = "Unable to upload mesh model. missing high_lod"; 361 error = "Missing high_lod block";
364 return false; 362 return false;
365 } 363 }
366 364
@@ -418,7 +416,7 @@ namespace OpenSim.Region.ClientStack.Linden
418 416
419 if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles)) 417 if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles))
420 { 418 {
421 error = "Unable to upload mesh model. parsing error"; 419 error = "Model data parsing error";
422 return false; 420 return false;
423 } 421 }
424 } 422 }