aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-07-13 00:33:49 +0000
committerrowanbeentje <rowan@beent.je>2010-07-13 00:33:49 +0000
commit52011b886bc031b99a1a359fa17b5e5469e2046d (patch)
treeb1741fd470e0a5ed3cbdcf3f102fa8e9a5a6d15e /Source
parenta6ada15b76adec570758807136b6fc9c95c8b6f3 (diff)
downloadsequelpro-52011b886bc031b99a1a359fa17b5e5469e2046d.tar.gz
sequelpro-52011b886bc031b99a1a359fa17b5e5469e2046d.tar.bz2
sequelpro-52011b886bc031b99a1a359fa17b5e5469e2046d.zip
Improve handling of network drops, including a new automatic reconnection attempt, as well as improved handling of networks not present. This addresses Issue #657.
In MCPKit: - Disable MySQL automatic reconnection, and add our own reconnection code for greater consistency - If no network is available, delay reconnects by a short period to allow the network to come back up - Improved handling of proxy disconnects In SPSSHTunnel: - Improved handling of SSH tunnel disconnects, improving automatic reconnection via MCPKit and fixing potential memory/logic tramping. Also remove the "Retry" button from the Disconnected dialog, leaving only the choices "Reconnect" or "Disconnect".
Diffstat (limited to 'Source')
-rw-r--r--Source/SPSSHTunnel.m15
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index 59acb9e0..0cf2a724 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -278,7 +278,6 @@
taskArguments = [[NSMutableArray alloc] init];
[taskArguments addObject:@"-N"]; // Tunnel only
[taskArguments addObject:@"-v"]; // Verbose mode for messages
-// [taskArguments addObject:@"-C"]; // TODO: compression?
[taskArguments addObject:@"-M"]; // Places the ssh client into 'master' mode for connection sharing
[taskArguments addObject:@"-o ExitOnForwardFailure=yes"];
[taskArguments addObject:[NSString stringWithFormat:@"-o ConnectTimeout=%ld", (long)connectionTimeout]];
@@ -347,6 +346,13 @@
// Listen for output
[task waitUntilExit];
+
+ // On tunnel close, clean up, ready for re-use if the delegate reconnects.
+ [task release], task = nil;
+ [standardError release], standardError = nil;
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:@"NSFileHandleDataAvailableNotification"
+ object:nil];
// If the task closed unexpectedly, alert appropriately
if (connectionState != PROXY_STATE_IDLE) {
@@ -356,16 +362,9 @@
if (delegate) [delegate performSelectorOnMainThread:stateChangeSelector withObject:self waitUntilDone:NO];
}
- // On tunnel close, clean up
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:@"NSFileHandleDataAvailableNotification"
- object:nil];
-
// Run the run loop for a short time to ensure all task/pipe callbacks are dealt with
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
- [task release], task = nil;
- [standardError release], standardError = nil;
[taskEnvironment release], taskEnvironment = nil;
[taskArguments release], taskArguments = nil;