This commit is contained in:
Joey Hess 2020-12-10 16:33:52 -04:00
parent 6a11b6fab8
commit cedad7b37d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -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