From a7800682c2a2fcd9bb5c85d2f5f965486b3a72d5 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 27 Mar 2010 22:49:10 +0000 Subject: - Improve MCPConnection behaviour with respect to run loops and proxies, improving both proxy disconnection and reconnection after dropped connections - Slightly tweak SPSSHTunnel to improve proxy behaviour --- Source/SPSSHTunnel.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Source') diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index e6d9729a..46ceea97 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -163,7 +163,7 @@ - (void) connect { localPort = 0; - + if (connectionState != PROXY_STATE_IDLE) return; [debugMessages removeAllObjects]; [NSThread detachNewThreadSelector:@selector(launchTask:) toTarget: self withObject: nil ]; @@ -350,12 +350,10 @@ - (void)disconnect { if (connectionState == PROXY_STATE_IDLE) return; - + // Before terminating the tunnel, check that it's actually running. This is to accommodate tunnels which // suddenly disappear as a result of network disconnections. if ([task isRunning]) [task terminate]; - - connectionState = PROXY_STATE_IDLE; if (delegate) [delegate performSelectorOnMainThread:stateChangeSelector withObject:self waitUntilDone:NO]; } -- cgit v1.2.3