diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT')
-rw-r--r-- | src/Network/BitTorrent/DHT/Protocol.hs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/Network/BitTorrent/DHT/Protocol.hs b/src/Network/BitTorrent/DHT/Protocol.hs index 5267a916..5cc1722d 100644 --- a/src/Network/BitTorrent/DHT/Protocol.hs +++ b/src/Network/BitTorrent/DHT/Protocol.hs | |||
@@ -36,6 +36,7 @@ import Remote.KRPC.Protocol | |||
36 | import Data.BEncode | 36 | import Data.BEncode |
37 | import Data.Torrent | 37 | import Data.Torrent |
38 | import Network.BitTorrent.Peer | 38 | import Network.BitTorrent.Peer |
39 | import Network.BitTorrent.Exchange.Protocol () | ||
39 | 40 | ||
40 | {----------------------------------------------------------------------- | 41 | {----------------------------------------------------------------------- |
41 | Node | 42 | Node |
@@ -50,11 +51,6 @@ type NodeId = ByteString | |||
50 | genNodeId :: IO NodeId | 51 | genNodeId :: IO NodeId |
51 | genNodeId = getEntropy 20 | 52 | genNodeId = getEntropy 20 |
52 | 53 | ||
53 | instance Serialize PortNumber where | ||
54 | get = fromIntegral <$> getWord16be | ||
55 | put = putWord16be . fromIntegral | ||
56 | |||
57 | |||
58 | data NodeAddr = NodeAddr { | 54 | data NodeAddr = NodeAddr { |
59 | nodeIP :: {-# UNPACK #-} !HostAddress | 55 | nodeIP :: {-# UNPACK #-} !HostAddress |
60 | , nodePort :: {-# UNPACK #-} !PortNumber | 56 | , nodePort :: {-# UNPACK #-} !PortNumber |
@@ -66,7 +62,6 @@ instance Serialize NodeAddr where | |||
66 | putWord32be nodeIP | 62 | putWord32be nodeIP |
67 | put nodePort | 63 | put nodePort |
68 | 64 | ||
69 | |||
70 | data NodeInfo = NodeInfo { | 65 | data NodeInfo = NodeInfo { |
71 | nodeID :: !NodeId | 66 | nodeID :: !NodeId |
72 | , nodeAddr :: !NodeAddr | 67 | , nodeAddr :: !NodeAddr |
@@ -175,7 +170,7 @@ assignToken _ _ = return "" | |||
175 | 170 | ||
176 | -- TODO | 171 | -- TODO |
177 | checkToken :: NodeId -> Token -> NodeSession -> IO Bool | 172 | checkToken :: NodeId -> Token -> NodeSession -> IO Bool |
178 | checkToken nid token _ = return True | 173 | checkToken _ _ _ = return True |
179 | 174 | ||
180 | updateTimestamp :: NodeSession -> NodeId -> IO () | 175 | updateTimestamp :: NodeSession -> NodeId -> IO () |
181 | updateTimestamp = error "updateTimestamp" | 176 | updateTimestamp = error "updateTimestamp" |