aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetServerBase.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs25
1 files changed, 21 insertions, 4 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index e117c93..659b9c9 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Framework.Communications.Cache
40 public abstract class AssetServerBase : IAssetServer 40 public abstract class AssetServerBase : IAssetServer
41 { 41 {
42 protected IAssetReceiver _receiver; 42 protected IAssetReceiver _receiver;
43 protected BlockingQueue<ARequest> _assetRequests; 43 protected BlockingQueue<AssetRequest> _assetRequests;
44 protected Thread _localAssetServerThread; 44 protected Thread _localAssetServerThread;
45 protected IAssetProvider m_assetProviderPlugin; 45 protected IAssetProvider m_assetProviderPlugin;
46 protected object syncLock = new object(); 46 protected object syncLock = new object();
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Communications.Cache
48 protected abstract void StoreAsset(AssetBase asset); 48 protected abstract void StoreAsset(AssetBase asset);
49 protected abstract void CommitAssets(); 49 protected abstract void CommitAssets();
50 50
51 protected abstract void RunRequests(); 51 protected abstract void ProcessRequest(AssetRequest req);
52 52
53 public void LoadDefaultAssets() 53 public void LoadDefaultAssets()
54 { 54 {
@@ -64,13 +64,30 @@ namespace OpenSim.Framework.Communications.Cache
64 public AssetServerBase() 64 public AssetServerBase()
65 { 65 {
66 MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system"); 66 MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system");
67 _assetRequests = new BlockingQueue<ARequest>(); 67 _assetRequests = new BlockingQueue<AssetRequest>();
68 68
69 _localAssetServerThread = new Thread(RunRequests); 69 _localAssetServerThread = new Thread(RunRequests);
70 _localAssetServerThread.IsBackground = true; 70 _localAssetServerThread.IsBackground = true;
71 _localAssetServerThread.Start(); 71 _localAssetServerThread.Start();
72 } 72 }
73 73
74 private void RunRequests()
75 {
76 while (true) // Since it's a 'blocking queue'
77 {
78 try
79 {
80 AssetRequest req = _assetRequests.Dequeue();
81
82 ProcessRequest(req);
83 }
84 catch(Exception e)
85 {
86 MainLog.Instance.Error("ASSETSERVER", e.Message );
87 }
88 }
89 }
90
74 public void LoadAsset(AssetBase info, bool image, string filename) 91 public void LoadAsset(AssetBase info, bool image, string filename)
75 { 92 {
76 //should request Asset from storage manager 93 //should request Asset from storage manager
@@ -97,7 +114,7 @@ namespace OpenSim.Framework.Communications.Cache
97 114
98 public void RequestAsset(LLUUID assetID, bool isTexture) 115 public void RequestAsset(LLUUID assetID, bool isTexture)
99 { 116 {
100 ARequest req = new ARequest(); 117 AssetRequest req = new AssetRequest();
101 req.AssetID = assetID; 118 req.AssetID = assetID;
102 req.IsTexture = isTexture; 119 req.IsTexture = isTexture;
103 MainLog.Instance.Verbose("ASSET","Adding {0} to request queue", assetID); 120 MainLog.Instance.Verbose("ASSET","Adding {0} to request queue", assetID);