From f0a18bb62761e7f70b418cbed038cb48c451ab66 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Tue, 15 Dec 2015 22:48:23 +0530 Subject: [PATCH] FileSystem: typo updateState -> updateStats --- src/FuncTorrent/FileSystem.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FuncTorrent/FileSystem.hs b/src/FuncTorrent/FileSystem.hs index bfaf674..56ec41e 100644 --- a/src/FuncTorrent/FileSystem.hs +++ b/src/FuncTorrent/FileSystem.hs @@ -49,7 +49,7 @@ run' :: PieceMap -> MsgChannel -> Handle -> StateT Stats IO () run' pieceMap c handle = do msg <- liftIO recvMsg liftIO $ sendResponse msg - updateState msg + updateStats msg where recvMsg = readChan c sendResponse msg = @@ -74,11 +74,11 @@ run' pieceMap c handle = do len' = len (pieceMap ! n) bs' <- readFileAtOffset handle offset len' return $ verifyHash bs' hash' - updateState (ReadPiece _ l _) = + updateStats (ReadPiece _ l _) = modify (\st -> st {bytesRead = bytesRead st + l}) - updateState (WritePiece (Piece _ bs)) = + updateStats (WritePiece (Piece _ bs)) = modify (\st -> st {bytesWritten = bytesWritten st + fromIntegral (BS.length bs)}) - updateState _ = modify id + updateStats _ = modify id pieceMapFromFile :: FilePath -> Integer -> PieceMap -> IO PieceMap pieceMapFromFile filePath fileLen pieceMap = do -- 2.37.2