diff options
author | rowanbeentje <rowan@beent.je> | 2012-10-14 16:09:45 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-10-14 16:09:45 +0000 |
commit | dc45c654aab99cbccecda192396dc8baefd5690e (patch) | |
tree | a1b0a16eb468e191177c3617fc1f3c73c3e4750f /Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories | |
parent | 7d14dae0476ee3e3ab7c2fac391c506ac320d5ea (diff) | |
download | sequelpro-dc45c654aab99cbccecda192396dc8baefd5690e.tar.gz sequelpro-dc45c654aab99cbccecda192396dc8baefd5690e.tar.bz2 sequelpro-dc45c654aab99cbccecda192396dc8baefd5690e.zip |
- In the SPMySQL.framework, separate framework-triggered connections and disconnections from external actions, and use that separation to perform safer disconnects
- When closing a database document, add a new notification, and use that to resolve retain cycles affecting connection processes
- Improve connection controller disconnection when the document is closed, fixing crashes, by building on those two features (addresses Issue #1396)
- Use some of the new functionality to improve SSH and MySQL connection cancellation, making both cancelable in the interface and making both respond much more quickly
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories')
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Max Packet Size.m | 2 | ||||
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Max Packet Size.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Max Packet Size.m index e0bfef52..867b7fba 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Max Packet Size.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Max Packet Size.m @@ -150,7 +150,7 @@ if (newSize != NSNotFound) { // Successfully increased the global size - reconnect to use it, and return success - [self reconnect]; + [self _reconnectAllowingRetries:YES]; return YES; } } diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m index bafa1e6e..22e35648 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m @@ -222,6 +222,11 @@ lastQueryWasCancelled = NO; lastQueryWasCancelledUsingReconnect = NO; + // If a disconnect was requested, cancel the action + if (userTriggeredDisconnect) { + return nil; + } + // Check the connection state - if no connection is available, log an // error and return. if (state == SPMySQLDisconnected || state == SPMySQLConnecting) { @@ -368,6 +373,7 @@ // Unlock the connection if appropriate - if not a streaming result type. if (![theResult isKindOfClass:[SPMySQLStreamingResult class]]) { + [self _tryLockConnection]; [self _unlockConnection]; // Also perform restore if appropriate @@ -514,7 +520,6 @@ // so set up a new connection to run the KILL command. MYSQL *killerConnection = [self _makeRawMySQLConnectionWithEncoding:@"utf8" isMasterConnection:NO]; - // If the new connection was successfully set up, use it to run a KILL command. if (killerConnection) { NSStringEncoding aStringEncoding = [SPMySQLConnection stringEncodingForMySQLCharset:mysql_character_set_name(killerConnection)]; @@ -553,7 +558,7 @@ } else { NSLog(@"SPMySQL Framework: query cancellation failed due to cancellation query error (status %d)", killQueryStatus); } - } else { + } else if (!userTriggeredDisconnect) { NSLog(@"SPMySQL Framework: query cancellation failed because connection failed"); } @@ -565,13 +570,13 @@ return; } - if (state == SPMySQLDisconnecting) return; + if (state == SPMySQLDisconnecting || state == SPMySQLDisconnected) return; // Reset the connection with a reconnect. Unlock the connection beforehand, // to allow the reconnect, but lock it again afterwards to restore the expected // state (query execution process should unlock as appropriate). [self _unlockConnection]; - [self reconnect]; + [self _reconnectAllowingRetries:YES]; [self _lockConnection]; // Reset tracking bools to cover encompassed queries |