summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-24 02:26:05 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-24 02:26:05 +0400
commit04815747e3a9b80ee2fbe37a8e5636ab42c33bdf (patch)
tree8748dfc38b7aa4ebbe9eac167c620aac3a14efde /src/Network/BitTorrent
parent279ea9c29e0f61541ea0281678412d6dc6586d60 (diff)
Minor changes
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/DHT.hs4
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs1
2 files changed, 4 insertions, 1 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.
159restore :: ByteString -> DHT ip () 159restore :: ByteString -> IO (Node ip)
160restore = error "DHT.restore: not implemented" 160restore = 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
215invalidateTokens :: UTCTime -> SessionTokens -> SessionTokens 216invalidateTokens :: UTCTime -> SessionTokens -> SessionTokens
216invalidateTokens curTime ts @ SessionTokens {..} 217invalidateTokens curTime ts @ SessionTokens {..}
217 | curTime `diffUTCTime` lastUpdate > maxInterval = SessionTokens 218 | curTime `diffUTCTime` lastUpdate > maxInterval = SessionTokens