summaryrefslogtreecommitdiff
path: root/dht/examples/dhtd.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2020-01-03 18:22:16 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-07 13:24:59 -0500
commit15ab3290ad04280764968ba4760474a8c0cbfa52 (patch)
tree8df7bdfe38005f5478243427bb2b692d32843283 /dht/examples/dhtd.hs
parentb411ab66ceee7386e4829e2337c735a08fb3d54d (diff)
Modify kademlia search to distinguish a Canceled from timed-out query.
Diffstat (limited to 'dht/examples/dhtd.hs')
-rw-r--r--dht/examples/dhtd.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs
index 26f3f149..6b057af9 100644
--- a/dht/examples/dhtd.hs
+++ b/dht/examples/dhtd.hs
@@ -811,8 +811,8 @@ clientSession s@Session{..} sock cnum h = do
811 where 811 where
812 go | null destination = fmap Right . qhandler self 812 go | null destination = fmap Right . qhandler self
813 | otherwise = case readEither destination of 813 | otherwise = case readEither destination of
814 Right ni -> fmap (maybe (Left "Timeout.") Right) 814 Right ni -> fmap (maybe (Left "Timeout.") Right . resultToMaybe)
815 . flip (searchQuery qsearch) ni 815 . flip (searchQuery qsearch) ni -- TODO report canceled
816 Left e -> const $ return $ Left ("Bad destination: "++e) 816 Left e -> const $ return $ Left ("Bad destination: "++e)
817 maybe (hPutClient h ("Unsupported method: "++method)) 817 maybe (hPutClient h ("Unsupported method: "++method))
818 goQuery 818 goQuery