aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionController.m
diff options
context:
space:
mode:
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) {