From e80fe4a1b0cae4de60509b560e7845f59bf91b9e Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 1 Nov 2017 16:24:52 -0400 Subject: Fixed "ping" and "cookie" commands broken in "help" commit 4a36678. --- examples/dhtd.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/dhtd.hs b/examples/dhtd.hs index e5539036..755a65d7 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs @@ -404,6 +404,18 @@ clientSession s@Session{..} sock cnum h = do ] case (map toLower c,args) of (n, _) | n `elem` Map.keys dhts -> switchNetwork n + -- "ping" + -- "cookie" + (pinglike, s) | Just DHT{dhtPing} <- Map.lookup netname dhts + , Just DHTPing{ pingQuery=ping + , pingShowResult=showr } <- Map.lookup pinglike dhtPing + , ws@(_:_) <- words s + -> cmd0 $ do + case readEither $ last ws of + Right addr -> do result <- ping (init ws) addr + let rs = [" ", maybe "Timeout." showr result] + hPutClient h $ unlines rs + Left er -> hPutClient h er (x,_) | not (null (strp x)) , x `notElem` map head sessionCommands -> cmd0 $ do hPutClient h $ "error." @@ -473,18 +485,6 @@ clientSession s@Session{..} sock cnum h = do , ("node-id", show $ thisNode bkts) , ("network", netname) ] - -- "ping" - -- "cookie" - (pinglike, s) | Just DHT{dhtPing} <- Map.lookup netname dhts - , Just DHTPing{ pingQuery=ping - , pingShowResult=showr } <- Map.lookup pinglike dhtPing - , ws@(_:_) <- words s - -> cmd0 $ do - case readEither $ last ws of - Right addr -> do result <- ping (init ws) addr - let rs = [" ", maybe "Timeout." showr result] - hPutClient h $ unlines rs - Left er -> hPutClient h er ("k", s) | "" <- strp s -> cmd0 $ do ks <- atomically $ readTVar userkeys hPutClient h $ unlines $ map (mappend " " . show . Tox.key2id . snd) ks -- cgit v1.2.3