diff options
author | Max <post@wickenrode.com> | 2016-02-18 02:49:28 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2016-02-18 02:49:28 +0100 |
commit | f2575a3a755e625330263c06403d167f7e7901d4 (patch) | |
tree | 80771ed692531184b2b9b13579b4f7e3506cd593 /Frameworks/SPMySQLFramework | |
parent | a19f4b3754e331787aed418866ed31e97ff2151a (diff) | |
download | sequelpro-f2575a3a755e625330263c06403d167f7e7901d4.tar.gz sequelpro-f2575a3a755e625330263c06403d167f7e7901d4.tar.bz2 sequelpro-f2575a3a755e625330263c06403d167f7e7901d4.zip |
* Change a while() to do while; to help code analysis
* Add log message (possibly related to #2258)
Diffstat (limited to 'Frameworks/SPMySQLFramework')
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m | 5 | ||||
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m index e5a48d48..d96ebe52 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m @@ -296,7 +296,7 @@ [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 @@ [self _lockConnection]; NSAssert(mySQLConnection != NULL, @"mySQLConnection has disappeared while checking it!"); - queryAttemptsAllowed--; - } + } while (--queryAttemptsAllowed > 0); id theResult = nil; diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m index e102c24d..286296af 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m @@ -928,7 +928,10 @@ static uint64_t _elapsedMicroSecondsSinceAbsoluteTime(uint64_t comparisonTime) 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]; |