aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs110
1 files changed, 86 insertions, 24 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 552f64c..d41deb0 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -182,6 +182,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
182 public event TeleportLocationRequest OnSetStartLocationRequest; 182 public event TeleportLocationRequest OnSetStartLocationRequest;
183 public event UpdateAvatarProperties OnUpdateAvatarProperties; 183 public event UpdateAvatarProperties OnUpdateAvatarProperties;
184 public event CreateNewInventoryItem OnCreateNewInventoryItem; 184 public event CreateNewInventoryItem OnCreateNewInventoryItem;
185 public event LinkInventoryItem OnLinkInventoryItem;
185 public event CreateInventoryFolder OnCreateNewInventoryFolder; 186 public event CreateInventoryFolder OnCreateNewInventoryFolder;
186 public event UpdateInventoryFolder OnUpdateInventoryFolder; 187 public event UpdateInventoryFolder OnUpdateInventoryFolder;
187 public event MoveInventoryFolder OnMoveInventoryFolder; 188 public event MoveInventoryFolder OnMoveInventoryFolder;
@@ -641,7 +642,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
641 if (pprocessor.Async) 642 if (pprocessor.Async)
642 { 643 {
643 object obj = new AsyncPacketProcess(this, pprocessor.method, packet); 644 object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
644 Util.FireAndForget(ProcessSpecificPacketAsync,obj); 645 Util.FireAndForget(ProcessSpecificPacketAsync, obj);
645 result = true; 646 result = true;
646 } 647 }
647 else 648 else
@@ -669,8 +670,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
669 public void ProcessSpecificPacketAsync(object state) 670 public void ProcessSpecificPacketAsync(object state)
670 { 671 {
671 AsyncPacketProcess packetObject = (AsyncPacketProcess)state; 672 AsyncPacketProcess packetObject = (AsyncPacketProcess)state;
672 packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack); 673
673 674 try
675 {
676 packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack);
677 }
678 catch (Exception e)
679 {
680 // Make sure that we see any exception caused by the asynchronous operation.
681 m_log.Error(
682 string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e);
683 }
674 } 684 }
675 685
676 #endregion Packet Handling 686 #endregion Packet Handling
@@ -4726,6 +4736,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4726 AddLocalPacketHandler(PacketType.UpdateInventoryFolder, HandleUpdateInventoryFolder); 4736 AddLocalPacketHandler(PacketType.UpdateInventoryFolder, HandleUpdateInventoryFolder);
4727 AddLocalPacketHandler(PacketType.MoveInventoryFolder, HandleMoveInventoryFolder); 4737 AddLocalPacketHandler(PacketType.MoveInventoryFolder, HandleMoveInventoryFolder);
4728 AddLocalPacketHandler(PacketType.CreateInventoryItem, HandleCreateInventoryItem); 4738 AddLocalPacketHandler(PacketType.CreateInventoryItem, HandleCreateInventoryItem);
4739 AddLocalPacketHandler(PacketType.LinkInventoryItem, HandleLinkInventoryItem);
4729 AddLocalPacketHandler(PacketType.FetchInventory, HandleFetchInventory); 4740 AddLocalPacketHandler(PacketType.FetchInventory, HandleFetchInventory);
4730 AddLocalPacketHandler(PacketType.FetchInventoryDescendents, HandleFetchInventoryDescendents); 4741 AddLocalPacketHandler(PacketType.FetchInventoryDescendents, HandleFetchInventoryDescendents);
4731 AddLocalPacketHandler(PacketType.PurgeInventoryDescendents, HandlePurgeInventoryDescendents); 4742 AddLocalPacketHandler(PacketType.PurgeInventoryDescendents, HandlePurgeInventoryDescendents);
@@ -7045,6 +7056,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7045 return true; 7056 return true;
7046 } 7057 }
7047 7058
7059 /// <summary>
7060 /// This is the entry point for the UDP route by which the client can retrieve asset data. If the request
7061 /// is successful then a TransferInfo packet will be sent back, followed by one or more TransferPackets
7062 /// </summary>
7063 /// <param name="sender"></param>
7064 /// <param name="Pack"></param>
7065 /// <returns>This parameter may be ignored since we appear to return true whatever happens</returns>
7048 private bool HandleTransferRequest(IClientAPI sender, Packet Pack) 7066 private bool HandleTransferRequest(IClientAPI sender, Packet Pack)
7049 { 7067 {
7050 //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); 7068 //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request");
@@ -7055,7 +7073,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7055 // Has to be done here, because AssetCache can't do it 7073 // Has to be done here, because AssetCache can't do it
7056 // 7074 //
7057 UUID taskID = UUID.Zero; 7075 UUID taskID = UUID.Zero;
7058 if (transfer.TransferInfo.SourceType == 3) 7076 if (transfer.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
7059 { 7077 {
7060 taskID = new UUID(transfer.TransferInfo.Params, 48); 7078 taskID = new UUID(transfer.TransferInfo.Params, 48);
7061 UUID itemID = new UUID(transfer.TransferInfo.Params, 64); 7079 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
@@ -7326,6 +7344,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7326 return true; 7344 return true;
7327 } 7345 }
7328 7346
7347 private bool HandleLinkInventoryItem(IClientAPI sender, Packet Pack)
7348 {
7349 LinkInventoryItemPacket createLink = (LinkInventoryItemPacket)Pack;
7350
7351 #region Packet Session and User Check
7352 if (m_checkPackets)
7353 {
7354 if (createLink.AgentData.SessionID != SessionId ||
7355 createLink.AgentData.AgentID != AgentId)
7356 return true;
7357 }
7358 #endregion
7359
7360 LinkInventoryItem linkInventoryItem = OnLinkInventoryItem;
7361
7362 if (linkInventoryItem != null)
7363 {
7364 linkInventoryItem(
7365 this,
7366 createLink.InventoryBlock.TransactionID,
7367 createLink.InventoryBlock.FolderID,
7368 createLink.InventoryBlock.CallbackID,
7369 Util.FieldToString(createLink.InventoryBlock.Description),
7370 Util.FieldToString(createLink.InventoryBlock.Name),
7371 createLink.InventoryBlock.InvType,
7372 createLink.InventoryBlock.Type,
7373 createLink.InventoryBlock.OldItemID);
7374 }
7375
7376 return true;
7377 }
7378
7329 private bool HandleFetchInventory(IClientAPI sender, Packet Pack) 7379 private bool HandleFetchInventory(IClientAPI sender, Packet Pack)
7330 { 7380 {
7331 if (OnFetchInventory != null) 7381 if (OnFetchInventory != null)
@@ -7670,12 +7720,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7670 newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask; 7720 newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask;
7671 newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask; 7721 newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask;
7672 newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask; 7722 newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask;
7723
7724 // Unused? Clicking share with group sets GroupPermissions instead, so perhaps this is something
7725 // different
7673 //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned; 7726 //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned;
7674 newTaskItem.Type = updatetask.InventoryData.Type; 7727 newTaskItem.Type = updatetask.InventoryData.Type;
7675 newTaskItem.InvType = updatetask.InventoryData.InvType; 7728 newTaskItem.InvType = updatetask.InventoryData.InvType;
7676 newTaskItem.Flags = updatetask.InventoryData.Flags; 7729 newTaskItem.Flags = updatetask.InventoryData.Flags;
7677 //newTaskItem.SaleType=updatetask.InventoryData.SaleType; 7730 //newTaskItem.SaleType=updatetask.InventoryData.SaleType;
7678 //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;; 7731 //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;
7679 newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name); 7732 newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name);
7680 newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description); 7733 newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description);
7681 newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate; 7734 newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
@@ -7683,7 +7736,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7683 newTaskItem, updatetask.UpdateData.LocalID); 7736 newTaskItem, updatetask.UpdateData.LocalID);
7684 } 7737 }
7685 } 7738 }
7686 } 7739 }
7687 7740
7688 return true; 7741 return true;
7689 } 7742 }
@@ -11075,7 +11128,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11075 { 11128 {
11076 if (m_debugPacketLevel >= 255) 11129 if (m_debugPacketLevel >= 255)
11077 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); 11130 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
11078 11131
11079 if (!ProcessPacketMethod(Pack)) 11132 if (!ProcessPacketMethod(Pack))
11080 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); 11133 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type);
11081 11134
@@ -11297,17 +11350,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11297 return String.Empty; 11350 return String.Empty;
11298 } 11351 }
11299 11352
11300 public void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID) 11353 /// <summary>
11354 /// Make an asset request to the asset service in response to a client request.
11355 /// </summary>
11356 /// <param name="transferRequest"></param>
11357 /// <param name="taskID"></param>
11358 protected void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID)
11301 { 11359 {
11302 UUID requestID = UUID.Zero; 11360 UUID requestID = UUID.Zero;
11303 if (transferRequest.TransferInfo.SourceType == 2) 11361 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11304 { 11362 {
11305 //direct asset request
11306 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 11363 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
11307 } 11364 }
11308 else if (transferRequest.TransferInfo.SourceType == 3) 11365 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11309 { 11366 {
11310 //inventory asset request
11311 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11367 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11312 //m_log.Debug("[XXX] inventory asset request " + requestID); 11368 //m_log.Debug("[XXX] inventory asset request " + requestID);
11313 //if (taskID == UUID.Zero) // Agent 11369 //if (taskID == UUID.Zero) // Agent
@@ -11320,29 +11376,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11320 // } 11376 // }
11321 } 11377 }
11322 11378
11323 //check to see if asset is in local cache, if not we need to request it from asset server. 11379 //m_log.DebugFormat("[LLCLIENTVIEW]: {0} requesting asset {1}", Name, requestID);
11324 //m_log.Debug("asset request " + requestID);
11325 11380
11326 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 11381 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
11327
11328 } 11382 }
11329 11383
11384 /// <summary>
11385 /// When we get a reply back from the asset service in response to a client request, send back the data.
11386 /// </summary>
11387 /// <param name="id"></param>
11388 /// <param name="sender"></param>
11389 /// <param name="asset"></param>
11330 protected void AssetReceived(string id, Object sender, AssetBase asset) 11390 protected void AssetReceived(string id, Object sender, AssetBase asset)
11331 { 11391 {
11332 TransferRequestPacket transferRequest = (TransferRequestPacket)sender; 11392 TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
11333 11393
11334 UUID requestID = UUID.Zero; 11394 UUID requestID = UUID.Zero;
11335 byte source = 2; 11395 byte source = (byte)SourceType.Asset;
11336 if ((transferRequest.TransferInfo.SourceType == 2) || (transferRequest.TransferInfo.SourceType == 2222)) 11396
11397 if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11398 || (transferRequest.TransferInfo.SourceType == 2222))
11337 { 11399 {
11338 //direct asset request
11339 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 11400 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
11340 } 11401 }
11341 else if ((transferRequest.TransferInfo.SourceType == 3) || (transferRequest.TransferInfo.SourceType == 3333)) 11402 else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11403 || (transferRequest.TransferInfo.SourceType == 3333))
11342 { 11404 {
11343 //inventory asset request
11344 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11405 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11345 source = 3; 11406 source = (byte)SourceType.SimInventoryItem;
11346 //m_log.Debug("asset request " + requestID); 11407 //m_log.Debug("asset request " + requestID);
11347 } 11408 }
11348 11409
@@ -11355,9 +11416,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11355 if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) 11416 if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
11356 { 11417 {
11357 m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); 11418 m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
11358 if (transferRequest.TransferInfo.SourceType == 2) 11419 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11359 transferRequest.TransferInfo.SourceType = 2222; // marker 11420 transferRequest.TransferInfo.SourceType = 2222; // marker
11360 else if (transferRequest.TransferInfo.SourceType == 3) 11421 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11361 transferRequest.TransferInfo.SourceType = 3333; // marker 11422 transferRequest.TransferInfo.SourceType = 3333; // marker
11362 11423
11363 m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); 11424 m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
@@ -11372,7 +11433,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11372 } 11433 }
11373 11434
11374 // Scripts cannot be retrieved by direct request 11435 // Scripts cannot be retrieved by direct request
11375 if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) 11436 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10)
11376 return; 11437 return;
11377 11438
11378 // The asset is known to exist and is in our cache, so add it to the AssetRequests list 11439 // The asset is known to exist and is in our cache, so add it to the AssetRequests list
@@ -11605,6 +11666,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11605 public PacketMethod method; 11666 public PacketMethod method;
11606 public bool Async; 11667 public bool Async;
11607 } 11668 }
11669
11608 public class AsyncPacketProcess 11670 public class AsyncPacketProcess
11609 { 11671 {
11610 public bool result = false; 11672 public bool result = false;