Modified:
branches/5.1/Driver/Source/MySqlPoolManager.cs
branches/5.1/TestSuite/Source/PoolingTests.cs
Log:
merged
Modified: branches/5.1/Driver/Source/MySqlPoolManager.cs
===================================================================
--- branches/5.1/Driver/Source/MySqlPoolManager.cs 2008-05-05 17:10:22 UTC (rev 1275)
+++ branches/5.1/Driver/Source/MySqlPoolManager.cs 2008-05-05 20:21:08 UTC (rev 1276)
@@ -55,26 +55,38 @@
public static void RemoveConnection(Driver driver)
{
- lock (pools.SyncRoot)
+ string key = driver.Settings.GetConnectionString(true);
+ MySqlPool pool = (MySqlPool) pools[key];
+
+ // if we can't find the pool but we did get a thread id then we assume
+ // something is bad wrong. If we didn't get a thread id then we assume that
+ // the driver connection info was bogus and that led to the pool failing
+ // to create
+ if (pool == null)
{
- string key = driver.Settings.GetConnectionString(true);
- MySqlPool pool = (MySqlPool) pools[key];
- if (pool == null)
+ if (driver.ThreadID != -1)
throw new MySqlException("Pooling exception: Unable to find original
pool for connection");
+ }
+ else
pool.RemoveConnection(driver);
- }
}
public static void ReleaseConnection(Driver driver)
{
- lock (pools.SyncRoot)
+ string key = driver.Settings.GetConnectionString(true);
+ MySqlPool pool = (MySqlPool) pools[key];
+
+ // if we can't find the pool but we did get a thread id then we assume
+ // something is bad wrong. If we didn't get a thread id then we assume that
+ // the driver connection info was bogus and that led to the pool failing
+ // to create
+ if (pool == null)
{
- string key = driver.Settings.GetConnectionString(true);
- MySqlPool pool = (MySqlPool) pools[key];
- if (pool == null)
+ if (driver.ThreadID != -1)
throw new MySqlException("Pooling exception: Unable to find original
pool for connection");
+ }
+ else
pool.ReleaseConnection(driver);
- }
}
}
}
\ No newline at end of file
Modified: branches/5.1/TestSuite/Source/PoolingTests.cs
===================================================================
--- branches/5.1/TestSuite/Source/PoolingTests.cs 2008-05-05 17:10:22 UTC (rev 1275)
+++ branches/5.1/TestSuite/Source/PoolingTests.cs 2008-05-05 20:21:08 UTC (rev 1276)
@@ -600,6 +600,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
| Thread |
|---|
| • Connector/NET commit: r1276 - in branches/5.1: Driver/Source TestSuite/Source | rburnett | 5 May |