diff options
author | stuconnolly <stuart02@gmail.com> | 2009-10-29 11:36:05 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-10-29 11:36:05 +0000 |
commit | e92cd4a8912a2f0fefe695bf389596e315a0643b (patch) | |
tree | 48d94e40c8097e26f7e6a54dcb6e652566f0e725 /Source/SPSSHTunnel.m | |
parent | e16c728dd900cfe39369e0afe8c85f58e4aecdf7 (diff) | |
download | sequelpro-e92cd4a8912a2f0fefe695bf389596e315a0643b.tar.gz sequelpro-e92cd4a8912a2f0fefe695bf389596e315a0643b.tar.bz2 sequelpro-e92cd4a8912a2f0fefe695bf389596e315a0643b.zip |
Before terminating the SSH tunnel task check that it's actually running to accommodate tunnels that suddenly disappear.
Diffstat (limited to 'Source/SPSSHTunnel.m')
-rw-r--r-- | Source/SPSSHTunnel.m | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index d6a5756f..18ec38b3 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -352,8 +352,13 @@ - (void)disconnect { if (connectionState == PROXY_STATE_IDLE) return; - [task terminate]; - connectionState = PROXY_STATE_IDLE; + + // 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]; } |