diff options
author | Justin Clark-Casey (justincc) | 2010-04-14 22:31:11 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-04-14 22:31:11 +0100 |
commit | e0f8362e7a24a842a569b692652bc18784a2248b (patch) | |
tree | de068d28d8a539273207683de20557245001379a /OpenSim/Region/ClientStack | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-e0f8362e7a24a842a569b692652bc18784a2248b.zip opensim-SC_OLD-e0f8362e7a24a842a569b692652bc18784a2248b.tar.gz opensim-SC_OLD-e0f8362e7a24a842a569b692652bc18784a2248b.tar.bz2 opensim-SC_OLD-e0f8362e7a24a842a569b692652bc18784a2248b.tar.xz |
minor: add some documentation around the asset udp request path and replace some magic numbers with libomv enums
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f0f3932..b3f5f09 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -7069,6 +7069,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7069 | return true; | 7069 | return true; |
7070 | } | 7070 | } |
7071 | 7071 | ||
7072 | /// <summary> | ||
7073 | /// This is the entry point for the UDP route by which the client can retrieve asset data. If the request | ||
7074 | /// is successful then a TransferInfo packet will be sent back, followed by one or more TransferPackets | ||
7075 | /// </summary> | ||
7076 | /// <param name="sender"></param> | ||
7077 | /// <param name="Pack"></param> | ||
7078 | /// <returns>This parameter may be ignored since we appear to return true whatever happens</returns> | ||
7072 | private bool HandleTransferRequest(IClientAPI sender, Packet Pack) | 7079 | private bool HandleTransferRequest(IClientAPI sender, Packet Pack) |
7073 | { | 7080 | { |
7074 | //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); | 7081 | //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); |
@@ -7079,7 +7086,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7079 | // Has to be done here, because AssetCache can't do it | 7086 | // Has to be done here, because AssetCache can't do it |
7080 | // | 7087 | // |
7081 | UUID taskID = UUID.Zero; | 7088 | UUID taskID = UUID.Zero; |
7082 | if (transfer.TransferInfo.SourceType == 3) | 7089 | if (transfer.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) |
7083 | { | 7090 | { |
7084 | taskID = new UUID(transfer.TransferInfo.Params, 48); | 7091 | taskID = new UUID(transfer.TransferInfo.Params, 48); |
7085 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); | 7092 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); |
@@ -11356,17 +11363,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11356 | return String.Empty; | 11363 | return String.Empty; |
11357 | } | 11364 | } |
11358 | 11365 | ||
11359 | public void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID) | 11366 | /// <summary> |
11367 | /// Make an asset request to the asset service in response to a client request. | ||
11368 | /// </summary> | ||
11369 | /// <param name="transferRequest"></param> | ||
11370 | /// <param name="taskID"></param> | ||
11371 | protected void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID) | ||
11360 | { | 11372 | { |
11361 | UUID requestID = UUID.Zero; | 11373 | UUID requestID = UUID.Zero; |
11362 | if (transferRequest.TransferInfo.SourceType == 2) | 11374 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) |
11363 | { | 11375 | { |
11364 | //direct asset request | ||
11365 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); | 11376 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); |
11366 | } | 11377 | } |
11367 | else if (transferRequest.TransferInfo.SourceType == 3) | 11378 | else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) |
11368 | { | 11379 | { |
11369 | //inventory asset request | ||
11370 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); | 11380 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); |
11371 | //m_log.Debug("[XXX] inventory asset request " + requestID); | 11381 | //m_log.Debug("[XXX] inventory asset request " + requestID); |
11372 | //if (taskID == UUID.Zero) // Agent | 11382 | //if (taskID == UUID.Zero) // Agent |
@@ -11379,29 +11389,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11379 | // } | 11389 | // } |
11380 | } | 11390 | } |
11381 | 11391 | ||
11382 | //check to see if asset is in local cache, if not we need to request it from asset server. | 11392 | //m_log.DebugFormat("[LLCLIENTVIEW]: {0} requesting asset {1}", Name, requestID); |
11383 | //m_log.Debug("asset request " + requestID); | ||
11384 | 11393 | ||
11385 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 11394 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
11386 | |||
11387 | } | 11395 | } |
11388 | 11396 | ||
11397 | /// <summary> | ||
11398 | /// When we get a reply back from the asset service in response to a client request, send back the data. | ||
11399 | /// </summary> | ||
11400 | /// <param name="id"></param> | ||
11401 | /// <param name="sender"></param> | ||
11402 | /// <param name="asset"></param> | ||
11389 | protected void AssetReceived(string id, Object sender, AssetBase asset) | 11403 | protected void AssetReceived(string id, Object sender, AssetBase asset) |
11390 | { | 11404 | { |
11391 | TransferRequestPacket transferRequest = (TransferRequestPacket)sender; | 11405 | TransferRequestPacket transferRequest = (TransferRequestPacket)sender; |
11392 | 11406 | ||
11393 | UUID requestID = UUID.Zero; | 11407 | UUID requestID = UUID.Zero; |
11394 | byte source = 2; | 11408 | byte source = (byte)SourceType.Asset; |
11395 | if ((transferRequest.TransferInfo.SourceType == 2) || (transferRequest.TransferInfo.SourceType == 2222)) | 11409 | |
11410 | if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) | ||
11411 | || (transferRequest.TransferInfo.SourceType == 2222)) | ||
11396 | { | 11412 | { |
11397 | //direct asset request | ||
11398 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); | 11413 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); |
11399 | } | 11414 | } |
11400 | else if ((transferRequest.TransferInfo.SourceType == 3) || (transferRequest.TransferInfo.SourceType == 3333)) | 11415 | else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) |
11416 | || (transferRequest.TransferInfo.SourceType == 3333)) | ||
11401 | { | 11417 | { |
11402 | //inventory asset request | ||
11403 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); | 11418 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); |
11404 | source = 3; | 11419 | source = (byte)SourceType.SimInventoryItem; |
11405 | //m_log.Debug("asset request " + requestID); | 11420 | //m_log.Debug("asset request " + requestID); |
11406 | } | 11421 | } |
11407 | 11422 | ||
@@ -11414,9 +11429,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11414 | if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) | 11429 | if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) |
11415 | { | 11430 | { |
11416 | m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); | 11431 | m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); |
11417 | if (transferRequest.TransferInfo.SourceType == 2) | 11432 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) |
11418 | transferRequest.TransferInfo.SourceType = 2222; // marker | 11433 | transferRequest.TransferInfo.SourceType = 2222; // marker |
11419 | else if (transferRequest.TransferInfo.SourceType == 3) | 11434 | else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) |
11420 | transferRequest.TransferInfo.SourceType = 3333; // marker | 11435 | transferRequest.TransferInfo.SourceType = 3333; // marker |
11421 | 11436 | ||
11422 | m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); | 11437 | m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); |
@@ -11431,7 +11446,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11431 | } | 11446 | } |
11432 | 11447 | ||
11433 | // Scripts cannot be retrieved by direct request | 11448 | // Scripts cannot be retrieved by direct request |
11434 | if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) | 11449 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10) |
11435 | return; | 11450 | return; |
11436 | 11451 | ||
11437 | // The asset is known to exist and is in our cache, so add it to the AssetRequests list | 11452 | // The asset is known to exist and is in our cache, so add it to the AssetRequests list |