* Add missing locking to mysql inventory plugin

* Should resolve mantis 542
ThreadPoolClientBranch
Justin Clarke Casey 2008-02-12 22:24:12 +00:00
parent 6a3455a98c
commit c0211c1ca2
2 changed files with 34 additions and 20 deletions

View File

@ -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))
{

View File

@ -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
@ -513,9 +514,12 @@ namespace OpenSim.Framework.Data.MySQL
cmd.Parameters.AddWithValue("?version", folder.version);
try
{
lock (database)
{
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.Error(e.ToString());
@ -543,11 +547,13 @@ namespace OpenSim.Framework.Data.MySQL
cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString());
cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString());
try
{
lock (database)
{
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.Error(e.ToString());
@ -590,8 +596,12 @@ namespace OpenSim.Framework.Data.MySQL
MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
lock (database)
{
cmd.ExecuteNonQuery();
}
}
catch (MySqlException e)
{
database.Reconnect();
@ -606,8 +616,12 @@ namespace OpenSim.Framework.Data.MySQL
MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
lock (database)
{
cmd.ExecuteNonQuery();
}
}
catch (MySqlException e)
{
database.Reconnect();
@ -621,8 +635,6 @@ namespace OpenSim.Framework.Data.MySQL
/// </summary>
/// <param name="folderId">Id of folder to delete</param>
public void deleteInventoryFolder(LLUUID folderID)
{
lock (database)
{
List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
@ -639,4 +651,3 @@ namespace OpenSim.Framework.Data.MySQL
}
}
}
}