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
))
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
:: AnnexWorkerPool
-> ProxyConnectionPoolSize
-> ClusterConcurrency
- -> (AcquireP2PConnection -> Annex a)
+ -> ([UUID] -> AcquireP2PConnection -> Annex a)
-> Annex a
withP2PConnections workerpool proxyconnectionpoolsize clusterconcurrency a = do
enableInteractiveBranchAccess
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