summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs
index b4ff0208..75d3294f 100644
--- a/src/Network/BitTorrent/DHT/Session.hs
+++ b/src/Network/BitTorrent/DHT/Session.hs
@@ -250,6 +250,7 @@ newtype DHT ip a = DHT { unDHT :: ReaderT (Node ip) IO a }
250 deriving ( Functor, Applicative, Monad 250 deriving ( Functor, Applicative, Monad
251 , MonadIO, MonadBase IO 251 , MonadIO, MonadBase IO
252 , MonadReader (Node ip) 252 , MonadReader (Node ip)
253 , MonadThrow, MonadUnsafeIO
253 ) 254 )
254 255
255instance MonadBaseControl IO (DHT ip) where 256instance MonadBaseControl IO (DHT ip) where
@@ -263,6 +264,12 @@ instance MonadBaseControl IO (DHT ip) where
263 restoreM = DHT . restoreM . unSt 264 restoreM = DHT . restoreM . unSt
264 {-# INLINE restoreM #-} 265 {-# INLINE restoreM #-}
265 266
267-- | All allocated resources will be closed at 'stopNode'.
268instance MonadResource (DHT ip) where
269 liftResourceT m = do
270 s <- asks resources
271 liftIO $ runInternalState m s
272
266instance MonadKRPC (DHT ip) (DHT ip) where 273instance MonadKRPC (DHT ip) (DHT ip) where
267 getManager = asks manager 274 getManager = asks manager
268 275