From 210649f0d4c55b840fc5886fe41e7d4505fa5097 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Feb 2010 17:38:05 +0000 Subject: Make an exception report more clear. Fix a database access in Presence to conform to the changes in the generic table handler. --- OpenSim/Data/MySQL/MySQLPresenceData.cs | 37 ++++++++++++++--------- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 +- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index 4950f7f..fcbe3d6 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs @@ -122,26 +122,33 @@ namespace OpenSim.Data.MySQL cmd.CommandText = String.Format("select * from {0} where UserID=?UserID", m_Realm); cmd.Parameters.AddWithValue("?UserID", userID); +; + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); - using (IDataReader reader = cmd.ExecuteReader()) - { + cmd.Connection = dbcon; - List deleteSessions = new List(); - int online = 0; - - while(reader.Read()) + using (IDataReader reader = cmd.ExecuteReader()) { - if (bool.Parse(reader["Online"].ToString())) - online++; - else - deleteSessions.Add(new UUID(reader["SessionID"].ToString())); - } - if (online == 0 && deleteSessions.Count > 0) - deleteSessions.RemoveAt(0); + List deleteSessions = new List(); + int online = 0; + + while(reader.Read()) + { + if (bool.Parse(reader["Online"].ToString())) + online++; + else + deleteSessions.Add(new UUID(reader["SessionID"].ToString())); + } - foreach (UUID s in deleteSessions) - Delete("SessionID", s.ToString()); + if (online == 0 && deleteSessions.Count > 0) + deleteSessions.RemoveAt(0); + + foreach (UUID s in deleteSessions) + Delete("SessionID", s.ToString()); + } } } } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index a3f52ff..ba50e3f 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -240,7 +240,7 @@ namespace OpenSim.Services.LLLoginService } catch (Exception e) { - m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2}", firstName, lastName, e.StackTrace); + m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2}", firstName, lastName, e.ToString()); if (m_PresenceService != null) m_PresenceService.LogoutAgent(session, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); return LLFailedLoginResponse.InternalError; -- cgit v1.1