summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/DHT.hs')
-rw-r--r--src/Network/BitTorrent/DHT.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs
index 51d92127..d9328cea 100644
--- a/src/Network/BitTorrent/DHT.hs
+++ b/src/Network/BitTorrent/DHT.hs
@@ -70,8 +70,11 @@ import Network.BitTorrent.DHT.Query
70import Network.BitTorrent.DHT.Session 70import Network.BitTorrent.DHT.Session
71import Network.DHT.Routing as T hiding (null) 71import Network.DHT.Routing as T hiding (null)
72import qualified Data.Text as Text 72import qualified Data.Text as Text
73import Data.Typeable
73import Data.Monoid 74import Data.Monoid
74import Network.DatagramServer.Mainline (KMessageOf) 75import Network.DatagramServer.Mainline (KMessageOf)
76import qualified Network.DatagramServer as KRPC (listen, Protocol(..))
77
75 78
76 79
77{----------------------------------------------------------------------- 80{-----------------------------------------------------------------------
@@ -97,8 +100,12 @@ dht :: (Ord ip, Address ip)
97 -> IO a -- ^ result. 100 -> IO a -- ^ result.
98dht opts addr logfilter action = do 101dht opts addr logfilter action = do
99 runStderrLoggingT $ filterLogger logfilter $ LoggingT $ \ logger -> do 102 runStderrLoggingT $ filterLogger logfilter $ LoggingT $ \ logger -> do
100 bracket (newNode defaultHandlers opts addr logger Nothing) closeNode $ 103 bracket (newNode opts addr logger Nothing) closeNode $
101 \ node -> runDHT node action 104 \ node -> runDHT node $ do
105 hs <- defaultHandlers logger
106 m <- asks manager
107 liftIO $ KRPC.listen m hs (KRPC.Protocol Proxy Proxy)
108 action
102{-# INLINE dht #-} 109{-# INLINE dht #-}
103 110
104{----------------------------------------------------------------------- 111{-----------------------------------------------------------------------