fix hang in GET from http p2p proxy
serverP2PConnection = proxyfromclientconn causes serveGet to signalFullyConsumedByteString to it, which is what it's waiting for
This commit is contained in:
parent
60ccbc4fe6
commit
576ec6ed71
3 changed files with 8 additions and 13 deletions
|
@ -119,11 +119,8 @@ serveGet st su apiver (B64Key k) cu bypass baf startat sec auth = do
|
|||
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
|
||||
|
|
|
@ -248,7 +248,7 @@ withP2PConnections workerpool a = do
|
|||
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.
|
||||
|
@ -288,7 +288,7 @@ localP2PConnectionPair connparams relv startworker = do
|
|||
return $ Right $ P2PConnectionPair
|
||||
{ clientRunState = clientrunst
|
||||
, clientP2PConnection = clientconn
|
||||
, serverP2PConnection = Just serverconn
|
||||
, serverP2PConnection = serverconn
|
||||
, releaseP2PConnection = releaseconn
|
||||
, closeP2PConnection = releaseconn
|
||||
}
|
||||
|
@ -338,8 +338,8 @@ proxyConnection
|
|||
-> 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 $
|
||||
|
@ -377,7 +377,7 @@ proxyConnection relv connparams workerpool proxyconn = do
|
|||
return $ Right $ P2PConnectionPair
|
||||
{ clientRunState = clientrunst
|
||||
, clientP2PConnection = clientconn
|
||||
, serverP2PConnection = Nothing
|
||||
, serverP2PConnection = proxyfromclientconn
|
||||
, releaseP2PConnection = releaseconn True
|
||||
, closeP2PConnection = releaseconn False
|
||||
}
|
||||
|
|
|
@ -28,9 +28,7 @@ Planned schedule of work:
|
|||
|
||||
## 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.
|
||||
|
|
Loading…
Reference in a new issue