diff options
author | rowanbeentje <rowan@beent.je> | 2011-10-28 22:41:07 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2011-10-28 22:41:07 +0000 |
commit | 355c209d75793ed7a845cd9c73261a5c32732294 (patch) | |
tree | 7a98c1a8cc4c3badb5e13c5ff2b32131e2754296 /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | |
parent | 6c8e8f9e66d76858e76b8a391aa51d161801ed43 (diff) | |
download | sequelpro-355c209d75793ed7a845cd9c73261a5c32732294.tar.gz sequelpro-355c209d75793ed7a845cd9c73261a5c32732294.tar.bz2 sequelpro-355c209d75793ed7a845cd9c73261a5c32732294.zip |
- Fix an issue in MCPConnection causing connection locking if the connection has an active query and is performing actions such as encoding conversions
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m')
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index f40d79e8..3be896b1 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -761,7 +761,23 @@ static BOOL sTruncateLongFieldInLogs = YES; if (!mConnected) return NO; BOOL connectionVerified = FALSE; - + + // If the connection is currently locked, it's probably in use - no need to check + // the connection. + if ([connectionLock condition] == MCPConnectionBusy) { + + // However if a ping thread is active, might be a background ping - wait for it + // to complete, then check the connection. + if (pingThreadActive) { + while (pingThreadActive) { + usleep(10000); + } + return [self checkConnection]; + } + + return YES; + } + // Check whether the connection is still operational via a wrapped version of MySQL ping. connectionVerified = [self pingConnectionUsingLoopDelay:400]; |