ssh connection caching
Ssh connection caching is now enabled automatically by git-annex. Only one ssh connection is made to each host per git-annex run, which can speed some things up a lot, as well as avoiding repeated password prompts. Concurrent git-annex processes also share ssh connections. Cached ssh connections are shut down when git-annex exits. Note: The rsync special remote does not yet participate in the ssh connection caching.
This commit is contained in:
parent
25f998679c
commit
47250a153a
9 changed files with 173 additions and 23 deletions
|
@ -7,25 +7,21 @@
|
|||
|
||||
module Remote.Helper.Ssh where
|
||||
|
||||
import Common
|
||||
import Common.Annex
|
||||
import qualified Git
|
||||
import qualified Git.Url
|
||||
import Types
|
||||
import Config
|
||||
import Annex.UUID
|
||||
import Annex.Ssh
|
||||
|
||||
{- Generates parameters to ssh to a repository's host and run a command.
|
||||
- Caller is responsible for doing any neccessary shellEscaping of the
|
||||
- passed command. -}
|
||||
sshToRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam]
|
||||
sshToRepo repo sshcmd = do
|
||||
s <- getConfig repo "ssh-options" ""
|
||||
let sshoptions = map Param (words s)
|
||||
let sshport = case Git.Url.port repo of
|
||||
Nothing -> []
|
||||
Just p -> [Param "-p", Param (show p)]
|
||||
let sshhost = Param $ Git.Url.hostuser repo
|
||||
return $ sshoptions ++ sshport ++ [sshhost] ++ sshcmd
|
||||
opts <- map Param . words <$> getConfig repo "ssh-options" ""
|
||||
params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo)
|
||||
return $ opts ++ params ++ sshcmd
|
||||
|
||||
{- Generates parameters to run a git-annex-shell command on a remote
|
||||
- repository. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue