summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dht/Announcer.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/dht/Announcer.hs b/dht/Announcer.hs
index 41f86f24..98fcdf94 100644
--- a/dht/Announcer.hs
+++ b/dht/Announcer.hs
@@ -13,6 +13,8 @@ module Announcer
13 , scheduleToList 13 , scheduleToList
14 , packAnnounceKey 14 , packAnnounceKey
15 , unpackAnnounceKey 15 , unpackAnnounceKey
16 , encodeAnnounceKey
17 , decodeAnnounceKey
16 , forkAnnouncer 18 , forkAnnouncer
17 , stopAnnouncer 19 , stopAnnouncer
18 , cancel 20 , cancel
@@ -44,15 +46,18 @@ import qualified GHC.Generics as Generics
44newtype AnnounceKey = AnnounceKey ByteString 46newtype AnnounceKey = AnnounceKey ByteString
45 deriving (Hashable,Ord,Eq) 47 deriving (Hashable,Ord,Eq)
46 48
47-- instance Show AnnounceKey where
48-- show (AnnounceKey bs) = "AnnounceKey " ++ show (Char8.unpack bs)
49
50packAnnounceKey :: Announcer -> String -> AnnounceKey 49packAnnounceKey :: Announcer -> String -> AnnounceKey
51packAnnounceKey _ = AnnounceKey . Char8.pack 50packAnnounceKey _ = AnnounceKey . Char8.pack
52 51
53unpackAnnounceKey :: Announcer -> AnnounceKey -> String 52unpackAnnounceKey :: Announcer -> AnnounceKey -> String
54unpackAnnounceKey _ (AnnounceKey bs) = Char8.unpack bs 53unpackAnnounceKey _ (AnnounceKey bs) = Char8.unpack bs
55 54
55encodeAnnounceKey :: Announcer -> AnnounceKey -> ByteString
56encodeAnnounceKey _ (AnnounceKey k) = k
57
58decodeAnnounceKey :: Announcer -> ByteString -> AnnounceKey
59decodeAnnounceKey _ k = AnnounceKey k
60
56-- | Actions that can be scheduled to occur at some particular time in the 61-- | Actions that can be scheduled to occur at some particular time in the
57-- future. Since periodic event handlers are responsible for re-scheduling 62-- future. Since periodic event handlers are responsible for re-scheduling
58-- themselves, they are typically bootstrapped using 'scheduleImmediately' with 63-- themselves, they are typically bootstrapped using 'scheduleImmediately' with