diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT.hs | 11 |
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 | |||
70 | import Network.BitTorrent.DHT.Session | 70 | import Network.BitTorrent.DHT.Session |
71 | import Network.DHT.Routing as T hiding (null) | 71 | import Network.DHT.Routing as T hiding (null) |
72 | import qualified Data.Text as Text | 72 | import qualified Data.Text as Text |
73 | import Data.Typeable | ||
73 | import Data.Monoid | 74 | import Data.Monoid |
74 | import Network.DatagramServer.Mainline (KMessageOf) | 75 | import Network.DatagramServer.Mainline (KMessageOf) |
76 | import 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. |
98 | dht opts addr logfilter action = do | 101 | dht 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 | {----------------------------------------------------------------------- |