* Add missing locking to mysql inventory plugin
* Should resolve mantis 542ThreadPoolClientBranch
parent
6a3455a98c
commit
c0211c1ca2
|
@ -259,6 +259,9 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
|
||||
{
|
||||
// m_log.InfoFormat("[INVENTORYCACHE]: Purging folder {0} for {1} uuid {2}",
|
||||
// folderID, remoteClient.Name, remoteClient.AgentId);
|
||||
|
||||
CachedUserInfo userProfile;
|
||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||
{
|
||||
|
|
|
@ -38,7 +38,8 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// </summary>
|
||||
public class MySQLInventoryData : IInventoryData
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly log4net.ILog m_log
|
||||
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// The database manager
|
||||
|
@ -514,7 +515,10 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
lock (database)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -543,10 +547,12 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString());
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
lock (database)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -586,11 +592,15 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
protected void deleteOneFolder(LLUUID folderID)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
MySqlCommand cmd =
|
||||
new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection);
|
||||
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
lock (database)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
|
@ -606,7 +616,11 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
MySqlCommand cmd =
|
||||
new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection);
|
||||
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
lock (database)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
|
@ -622,21 +636,18 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// <param name="folderId">Id of folder to delete</param>
|
||||
public void deleteInventoryFolder(LLUUID folderID)
|
||||
{
|
||||
lock (database)
|
||||
List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
|
||||
|
||||
//Delete all sub-folders
|
||||
foreach (InventoryFolderBase f in subFolders)
|
||||
{
|
||||
List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
|
||||
|
||||
//Delete all sub-folders
|
||||
foreach (InventoryFolderBase f in subFolders)
|
||||
{
|
||||
deleteOneFolder(f.folderID);
|
||||
deleteItemsInFolder(f.folderID);
|
||||
}
|
||||
|
||||
//Delete the actual row
|
||||
deleteOneFolder(folderID);
|
||||
deleteItemsInFolder(folderID);
|
||||
deleteOneFolder(f.folderID);
|
||||
deleteItemsInFolder(f.folderID);
|
||||
}
|
||||
|
||||
//Delete the actual row
|
||||
deleteOneFolder(folderID);
|
||||
deleteItemsInFolder(folderID);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue