From 4fb2d7037358c320540edc3b2f5660e3cb3531a6 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sat, 1 Nov 2008 15:10:45 +0000
Subject: A stab a getting the user server to act right. Move acquisition of
the locks to just before the try/catch/finally block, so that an exception
thrown between taking the lock and entering the try doesn't leave a mutex
locked
---
OpenSim/Data/MySQL/MySQLGridData.cs | 6 +++---
OpenSim/Data/MySQL/MySQLUserData.cs | 33 ++++++++++++++++++---------------
2 files changed, 21 insertions(+), 18 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs
index 26a8591..b6d481c 100644
--- a/OpenSim/Data/MySQL/MySQLGridData.cs
+++ b/OpenSim/Data/MySQL/MySQLGridData.cs
@@ -403,10 +403,10 @@ namespace OpenSim.Data.MySQL
/// The sim profile
override public RegionProfileData GetProfileByString(string regionName)
{
- MySQLSuperManager dbm = GetLockedConnection();
-
if (regionName.Length > 2)
{
+ MySQLSuperManager dbm = GetLockedConnection();
+
try
{
Dictionary param = new Dictionary();
@@ -436,8 +436,8 @@ namespace OpenSim.Data.MySQL
dbm.Release();
}
+ dbm.Release();
}
- dbm.Release();
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
return null;
}
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 2937ea8..e671989 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -208,8 +208,6 @@ namespace OpenSim.Data.MySQL
public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
- MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend");
-
int dtvalue = Util.UnixTimeSinceEpoch();
Dictionary param = new Dictionary();
@@ -218,6 +216,8 @@ namespace OpenSim.Data.MySQL
param["?friendPerms"] = perms.ToString();
param["?datetimestamp"] = dtvalue.ToString();
+ MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend");
+
try
{
IDbCommand adder =
@@ -252,12 +252,12 @@ namespace OpenSim.Data.MySQL
public override void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
- MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend");
-
Dictionary param = new Dictionary();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
+ MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend");
+
try
{
IDbCommand updater =
@@ -286,13 +286,13 @@ namespace OpenSim.Data.MySQL
public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
- MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms");
-
Dictionary param = new Dictionary();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
param["?friendPerms"] = perms.ToString();
+ MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms");
+
try
{
IDbCommand updater =
@@ -317,12 +317,13 @@ namespace OpenSim.Data.MySQL
public override List GetUserFriendList(UUID friendlistowner)
{
- MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList");
List Lfli = new List();
Dictionary param = new Dictionary();
param["?ownerID"] = friendlistowner.ToString();
+ MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList");
+
try
{
//Left Join userfriends to itself
@@ -373,8 +374,6 @@ namespace OpenSim.Data.MySQL
public override List GeneratePickerResults(UUID queryID, string query)
{
- MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
-
List returnlist = new List();
Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
@@ -386,6 +385,8 @@ namespace OpenSim.Data.MySQL
Dictionary param = new Dictionary();
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%";
+ MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
+
try
{
IDbCommand result =
@@ -419,6 +420,8 @@ namespace OpenSim.Data.MySQL
}
else if (querysplit.Length == 1)
{
+ MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
+
try
{
Dictionary param = new Dictionary();
@@ -520,12 +523,12 @@ namespace OpenSim.Data.MySQL
/// is it still used ?
public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey)
{
- MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey");
-
Dictionary param = new Dictionary();
param["?UUID"] = AgentID.ToString();
param["?webLoginKey"] = WebLoginKey.ToString();
+ MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey");
+
try
{
dbm.Manager.ExecuteParameterizedSql(
@@ -785,11 +788,11 @@ namespace OpenSim.Data.MySQL
public Hashtable GetUserAttachments(UUID agentID)
{
- MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments");
-
Dictionary param = new Dictionary();
param["?uuid"] = agentID.ToString();
+ MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments");
+
try
{
IDbCommand result = dbm.Manager.Query(
@@ -829,11 +832,11 @@ namespace OpenSim.Data.MySQL
public override void ResetAttachments(UUID userID)
{
- MySQLSuperManager dbm = GetLockedConnection("ResetAttachments");
-
Dictionary param = new Dictionary();
param["?uuid"] = userID.ToString();
+ MySQLSuperManager dbm = GetLockedConnection("ResetAttachments");
+
try
{
dbm.Manager.ExecuteParameterizedSql(
--
cgit v1.1