diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-20 06:17:52 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-20 06:17:52 +0400 |
commit | 0f76501d5bdc033fd5b3a821021f2c319ec314da (patch) | |
tree | d22cd3ecd10d757031cf8998ed249e1ac8809671 | |
parent | 24e337832cb4e9fd102cba981d308759487335ea (diff) |
Use a better initial guess in DHT.Query spec
-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 |