summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Data/Torrent.hs16
-rw-r--r--src/Data/Torrent/Magnet.hs2
-rw-r--r--src/Network/BitTorrent/Client/Swarm.hs2
3 files changed, 10 insertions, 10 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index db7f38eb..497a96d3 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -191,7 +191,7 @@ instance Pretty InfoDict where
191 191
192-- | Metainfo about particular torrent. 192-- | Metainfo about particular torrent.
193data Torrent = Torrent 193data Torrent = Torrent
194 { tAnnounce :: !URI 194 { tAnnounce :: !(Maybe URI)
195 -- ^ The URL of the tracker. 195 -- ^ The URL of the tracker.
196 196
197 , tAnnounceList :: !(Maybe [[URI]]) 197 , tAnnounceList :: !(Maybe [[URI]])
@@ -215,7 +215,7 @@ data Torrent = Torrent
215 , tInfoDict :: !InfoDict 215 , tInfoDict :: !InfoDict
216 -- ^ Info about each content file. 216 -- ^ Info about each content file.
217 217
218 , tNodes :: Maybe [NodeAddr ByteString] 218 , tNodes :: !(Maybe [NodeAddr ByteString])
219 -- ^ This key should be set to the /K closest/ nodes in the 219 -- ^ This key should be set to the /K closest/ nodes in the
220 -- torrent generating client's routing table. Alternatively, the 220 -- torrent generating client's routing table. Alternatively, the
221 -- key could be set to a known good 'Network.BitTorrent.Core.Node' 221 -- key could be set to a known good 'Network.BitTorrent.Core.Node'
@@ -284,7 +284,7 @@ instance BEncode POSIXTime where
284 284
285instance BEncode Torrent where 285instance BEncode Torrent where
286 toBEncode Torrent {..} = toDict $ 286 toBEncode Torrent {..} = toDict $
287 "announce" .=! tAnnounce 287 "announce" .=? tAnnounce
288 .: "announce-list" .=? tAnnounceList 288 .: "announce-list" .=? tAnnounceList
289 .: "comment" .=? tComment 289 .: "comment" .=? tComment
290 .: "created by" .=? tCreatedBy 290 .: "created by" .=? tCreatedBy
@@ -298,7 +298,7 @@ instance BEncode Torrent where
298 .: endDict 298 .: endDict
299 299
300 fromBEncode = fromDict $ do 300 fromBEncode = fromDict $ do
301 Torrent <$>! "announce" 301 Torrent <$>? "announce"
302 <*>? "announce-list" 302 <*>? "announce-list"
303 <*>? "comment" 303 <*>? "comment"
304 <*>? "created by" 304 <*>? "created by"
@@ -341,10 +341,10 @@ instance Pretty Torrent where
341 "Signature" <:>? ((text . show) <$> tSignature) 341 "Signature" <:>? ((text . show) <$> tSignature)
342 342
343-- | A simple torrent contains only required fields. 343-- | A simple torrent contains only required fields.
344nullTorrent :: URI -> InfoDict -> Torrent 344nullTorrent :: InfoDict -> Torrent
345nullTorrent ann info = Torrent 345nullTorrent info = Torrent
346 ann Nothing Nothing Nothing Nothing Nothing 346 Nothing Nothing Nothing Nothing Nothing Nothing
347 info Nothing Nothing Nothing Nothing 347 info Nothing Nothing Nothing Nothing
348 348
349-- | Mime type of torrent files. 349-- | Mime type of torrent files.
350typeTorrent :: BS.ByteString 350typeTorrent :: BS.ByteString
diff --git a/src/Data/Torrent/Magnet.hs b/src/Data/Torrent/Magnet.hs
index ae4e134b..ae6a8dc5 100644
--- a/src/Data/Torrent/Magnet.hs
+++ b/src/Data/Torrent/Magnet.hs
@@ -326,7 +326,7 @@ detailedMagnet :: Torrent -> Magnet
326detailedMagnet t @ Torrent {tInfoDict = InfoDict {..}, tAnnounce} 326detailedMagnet t @ Torrent {tInfoDict = InfoDict {..}, tAnnounce}
327 = (simpleMagnet t) 327 = (simpleMagnet t)
328 { exactLength = Just $ fromIntegral $ contentLength idLayoutInfo 328 { exactLength = Just $ fromIntegral $ contentLength idLayoutInfo
329 , tracker = Just tAnnounce 329 , tracker = tAnnounce
330 } 330 }
331 331
332{----------------------------------------------------------------------- 332{-----------------------------------------------------------------------
diff --git a/src/Network/BitTorrent/Client/Swarm.hs b/src/Network/BitTorrent/Client/Swarm.hs
index 1901905c..7fdd1f2f 100644
--- a/src/Network/BitTorrent/Client/Swarm.hs
+++ b/src/Network/BitTorrent/Client/Swarm.hs
@@ -24,7 +24,7 @@ data Swarm = Swarm
24 24
25newLeecher :: PeerId -> PortNumber -> Torrent -> IO Swarm 25newLeecher :: PeerId -> PortNumber -> Torrent -> IO Swarm
26newLeecher pid port Torrent {..} = do 26newLeecher pid port Torrent {..} = do
27 tracker <- connect tAnnounce 27 tracker <- connect undefined
28 return Swarm 28 return Swarm
29 { swarmTopic = idInfoHash tInfoDict 29 { swarmTopic = idInfoHash tInfoDict
30 , thisPeerId = pid 30 , thisPeerId = pid