aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-03-18 01:29:17 +0000
committerrowanbeentje <rowan@beent.je>2010-03-18 01:29:17 +0000
commit48f80fe6342b14913ffbebf5449895ff9d5e9af8 (patch)
tree5b98ec4570c28cc209a4ec701cb9e1aded7ac9d3 /Source/SPConnectionController.m
parenta8dc3ac2af642fb59c8fbed12c3a28038ef3a175 (diff)
downloadsequelpro-48f80fe6342b14913ffbebf5449895ff9d5e9af8.tar.gz
sequelpro-48f80fe6342b14913ffbebf5449895ff9d5e9af8.tar.bz2
sequelpro-48f80fe6342b14913ffbebf5449895ff9d5e9af8.zip
- Fix a couple of calls which crashed if the window had already been closed, fixing window close on query startup or after queries; this fixes http://log.sequelpro.com/view/9
- Fix an exception caused in the NavigatorController if the dbstructure has not been fetched yet
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r--Source/SPConnectionController.m16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 2e48106c..869bd35c 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -68,6 +68,7 @@
connectionSSHKeychainItemAccount = nil;
mySQLConnection = nil;
sshTunnel = nil;
+ cancellingConnection = NO;
// Load the connection nib
[NSBundle loadNibNamed:@"ConnectionView" owner:self];
@@ -165,6 +166,7 @@
if (![self checkHost]) return;
// Basic details have validated - start the connection process animating
+ cancellingConnection = NO;
[addToFavoritesButton setHidden:YES];
[addToFavoritesButton display];
[helpButton setHidden:YES];
@@ -251,12 +253,26 @@
}
/*
+ * Cancel connection.
+ * Currently only cleans up the SSH connection (MySQL connection isn't threaded)
+ */
+- (void)cancelConnection
+{
+ if (!sshTunnel) return;
+ cancellingConnection = YES;
+ [sshTunnel disconnect];
+ [sshTunnel release];
+ sshTunnel = nil;
+}
+
+/*
* A callback function for the SSH Tunnel setup process - will be called on a connection
* state change, allowing connection to fail or proceed as appropriate. If successful,
* will call initiateMySQLConnection.
*/
- (void)sshTunnelCallback:(SPSSHTunnel *)theTunnel
{
+ if (cancellingConnection) return;
NSInteger newState = [theTunnel state];
if (newState == PROXY_STATE_IDLE) {