From: Ramakrishnan Muthukrishnan Date: Tue, 8 Sep 2015 11:17:35 +0000 (+0530) Subject: Peer: cosmetic indentation fixes X-Git-Url: https://git.rkrishnan.org/listings/specifications//%22file:/%22?a=commitdiff_plain;h=3597001278c78846e88ac0266120b9044480820a;p=functorrent.git Peer: cosmetic indentation fixes --- 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 =