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