From: Ramakrishnan Muthukrishnan Date: Tue, 15 Dec 2015 17:18:23 +0000 (+0530) Subject: FileSystem: typo updateState -> updateStats X-Git-Url: https://git.rkrishnan.org/pf/components/com_hotproperty/css/frontends/webapi.txt?a=commitdiff_plain;h=f0a18bb62761e7f70b418cbed038cb48c451ab66;p=functorrent.git FileSystem: typo updateState -> updateStats --- 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