From: Ramakrishnan Muthukrishnan Date: Thu, 7 May 2015 05:52:14 +0000 (+0530) Subject: cleanup unused imports/functions X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/biz/statistics?a=commitdiff_plain;h=dc7423516e4e263d13c9eca41b182583ccc7e5a5;p=functorrent.git cleanup unused imports/functions Cleanup the debug identifiers/prints. --- diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index 7b263a5..353e08a 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -8,16 +8,15 @@ module FuncTorrent.Peer import Prelude hiding (lookup, concat, replicate, splitAt) import System.IO -import Data.ByteString (ByteString, pack, unpack, concat, hGet, hPut, singleton, append) +import Data.ByteString (ByteString, pack, unpack, concat, hGet, hPut, singleton) import Data.ByteString.Lazy (fromStrict, fromChunks) -import qualified Data.ByteString.Char8 as BC (replicate, pack, readInt, putStrLn) +import qualified Data.ByteString.Char8 as BC (replicate, pack) import Network (connectTo, PortID(..)) import Data.Binary (Binary(..), decode) import Data.Binary.Put (putWord32be, putWord16be, putWord8) import Data.Binary.Get (getWord32be, getWord16be, getWord8, runGet) import Control.Monad (replicateM, liftM, forever) import Control.Applicative ((<$>), liftA3) -import Control.Concurrent (threadDelay) type ID = String type IP = String @@ -143,10 +142,10 @@ getMsg h = do then return KeepAliveMsg else do putStrLn $ "len: " ++ show l - msgType <- hGet h 1 - putStrLn $ "msg Type: " ++ show msgType + msgID <- hGet h 1 + putStrLn $ "msg Type: " ++ show msgID msg <- hGet h (l - 1) - return $ decode $ fromStrict $ concat [lBS, msgType, msg] + return $ decode $ fromStrict $ concat [lBS, msgID, msg] bsToInt :: ByteString -> Int bsToInt x = fromIntegral (runGet getWord32be (fromChunks (return x)))