From 442a7c0941b4f2659988193404263348593551a2 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Sat, 15 Mar 2014 20:37:11 +0400 Subject: Expose UDP tracker specific message types Those can be used to implement UDP tracker server by third party libraries or projects. --- src/Network/BitTorrent/Tracker/Session.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Network/BitTorrent/Tracker/Session.hs') diff --git a/src/Network/BitTorrent/Tracker/Session.hs b/src/Network/BitTorrent/Tracker/Session.hs index 7be16fd6..9fe02b52 100644 --- a/src/Network/BitTorrent/Tracker/Session.hs +++ b/src/Network/BitTorrent/Tracker/Session.hs @@ -50,13 +50,13 @@ import Network.BitTorrent.Tracker.RPC as RPC -- Tracker entry -----------------------------------------------------------------------} -data Scrape = Scrape +data LastScrape = LastScrape { leechersCount :: Maybe Int , seedersCount :: Maybe Int } deriving (Show, Eq) -instance Default Scrape where - def = Scrape Nothing Nothing +instance Default LastScrape where + def = LastScrape Nothing Nothing data Status @@ -102,7 +102,7 @@ data TrackerEntry = TrackerEntry , peersCache :: Cached [PeerAddr IP] -- | May be used to show brief swarm stats in client GUI. - , scrapeCache :: Cached Scrape + , scrapeCache :: Cached LastScrape } nullEntry :: URI -> TrackerEntry @@ -140,11 +140,11 @@ cachePeers AnnounceInfo {..} = (seconds (fromMaybe respInterval respMinInterval)) (getPeerList respPeers) -cacheScrape :: AnnounceInfo -> IO (Cached Scrape) +cacheScrape :: AnnounceInfo -> IO (Cached LastScrape) cacheScrape AnnounceInfo {..} = newCached (seconds respInterval) (seconds (fromMaybe respInterval respMinInterval)) - Scrape + LastScrape { seedersCount = respComplete , leechersCount = respIncomplete } -- cgit v1.2.3