aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-14 11:44:17 -0700
committerJohn Hurliman2009-10-14 11:44:17 -0700
commit4b5a2f8c024b63f75b122916f6322f2f04d79f42 (patch)
treee4c3b1d086a70c6d50b91bca6f61a08b77b65188 /OpenSim/Region/ClientStack/LindenUDP
parent* Minimized the number of times textures are pulled off the priority queue (diff)
parentMerge branch 'master' into htb-throttle (diff)
downloadopensim-SC-4b5a2f8c024b63f75b122916f6322f2f04d79f42.zip
opensim-SC-4b5a2f8c024b63f75b122916f6322f2f04d79f42.tar.gz
opensim-SC-4b5a2f8c024b63f75b122916f6322f2f04d79f42.tar.bz2
opensim-SC-4b5a2f8c024b63f75b122916f6322f2f04d79f42.tar.xz
Merge branch 'htb-throttle' of ssh://opensimulator.org/var/git/opensim into htb-throttle
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs14
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs50
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs5
3 files changed, 58 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 9ded390..b53a2fb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -31,6 +31,7 @@ using OpenMetaverse;
31using OpenMetaverse.Imaging; 31using OpenMetaverse.Imaging;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes.Hypergrid;
34using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
35using log4net; 36using log4net;
36using System.Reflection; 37using System.Reflection;
@@ -54,6 +55,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
54 public UUID TextureID; 55 public UUID TextureID;
55 public IJ2KDecoder J2KDecoder; 56 public IJ2KDecoder J2KDecoder;
56 public IAssetService AssetService; 57 public IAssetService AssetService;
58 public UUID AgentID;
59 public IHyperAssetService HyperAssets;
57 public OpenJPEG.J2KLayerInfo[] Layers; 60 public OpenJPEG.J2KLayerInfo[] Layers;
58 public bool IsDecoded; 61 public bool IsDecoded;
59 public bool HasAsset; 62 public bool HasAsset;
@@ -373,6 +376,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
373 UUID assetID = UUID.Zero; 376 UUID assetID = UUID.Zero;
374 if (asset != null) 377 if (asset != null)
375 assetID = asset.FullID; 378 assetID = asset.FullID;
379 else if ((HyperAssets != null) && (sender != HyperAssets))
380 {
381 // Try the user's inventory, but only if it's different from the regions'
382 string userAssets = HyperAssets.GetUserAssetServer(AgentID);
383 if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer()))
384 {
385 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
386 AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived);
387 return;
388 }
389 }
376 390
377 AssetDataCallback(assetID, asset); 391 AssetDataCallback(assetID, asset);
378 392
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 9afff5a..8487adc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -43,6 +43,7 @@ using OpenSim.Framework.Communications.Cache;
43using OpenSim.Framework.Statistics; 43using OpenSim.Framework.Statistics;
44using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.Framework.Scenes.Hypergrid;
46using OpenSim.Services.Interfaces; 47using OpenSim.Services.Interfaces;
47using Timer=System.Timers.Timer; 48using Timer=System.Timers.Timer;
48using AssetLandmark = OpenSim.Framework.AssetLandmark; 49using AssetLandmark = OpenSim.Framework.AssetLandmark;
@@ -319,6 +320,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
319 /// OnQueueEmpty event is triggered for the texture category</summary> 320 /// OnQueueEmpty event is triggered for the texture category</summary>
320 protected int m_textureSendLimit = 20; 321 protected int m_textureSendLimit = 20;
321 protected IAssetService m_assetService; 322 protected IAssetService m_assetService;
323 private IHyperAssetService m_hyperAssets;
324
322 325
323 #endregion Class Members 326 #endregion Class Members
324 327
@@ -377,6 +380,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
377 380
378 m_scene = scene; 381 m_scene = scene;
379 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 382 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
383 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
380 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); 384 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
381 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); 385 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
382 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion()); 386 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion());
@@ -6895,7 +6899,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6895 #endregion 6899 #endregion
6896 6900
6897 //handlerTextureRequest = null; 6901 //handlerTextureRequest = null;
6898
6899 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 6902 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
6900 { 6903 {
6901 if (OnRequestTexture != null) 6904 if (OnRequestTexture != null)
@@ -6906,7 +6909,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6906 args.PacketNumber = imageRequest.RequestImage[i].Packet; 6909 args.PacketNumber = imageRequest.RequestImage[i].Packet;
6907 args.Priority = imageRequest.RequestImage[i].DownloadPriority; 6910 args.Priority = imageRequest.RequestImage[i].DownloadPriority;
6908 args.requestSequence = imageRequest.Header.Sequence; 6911 args.requestSequence = imageRequest.Header.Sequence;
6909
6910 //handlerTextureRequest = OnRequestTexture; 6912 //handlerTextureRequest = OnRequestTexture;
6911 6913
6912 //if (handlerTextureRequest != null) 6914 //if (handlerTextureRequest != null)
@@ -6929,10 +6931,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6929 // Validate inventory transfers 6931 // Validate inventory transfers
6930 // Has to be done here, because AssetCache can't do it 6932 // Has to be done here, because AssetCache can't do it
6931 // 6933 //
6932 6934 UUID taskID = UUID.Zero;
6933 if (transfer.TransferInfo.SourceType == 3) 6935 if (transfer.TransferInfo.SourceType == 3)
6934 { 6936 {
6935 UUID taskID = new UUID(transfer.TransferInfo.Params, 48); 6937 taskID = new UUID(transfer.TransferInfo.Params, 48);
6936 UUID itemID = new UUID(transfer.TransferInfo.Params, 64); 6938 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
6937 UUID requestID = new UUID(transfer.TransferInfo.Params, 80); 6939 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
6938 if (!(((Scene)m_scene).Permissions.BypassPermissions())) 6940 if (!(((Scene)m_scene).Permissions.BypassPermissions()))
@@ -7003,7 +7005,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7003 7005
7004 //m_assetCache.AddAssetRequest(this, transfer); 7006 //m_assetCache.AddAssetRequest(this, transfer);
7005 7007
7006 MakeAssetRequest(transfer); 7008 MakeAssetRequest(transfer, taskID);
7007 7009
7008 /* RequestAsset = OnRequestAsset; 7010 /* RequestAsset = OnRequestAsset;
7009 if (RequestAsset != null) 7011 if (RequestAsset != null)
@@ -10210,7 +10212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10210 return String.Empty; 10212 return String.Empty;
10211 } 10213 }
10212 10214
10213 public void MakeAssetRequest(TransferRequestPacket transferRequest) 10215 public void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID)
10214 { 10216 {
10215 UUID requestID = UUID.Zero; 10217 UUID requestID = UUID.Zero;
10216 if (transferRequest.TransferInfo.SourceType == 2) 10218 if (transferRequest.TransferInfo.SourceType == 2)
@@ -10222,12 +10224,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10222 { 10224 {
10223 //inventory asset request 10225 //inventory asset request
10224 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 10226 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
10225 //m_log.Debug("asset request " + requestID); 10227 //m_log.Debug("[XXX] inventory asset request " + requestID);
10228 //if (taskID == UUID.Zero) // Agent
10229 // if (m_scene is HGScene)
10230 // {
10231 // m_log.Debug("[XXX] hg asset request " + requestID);
10232 // // We may need to fetch the asset from the user's asset server into the local asset server
10233 // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
10234 // mapper.Get(requestID, AgentId);
10235 // }
10226 } 10236 }
10227 10237
10228 //check to see if asset is in local cache, if not we need to request it from asset server. 10238 //check to see if asset is in local cache, if not we need to request it from asset server.
10229 //m_log.Debug("asset request " + requestID); 10239 //m_log.Debug("asset request " + requestID);
10230 10240
10231 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 10241 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
10232 10242
10233 } 10243 }
@@ -10238,12 +10248,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10238 10248
10239 UUID requestID = UUID.Zero; 10249 UUID requestID = UUID.Zero;
10240 byte source = 2; 10250 byte source = 2;
10241 if (transferRequest.TransferInfo.SourceType == 2) 10251 if ((transferRequest.TransferInfo.SourceType == 2) || (transferRequest.TransferInfo.SourceType == 2222))
10242 { 10252 {
10243 //direct asset request 10253 //direct asset request
10244 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 10254 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
10245 } 10255 }
10246 else if (transferRequest.TransferInfo.SourceType == 3) 10256 else if ((transferRequest.TransferInfo.SourceType == 3) || (transferRequest.TransferInfo.SourceType == 3333))
10247 { 10257 {
10248 //inventory asset request 10258 //inventory asset request
10249 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 10259 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
@@ -10251,10 +10261,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10251 //m_log.Debug("asset request " + requestID); 10261 //m_log.Debug("asset request " + requestID);
10252 } 10262 }
10253 10263
10254 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
10255 if (null == asset) 10264 if (null == asset)
10256 { 10265 {
10266 if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000))
10267 {
10268 // Try the user's inventory, but only if it's different from the regions'
10269 string userAssets = m_hyperAssets.GetUserAssetServer(AgentId);
10270 if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
10271 {
10272 m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
10273 if (transferRequest.TransferInfo.SourceType == 2)
10274 transferRequest.TransferInfo.SourceType = 2222; // marker
10275 else if (transferRequest.TransferInfo.SourceType == 3)
10276 transferRequest.TransferInfo.SourceType = 3333; // marker
10277
10278 m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
10279 return;
10280 }
10281 }
10282
10257 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); 10283 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
10284
10285 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
10258 return; 10286 return;
10259 } 10287 }
10260 10288
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 9d36cff..25542ab 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
59 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); 59 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
60 private object m_syncRoot = new object(); 60 private object m_syncRoot = new object();
61 61
62 private IHyperAssetService m_hyperAssets;
63
62 public LLClientView Client { get { return m_client; } } 64 public LLClientView Client { get { return m_client; } }
63 public AssetBase MissingImage { get { return m_missingImage; } } 65 public AssetBase MissingImage { get { return m_missingImage; } }
64 66
@@ -74,6 +76,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
74 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); 76 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
75 77
76 m_j2kDecodeModule = pJ2kDecodeModule; 78 m_j2kDecodeModule = pJ2kDecodeModule;
79 m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
77 } 80 }
78 81
79 /// <summary> 82 /// <summary>
@@ -146,6 +149,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
146 imgrequest = new J2KImage(this); 149 imgrequest = new J2KImage(this);
147 imgrequest.J2KDecoder = m_j2kDecodeModule; 150 imgrequest.J2KDecoder = m_j2kDecodeModule;
148 imgrequest.AssetService = m_assetCache; 151 imgrequest.AssetService = m_assetCache;
152 imgrequest.AgentID = m_client.AgentId;
153 imgrequest.HyperAssets = m_hyperAssets;
149 imgrequest.DiscardLevel = newRequest.DiscardLevel; 154 imgrequest.DiscardLevel = newRequest.DiscardLevel;
150 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); 155 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
151 imgrequest.Priority = newRequest.Priority; 156 imgrequest.Priority = newRequest.Priority;