diff --git a/Command/P2PHttp.hs b/Command/P2PHttp.hs index ec37bf6d0a..51f992cb91 100644 --- a/Command/P2PHttp.hs +++ b/Command/P2PHttp.hs @@ -16,7 +16,6 @@ import P2P.Http.Server import P2P.Http.Url import qualified P2P.Protocol as P2P import Utility.Env -import Annex.UUID import Servant import qualified Network.Wai.Handler.Warp as Warp @@ -103,19 +102,17 @@ optParser _ = Options )) seek :: Options -> CommandSeek -seek o = do - u <- getUUID - getAnnexWorkerPool $ \workerpool -> - withP2PConnections workerpool - (fromMaybe 1 $ proxyConnectionsOption o) - (fromMaybe 1 $ clusterJobsOption o) - (go u workerpool) +seek o = getAnnexWorkerPool $ \workerpool -> + withP2PConnections workerpool + (fromMaybe 1 $ proxyConnectionsOption o) + (fromMaybe 1 $ clusterJobsOption o) + (go workerpool) where - go u workerpool acquireconn = liftIO $ do + go workerpool servinguuids acquireconn = liftIO $ do authenv <- getAuthEnv st <- mkP2PHttpServerState acquireconn workerpool $ mkGetServerMode authenv o - let mst = M.singleton u st + let mst = M.fromList $ zip servinguuids (repeat st) let settings = Warp.setPort port $ Warp.setHost host $ Warp.defaultSettings case (certFileOption o, privateKeyFileOption o) of diff --git a/P2P/Http/State.hs b/P2P/Http/State.hs index 24d430957e..a9df861220 100644 --- a/P2P/Http/State.hs +++ b/P2P/Http/State.hs @@ -213,7 +213,7 @@ withP2PConnections :: AnnexWorkerPool -> ProxyConnectionPoolSize -> ClusterConcurrency - -> (AcquireP2PConnection -> Annex a) + -> ([UUID] -> AcquireP2PConnection -> Annex a) -> Annex a withP2PConnections workerpool proxyconnectionpoolsize clusterconcurrency a = do enableInteractiveBranchAccess @@ -228,7 +228,8 @@ withP2PConnections workerpool proxyconnectionpoolsize clusterconcurrency a = do let endit = do liftIO $ atomically $ putTMVar endv () liftIO $ wait asyncservicer - a (acquireconn reqv) `finally` endit + let servinguuids = myuuid : map proxyRemoteUUID (maybe [] S.toList myproxies) + a servinguuids (acquireconn reqv) `finally` endit where acquireconn reqv connparams = do respvar <- newEmptyTMVarIO