From: Jaseem Abid Date: Fri, 24 Apr 2015 13:49:32 +0000 (+0530) Subject: Rename connect to tracker X-Git-Url: https://git.rkrishnan.org/vdrive/components/com_hotproperty/css/%3C?a=commitdiff_plain;h=8e951838fd82485bc0c9b16fe6ae5ed731c66684;p=functorrent.git Rename connect to tracker Bad clash with socket library! --- diff --git a/src/FuncTorrent.hs b/src/FuncTorrent.hs index 67fc309..e17b024 100644 --- a/src/FuncTorrent.hs +++ b/src/FuncTorrent.hs @@ -4,7 +4,7 @@ module FuncTorrent Metainfo(..), Peer, TrackerResponse(..), - connect, + tracker, decode, encode, handShakeMsg, diff --git a/src/FuncTorrent/Tracker.hs b/src/FuncTorrent/Tracker.hs index 07bf7f7..57c8f9d 100644 --- a/src/FuncTorrent/Tracker.hs +++ b/src/FuncTorrent/Tracker.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module FuncTorrent.Tracker (TrackerResponse(..), - connect, + tracker, mkArgs, mkTrackerResponse, urlEncodeHash @@ -66,8 +66,8 @@ mkTrackerResponse resp = where (ip', port') = splitAt 4 peer -- | Connect to a tracker and get peer info -connect :: Metainfo -> String -> IO ByteString -connect m peer_id = get (head . announceList $ m) $ mkArgs m peer_id +tracker :: Metainfo -> String -> IO ByteString +tracker m peer_id = get (head . announceList $ m) $ mkArgs m peer_id --- | URL encode hash as per RFC1738 --- TODO: Add tests diff --git a/src/Main.hs b/src/Main.hs index 791b4b5..9cb5908 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -12,7 +12,7 @@ import FuncTorrent.Bencode (decode) import FuncTorrent.Logger (initLogger, logMessage, logStop) import FuncTorrent.Metainfo (Info(..), Metainfo(..), mkMetaInfo) import FuncTorrent.Peer (handShakeMsg) -import FuncTorrent.Tracker (connect, peers, mkTrackerResponse) +import FuncTorrent.Tracker (tracker, peers, mkTrackerResponse) logError :: ParseError -> (String -> IO ()) -> IO () logError e logMsg = logMsg $ "parse error: \n" ++ show e @@ -53,7 +53,7 @@ main = do log "Trying to fetch peers" log $ "Trackers: " ++ head (announceList m) - response <- connect m peerId + response <- tracker m peerId let hsMsgLen = show $ length $ handShakeMsg m peerId log $ "Hand-shake message length : " ++ hsMsgLen