fix reversion in GET from proxy over http
4f3ae96666
caused a hang in GET,
which git-annex testremote could reliably cause.
The problem is that closing both P2P handles before waiting on the
asyncworker prevents all the DATA from getting sent.
The solution is to only close the P2P handles early when the
P2PConnection is being closed. When it's being released, let the
asyncworker finish. closeP2PConnection is called in GET when it was
unable to send all data, and in PUT when it did not receive all the
data, and in both cases closing the P2P handles early is ok.
This commit is contained in:
parent
6af44b9de6
commit
7402ae61d9
1 changed files with 10 additions and 4 deletions
|
@ -378,12 +378,18 @@ proxyConnection proxyconnectionpoolsize relv connparams workerpool proxypool pro
|
|||
liftIO $ runNetProto proxyfromclientrunst proxyfromclientconn $
|
||||
P2P.net P2P.receiveMessage
|
||||
|
||||
let releaseconn returntopool = do
|
||||
let closebothsides = do
|
||||
liftIO $ closeConnection proxyfromclientconn
|
||||
liftIO $ closeConnection clientconn
|
||||
|
||||
let releaseconn connstillusable = do
|
||||
atomically $ void $ tryPutTMVar relv $ do
|
||||
liftIO $ closeConnection proxyfromclientconn
|
||||
liftIO $ closeConnection clientconn
|
||||
unless connstillusable
|
||||
closebothsides
|
||||
r <- liftIO $ wait asyncworker
|
||||
if returntopool
|
||||
when connstillusable
|
||||
closebothsides
|
||||
if connstillusable
|
||||
then liftIO $ do
|
||||
now <- getPOSIXTime
|
||||
evicted <- atomically $ putProxyConnectionPool proxypool proxyconnectionpoolsize connparams $
|
||||
|
|
Loading…
Reference in a new issue