aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
diff options
context:
space:
mode:
authorubit2012-09-22 22:15:35 +0200
committerubit2012-09-22 22:15:35 +0200
commit80a81896b63e710253601876bc2952c67a66fd99 (patch)
tree4f81f9616c94176127cf0f63f314c958298682f3 /OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parent report asset upload errors the right away (diff)
downloadopensim-SC-80a81896b63e710253601876bc2952c67a66fd99.zip
opensim-SC-80a81896b63e710253601876bc2952c67a66fd99.tar.gz
opensim-SC-80a81896b63e710253601876bc2952c67a66fd99.tar.bz2
opensim-SC-80a81896b63e710253601876bc2952c67a66fd99.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs80
1 files changed, 64 insertions, 16 deletions
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