fix hang in GET from http p2p proxy
authorJoey Hess <joeyh@joeyh.name>
Fri, 26 Jul 2024 16:49:06 +0000 (12:49 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 26 Jul 2024 16:51:00 +0000 (12:51 -0400)
serverP2PConnection = proxyfromclientconn causes serveGet to
signalFullyConsumedByteString to it, which is what it's waiting for

P2P/Http/Server.hs
P2P/Http/State.hs
doc/todo/git-annex_proxies.mdwn

index f6e77f9180a78c2174ec37172958b3a9c41d1b32..42e06d3ee75057543e6e840f172715b91a934e4f 100644 (file)
@@ -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
index 569853f7a75aa5c11c5a23c0203835b2a5acaf5a..377357f7f9a5a5c70a8293a46fa76fcd86dbac0a 100644 (file)
@@ -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
                }
index c7d054d1e4663912825be6beca554c6d0164fcc5..1eed6540c78d3a388bacb9c8d92313397efc5c5d 100644 (file)
@@ -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.