From 9a378b18fb1fe1b87bc9182e964eddabb6779b86 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 13 Mar 2013 14:10:29 -0400 Subject: webapp: Set locally paired repositories to a lower cost than other network remotes. --- Assistant/MakeRemote.hs | 6 ++++-- Assistant/Pairing/MakeRemote.hs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Assistant') diff --git a/Assistant/MakeRemote.hs b/Assistant/MakeRemote.hs index 113018363..8d4e3a1ba 100644 --- a/Assistant/MakeRemote.hs +++ b/Assistant/MakeRemote.hs @@ -20,15 +20,17 @@ import qualified Command.InitRemote import Logs.UUID import Logs.Remote import Git.Remote +import Config import qualified Data.Text as T import qualified Data.Map as M {- Sets up and begins syncing with a new ssh or rsync remote. -} -makeSshRemote :: Bool -> SshData -> Assistant Remote -makeSshRemote forcersync sshdata = do +makeSshRemote :: Bool -> SshData -> Maybe Int -> Assistant Remote +makeSshRemote forcersync sshdata mcost = do r <- liftAnnex $ addRemote $ maker (sshRepoName sshdata) sshurl + liftAnnex $ maybe noop (setRemoteCost r) mcost syncNewRemote r return r where diff --git a/Assistant/Pairing/MakeRemote.hs b/Assistant/Pairing/MakeRemote.hs index 24a83b43c..e4aab434d 100644 --- a/Assistant/Pairing/MakeRemote.hs +++ b/Assistant/Pairing/MakeRemote.hs @@ -12,6 +12,7 @@ import Assistant.Ssh import Assistant.Pairing import Assistant.Pairing.Network import Assistant.MakeRemote +import Config import Network.Socket import qualified Data.Text as T @@ -42,7 +43,7 @@ finishedLocalPairing msg keypair = do , "git-annex-shell -c configlist " ++ T.unpack (sshDirectory sshdata) ] Nothing - void $ makeSshRemote False sshdata + void $ makeSshRemote False sshdata (Just semiExpensiveRemoteCost) {- Mostly a straightforward conversion. Except: - * Determine the best hostname to use to contact the host. -- cgit v1.2.3