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:
Richard Frith-MacDonald 2015-05-27 06:02:43 +00:00
parent 1fd4b0abe9
commit 23870a60a2

View file

@ -1417,8 +1417,6 @@ static int poolConnections = 0;
NSTimeInterval t0; NSTimeInterval t0;
NSTimeInterval t1; NSTimeInterval t1;
NSAssert([other isKindOfClass: SQLClientClass], NSInvalidArgumentException);
t0 = _lastOperation; t0 = _lastOperation;
if (t0 < _lastStart) if (t0 < _lastStart)
{ {
@ -1429,7 +1427,7 @@ static int poolConnections = 0;
t0 = 0.0; t0 = 0.0;
} }
if (YES == [other isProxy]) if (NO == [other isKindOfClass: SQLClientClass] || YES == [other isProxy])
{ {
t1 = 0.0; t1 = 0.0;
} }
@ -1440,21 +1438,21 @@ static int poolConnections = 0;
{ {
t1 = other->_lastStart; t1 = other->_lastStart;
} }
if (NO == connected || 0 != other->_connectFails) if (NO == other->connected || 0 != other->_connectFails)
{ {
t1 = 0.0; t1 = 0.0;
} }
} }
if (t0 <= 0.0 && t1 <= 0.0) if (t1 > 0.0 && t1 <= t0)
{
return nil;
}
if (t1 <= t0)
{ {
return other; return other;
} }
return self; if (t0 > 0.0 && t0 <= t1)
{
return self;
}
return nil;
} }
- (NSString*) name - (NSString*) name