From 5233bacca87058537323ac71748cb626f30dec54 Mon Sep 17 00:00:00 2001 From: Sam T Date: Fri, 5 Apr 2013 01:57:15 +0400 Subject: + add THP --- tests/client.hs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/client.hs b/tests/client.hs index 2b626241..bab11b11 100644 --- a/tests/client.hs +++ b/tests/client.hs @@ -1,12 +1,19 @@ module Main (main) where -import Data.Torrent -import Network.Torrent.THP import System.Environment import Data.ByteString as B import Data.ByteString.Lazy as L import Data.BEncode +import Data.Torrent +import Network.Torrent.THP +import Network.Torrent.PeerID + +showWarn :: TResponse -> IO () +showWarn resp + | Just msg <- respWarning resp = print msg + | otherwise = return () + main :: IO () main = do [path] <- getArgs @@ -14,6 +21,7 @@ main = do let Right contents' = decode contents >>= return . L.toStrict . encode print (contents' == contents) + -- let (a, b) = showInfos contents -- print b -- print a @@ -22,7 +30,10 @@ main = do let Right b = decode contents let Right t = fromBEncode b + peerID <- newPeerID + + let req = defaultRequest (tAnnounce t) (tInfoHash t) (peerID) + Right resp <- sendRequest req - let req = defaultRequest (tAnnounce t) (tInfoHash t) - resp <- sendRequest req print resp + showWarn resp -- cgit v1.2.3