aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-16 04:39:41 +0000
committerMelanie Thielker2008-11-16 04:39:41 +0000
commit8e119130c506a2debff44a991af7a9106d188759 (patch)
treeed39df8e49a527ceac5d220ff2e679b0bd845327 /OpenSim/Data
parentReinstate the IM sending from scripts and from autoreturn (diff)
downloadopensim-SC-8e119130c506a2debff44a991af7a9106d188759.zip
opensim-SC-8e119130c506a2debff44a991af7a9106d188759.tar.gz
opensim-SC-8e119130c506a2debff44a991af7a9106d188759.tar.bz2
opensim-SC-8e119130c506a2debff44a991af7a9106d188759.tar.xz
Make a quick stab at the "Open data reader" issue.
MySqlDataReader needs to be Close()d explicitly. Disposing it or letting it fall out of scope will not free it's hold on the connection.
Diffstat (limited to '')
-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 }