From 3597001278c78846e88ac0266120b9044480820a Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Tue, 8 Sep 2015 16:47:35 +0530 Subject: [PATCH] Peer: cosmetic indentation fixes --- src/FuncTorrent/Peer.hs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index cfefb11..9f1aa2a 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -182,22 +182,22 @@ msgLoop pieceStatus file = do downloadPiece :: Handle -> Integer -> Integer -> IO ByteString downloadPiece h index pieceLength = do let chunks = splitNum pieceLength 16384 - liftM concat $ forM (zip [0..] chunks) (\(i, pLen) -> do - sendMsg h (RequestMsg index (i*pLen) pLen) - putStrLn $ "--> " ++ "RequestMsg for Piece " - ++ show index ++ ", part: " ++ show i ++ " of length: " - ++ show pLen - msg <- getMsg h - case msg of - PieceMsg index begin block -> do - putStrLn $ " <-- PieceMsg for Piece: " - ++ show index - ++ ", offset: " - ++ show begin - return block - _ -> do - putStrLn "ignoring irrelevant msg" - return empty) + concat `liftM` forM (zip [0..] chunks) (\(i, pLen) -> do + sendMsg h (RequestMsg index (i*pLen) pLen) + putStrLn $ "--> " ++ "RequestMsg for Piece " + ++ show index ++ ", part: " ++ show i ++ " of length: " + ++ show pLen + msg <- getMsg h + case msg of + PieceMsg index begin block -> do + putStrLn $ " <-- PieceMsg for Piece: " + ++ show index + ++ ", offset: " + ++ show begin + return block + _ -> do + putStrLn "ignoring irrelevant msg" + return empty) verifyHash :: ByteString -> ByteString -> Bool verifyHash bs pieceHash = -- 2.37.2