Author: rfm
Date: Mon Jan 5 16:52:02 2015
New Revision: 38279
URL: http://svn.gna.org/viewcvs/gnustep?rev=38279&view=rev
Log:
fixup to avoid repeatedly closing/opening connections
Modified:
libs/sqlclient/trunk/SQLClient.h
libs/sqlclient/trunk/SQLClientPool.m
Modified: libs/sqlclient/trunk/SQLClient.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.h?rev=38279&r1=38278&r2=38279&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.h (original)
+++ libs/sqlclient/trunk/SQLClient.h Mon Jan 5 16:52:02 2015
@@ -1515,7 +1515,7 @@
* to the database server.<br />
* The value of minConnections is the minimum number of connected clients
* normally expected to be in the pool. The pool tries to ensure that it
- * doesn't contain more than this number of idle connected clients.<br />
+ * contains at least this number of connected clients.<br />
* The value of maxConnections must be greater than or equal to that of
* minConnections and may not be greater than 100.
* The value of minConnections must be less than or equal to that of
@@ -1530,10 +1530,7 @@
/** Puts the client back in the pool. This happens automatically
* when a client from a pool would normally be deallocated so you don't
* generally need to do it.<br />
- * Returns YES if the supplied client was from the pool, NO otherwise.<br />
- * If the swallowed client would take the count of idle client connections
- * in the pool above the configured minimum, the oldest (ie longest idle)
- * client in the pool is disconnected.
+ * Returns YES if the supplied client was from the pool, NO otherwise.
*/
- (BOOL) swallowClient: (SQLClient*)client;
Modified: libs/sqlclient/trunk/SQLClientPool.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClientPool.m?rev=38279&r1=38278&r2=38279&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClientPool.m (original)
+++ libs/sqlclient/trunk/SQLClientPool.m Mon Jan 5 16:52:02 2015
@@ -152,6 +152,9 @@
int index;
int cond = 0;
+ /* If we haven't been given a timeout, we should wait for a client
+ * indefinitely ... so we set the timeout to be in the distant future.
+ */
if (nil == when)
{
static NSDate *future = nil;
@@ -166,7 +169,7 @@
/* We want to log stuff if we don't get a client quickly.
* Ideally we get the lock straight away,
* but if not we want to log every ten seconds (and possibly
- * when we begin waiting.
+ * when we begin waiting).
*/
if (YES == [lock tryLockWhenCondition: 1])
{
@@ -492,35 +495,6 @@
}
}
- /* If we have more idle client connections than we want,
- * disconnect the longest idle first.
- */
- while (idle > 0 && (used + idle) > min)
- {
- SQLClient *oldest = nil;
-
- for (index = 0; index < max; index++)
- {
- if (NO == u[index] && YES == [c[index] connected])
- {
- if (nil == oldest)
- {
- oldest = c[index];
- }
- else
- {
- oldest = [oldest longestIdle: c[index]];
- }
- }
- }
- NS_DURING
- [oldest disconnect];
- NS_HANDLER
- NSLog(@"Failed to disconnect %@ ... %@", oldest, localException);
- NS_ENDHANDLER
- idle--;
- }
-
/* If we have fewer connections than we want, connect clients until we
* are back up to the minimum.
*/
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs