diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-24 02:26:05 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-24 02:26:05 +0400 |
commit | 04815747e3a9b80ee2fbe37a8e5636ab42c33bdf (patch) | |
tree | 8748dfc38b7aa4ebbe9eac167c620aac3a14efde /src/Network/BitTorrent | |
parent | 279ea9c29e0f61541ea0281678412d6dc6586d60 (diff) |
Minor changes
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r-- | src/Network/BitTorrent/DHT.hs | 4 | ||||
-rw-r--r-- | src/Network/BitTorrent/DHT/Session.hs | 1 |
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. |
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 |