From cb29bcb923804e844411fb4872f55993bf29ee91 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 8 May 2012 01:03:31 +0000 Subject: Rework connection loss handling in SPMySQL, particularly to improve background loss of connections: - Attempt to fix a condition causing a reconnection loop by fixing the order of connection state check and a query variable - If a connection is lost in the background, only attempt a single reconnect instead of requiring user intervention at once - Add a new connection state to handle background disconnects - If the connection has been lost in the background but is about to be used, reconnect it automatically (informing the user of loss if appropriate) - Don't attempt background reconnections if the connection has not been used for some time (Also update localisable strings, and tweak navigator controller connection usage) --- Source/SPNavigatorController.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Source/SPNavigatorController.m') diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 54f817cc..bd144e2a 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -422,12 +422,10 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if (doc && [doc isKindOfClass:[SPDatabaseDocument class]]) { - id theConnection = [doc valueForKeyPath:@"mySQLConnection"]; - - if(!theConnection || ![theConnection isConnected]) return; + SPMySQLConnection *theConnection = [doc getConnection]; + if (!theConnection || ![theConnection isConnected]) return; NSString *connectionID = [doc connectionID]; - NSString *connectionName = [doc connectionID]; if(!connectionName || [connectionName isEqualToString:@"_"] || (connectionID && ![connectionName isEqualToString:connectionID]) ) { -- cgit v1.2.3