summaryrefslogtreecommitdiff
path: root/examples/GetTorrent.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-05 17:42:21 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-05 17:42:21 +0400
commit5b122b1fab7f2de4942db6100a7363ccdc478a71 (patch)
tree5f1e6a7b0faec514cb1f1c1d228a037a1a2ff419 /examples/GetTorrent.hs
parenta001d6a9415e61a31b8d0abcddb20ed638fd9916 (diff)
Make Torrent(tAnnounce) field optional
Diffstat (limited to 'examples/GetTorrent.hs')
-rw-r--r--examples/GetTorrent.hs5
1 files changed, 1 insertions, 4 deletions
diff --git a/examples/GetTorrent.hs b/examples/GetTorrent.hs
index 5e624fa1..db52263d 100644
--- a/examples/GetTorrent.hs
+++ b/examples/GetTorrent.hs
@@ -52,9 +52,6 @@ programInfo = info (helper <*> paramsParser)
52 <> header "gettorrent - get torrent file by infohash" 52 <> header "gettorrent - get torrent file by infohash"
53 ) 53 )
54 54
55fakeTracker :: URI
56fakeTracker = fromJust $ parseURI "http://foo.org"
57
58exchangeTorrent :: PeerAddr IP -> InfoHash -> IO InfoDict 55exchangeTorrent :: PeerAddr IP -> InfoHash -> IO InfoDict
59exchangeTorrent addr ih = do 56exchangeTorrent addr ih = do
60 pid <- genPeerId 57 pid <- genPeerId
@@ -72,7 +69,7 @@ getTorrent Params {..} = do
72 DHT.lookup topic $$ C.mapM_ $ \ peers -> do 69 DHT.lookup topic $$ C.mapM_ $ \ peers -> do
73 liftIO $ forM_ peers $ \ peer -> do 70 liftIO $ forM_ peers $ \ peer -> do
74 infodict <- exchangeTorrent (IPv4 <$> peer) topic 71 infodict <- exchangeTorrent (IPv4 <$> peer) topic
75 let torrent = nullTorrent fakeTracker infodict 72 let torrent = nullTorrent infodict -- TODO add tNodes, tCreated, etc?
76 toFile (show topic <.> torrentExt) torrent 73 toFile (show topic <.> torrentExt) torrent
77 exitSuccess 74 exitSuccess
78 75