summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-13 19:30:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-13 19:30:13 -0400
commitb3bdaf1a6f99b476da3f9821d83148f75be62121 (patch)
tree905c3771af445f66827918de25e9dc1b810a39c7 /Annex
parentc1c5ff5626edbd4474b327dc8b8e66bd218b3e5e (diff)
only run sshCleanup when the command actually used ssh connection caching
Optimises query commands that do not. More importantly, avoids any ssh connection cleanup delay causing problems at the end of such commands.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Ssh.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index aedf418f8..583a590ae 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -9,7 +9,6 @@
module Annex.Ssh (
sshCachingOptions,
- sshCleanup,
sshCacheDir,
sshReadPort,
) where
@@ -24,6 +23,7 @@ import qualified Build.SysConfig as SysConfig
import qualified Annex
import Config
import Utility.Env
+import Types.CleanupActions
#ifndef mingw32_HOST_OS
import Annex.Perms
#endif
@@ -31,7 +31,9 @@ import Annex.Perms
{- Generates parameters to ssh to a given host (or user@host) on a given
- port, with connection caching. -}
sshCachingOptions :: (String, Maybe Integer) -> [CommandParam] -> Annex [CommandParam]
-sshCachingOptions (host, port) opts = go =<< sshInfo (host, port)
+sshCachingOptions (host, port) opts = do
+ Annex.addCleanup SshCachingCleanup sshCleanup
+ go =<< sshInfo (host, port)
where
go (Nothing, params) = ret params
go (Just socketfile, params) = do
@@ -146,6 +148,7 @@ sshCleanup = go =<< sshCacheDir
[ Params "-O stop"
] ++ params ++ [Param "any"])
{ cwd = Just dir }
+ liftIO $ nukeFile socketfile
-- Cannot remove the lock file; other processes may
-- be waiting on our exclusive lock to use it.