summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Torrent.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index 1f70aea2..0ce2efd7 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -195,6 +195,8 @@ import System.FilePath
195import System.Posix.Types 195import System.Posix.Types
196 196
197import Network.BitTorrent.Address 197import Network.BitTorrent.Address
198import Network.BitTorrent.DHT.Routing
199import Network.DatagramServer.Mainline
198 200
199 201
200{----------------------------------------------------------------------- 202{-----------------------------------------------------------------------
@@ -237,6 +239,12 @@ instance BEncode InfoHash where
237 fromBEncode be = InfoHash <$> fromBEncode be 239 fromBEncode be = InfoHash <$> fromBEncode be
238#endif 240#endif
239 241
242instance TableKey KMessageOf InfoHash where
243 toNodeId = either (error msg) id . S.decode . S.encode
244 where -- TODO unsafe coerse?
245 msg = "tableKey: impossible"
246
247
240-- | Convert to\/from raw bytestring. (no encoding) 248-- | Convert to\/from raw bytestring. (no encoding)
241instance Serialize InfoHash where 249instance Serialize InfoHash where
242 put (InfoHash ih) = putByteString ih 250 put (InfoHash ih) = putByteString ih