aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs120
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs5
3 files changed, 23 insertions, 118 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 9869a99..e9e2dca 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
55 public IJ2KDecoder J2KDecoder; 55 public IJ2KDecoder J2KDecoder;
56 public IAssetService AssetService; 56 public IAssetService AssetService;
57 public UUID AgentID; 57 public UUID AgentID;
58 public IHyperAssetService HyperAssets; 58 public IInventoryAccessModule InventoryAccessModule;
59 public OpenJPEG.J2KLayerInfo[] Layers; 59 public OpenJPEG.J2KLayerInfo[] Layers;
60 public bool IsDecoded; 60 public bool IsDecoded;
61 public bool HasAsset; 61 public bool HasAsset;
@@ -375,14 +375,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
375 UUID assetID = UUID.Zero; 375 UUID assetID = UUID.Zero;
376 if (asset != null) 376 if (asset != null)
377 assetID = asset.FullID; 377 assetID = asset.FullID;
378 else if ((HyperAssets != null) && (sender != HyperAssets)) 378 else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
379 { 379 {
380 // Try the user's inventory, but only if it's different from the regions' 380 // Unfortunately we need this here, there's no other way.
381 string userAssets = HyperAssets.GetUserAssetServer(AgentID); 381 // This is due to the fact that textures opened directly from the agent's inventory
382 if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer())) 382 // don't have any distinguishing feature. As such, in order to serve those when the
383 // foreign user is visiting, we need to try again after the first fail to the local
384 // asset service.
385 string assetServerURL = string.Empty;
386 if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
383 { 387 {
384 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); 388 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
385 AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived); 389 AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived);
386 return; 390 return;
387 } 391 }
388 } 392 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index ddc963a..c59eedf 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -357,7 +357,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
357 protected uint m_agentFOVCounter; 357 protected uint m_agentFOVCounter;
358 358
359 protected IAssetService m_assetService; 359 protected IAssetService m_assetService;
360 private IHyperAssetService m_hyperAssets;
361 private const bool m_checkPackets = true; 360 private const bool m_checkPackets = true;
362 361
363 private Timer m_propertiesPacketTimer; 362 private Timer m_propertiesPacketTimer;
@@ -432,7 +431,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
432// m_attachmentsSent = new HashSet<uint>(); 431// m_attachmentsSent = new HashSet<uint>();
433 432
434 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 433 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
435 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
436 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); 434 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
437 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); 435 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
438 m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion()); 436 m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion());
@@ -3680,30 +3678,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3680 3678
3681 #endregion Primitive Packet/Data Sending Methods 3679 #endregion Primitive Packet/Data Sending Methods
3682 3680
3683 /// <summary>
3684 ///
3685 /// </summary>
3686 /// <param name="localID"></param>
3687 /// <param name="rotation"></param>
3688 /// <param name="attachPoint"></param>
3689 public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
3690 {
3691 if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD
3692 return;
3693
3694 ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
3695 // TODO: don't create new blocks if recycling an old packet
3696 attach.AgentData.AgentID = AgentId;
3697 attach.AgentData.SessionID = m_sessionId;
3698 attach.AgentData.AttachmentPoint = attachPoint;
3699 attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
3700 attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
3701 attach.ObjectData[0].ObjectLocalID = localID;
3702 attach.ObjectData[0].Rotation = rotation;
3703 attach.Header.Zerocoded = true;
3704 OutPacket(attach, ThrottleOutPacketType.Task);
3705 }
3706
3707 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) 3681 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
3708 { 3682 {
3709 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) 3683 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
@@ -5732,7 +5706,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5732 { 5706 {
5733 if (att.ObjectData.Length > 0) 5707 if (att.ObjectData.Length > 0)
5734 { 5708 {
5735 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false); 5709 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, false);
5736 } 5710 }
5737 } 5711 }
5738 } 5712 }
@@ -7195,59 +7169,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7195 } 7169 }
7196 else // Agent 7170 else // Agent
7197 { 7171 {
7198 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); 7172 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
7199 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId); 7173 if (invAccess != null)
7200 assetRequestItem = invService.GetItem(assetRequestItem);
7201 if (assetRequestItem == null)
7202 { 7174 {
7203 ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>(); 7175 if (!invAccess.GetAgentInventoryItem(this, itemID, requestID))
7204 if (lib != null) 7176 return false;
7205 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
7206 if (assetRequestItem == null)
7207 return true;
7208 }
7209 7177
7210 // At this point, we need to apply perms
7211 // only to notecards and scripts. All
7212 // other asset types are always available
7213 //
7214 if (assetRequestItem.AssetType == (int)AssetType.LSLText)
7215 {
7216 if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
7217 {
7218 SendAgentAlertMessage("Insufficient permissions to view script", false);
7219 return true;
7220 }
7221 }
7222 else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
7223 {
7224 if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
7225 {
7226 SendAgentAlertMessage("Insufficient permissions to view notecard", false);
7227 return true;
7228 }
7229 } 7178 }
7179 else
7180 return false;
7230 7181
7231 if (assetRequestItem.AssetID != requestID)
7232 {
7233 m_log.WarnFormat(
7234 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
7235 Name, requestID, itemID, assetRequestItem.AssetID);
7236 return true;
7237 }
7238 } 7182 }
7239 } 7183 }
7240 } 7184 }
7241 7185
7242 //m_assetCache.AddAssetRequest(this, transfer);
7243
7244 MakeAssetRequest(transfer, taskID); 7186 MakeAssetRequest(transfer, taskID);
7245 7187
7246 /* RequestAsset = OnRequestAsset;
7247 if (RequestAsset != null)
7248 {
7249 RequestAsset(this, transfer);
7250 }*/
7251 return true; 7188 return true;
7252 } 7189 }
7253 7190
@@ -11458,15 +11395,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11458 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 11395 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11459 { 11396 {
11460 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11397 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11461 //m_log.Debug("[XXX] inventory asset request " + requestID);
11462 //if (taskID == UUID.Zero) // Agent
11463 // if (m_scene is HGScene)
11464 // {
11465 // m_log.Debug("[XXX] hg asset request " + requestID);
11466 // // We may need to fetch the asset from the user's asset server into the local asset server
11467 // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
11468 // mapper.Get(requestID, AgentId);
11469 // }
11470 } 11398 }
11471 11399
11472// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 11400// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
@@ -11482,49 +11410,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11482 /// <param name="asset"></param> 11410 /// <param name="asset"></param>
11483 protected void AssetReceived(string id, Object sender, AssetBase asset) 11411 protected void AssetReceived(string id, Object sender, AssetBase asset)
11484 { 11412 {
11413 if (asset == null)
11414 return;
11415
11485 TransferRequestPacket transferRequest = (TransferRequestPacket)sender; 11416 TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
11486 11417
11487 UUID requestID = UUID.Zero; 11418 UUID requestID = UUID.Zero;
11488 byte source = (byte)SourceType.Asset; 11419 byte source = (byte)SourceType.Asset;
11489 11420
11490 if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) 11421 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11491 || (transferRequest.TransferInfo.SourceType == 2222))
11492 { 11422 {
11493 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 11423 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
11494 } 11424 }
11495 else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 11425 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11496 || (transferRequest.TransferInfo.SourceType == 3333))
11497 { 11426 {
11498 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11427 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11499 source = (byte)SourceType.SimInventoryItem; 11428 source = (byte)SourceType.SimInventoryItem;
11500 //m_log.Debug("asset request " + requestID); 11429 //m_log.Debug("asset request " + requestID);
11501 } 11430 }
11502 11431
11503 if (null == asset)
11504 {
11505 if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000))
11506 {
11507 // Try the user's inventory, but only if it's different from the regions'
11508 string userAssets = m_hyperAssets.GetUserAssetServer(AgentId);
11509 if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
11510 {
11511 m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
11512 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11513 transferRequest.TransferInfo.SourceType = 2222; // marker
11514 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11515 transferRequest.TransferInfo.SourceType = 3333; // marker
11516
11517 m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
11518 return;
11519 }
11520 }
11521
11522 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
11523
11524 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
11525 return;
11526 }
11527
11528 // Scripts cannot be retrieved by direct request 11432 // Scripts cannot be retrieved by direct request
11529 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10) 11433 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10)
11530 return; 11434 return;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 938cf50..9e0db12 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -58,8 +58,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
58 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); 58 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
59 private object m_syncRoot = new object(); 59 private object m_syncRoot = new object();
60 60
61 private IHyperAssetService m_hyperAssets;
62
63 public LLClientView Client { get { return m_client; } } 61 public LLClientView Client { get { return m_client; } }
64 public AssetBase MissingImage { get { return m_missingImage; } } 62 public AssetBase MissingImage { get { return m_missingImage; } }
65 63
@@ -75,7 +73,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
75 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); 73 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
76 74
77 m_j2kDecodeModule = pJ2kDecodeModule; 75 m_j2kDecodeModule = pJ2kDecodeModule;
78 m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
79 } 76 }
80 77
81 /// <summary> 78 /// <summary>
@@ -149,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
149 imgrequest.J2KDecoder = m_j2kDecodeModule; 146 imgrequest.J2KDecoder = m_j2kDecodeModule;
150 imgrequest.AssetService = m_assetCache; 147 imgrequest.AssetService = m_assetCache;
151 imgrequest.AgentID = m_client.AgentId; 148 imgrequest.AgentID = m_client.AgentId;
152 imgrequest.HyperAssets = m_hyperAssets; 149 imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
153 imgrequest.DiscardLevel = newRequest.DiscardLevel; 150 imgrequest.DiscardLevel = newRequest.DiscardLevel;
154 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); 151 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
155 imgrequest.Priority = newRequest.Priority; 152 imgrequest.Priority = newRequest.Priority;