Closed synlestidae closed 8 years ago
Don't think I can assign this one to myself yet, but I am working on it right now
Great to see this. As am implementing the tracker request/response cycle, I think taking the file as bytes indeed makes the most sense, they're stored on disk as such and hyper too works directly with bytes well, so i.e. if we want to be able to get a torrent from the network at some point, (i.e magnet links?) , we'll be able to feed the hyper byte stream directly into the meta info parser.
So I take it magnet links work by making an ordinary HTTP request, and treating the response as a metainfo file? If so, all you have to do is call bdict_decode then pass the resultant BDict into MetaInfo::from(dict: &BDict) :) Very keen to see your tracker code.
I just fixed a bug I introduced with blist_decode. I have two unit tests that parse real (legal) .torrent files, and one of them is failing. I found out the reason it was failing was because blist_decode had an off-by-one error with its returned position value. With this fixed, I find that the failing tests is now breaking on something else! It's late now so I'll leave this to tomorrow. Feel free to take a look at my WIP metainfo branch if you like. Should have it working well soon enough 👍
See #7
Thanks for the work @synlestidae!
For rusttorrent to be usable, it needs to be able to parse and use meta info files. We need a function that takes a file (i.e. as bytes, a BDict, whatever) and outputs a MetaInfo struct. The MetaInfo struct will have all fields of a metainfo file specified.