let storer _offset len = sendContentWith $ \bs -> liftIO $ do
atomically $ putTMVar bsv (len, bs)
atomically $ takeTMVar endv
- case serverP2PConnection conn of
- Just c ->
- signalFullyConsumedByteString $
- connOhdl c
- Nothing -> noop
+ signalFullyConsumedByteString $
+ connOhdl $ serverP2PConnection conn
return $ \v -> do
liftIO $ atomically $ putTMVar validityv v
return True
data P2PConnectionPair = P2PConnectionPair
{ clientRunState :: RunState
, clientP2PConnection :: P2PConnection
- , serverP2PConnection :: Maybe P2PConnection
+ , serverP2PConnection :: P2PConnection
, releaseP2PConnection :: IO ()
-- ^ Releases a P2P connection, which can be reused for other
-- requests.
return $ Right $ P2PConnectionPair
{ clientRunState = clientrunst
, clientP2PConnection = clientconn
- , serverP2PConnection = Just serverconn
+ , serverP2PConnection = serverconn
, releaseP2PConnection = releaseconn
, closeP2PConnection = releaseconn
}
-> ProxyConnection
-> IO (Either ConnectionProblem P2PConnectionPair)
proxyConnection relv connparams workerpool proxyconn = do
- (clientconn, proxyfromclientconn) <- mkP2PConnectionPair connparams
- ("http client", "proxy")
+ (clientconn, proxyfromclientconn) <-
+ mkP2PConnectionPair connparams ("http client", "proxy")
clientrunst <- mkClientRunState connparams
proxyfromclientrunst <- mkClientRunState connparams
asyncworker <- async $
return $ Right $ P2PConnectionPair
{ clientRunState = clientrunst
, clientP2PConnection = clientconn
- , serverP2PConnection = Nothing
+ , serverP2PConnection = proxyfromclientconn
, releaseP2PConnection = releaseconn True
, closeP2PConnection = releaseconn False
}
## work notes
-* http server proxying hangs when git-annex copy --to it,
- and git-annex get --from it, maybe other
- times. Need to fully test.
+* http server proxying hangs on git-annex copy --to it
* http server proxying needs to get the version negotiated with the proxied
remote and feed that into the proxy function.