TODO: implement complete/incomplete fields
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Mon, 16 Feb 2015 11:22:05 +0000 (16:52 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Mon, 16 Feb 2015 11:22:05 +0000 (16:52 +0530)
src/Peer.hs

index d30f9b0699e71d1fd3de2ae902ee2918bee2a8bb..020f59690d71313ab429f894cb01afc021efcf3f 100644 (file)
@@ -14,6 +14,8 @@ data Peer = Peer { ip :: String
                             
 data PeerResp = PeerResponse { interval :: Maybe Integer
                              , peers :: [Peer]
+                             , complete :: Maybe Integer
+                             , incomplete :: Maybe Integer
                              } deriving (Show)
 
 toInt :: String -> Integer
@@ -37,4 +39,4 @@ getPeerResponse body = case (Benc.decode body) of
                                 toIPNum = (L.intercalate ".") .
                                           map (show . toInt . ("0x" ++) . BC.unpack) .
                                           (U.splitN 2) . B16.encode
-                        Left _ -> PeerResponse { interval = Nothing, peers = [] }
+                        Left _ -> PeerResponse { peers = [] }