diff options
* Trying to address TextureSender issues
* The BlockingQueue exposes Contains so we can make sure we don't add a TextureSender to the queue if there's already one present
* introduced some TryGetValue and various code convention stuff
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServerBase.cs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 318082b..f0ed968 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -37,11 +37,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
37 | { | 37 | { |
38 | public abstract class AssetServerBase : IAssetServer | 38 | public abstract class AssetServerBase : IAssetServer |
39 | { | 39 | { |
40 | protected IAssetReceiver _receiver; | 40 | protected IAssetReceiver m_receiver; |
41 | protected BlockingQueue<AssetRequest> _assetRequests; | 41 | protected BlockingQueue<AssetRequest> m_assetRequests; |
42 | protected Thread _localAssetServerThread; | 42 | protected Thread m_localAssetServerThread; |
43 | protected IAssetProvider m_assetProviderPlugin; | 43 | protected IAssetProvider m_assetProvider; |
44 | protected object syncLock = new object(); | 44 | protected object m_syncLock = new object(); |
45 | 45 | ||
46 | // Temporarily hardcoded - should be a plugin | 46 | // Temporarily hardcoded - should be a plugin |
47 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); | 47 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); |
@@ -71,14 +71,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
71 | MainLog.Instance.Verbose( | 71 | MainLog.Instance.Verbose( |
72 | "ASSET", "Asset {0} received from asset server", req.AssetID); | 72 | "ASSET", "Asset {0} received from asset server", req.AssetID); |
73 | 73 | ||
74 | _receiver.AssetReceived(asset, req.IsTexture); | 74 | m_receiver.AssetReceived(asset, req.IsTexture); |
75 | } | 75 | } |
76 | else | 76 | else |
77 | { | 77 | { |
78 | MainLog.Instance.Error( | 78 | MainLog.Instance.Error( |
79 | "ASSET", "Asset {0} not found by asset server", req.AssetID); | 79 | "ASSET", "Asset {0} not found by asset server", req.AssetID); |
80 | 80 | ||
81 | _receiver.AssetNotFound(req.AssetID); | 81 | m_receiver.AssetNotFound(req.AssetID); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
@@ -95,11 +95,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
95 | public AssetServerBase() | 95 | public AssetServerBase() |
96 | { | 96 | { |
97 | MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system"); | 97 | MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system"); |
98 | _assetRequests = new BlockingQueue<AssetRequest>(); | 98 | m_assetRequests = new BlockingQueue<AssetRequest>(); |
99 | 99 | ||
100 | _localAssetServerThread = new Thread(RunRequests); | 100 | m_localAssetServerThread = new Thread(RunRequests); |
101 | _localAssetServerThread.IsBackground = true; | 101 | m_localAssetServerThread.IsBackground = true; |
102 | _localAssetServerThread.Start(); | 102 | m_localAssetServerThread.Start(); |
103 | } | 103 | } |
104 | 104 | ||
105 | private void RunRequests() | 105 | private void RunRequests() |
@@ -108,7 +108,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
108 | { | 108 | { |
109 | try | 109 | try |
110 | { | 110 | { |
111 | AssetRequest req = _assetRequests.Dequeue(); | 111 | AssetRequest req = m_assetRequests.Dequeue(); |
112 | 112 | ||
113 | ProcessRequest(req); | 113 | ProcessRequest(req); |
114 | } | 114 | } |
@@ -121,7 +121,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
121 | 121 | ||
122 | public void SetReceiver(IAssetReceiver receiver) | 122 | public void SetReceiver(IAssetReceiver receiver) |
123 | { | 123 | { |
124 | _receiver = receiver; | 124 | m_receiver = receiver; |
125 | } | 125 | } |
126 | 126 | ||
127 | public void RequestAsset(LLUUID assetID, bool isTexture) | 127 | public void RequestAsset(LLUUID assetID, bool isTexture) |
@@ -129,23 +129,23 @@ namespace OpenSim.Framework.Communications.Cache | |||
129 | AssetRequest req = new AssetRequest(); | 129 | AssetRequest req = new AssetRequest(); |
130 | req.AssetID = assetID; | 130 | req.AssetID = assetID; |
131 | req.IsTexture = isTexture; | 131 | req.IsTexture = isTexture; |
132 | _assetRequests.Enqueue(req); | 132 | m_assetRequests.Enqueue(req); |
133 | 133 | ||
134 | MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID); | 134 | MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID); |
135 | } | 135 | } |
136 | 136 | ||
137 | public virtual void UpdateAsset(AssetBase asset) | 137 | public virtual void UpdateAsset(AssetBase asset) |
138 | { | 138 | { |
139 | lock (syncLock) | 139 | lock (m_syncLock) |
140 | { | 140 | { |
141 | m_assetProviderPlugin.UpdateAsset(asset); | 141 | m_assetProvider.UpdateAsset(asset); |
142 | m_assetProviderPlugin.CommitAssets(); | 142 | m_assetProvider.CommitAssets(); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | public void StoreAndCommitAsset(AssetBase asset) | 146 | public void StoreAndCommitAsset(AssetBase asset) |
147 | { | 147 | { |
148 | lock (syncLock) | 148 | lock (m_syncLock) |
149 | { | 149 | { |
150 | StoreAsset(asset); | 150 | StoreAsset(asset); |
151 | CommitAssets(); | 151 | CommitAssets(); |
@@ -154,7 +154,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
154 | 154 | ||
155 | public virtual void Close() | 155 | public virtual void Close() |
156 | { | 156 | { |
157 | _localAssetServerThread.Abort(); | 157 | m_localAssetServerThread.Abort(); |
158 | } | 158 | } |
159 | 159 | ||
160 | public void SetServerInfo(string ServerUrl, string ServerKey) | 160 | public void SetServerInfo(string ServerUrl, string ServerKey) |