aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
diff options
context:
space:
mode:
authorMW2007-09-11 04:54:55 +0000
committerMW2007-09-11 04:54:55 +0000
commit0770a5de0a53c9b539891e6a993724628668a489 (patch)
treee74051b9fe0e9caada20f22c748a63b4d0059b5b /OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
parentMake grass and trees phantom by default. Same behavior as LL grid. (diff)
downloadopensim-SC-0770a5de0a53c9b539891e6a993724628668a489.zip
opensim-SC-0770a5de0a53c9b539891e6a993724628668a489.tar.gz
opensim-SC-0770a5de0a53c9b539891e6a993724628668a489.tar.bz2
opensim-SC-0770a5de0a53c9b539891e6a993724628668a489.tar.xz
Trying some locks on asset database access.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/SQLAssetServer.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs31
1 files changed, 21 insertions, 10 deletions
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index fc4efc5..a965ee0 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -44,7 +44,8 @@ namespace OpenSim.Framework.Communications.Caches
44 private IAssetReceiver _receiver; 44 private IAssetReceiver _receiver;
45 private BlockingQueue<ARequest> _assetRequests; 45 private BlockingQueue<ARequest> _assetRequests;
46 private Thread _localAssetServerThread; 46 private Thread _localAssetServerThread;
47 protected IAssetProvider m_plugin; 47 protected IAssetProvider m_plugin;
48 private object syncLock = new object();
48 49
49 50
50 public SQLAssetServer() 51 public SQLAssetServer()
@@ -101,15 +102,21 @@ namespace OpenSim.Framework.Communications.Caches
101 } 102 }
102 103
103 public void UpdateAsset(AssetBase asset) 104 public void UpdateAsset(AssetBase asset)
104 { 105 {
105 m_plugin.UpdateAsset(asset); 106 lock (syncLock)
106 m_plugin.CommitAssets(); 107 {
108 m_plugin.UpdateAsset(asset);
109 m_plugin.CommitAssets();
110 }
107 } 111 }
108 112
109 public void CreateAsset(AssetBase asset) 113 public void CreateAsset(AssetBase asset)
110 { 114 {
111 m_plugin.CreateAsset(asset); 115 lock (syncLock)
112 m_plugin.CommitAssets(); 116 {
117 m_plugin.CreateAsset(asset);
118 m_plugin.CommitAssets();
119 }
113 } 120 }
114 121
115 public void SetServerInfo(string ServerUrl, string ServerKey) 122 public void SetServerInfo(string ServerUrl, string ServerKey)
@@ -128,9 +135,13 @@ namespace OpenSim.Framework.Communications.Caches
128 { 135 {
129 ARequest req = this._assetRequests.Dequeue(); 136 ARequest req = this._assetRequests.Dequeue();
130 137
131 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); 138 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
132 139
133 AssetBase asset = m_plugin.FetchAsset(req.AssetID); 140 AssetBase asset = null;
141 lock (syncLock)
142 {
143 asset = m_plugin.FetchAsset(req.AssetID);
144 }
134 if (asset != null) 145 if (asset != null)
135 { 146 {
136 _receiver.AssetReceived(asset, req.IsTexture); 147 _receiver.AssetReceived(asset, req.IsTexture);