Trying some locks on asset database access.
parent
1fb47bc4c5
commit
0770a5de0a
|
@ -45,6 +45,7 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
private BlockingQueue<ARequest> _assetRequests;
|
private BlockingQueue<ARequest> _assetRequests;
|
||||||
private Thread _localAssetServerThread;
|
private Thread _localAssetServerThread;
|
||||||
protected IAssetProvider m_plugin;
|
protected IAssetProvider m_plugin;
|
||||||
|
private object syncLock = new object();
|
||||||
|
|
||||||
|
|
||||||
public SQLAssetServer()
|
public SQLAssetServer()
|
||||||
|
@ -101,16 +102,22 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateAsset(AssetBase asset)
|
public void UpdateAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
lock (syncLock)
|
||||||
{
|
{
|
||||||
m_plugin.UpdateAsset(asset);
|
m_plugin.UpdateAsset(asset);
|
||||||
m_plugin.CommitAssets();
|
m_plugin.CommitAssets();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void CreateAsset(AssetBase asset)
|
public void CreateAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
lock (syncLock)
|
||||||
{
|
{
|
||||||
m_plugin.CreateAsset(asset);
|
m_plugin.CreateAsset(asset);
|
||||||
m_plugin.CommitAssets();
|
m_plugin.CommitAssets();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetServerInfo(string ServerUrl, string ServerKey)
|
public void SetServerInfo(string ServerUrl, string ServerKey)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +137,11 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
|
|
||||||
MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
|
MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
|
||||||
|
|
||||||
AssetBase asset = m_plugin.FetchAsset(req.AssetID);
|
AssetBase asset = null;
|
||||||
|
lock (syncLock)
|
||||||
|
{
|
||||||
|
asset = m_plugin.FetchAsset(req.AssetID);
|
||||||
|
}
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
_receiver.AssetReceived(asset, req.IsTexture);
|
_receiver.AssetReceived(asset, req.IsTexture);
|
||||||
|
|
Loading…
Reference in New Issue