synlestidae / rustorrent

Modern, easy-to-use BitTorrent library for the Rust ecosystem (WIP)
Apache License 2.0
5 stars 0 forks source link

Implement Peer Wire Protocol #5

Open MatejLach opened 8 years ago

MatejLach commented 8 years ago

This is a tracking issue for implementing the Peer Wire Protocol

Once tracker request/response cycle is implemented, we are ready to implement the Peer Wire Protocol. The Peer Wire Protocol facilitates the actual P2P exchange of blocks and is thus the heart of the BitTorrent protocol.

MatejLach commented 8 years ago

Examples:

synlestidae commented 8 years ago

Examples are definitely worth reading. That C# one - woah! Lots of detail there.

Don't have a lot of experience with this kind of network programming... but I think MIO is a good option. One asynchronous event loop would handle reading and writing to peers... not sure what to suggest from there lol but I'll have more ideas soon.

MatejLach commented 8 years ago

@synlestidae Yeah, am not too versed in this as well, but that's part of the fun, night :-) I agree with mio + I wonder whether futures-rs can help us here as well.

synlestidae commented 8 years ago

Yes a few months ago I would have said MIO for sure as it seemed to be the only (as far as I knew) cross-platform async-IO rust library. There is also tokio which is built on top of MIO. Worth a look...

MatejLach commented 8 years ago

I saw that hyper is about to improve its async API by using tokio, however this benchmark, shows that current hyper, (which does not integrate tokio, but rotor instead), is significantly slower than both, raw mio and the futures HTTP implementation, so I am interested in seeing how that improves with hyper 0.10, implementing tokio and whether tokio will offer rps speeds closer to raw mio.