diff options
author | joe <joe@jerkface.net> | 2017-10-16 15:34:57 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-10-16 15:34:57 -0400 |
commit | 2493cd4203d9041295ffbfb144ee2ba23f93c694 (patch) | |
tree | 8edf04f24b7cf0e516baf972aebe82e6254ee3a9 /examples/dhtd.hs | |
parent | 281d2e961876dfaf076fdb171bd0f7d44f70ba8e (diff) |
Started k (keys) command.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r-- | examples/dhtd.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index ad90d459..60019072 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -45,7 +45,7 @@ import Control.Concurrent.Lifted | |||
45 | import GHC.Conc (labelThread) | 45 | import GHC.Conc (labelThread) |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | import Crypto.Tox (zeros32) | 48 | import Crypto.Tox (zeros32,SecretKey,PublicKey) |
49 | import Network.UPNP as UPNP | 49 | import Network.UPNP as UPNP |
50 | import Network.Address hiding (NodeId, NodeInfo(..)) | 50 | import Network.Address hiding (NodeId, NodeInfo(..)) |
51 | import Network.Kademlia.Search | 51 | import Network.Kademlia.Search |
@@ -283,6 +283,7 @@ data Session = Session | |||
283 | , externalAddresses :: IO [SockAddr] | 283 | , externalAddresses :: IO [SockAddr] |
284 | , swarms :: Mainline.SwarmsDatabase | 284 | , swarms :: Mainline.SwarmsDatabase |
285 | , toxkeys :: TVar Tox.AnnouncedKeys | 285 | , toxkeys :: TVar Tox.AnnouncedKeys |
286 | , keys :: TVar [(SecretKey,PublicKey)] | ||
286 | , signalQuit :: MVar () | 287 | , signalQuit :: MVar () |
287 | } | 288 | } |
288 | 289 | ||
@@ -367,6 +368,9 @@ clientSession s@Session{..} sock cnum h = do | |||
367 | let rs = [" ", show result] | 368 | let rs = [" ", show result] |
368 | hPutClient h $ unlines rs | 369 | hPutClient h $ unlines rs |
369 | Left er -> hPutClient h er | 370 | Left er -> hPutClient h er |
371 | ("k", "") -> cmd0 $ do | ||
372 | ks <- atomically $ readTVar keys | ||
373 | hPutClient h $ unlines $ map (mappend " " . show . Tox.key2id . snd) ks | ||
370 | ("g", s) | Just DHT{..} <- Map.lookup netname dhts | 374 | ("g", s) | Just DHT{..} <- Map.lookup netname dhts |
371 | -> cmd0 $ do | 375 | -> cmd0 $ do |
372 | -- arguments: method | 376 | -- arguments: method |