From 2423be0ebf0bcdc4568b251cd8f9a9830bf9b04f Mon Sep 17 00:00:00 2001 From: joe Date: Tue, 5 Sep 2017 23:55:38 -0400 Subject: Top-level signatures. --- examples/dhtd.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'examples/dhtd.hs') diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 3f6dcaf4..232abd6e 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs @@ -68,6 +68,7 @@ import Data.Time.Clock.POSIX showReport :: [(String,String)] -> String showReport kvs = showColumns $ map (\(x,y)->[x,y]) kvs +showColumns :: [[[Char]]] -> [Char] showColumns rows = do let cols = transpose rows ws = map (maximum . map (succ . length)) cols @@ -247,6 +248,8 @@ forkSearch method nid DHTQuery{qsearch,qshowTok,qshowR} dhtSearches dhtBuckets modifyTVar' dhtSearches $ Map.insert (method,nid) new writeTVar kvar $ Just $ searchLoop qsearch nid storeResult st +reportSearchResults :: (Show t, Ord t1, Ord t, Hashable t) => + String -> Handle -> DHTSearch t1 t -> IO () reportSearchResults meth h DHTSearch{searchShowTok,searchState,searchResults} = do (ns,rs) <- atomically $ do mm <- readTVar $ searchInformant searchState @@ -269,6 +272,7 @@ data Session = Session , signalQuit :: MVar () } +clientSession :: Session -> t1 -> t -> Handle -> IO () clientSession s@Session{..} sock cnum h = do line <- map toLower . dropWhile isSpace <$> hGetLine h let (c,args) = second (dropWhile isSpace) $ break isSpace line @@ -464,8 +468,10 @@ readExternals vars = do -- TODO: Filter to only global addresses? return $ filter (not . unspecified) as +defaultPort :: String defaultPort = "6881" +main :: IO () main = do args <- getArgs p <- case take 2 (dropWhile (/="-p") args) of -- cgit v1.2.3