summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Tracker/Session.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Tracker/Session.hs')
-rw-r--r--src/Network/BitTorrent/Tracker/Session.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/Tracker/Session.hs b/src/Network/BitTorrent/Tracker/Session.hs
index a17973ad..107b83d6 100644
--- a/src/Network/BitTorrent/Tracker/Session.hs
+++ b/src/Network/BitTorrent/Tracker/Session.hs
@@ -214,9 +214,12 @@ newSession ih origUris = do
214 , sessionEvents = eventStream 214 , sessionEvents = eventStream
215 } 215 }
216 216
217-- | Release scarce resources associated with the given session. 217-- | Release scarce resources associated with the given session. This
218closeSession :: Session -> IO () 218-- function block until all trackers tied with this peer notified with
219closeSession _ = return () 219-- 'Stopped' event.
220closeSession :: Manager -> Session -> IO ()
221closeSession m s = do
222 notify m s Stopped
220 223
221{----------------------------------------------------------------------- 224{-----------------------------------------------------------------------
222-- Events 225-- Events
@@ -238,8 +241,9 @@ subscribe Session {..} = listen sessionEvents
238-----------------------------------------------------------------------} 241-----------------------------------------------------------------------}
239 242
240-- | Normally you need to use 'Control.Monad.Trans.Resource.alloc'. 243-- | Normally you need to use 'Control.Monad.Trans.Resource.alloc'.
241withSession :: InfoHash -> TrackerList URI -> (Session -> IO ()) -> IO () 244withSession :: Manager -> InfoHash -> TrackerList URI
242withSession ih uris = bracket (newSession ih uris) closeSession 245 -> (Session -> IO ()) -> IO ()
246withSession m ih uris = bracket (newSession ih uris) (closeSession m)
243 247
244-- | Get last announced status. The only action can alter this status 248-- | Get last announced status. The only action can alter this status
245-- is 'notify'. 249-- is 'notify'.