diff options
author | UbitUmarov | 2012-09-19 03:53:51 +0100 |
---|---|---|
committer | UbitUmarov | 2012-09-19 03:53:51 +0100 |
commit | 5317b1053f2b8fd81f71c0b95c79aaa03efb47e4 (patch) | |
tree | f42aa391cee7318d0d707a666ae71afa546a2fe1 /OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |
parent | create a single ModelCost provider for the caps instance. Let it know and (diff) | |
download | opensim-SC-5317b1053f2b8fd81f71c0b95c79aaa03efb47e4.zip opensim-SC-5317b1053f2b8fd81f71c0b95c79aaa03efb47e4.tar.gz opensim-SC-5317b1053f2b8fd81f71c0b95c79aaa03efb47e4.tar.bz2 opensim-SC-5317b1053f2b8fd81f71c0b95c79aaa03efb47e4.tar.xz |
be more tolerant to small prims, skipping them, only failing if they are
more than half of total. Add a state control to NewFileAgentInventory
to avoid more than one at a time per client. ( Incomplete and possible not that good)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 81 |
1 files changed, 69 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0fb6c99..d66076d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -117,6 +117,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
117 | private bool m_dumpAssetsToFile = false; | 117 | private bool m_dumpAssetsToFile = false; |
118 | private string m_regionName; | 118 | private string m_regionName; |
119 | private int m_levelUpload = 0; | 119 | private int m_levelUpload = 0; |
120 | private float m_PrimScaleMin = 0.001f; | ||
121 | |||
122 | private enum FileAgentInventoryState : int | ||
123 | { | ||
124 | idle = 0, | ||
125 | processRequest = 1, | ||
126 | waitUpload = 2, | ||
127 | processUpload = 3 | ||
128 | } | ||
129 | private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle; | ||
130 | |||
120 | // private bool m_addNewTextures = false; | 131 | // private bool m_addNewTextures = false; |
121 | // private bool m_addNewMeshes = false; | 132 | // private bool m_addNewMeshes = false; |
122 | 133 | ||
@@ -132,6 +143,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
132 | m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; | 143 | m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; |
133 | // m_ModelCost.PrimScaleMin = ?? | 144 | // m_ModelCost.PrimScaleMin = ?? |
134 | // m_ModelCost.ObjectLinkedPartsMax = ?? | 145 | // m_ModelCost.ObjectLinkedPartsMax = ?? |
146 | // m_PrimScaleMin = ?? | ||
135 | 147 | ||
136 | IConfigSource config = m_Scene.Config; | 148 | IConfigSource config = m_Scene.Config; |
137 | if (config != null) | 149 | if (config != null) |
@@ -158,6 +170,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
158 | ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; | 170 | ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; |
159 | TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; | 171 | TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; |
160 | GetClient = m_Scene.SceneGraph.GetControllingClient; | 172 | GetClient = m_Scene.SceneGraph.GetControllingClient; |
173 | |||
174 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | ||
161 | } | 175 | } |
162 | 176 | ||
163 | /// <summary> | 177 | /// <summary> |
@@ -224,9 +238,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
224 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | 238 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); |
225 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); | 239 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); |
226 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); | 240 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); |
227 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | 241 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); |
228 | |||
229 | |||
230 | 242 | ||
231 | m_HostCapsObj.RegisterHandler( | 243 | m_HostCapsObj.RegisterHandler( |
232 | "CopyInventoryFromNotecard", | 244 | "CopyInventoryFromNotecard", |
@@ -439,6 +451,35 @@ namespace OpenSim.Region.ClientStack.Linden | |||
439 | //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); | 451 | //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); |
440 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); | 452 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); |
441 | 453 | ||
454 | // start by getting the client | ||
455 | IClientAPI client = null; | ||
456 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); | ||
457 | |||
458 | // check current state so we only have one service at a time | ||
459 | lock (m_ModelCost) | ||
460 | { | ||
461 | switch (m_FileAgentInventoryState) | ||
462 | { | ||
463 | case FileAgentInventoryState.processRequest: | ||
464 | case FileAgentInventoryState.processUpload: | ||
465 | if (client != null) | ||
466 | client.SendAgentAlertMessage("Unable to upload asset. Processing previus request", false); | ||
467 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | ||
468 | errorResponse.uploader = ""; | ||
469 | errorResponse.state = "error"; | ||
470 | return errorResponse; | ||
471 | break; | ||
472 | case FileAgentInventoryState.waitUpload: | ||
473 | // todo stop current uploader server | ||
474 | break; | ||
475 | case FileAgentInventoryState.idle: | ||
476 | default: | ||
477 | break; | ||
478 | } | ||
479 | |||
480 | m_FileAgentInventoryState = FileAgentInventoryState.processRequest; | ||
481 | } | ||
482 | |||
442 | uint cost = 0; | 483 | uint cost = 0; |
443 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); | 484 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); |
444 | 485 | ||
@@ -447,15 +488,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
447 | llsdRequest.asset_type == "mesh" || | 488 | llsdRequest.asset_type == "mesh" || |
448 | llsdRequest.asset_type == "sound") | 489 | llsdRequest.asset_type == "sound") |
449 | { | 490 | { |
450 | ScenePresence avatar = null; | 491 | ScenePresence avatar = null; |
451 | IClientAPI client = null; | ||
452 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); | 492 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); |
453 | 493 | ||
454 | // check user level | 494 | // check user level |
455 | if (avatar != null) | 495 | if (avatar != null) |
456 | { | 496 | { |
457 | client = avatar.ControllingClient; | ||
458 | |||
459 | if (avatar.UserLevel < m_levelUpload) | 497 | if (avatar.UserLevel < m_levelUpload) |
460 | { | 498 | { |
461 | if (client != null) | 499 | if (client != null) |
@@ -464,6 +502,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
464 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 502 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
465 | errorResponse.uploader = ""; | 503 | errorResponse.uploader = ""; |
466 | errorResponse.state = "error"; | 504 | errorResponse.state = "error"; |
505 | lock (m_ModelCost) | ||
506 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | ||
467 | return errorResponse; | 507 | return errorResponse; |
468 | } | 508 | } |
469 | } | 509 | } |
@@ -490,6 +530,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
490 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 530 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
491 | errorResponse.uploader = ""; | 531 | errorResponse.uploader = ""; |
492 | errorResponse.state = "error"; | 532 | errorResponse.state = "error"; |
533 | lock (m_ModelCost) | ||
534 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | ||
493 | return errorResponse; | 535 | return errorResponse; |
494 | } | 536 | } |
495 | cost = (uint)modelcost; | 537 | cost = (uint)modelcost; |
@@ -509,6 +551,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
509 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 551 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
510 | errorResponse.uploader = ""; | 552 | errorResponse.uploader = ""; |
511 | errorResponse.state = "error"; | 553 | errorResponse.state = "error"; |
554 | lock (m_ModelCost) | ||
555 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | ||
512 | return errorResponse; | 556 | return errorResponse; |
513 | } | 557 | } |
514 | } | 558 | } |
@@ -555,8 +599,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
555 | } | 599 | } |
556 | 600 | ||
557 | uploader.OnUpLoad += UploadCompleteHandler; | 601 | uploader.OnUpLoad += UploadCompleteHandler; |
558 | return uploadResponse; | ||
559 | 602 | ||
603 | lock (m_ModelCost) | ||
604 | m_FileAgentInventoryState = FileAgentInventoryState.waitUpload; | ||
605 | |||
606 | return uploadResponse; | ||
560 | } | 607 | } |
561 | 608 | ||
562 | /// <summary> | 609 | /// <summary> |
@@ -569,6 +616,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
569 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | 616 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, |
570 | string assetType, uint cost) | 617 | string assetType, uint cost) |
571 | { | 618 | { |
619 | lock (m_ModelCost) | ||
620 | m_FileAgentInventoryState = FileAgentInventoryState.processUpload; | ||
621 | |||
572 | m_log.DebugFormat( | 622 | m_log.DebugFormat( |
573 | "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", | 623 | "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", |
574 | assetID, inventoryItem, inventoryType, assetType); | 624 | assetID, inventoryItem, inventoryType, assetType); |
@@ -730,12 +780,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
730 | // build prims from instances | 780 | // build prims from instances |
731 | for (int i = 0; i < instance_list.Count; i++) | 781 | for (int i = 0; i < instance_list.Count; i++) |
732 | { | 782 | { |
783 | OSDMap inner_instance_list = (OSDMap)instance_list[i]; | ||
784 | |||
785 | // skip prims that are 2 small | ||
786 | Vector3 scale = inner_instance_list["scale"].AsVector3(); | ||
787 | |||
788 | if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin) | ||
789 | continue; | ||
790 | |||
733 | PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); | 791 | PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); |
734 | 792 | ||
735 | Primitive.TextureEntry textureEntry | 793 | Primitive.TextureEntry textureEntry |
736 | = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); | 794 | = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); |
737 | 795 | ||
738 | OSDMap inner_instance_list = (OSDMap)instance_list[i]; | ||
739 | 796 | ||
740 | OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; | 797 | OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; |
741 | for (uint face = 0; face < face_list.Count; face++) | 798 | for (uint face = 0; face < face_list.Count; face++) |
@@ -789,7 +846,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
789 | } | 846 | } |
790 | 847 | ||
791 | Vector3 position = inner_instance_list["position"].AsVector3(); | 848 | Vector3 position = inner_instance_list["position"].AsVector3(); |
792 | Vector3 scale = inner_instance_list["scale"].AsVector3(); | ||
793 | Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); | 849 | Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); |
794 | 850 | ||
795 | // no longer used - begin ------------------------ | 851 | // no longer used - begin ------------------------ |
@@ -903,6 +959,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
903 | { | 959 | { |
904 | AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); | 960 | AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); |
905 | } | 961 | } |
962 | lock (m_ModelCost) | ||
963 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | ||
906 | } | 964 | } |
907 | 965 | ||
908 | /// <summary> | 966 | /// <summary> |
@@ -1270,8 +1328,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1270 | 1328 | ||
1271 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 1329 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
1272 | 1330 | ||
1273 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1274 | m_timeoutTimer.Stop(); | 1331 | m_timeoutTimer.Stop(); |
1332 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1275 | 1333 | ||
1276 | // TODO: probably make this a better set of extensions here | 1334 | // TODO: probably make this a better set of extensions here |
1277 | string extension = ".jp2"; | 1335 | string extension = ".jp2"; |
@@ -1289,7 +1347,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1289 | { | 1347 | { |
1290 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); | 1348 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); |
1291 | } | 1349 | } |
1292 | |||
1293 | return res; | 1350 | return res; |
1294 | } | 1351 | } |
1295 | 1352 | ||