diff options
-rw-r--r-- | src/Network/BitTorrent/DHT.hs | 4 | ||||
-rw-r--r-- | src/Network/BitTorrent/DHT/Session.hs | 1 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs | 7 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs index 44c55128..98ba1a56 100644 --- a/src/Network/BitTorrent/DHT.hs +++ b/src/Network/BitTorrent/DHT.hs | |||
@@ -156,7 +156,7 @@ isBootstrapped = T.full <$> getTable | |||
156 | -- | 156 | -- |
157 | -- This is blocking operation, use | 157 | -- This is blocking operation, use |
158 | -- 'Control.Concurrent.Async.Lifted.async' if needed. | 158 | -- 'Control.Concurrent.Async.Lifted.async' if needed. |
159 | restore :: ByteString -> DHT ip () | 159 | restore :: ByteString -> IO (Node ip) |
160 | restore = error "DHT.restore: not implemented" | 160 | restore = error "DHT.restore: not implemented" |
161 | 161 | ||
162 | -- | Serialize current DHT session to byte string. | 162 | -- | Serialize current DHT session to byte string. |
@@ -179,6 +179,8 @@ lookup topic = do -- TODO retry getClosest if bucket is empty | |||
179 | closest <- lift $ getClosest topic | 179 | closest <- lift $ getClosest topic |
180 | sourceList [closest] $= search topic (getPeersQ topic) | 180 | sourceList [closest] $= search topic (getPeersQ topic) |
181 | 181 | ||
182 | -- TODO do not republish if the topic is already in announceSet | ||
183 | |||
182 | -- | Announce that /this/ peer may have some pieces of the specified | 184 | -- | Announce that /this/ peer may have some pieces of the specified |
183 | -- torrent. DHT will reannounce this data periodically using | 185 | -- torrent. DHT will reannounce this data periodically using |
184 | -- 'optReannounce' interval. | 186 | -- 'optReannounce' interval. |
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs index 43bd65e5..755985fc 100644 --- a/src/Network/BitTorrent/DHT/Session.hs +++ b/src/Network/BitTorrent/DHT/Session.hs | |||
@@ -212,6 +212,7 @@ nullSessionTokens = SessionTokens | |||
212 | <*> liftIO getCurrentTime | 212 | <*> liftIO getCurrentTime |
213 | <*> pure defaultUpdateInterval | 213 | <*> pure defaultUpdateInterval |
214 | 214 | ||
215 | -- TODO invalidate *twice* if needed | ||
215 | invalidateTokens :: UTCTime -> SessionTokens -> SessionTokens | 216 | invalidateTokens :: UTCTime -> SessionTokens -> SessionTokens |
216 | invalidateTokens curTime ts @ SessionTokens {..} | 217 | invalidateTokens curTime ts @ SessionTokens {..} |
217 | | curTime `diffUTCTime` lastUpdate > maxInterval = SessionTokens | 218 | | curTime `diffUTCTime` lastUpdate > maxInterval = SessionTokens |
diff --git a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs index 540a887c..d0f0f26c 100644 --- a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs +++ b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs | |||
@@ -33,8 +33,11 @@ validateInfo AnnounceQuery {..} AnnounceInfo {..} = do | |||
33 | peerList = getPeerList respPeers | 33 | peerList = getPeerList respPeers |
34 | 34 | ||
35 | spec :: Spec | 35 | spec :: Spec |
36 | spec = parallel $ do | 36 | spec = do |
37 | forM_ trackerURIs $ \ uri -> | 37 | -- describe "RpcException" $ |
38 | |||
39 | parallel $ do | ||
40 | forM_ trackerURIs $ \ uri -> | ||
38 | context (show uri) $ do | 41 | context (show uri) $ do |
39 | describe "announce" $ do | 42 | describe "announce" $ do |
40 | it "have valid response" $ do | 43 | it "have valid response" $ do |