refactor
This commit is contained in:
parent
6a11b6fab8
commit
cedad7b37d
1 changed files with 7 additions and 8 deletions
|
@ -32,10 +32,7 @@ start :: CommandStart
|
||||||
start = do
|
start = do
|
||||||
enableInteractiveBranchAccess
|
enableInteractiveBranchAccess
|
||||||
(readh, writeh) <- liftIO dupIoHandles
|
(readh, writeh) <- liftIO dupIoHandles
|
||||||
let outputwriter v = do
|
let outputwriter = sendTransferResponse writeh . TransferOutput
|
||||||
hPutStrLn writeh $
|
|
||||||
unwords $ Proto.formatMessage $ TransferOutput v
|
|
||||||
hFlush writeh
|
|
||||||
let outputresponsereader = do
|
let outputresponsereader = do
|
||||||
l <- hGetLine readh
|
l <- hGetLine readh
|
||||||
return $ case Proto.parseMessage l of
|
return $ case Proto.parseMessage l of
|
||||||
|
@ -114,7 +111,9 @@ runRequests readh writeh a = go Nothing Nothing
|
||||||
Nothing -> transferrerProtocolError l
|
Nothing -> transferrerProtocolError l
|
||||||
Nothing -> transferrerProtocolError l
|
Nothing -> transferrerProtocolError l
|
||||||
|
|
||||||
sendresult b = liftIO $ do
|
sendresult = liftIO . sendTransferResponse writeh . TransferResult
|
||||||
hPutStrLn writeh $
|
|
||||||
unwords $ Proto.formatMessage $ TransferResult b
|
sendTransferResponse :: Handle -> TransferResponse -> IO ()
|
||||||
hFlush writeh
|
sendTransferResponse h r = do
|
||||||
|
hPutStrLn h $ unwords $ Proto.formatMessage r
|
||||||
|
hFlush h
|
||||||
|
|
Loading…
Add table
Reference in a new issue