diff options
author | Melanie Thielker | 2008-11-01 15:10:45 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-01 15:10:45 +0000 |
commit | 4fb2d7037358c320540edc3b2f5660e3cb3531a6 (patch) | |
tree | c97f8d429396c8ac11a5d4df411506c4f4902df4 | |
parent | Update svn properties, minor formatting cleanup. (diff) | |
download | opensim-SC-4fb2d7037358c320540edc3b2f5660e3cb3531a6.zip opensim-SC-4fb2d7037358c320540edc3b2f5660e3cb3531a6.tar.gz opensim-SC-4fb2d7037358c320540edc3b2f5660e3cb3531a6.tar.bz2 opensim-SC-4fb2d7037358c320540edc3b2f5660e3cb3531a6.tar.xz |
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
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGridData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 33 |
2 files changed, 21 insertions, 18 deletions
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 | |||
403 | /// <returns>The sim profile</returns> | 403 | /// <returns>The sim profile</returns> |
404 | override public RegionProfileData GetProfileByString(string regionName) | 404 | override public RegionProfileData GetProfileByString(string regionName) |
405 | { | 405 | { |
406 | MySQLSuperManager dbm = GetLockedConnection(); | ||
407 | |||
408 | if (regionName.Length > 2) | 406 | if (regionName.Length > 2) |
409 | { | 407 | { |
408 | MySQLSuperManager dbm = GetLockedConnection(); | ||
409 | |||
410 | try | 410 | try |
411 | { | 411 | { |
412 | Dictionary<string, string> param = new Dictionary<string, string>(); | 412 | Dictionary<string, string> param = new Dictionary<string, string>(); |
@@ -436,8 +436,8 @@ namespace OpenSim.Data.MySQL | |||
436 | dbm.Release(); | 436 | dbm.Release(); |
437 | 437 | ||
438 | } | 438 | } |
439 | dbm.Release(); | ||
439 | } | 440 | } |
440 | dbm.Release(); | ||
441 | m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters"); | 441 | m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters"); |
442 | return null; | 442 | return null; |
443 | } | 443 | } |
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 | |||
208 | 208 | ||
209 | public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | 209 | public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) |
210 | { | 210 | { |
211 | MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend"); | ||
212 | |||
213 | int dtvalue = Util.UnixTimeSinceEpoch(); | 211 | int dtvalue = Util.UnixTimeSinceEpoch(); |
214 | 212 | ||
215 | Dictionary<string, string> param = new Dictionary<string, string>(); | 213 | Dictionary<string, string> param = new Dictionary<string, string>(); |
@@ -218,6 +216,8 @@ namespace OpenSim.Data.MySQL | |||
218 | param["?friendPerms"] = perms.ToString(); | 216 | param["?friendPerms"] = perms.ToString(); |
219 | param["?datetimestamp"] = dtvalue.ToString(); | 217 | param["?datetimestamp"] = dtvalue.ToString(); |
220 | 218 | ||
219 | MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend"); | ||
220 | |||
221 | try | 221 | try |
222 | { | 222 | { |
223 | IDbCommand adder = | 223 | IDbCommand adder = |
@@ -252,12 +252,12 @@ namespace OpenSim.Data.MySQL | |||
252 | 252 | ||
253 | public override void RemoveUserFriend(UUID friendlistowner, UUID friend) | 253 | public override void RemoveUserFriend(UUID friendlistowner, UUID friend) |
254 | { | 254 | { |
255 | MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend"); | ||
256 | |||
257 | Dictionary<string, string> param = new Dictionary<string, string>(); | 255 | Dictionary<string, string> param = new Dictionary<string, string>(); |
258 | param["?ownerID"] = friendlistowner.ToString(); | 256 | param["?ownerID"] = friendlistowner.ToString(); |
259 | param["?friendID"] = friend.ToString(); | 257 | param["?friendID"] = friend.ToString(); |
260 | 258 | ||
259 | MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend"); | ||
260 | |||
261 | try | 261 | try |
262 | { | 262 | { |
263 | IDbCommand updater = | 263 | IDbCommand updater = |
@@ -286,13 +286,13 @@ namespace OpenSim.Data.MySQL | |||
286 | 286 | ||
287 | public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | 287 | public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) |
288 | { | 288 | { |
289 | MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms"); | ||
290 | |||
291 | Dictionary<string, string> param = new Dictionary<string, string>(); | 289 | Dictionary<string, string> param = new Dictionary<string, string>(); |
292 | param["?ownerID"] = friendlistowner.ToString(); | 290 | param["?ownerID"] = friendlistowner.ToString(); |
293 | param["?friendID"] = friend.ToString(); | 291 | param["?friendID"] = friend.ToString(); |
294 | param["?friendPerms"] = perms.ToString(); | 292 | param["?friendPerms"] = perms.ToString(); |
295 | 293 | ||
294 | MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms"); | ||
295 | |||
296 | try | 296 | try |
297 | { | 297 | { |
298 | IDbCommand updater = | 298 | IDbCommand updater = |
@@ -317,12 +317,13 @@ namespace OpenSim.Data.MySQL | |||
317 | 317 | ||
318 | public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) | 318 | public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) |
319 | { | 319 | { |
320 | MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList"); | ||
321 | List<FriendListItem> Lfli = new List<FriendListItem>(); | 320 | List<FriendListItem> Lfli = new List<FriendListItem>(); |
322 | 321 | ||
323 | Dictionary<string, string> param = new Dictionary<string, string>(); | 322 | Dictionary<string, string> param = new Dictionary<string, string>(); |
324 | param["?ownerID"] = friendlistowner.ToString(); | 323 | param["?ownerID"] = friendlistowner.ToString(); |
325 | 324 | ||
325 | MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList"); | ||
326 | |||
326 | try | 327 | try |
327 | { | 328 | { |
328 | //Left Join userfriends to itself | 329 | //Left Join userfriends to itself |
@@ -373,8 +374,6 @@ namespace OpenSim.Data.MySQL | |||
373 | 374 | ||
374 | public override List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) | 375 | public override List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) |
375 | { | 376 | { |
376 | MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults"); | ||
377 | |||
378 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); | 377 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); |
379 | 378 | ||
380 | Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); | 379 | Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); |
@@ -386,6 +385,8 @@ namespace OpenSim.Data.MySQL | |||
386 | Dictionary<string, string> param = new Dictionary<string, string>(); | 385 | Dictionary<string, string> param = new Dictionary<string, string>(); |
387 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%"; | 386 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%"; |
388 | param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%"; | 387 | param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%"; |
388 | MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults"); | ||
389 | |||
389 | try | 390 | try |
390 | { | 391 | { |
391 | IDbCommand result = | 392 | IDbCommand result = |
@@ -419,6 +420,8 @@ namespace OpenSim.Data.MySQL | |||
419 | } | 420 | } |
420 | else if (querysplit.Length == 1) | 421 | else if (querysplit.Length == 1) |
421 | { | 422 | { |
423 | MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults"); | ||
424 | |||
422 | try | 425 | try |
423 | { | 426 | { |
424 | Dictionary<string, string> param = new Dictionary<string, string>(); | 427 | Dictionary<string, string> param = new Dictionary<string, string>(); |
@@ -520,12 +523,12 @@ namespace OpenSim.Data.MySQL | |||
520 | /// <remarks>is it still used ?</remarks> | 523 | /// <remarks>is it still used ?</remarks> |
521 | public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey) | 524 | public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey) |
522 | { | 525 | { |
523 | MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey"); | ||
524 | |||
525 | Dictionary<string, string> param = new Dictionary<string, string>(); | 526 | Dictionary<string, string> param = new Dictionary<string, string>(); |
526 | param["?UUID"] = AgentID.ToString(); | 527 | param["?UUID"] = AgentID.ToString(); |
527 | param["?webLoginKey"] = WebLoginKey.ToString(); | 528 | param["?webLoginKey"] = WebLoginKey.ToString(); |
528 | 529 | ||
530 | MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey"); | ||
531 | |||
529 | try | 532 | try |
530 | { | 533 | { |
531 | dbm.Manager.ExecuteParameterizedSql( | 534 | dbm.Manager.ExecuteParameterizedSql( |
@@ -785,11 +788,11 @@ namespace OpenSim.Data.MySQL | |||
785 | 788 | ||
786 | public Hashtable GetUserAttachments(UUID agentID) | 789 | public Hashtable GetUserAttachments(UUID agentID) |
787 | { | 790 | { |
788 | MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments"); | ||
789 | |||
790 | Dictionary<string, string> param = new Dictionary<string, string>(); | 791 | Dictionary<string, string> param = new Dictionary<string, string>(); |
791 | param["?uuid"] = agentID.ToString(); | 792 | param["?uuid"] = agentID.ToString(); |
792 | 793 | ||
794 | MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments"); | ||
795 | |||
793 | try | 796 | try |
794 | { | 797 | { |
795 | IDbCommand result = dbm.Manager.Query( | 798 | IDbCommand result = dbm.Manager.Query( |
@@ -829,11 +832,11 @@ namespace OpenSim.Data.MySQL | |||
829 | 832 | ||
830 | public override void ResetAttachments(UUID userID) | 833 | public override void ResetAttachments(UUID userID) |
831 | { | 834 | { |
832 | MySQLSuperManager dbm = GetLockedConnection("ResetAttachments"); | ||
833 | |||
834 | Dictionary<string, string> param = new Dictionary<string, string>(); | 835 | Dictionary<string, string> param = new Dictionary<string, string>(); |
835 | param["?uuid"] = userID.ToString(); | 836 | param["?uuid"] = userID.ToString(); |
836 | 837 | ||
838 | MySQLSuperManager dbm = GetLockedConnection("ResetAttachments"); | ||
839 | |||
837 | try | 840 | try |
838 | { | 841 | { |
839 | dbm.Manager.ExecuteParameterizedSql( | 842 | dbm.Manager.ExecuteParameterizedSql( |