aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPSSHTunnel.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPSSHTunnel.m')
-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;