diff options
Diffstat (limited to 'tests/Network/BitTorrent/DHT/QuerySpec.hs')
-rw-r--r-- | tests/Network/BitTorrent/DHT/QuerySpec.hs | 11 |
1 files 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 | |||
80 | it "announce" $ do | 80 | it "announce" $ do |
81 | bootNode <- getBootInfo | 81 | bootNode <- getBootInfo |
82 | _ <- simpleDHT [] $ do | 82 | _ <- simpleDHT [] $ do |
83 | nid <- asks thisNodeId | 83 | let ih = entryHash (L.head testTorrents) |
84 | Right nodes <- findNodeQ nid bootNode | 84 | Right nodes <- findNodeQ ih bootNode |
85 | 85 | ||
86 | when (L.null nodes) $ | 86 | when (L.null nodes) $ |
87 | error "boot node malfunction" | 87 | error "boot node malfunction" |
88 | 88 | ||
89 | let ih = entryHash (L.head testTorrents) | ||
90 | let port = nodePort myAddr | ||
91 | queryParallel $ do | 89 | queryParallel $ do |
92 | announceQ ih port <$> nodes | 90 | announceQ ih (nodePort myAddr) <$> nodes |
93 | 91 | ||
94 | return () | 92 | return () |
95 | 93 | ||
@@ -100,8 +98,7 @@ spec = do | |||
100 | it "get at least 10 unique peers for each infohash" $ do | 98 | it "get at least 10 unique peers for each infohash" $ do |
101 | bootNode <- getBootInfo | 99 | bootNode <- getBootInfo |
102 | peers <- simpleDHT [] $ do | 100 | peers <- simpleDHT [] $ do |
103 | nid <- asks thisNodeId | 101 | Right startNodes <- findNodeQ entryHash bootNode |
104 | Right startNodes <- findNodeQ nid bootNode | ||
105 | sourceList [startNodes] $= | 102 | sourceList [startNodes] $= |
106 | search entryHash (getPeersQ entryHash) $= | 103 | search entryHash (getPeersQ entryHash) $= |
107 | CL.concat $$ CL.take 10 | 104 | CL.concat $$ CL.take 10 |