From 0f76501d5bdc033fd5b3a821021f2c319ec314da Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Thu, 20 Feb 2014 06:17:52 +0400 Subject: Use a better initial guess in DHT.Query spec --- tests/Network/BitTorrent/DHT/QuerySpec.hs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/Network/BitTorrent/DHT/QuerySpec.hs b/tests/Network/BitTorrent/DHT/QuerySpec.hs index 1bca477f..b89ce4ff 100644 --- a/tests/Network/BitTorrent/DHT/QuerySpec.hs +++ b/tests/Network/BitTorrent/DHT/QuerySpec.hs @@ -80,16 +80,14 @@ spec = do it "announce" $ do bootNode <- getBootInfo _ <- simpleDHT [] $ do - nid <- asks thisNodeId - Right nodes <- findNodeQ nid bootNode + let ih = entryHash (L.head testTorrents) + Right nodes <- findNodeQ ih bootNode when (L.null nodes) $ error "boot node malfunction" - let ih = entryHash (L.head testTorrents) - let port = nodePort myAddr queryParallel $ do - announceQ ih port <$> nodes + announceQ ih (nodePort myAddr) <$> nodes return () @@ -100,8 +98,7 @@ spec = do it "get at least 10 unique peers for each infohash" $ do bootNode <- getBootInfo peers <- simpleDHT [] $ do - nid <- asks thisNodeId - Right startNodes <- findNodeQ nid bootNode + Right startNodes <- findNodeQ entryHash bootNode sourceList [startNodes] $= search entryHash (getPeersQ entryHash) $= CL.concat $$ CL.take 10 -- cgit v1.2.3