mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-15 16:11:42 +00:00
fix logic of -longestIdle
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38575 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1fd4b0abe9
commit
23870a60a2
1 changed files with 8 additions and 10 deletions
18
SQLClient.m
18
SQLClient.m
|
@ -1417,8 +1417,6 @@ static int poolConnections = 0;
|
|||
NSTimeInterval t0;
|
||||
NSTimeInterval t1;
|
||||
|
||||
NSAssert([other isKindOfClass: SQLClientClass], NSInvalidArgumentException);
|
||||
|
||||
t0 = _lastOperation;
|
||||
if (t0 < _lastStart)
|
||||
{
|
||||
|
@ -1429,7 +1427,7 @@ static int poolConnections = 0;
|
|||
t0 = 0.0;
|
||||
}
|
||||
|
||||
if (YES == [other isProxy])
|
||||
if (NO == [other isKindOfClass: SQLClientClass] || YES == [other isProxy])
|
||||
{
|
||||
t1 = 0.0;
|
||||
}
|
||||
|
@ -1440,21 +1438,21 @@ static int poolConnections = 0;
|
|||
{
|
||||
t1 = other->_lastStart;
|
||||
}
|
||||
if (NO == connected || 0 != other->_connectFails)
|
||||
if (NO == other->connected || 0 != other->_connectFails)
|
||||
{
|
||||
t1 = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (t0 <= 0.0 && t1 <= 0.0)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if (t1 <= t0)
|
||||
if (t1 > 0.0 && t1 <= t0)
|
||||
{
|
||||
return other;
|
||||
}
|
||||
return self;
|
||||
if (t0 > 0.0 && t0 <= t1)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString*) name
|
||||
|
|
Loading…
Reference in a new issue