diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT/Query.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT/Query.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs index c7e48920..a1934014 100644 --- a/src/Network/BitTorrent/DHT/Query.hs +++ b/src/Network/BitTorrent/DHT/Query.hs | |||
@@ -14,6 +14,7 @@ | |||
14 | {-# LANGUAGE ScopedTypeVariables #-} | 14 | {-# LANGUAGE ScopedTypeVariables #-} |
15 | {-# LANGUAGE TemplateHaskell #-} | 15 | {-# LANGUAGE TemplateHaskell #-} |
16 | {-# LANGUAGE TupleSections #-} | 16 | {-# LANGUAGE TupleSections #-} |
17 | {-# LANGUAGE GADTs #-} | ||
17 | module Network.BitTorrent.DHT.Query | 18 | module Network.BitTorrent.DHT.Query |
18 | ( -- * Handler | 19 | ( -- * Handler |
19 | -- | To bind specific set of handlers you need to pass | 20 | -- | To bind specific set of handlers you need to pass |
@@ -71,6 +72,7 @@ import Data.Either | |||
71 | import Data.List as L | 72 | import Data.List as L |
72 | import Data.Monoid | 73 | import Data.Monoid |
73 | import Data.Text as T | 74 | import Data.Text as T |
75 | import Data.BEncode (BValue) | ||
74 | import qualified Data.Set as Set | 76 | import qualified Data.Set as Set |
75 | ;import Data.Set (Set) | 77 | ;import Data.Set (Set) |
76 | import Network | 78 | import Network |
@@ -89,14 +91,17 @@ import Network.BitTorrent.DHT.Routing as R | |||
89 | import Network.BitTorrent.DHT.Session | 91 | import Network.BitTorrent.DHT.Session |
90 | import Control.Concurrent.STM | 92 | import Control.Concurrent.STM |
91 | import qualified Network.BitTorrent.DHT.Search as Search | 93 | import qualified Network.BitTorrent.DHT.Search as Search |
94 | import Network.DHT.Mainline | ||
92 | 95 | ||
93 | {----------------------------------------------------------------------- | 96 | {----------------------------------------------------------------------- |
94 | -- Handlers | 97 | -- Handlers |
95 | -----------------------------------------------------------------------} | 98 | -----------------------------------------------------------------------} |
96 | 99 | ||
97 | nodeHandler :: Address ip => KRPC (Query a) (Response b) | 100 | nodeHandler :: ( Address ip |
101 | , KRPC (Query a) (Response b) | ||
102 | , Envelope (Query a) (Response b) ~ BValue ) | ||
98 | => (NodeAddr ip -> a -> DHT ip b) -> NodeHandler ip | 103 | => (NodeAddr ip -> a -> DHT ip b) -> NodeHandler ip |
99 | nodeHandler action = handler $ \ sockAddr qry -> do | 104 | nodeHandler action = handler mainline $ \ sockAddr qry -> do |
100 | let remoteId = queringNodeId qry | 105 | let remoteId = queringNodeId qry |
101 | read_only = queryIsReadOnly qry | 106 | read_only = queryIsReadOnly qry |
102 | q = queryParams qry | 107 | q = queryParams qry |