summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-10-16 15:34:57 -0400
committerjoe <joe@jerkface.net>2017-10-16 15:34:57 -0400
commit2493cd4203d9041295ffbfb144ee2ba23f93c694 (patch)
tree8edf04f24b7cf0e516baf972aebe82e6254ee3a9 /examples/dhtd.hs
parent281d2e961876dfaf076fdb171bd0f7d44f70ba8e (diff)
Started k (keys) command.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs6
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
45import GHC.Conc (labelThread) 45import GHC.Conc (labelThread)
46#endif 46#endif
47 47
48import Crypto.Tox (zeros32) 48import Crypto.Tox (zeros32,SecretKey,PublicKey)
49import Network.UPNP as UPNP 49import Network.UPNP as UPNP
50import Network.Address hiding (NodeId, NodeInfo(..)) 50import Network.Address hiding (NodeId, NodeInfo(..))
51import Network.Kademlia.Search 51import 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