From: Jaseem Abid Date: Sat, 21 Mar 2015 16:36:28 +0000 (+0530) Subject: Rename getPeers -> peers X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/?a=commitdiff_plain;h=def432df1b4f9c16953d1ad144f432e1f23dddc7;p=functorrent.git Rename getPeers -> peers --- diff --git a/src/FuncTorrent.hs b/src/FuncTorrent.hs index acd679e..c05be76 100644 --- a/src/FuncTorrent.hs +++ b/src/FuncTorrent.hs @@ -10,7 +10,6 @@ module FuncTorrent decode, encode, getPeerResponse, - getPeers, handShakeMsg, info, infoHash, diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index b9334ba..105994d 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -1,7 +1,6 @@ module FuncTorrent.Peer (Peer, PeerResp(..), - getPeers, getPeerResponse, handShakeMsg ) where @@ -35,9 +34,6 @@ data PeerResp = PeerResponse { interval :: Maybe Integer toInt :: String -> Integer toInt = read -getPeers :: PeerResp -> [Peer] -getPeers = peers - getPeerResponse :: ByteString -> PeerResp getPeerResponse body = case decode body of Right (Bdict peerM) -> diff --git a/src/Main.hs b/src/Main.hs index 8656d47..17bd053 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -10,7 +10,7 @@ import Text.ParserCombinators.Parsec (ParseError) import FuncTorrent.Bencode (decode, BVal(..)) import FuncTorrent.Logger (initLogger, logMessage, logStop) import FuncTorrent.Metainfo (announce, lengthInBytes, mkMetaInfo, info, name) -import FuncTorrent.Peer (getPeers, getPeerResponse, handShakeMsg) +import FuncTorrent.Peer (peers, getPeerResponse, handShakeMsg) import FuncTorrent.Tracker (connect, prepareRequest) logError :: ParseError -> (String -> IO ()) -> IO () @@ -53,7 +53,7 @@ main = do -- TODO: Write to ~/.functorrent/caches writeFile (name (info m) ++ ".cache") body - let peerResponse = show $ getPeers $ getPeerResponse body + let peerResponse = show $ peers $ getPeerResponse body logMsg $ "Peers List : " ++ peerResponse let hsMsgLen = show $ length $ handShakeMsg d' peerId