Permalink
Browse files

* Change a while() to do while; to help code analysis

* Add log message (possibly related to #2258)
  • Loading branch information...
dmoagx committed Feb 18, 2016
1 parent a19f4b3 commit f2575a3a755e625330263c06403d167f7e7901d4
@@ -296,7 +296,7 @@ - (id)queryString:(NSString *)theQueryString usingEncoding:(NSStringEncoding)the
[self _lockConnection];
unsigned long long theAffectedRowCount;
while (queryAttemptsAllowed > 0) {
do {
// While recording the overall execution time (including network lag!), run
// the raw query
@@ -342,8 +342,7 @@ - (id)queryString:(NSString *)theQueryString usingEncoding:(NSStringEncoding)the
[self _lockConnection];
NSAssert(mySQLConnection != NULL, @"mySQLConnection has disappeared while checking it!");
queryAttemptsAllowed--;
}
} while (--queryAttemptsAllowed > 0);
id theResult = nil;
@@ -928,7 +928,10 @@ - (void)_disconnect
uint64_t disconnectStartTime_t = mach_absolute_time();
while (![self _tryLockConnection]) {
usleep(100000);
if (_elapsedSecondsSinceAbsoluteTime(disconnectStartTime_t) > 10) break;
if (_elapsedSecondsSinceAbsoluteTime(disconnectStartTime_t) > 10) {
NSLog(@"%s: Could not acquire connection lock within time limit (10s). Forcing unlock!",__PRETTY_FUNCTION__);
break;
}
}
[self _unlockConnection];
[self _cancelKeepAlives];

0 comments on commit f2575a3

Please sign in to comment.