Closed jaseemabid closed 9 years ago
@vu3rdd So I'm guessing its ok. Merging in.
@jaseemabid: I get an error when I run it past the torrent files. Parsing input file: data/ubuntu-14.10-desktop-amd64.iso.torrent Input File OK Trying to fetch peers: functorrent: Map.!: given key is not an element in the map functorrent: thread blocked indefinitely in an MVar operation
This must be due to tracker returning an error. I just tried with the debian file and got d14:failure reason17:torrent not founde
from tracker. decode parsed it fine to. Bdict (fromList [("failure reason",Bstr "torrent not found")])
. getPeerResponse
is not a total function and it messed up. I'll fix this in a while.
Map BVal BVal
toMap String BVal
The keys are human readable keys like 'name', 'announce' etc and String is the natural fit. This change also gets rid of a lot of packing unpacking business.
Example:
encode
fromBVal -> String
toBVal -> ByteString
Encoded values might not be ASCII safe in the first place. Also, it makes sense to be the inverse function of decode.
encode . decode
pair might be a good candidate for Quickcheck.Other changes are consequences of the type change. Fixed a bunch of broken doctests in Bencode.
TIL haskell is kickass for refactoring!