finish message serialization of progress meters

Any given transfer can only display 1 progress meter at a time, or so
this code assumes. In some cases, there are progress meters for
different stages of a transfer, perhaps, and that is supported by this.

This commit was sponsored by Ethan Aubin.
This commit is contained in:
Joey Hess 2020-12-04 13:50:03 -04:00
parent 4efecaebd6
commit 31e417f351
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 91 additions and 33 deletions

View file

@ -11,6 +11,7 @@ import Assistant.Common
import Assistant.Types.TransferrerPool
import Types.Transfer
import Utility.Batch
import Messages.Serialized
import qualified Command.TransferKeys as T
@ -58,14 +59,9 @@ checkTransferrerPoolItem program batchmaker i = case i of
performTransfer :: Transferrer -> Transfer -> TransferInfo -> Assistant Bool
performTransfer transferrer t info = catchBoolIO $ do
(liftIO $ T.sendRequest t info (transferrerWrite transferrer))
readresponse
where
readresponse =
liftIO (T.readResponse (transferrerRead transferrer)) >>= \case
Right r -> return r
Left so -> do
liftAnnex $ emitSerializedOutput so
readresponse
relaySerializedOutput
(liftIO (T.readResponse (transferrerRead transferrer)))
liftAnnex
{- Starts a new git-annex transferkeys process, setting up handles
- that will be used to communicate with it. -}