diff options
Trying some locks on asset database access.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/SQLAssetServer.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | 31 |
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); |