From: Joey Hess Date: Thu, 10 Dec 2020 20:33:52 +0000 (-0400) Subject: refactor X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~2^2^2~76^2~375 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cedad7b37da3da5f69507b52a85eaf81e43e1ebf;p=git-annex.git refactor --- diff --git a/Command/Transferrer.hs b/Command/Transferrer.hs index 5222011c95..410a4de656 100644 --- a/Command/Transferrer.hs +++ b/Command/Transferrer.hs @@ -32,10 +32,7 @@ start :: CommandStart start = do enableInteractiveBranchAccess (readh, writeh) <- liftIO dupIoHandles - let outputwriter v = do - hPutStrLn writeh $ - unwords $ Proto.formatMessage $ TransferOutput v - hFlush writeh + let outputwriter = sendTransferResponse writeh . TransferOutput let outputresponsereader = do l <- hGetLine readh return $ case Proto.parseMessage l of @@ -114,7 +111,9 @@ runRequests readh writeh a = go Nothing Nothing Nothing -> transferrerProtocolError l Nothing -> transferrerProtocolError l - sendresult b = liftIO $ do - hPutStrLn writeh $ - unwords $ Proto.formatMessage $ TransferResult b - hFlush writeh + sendresult = liftIO . sendTransferResponse writeh . TransferResult + +sendTransferResponse :: Handle -> TransferResponse -> IO () +sendTransferResponse h r = do + hPutStrLn h $ unwords $ Proto.formatMessage r + hFlush h