summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-06-09 01:03:02 -0400
committerjoe <joe@jerkface.net>2017-06-09 01:03:02 -0400
commitecde95b20167e02092f6a359eac865ba9155614c (patch)
tree897c37bdf3562a950557b537e4491e99079c00d5 /src/Data
parent84798bfef62a001ded1bd628d846612f0b0ade80 (diff)
Started migration away from KRPC class.
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