diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-03-24 05:21:21 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-03-24 05:21:21 +0400 |
commit | c592e8e5a267ab4142f34e0ef023c797a99f8462 (patch) | |
tree | 8b3f2ab2126be3d3cdead8b7a184d7479a48c074 /src/Network/BitTorrent/Tracker/Session.hs | |
parent | c09681431dfff9522eec70dc20042183e6dde119 (diff) |
Allow to inspect each tier from getSessionState
Diffstat (limited to 'src/Network/BitTorrent/Tracker/Session.hs')
-rw-r--r-- | src/Network/BitTorrent/Tracker/Session.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Tracker/Session.hs b/src/Network/BitTorrent/Tracker/Session.hs index 74d854c5..e82501dd 100644 --- a/src/Network/BitTorrent/Tracker/Session.hs +++ b/src/Network/BitTorrent/Tracker/Session.hs | |||
@@ -66,7 +66,7 @@ import Data.Torrent.InfoHash | |||
66 | import Data.Torrent.JSON | 66 | import Data.Torrent.JSON |
67 | import Network.BitTorrent.Core | 67 | import Network.BitTorrent.Core |
68 | import Network.BitTorrent.Internal.Cache | 68 | import Network.BitTorrent.Internal.Cache |
69 | import Network.BitTorrent.Tracker.List | 69 | import Network.BitTorrent.Tracker.List as TL |
70 | import Network.BitTorrent.Tracker.Message | 70 | import Network.BitTorrent.Tracker.Message |
71 | import Network.BitTorrent.Tracker.RPC as RPC | 71 | import Network.BitTorrent.Tracker.RPC as RPC |
72 | 72 | ||
@@ -248,8 +248,8 @@ withSession m ih uris = bracket (newSession ih uris) (closeSession m) | |||
248 | getStatus :: Session -> IO Status | 248 | getStatus :: Session -> IO Status |
249 | getStatus Session {..} = readIORef sessionStatus | 249 | getStatus Session {..} = readIORef sessionStatus |
250 | 250 | ||
251 | getSessionState :: Session -> IO (TrackerList TrackerSession) | 251 | getSessionState :: Session -> IO [[TierEntry TrackerSession]] |
252 | getSessionState Session {..} = readMVar sessionTrackers | 252 | getSessionState Session {..} = TL.toList <$> readMVar sessionTrackers |
253 | 253 | ||
254 | -- | Do we need to sent this event to a first working tracker or to | 254 | -- | Do we need to sent this event to a first working tracker or to |
255 | -- the all known good trackers? | 255 | -- the all known good trackers? |
@@ -287,7 +287,7 @@ askPeers _mgr ses = do | |||
287 | L.concat <$> collect (tryTakeData . trackerPeers) list | 287 | L.concat <$> collect (tryTakeData . trackerPeers) list |
288 | 288 | ||
289 | collect :: (a -> IO (Maybe b)) -> TrackerList a -> IO [b] | 289 | collect :: (a -> IO (Maybe b)) -> TrackerList a -> IO [b] |
290 | collect f lst =(catMaybes . toList) <$> traverse f lst | 290 | collect f lst = (catMaybes . F.toList) <$> traverse f lst |
291 | 291 | ||
292 | --sourcePeers :: Session -> Source (PeerAddr IP) | 292 | --sourcePeers :: Session -> Source (PeerAddr IP) |
293 | --sourcePeers | 293 | --sourcePeers |