aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs28
1 files changed, 20 insertions, 8 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index e793b7e..fcb4c0b 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -212,16 +212,23 @@ namespace OpenSim.Data.MySQL
212 { 212 {
213 MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, m_connection); 213 MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, m_connection);
214 214
215 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 215 lock (m_dataSet)
216 { 216 {
217 if (dbReader.Read()) 217 MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow);
218 try
218 { 219 {
219 m_waitTimeout 220 if (dbReader.Read())
220 = Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway; 221 {
221 } 222 m_waitTimeout
223 = Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
224 }
222 225
223 dbReader.Close(); 226 cmd.Dispose();
224 cmd.Dispose(); 227 }
228 finally
229 {
230 dbReader.Close();
231 }
225 } 232 }
226 233
227 m_lastConnectionUse = System.DateTime.Now.Ticks; 234 m_lastConnectionUse = System.DateTime.Now.Ticks;
@@ -571,7 +578,8 @@ namespace OpenSim.Data.MySQL
571 lock (m_dataSet) 578 lock (m_dataSet)
572 { 579 {
573 CheckConnection(); 580 CheckConnection();
574 using (MySqlDataReader row = cmd.ExecuteReader()) 581 MySqlDataReader row = cmd.ExecuteReader();
582 try
575 { 583 {
576 int rev = 0; 584 int rev = 0;
577 if (row.Read()) 585 if (row.Read())
@@ -595,6 +603,10 @@ namespace OpenSim.Data.MySQL
595 603
596 m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); 604 m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
597 } 605 }
606 finally
607 {
608 row.Close();
609 }
598 } 610 }
599 return terret; 611 return terret;
600 } 612 }