BitTorrent-like p2p filesharing system code review request

Hi, I'm working on a learning project making a BitTorrent-like p2p filesharing system and I've got some of the basics done. A peer can announce itself to the tracker, get back a list of peers, connect to those peers and request/send pieces from them. But I don't really like the architecture I've set up at all and was wondering if someone wouldn't mind reviewing my code.

The files I really don't like are peer_connection and peer_connection_pool. It feels like quite a bit of channel soup that's a bit difficult to reason about. Also, now that I want to be able to add a bit more complex functionality I feel like the amount of stuff that's happening in channels makes it difficult to keep track of everything that's going on. If someone could review my code/architecture and give me some suggestions on how something like this should be structured, I'd appreciate it. Thanks! Also I'd appreciate suggestions for any open-source Rust repos that might be worth reviewing to learn how to architect something like this with all these different TCP connections flying around all over the place.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.