aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
authordiva2009-05-15 05:00:25 +0000
committerdiva2009-05-15 05:00:25 +0000
commit5e4fc6e91e5edffd1dc23af4f583d6294f394a3d (patch)
tree497076db68193be2d14fc3788c1d80c74d8c977d /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
parentsome sculpted prim geometry accuracy and meshing speed improvements (diff)
downloadopensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.zip
opensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.tar.gz
opensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.tar.bz2
opensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.tar.xz
Heart surgery on asset service code bits. Affects OpenSim.ini configuration -- please see the example. Affects region servers only.
This may break a lot of things, but it needs to go in. It was tested in standalone and the UCI grid, but it needs a lot more testing. Known problems: * HG asset transfers are borked for now * missing texture is missing * 3 unit tests commented out for now
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs107
1 files changed, 102 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 0eb08b2..7c524d9 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.Services.Interfaces;
46using Timer=System.Timers.Timer; 47using Timer=System.Timers.Timer;
47using Nini.Config; 48using Nini.Config;
48 49
@@ -66,7 +67,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
66 67
67 private int m_debugPacketLevel; 68 private int m_debugPacketLevel;
68 69
69 private readonly IAssetCache m_assetCache; 70 //private readonly IAssetCache m_assetCache;
70 private int m_cachedTextureSerial; 71 private int m_cachedTextureSerial;
71 private Timer m_clientPingTimer; 72 private Timer m_clientPingTimer;
72 73
@@ -141,6 +142,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
141 142
142 protected int m_packetMTU = 1400; 143 protected int m_packetMTU = 1400;
143 144
145 protected IAssetService m_assetService;
146
144 // LLClientView Only 147 // LLClientView Only
145 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args); 148 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args);
146 149
@@ -490,7 +493,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
490 InitDefaultAnimations(); 493 InitDefaultAnimations();
491 494
492 m_scene = scene; 495 m_scene = scene;
493 m_assetCache = assetCache; 496 //m_assetCache = assetCache;
497
498 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
499 m_log.Debug("[XXX] m_assetService is null? " + ((m_assetService == null) ? "yes" : "no"));
494 500
495 m_networkServer = packServer; 501 m_networkServer = packServer;
496 502
@@ -543,7 +549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
543 } 549 }
544 550
545 RegisterLocalPacketHandlers(); 551 RegisterLocalPacketHandlers();
546 m_imageManager = new LLImageManager(this, m_assetCache,Scene.RequestModuleInterface<IJ2KDecoder>()); 552 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
547 } 553 }
548 554
549 public void SetDebugPacketLevel(int newDebugPacketLevel) 555 public void SetDebugPacketLevel(int newDebugPacketLevel)
@@ -6451,7 +6457,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6451 } 6457 }
6452 } 6458 }
6453 6459
6454 m_assetCache.AddAssetRequest(this, transfer); 6460 //m_assetCache.AddAssetRequest(this, transfer);
6461
6462 MakeAssetRequest(transfer);
6463
6455 /* RequestAsset = OnRequestAsset; 6464 /* RequestAsset = OnRequestAsset;
6456 if (RequestAsset != null) 6465 if (RequestAsset != null)
6457 { 6466 {
@@ -7115,7 +7124,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7115 AssetLandmark lm; 7124 AssetLandmark lm;
7116 if (lmid != UUID.Zero) 7125 if (lmid != UUID.Zero)
7117 { 7126 {
7118 AssetBase lma = m_assetCache.GetAsset(lmid, false); 7127 //AssetBase lma = m_assetCache.GetAsset(lmid, false);
7128 AssetBase lma = m_assetService.Get(lmid.ToString());
7119 7129
7120 if (lma == null) 7130 if (lma == null)
7121 { 7131 {
@@ -10604,6 +10614,93 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10604 return ""; 10614 return "";
10605 } 10615 }
10606 10616
10617 public void MakeAssetRequest(TransferRequestPacket transferRequest)
10618 {
10619 UUID requestID = UUID.Zero;
10620 if (transferRequest.TransferInfo.SourceType == 2)
10621 {
10622 //direct asset request
10623 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
10624 }
10625 else if (transferRequest.TransferInfo.SourceType == 3)
10626 {
10627 //inventory asset request
10628 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
10629 //m_log.Debug("asset request " + requestID);
10630 }
10631
10632 //check to see if asset is in local cache, if not we need to request it from asset server.
10633 //m_log.Debug("asset request " + requestID);
10634
10635 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
10636
10637 }
10638
10639 protected void AssetReceived(string id, Object sender, AssetBase asset)
10640 {
10641 TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
10642
10643 UUID requestID = UUID.Zero;
10644 byte source = 2;
10645 if (transferRequest.TransferInfo.SourceType == 2)
10646 {
10647 //direct asset request
10648 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
10649 }
10650 else if (transferRequest.TransferInfo.SourceType == 3)
10651 {
10652 //inventory asset request
10653 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
10654 source = 3;
10655 //m_log.Debug("asset request " + requestID);
10656 }
10657
10658 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
10659 if (null == asset)
10660 {
10661 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
10662 return;
10663 }
10664
10665 // Scripts cannot be retrieved by direct request
10666 if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10)
10667 return;
10668
10669 // The asset is known to exist and is in our cache, so add it to the AssetRequests list
10670 AssetRequestToClient req = new AssetRequestToClient();
10671 req.AssetInf = asset;
10672 req.AssetRequestSource = source;
10673 req.IsTextureRequest = false;
10674 req.NumPackets = CalculateNumPackets(asset.Data);
10675 req.Params = transferRequest.TransferInfo.Params;
10676 req.RequestAssetID = requestID;
10677 req.TransferRequestID = transferRequest.TransferInfo.TransferID;
10678
10679 SendAsset(req);
10680 }
10681
10682 /// <summary>
10683 /// Calculate the number of packets required to send the asset to the client.
10684 /// </summary>
10685 /// <param name="data"></param>
10686 /// <returns></returns>
10687 private static int CalculateNumPackets(byte[] data)
10688 {
10689 const uint m_maxPacketSize = 600;
10690 int numPackets = 1;
10691
10692 if (data.LongLength > m_maxPacketSize)
10693 {
10694 // over max number of bytes so split up file
10695 long restData = data.LongLength - m_maxPacketSize;
10696 int restPackets = (int)((restData + m_maxPacketSize - 1) / m_maxPacketSize);
10697 numPackets += restPackets;
10698 }
10699
10700 return numPackets;
10701 }
10702
10703
10607 #region IClientIPEndpoint Members 10704 #region IClientIPEndpoint Members
10608 10705
10609 public IPAddress EndPoint 10706 public IPAddress EndPoint