-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Most of the time, when we first connect to a peer, their immediate response it to choke us. This means that essentially every message we send gets ignored until they decide to unchoke us. This is normally fine, but its causing us to lose out on potential piece requests or updates that the peer might need. The solution to this is to create a "cache" of messages, not including piece responses (they requested a piece from us) of messages we want to send to them, but are choked at the moment. The cache should be immediately emptied on the Unchoke message and we should send the peer all the messages they missed. For efficiencies sake, we should probably only cache the latest piece request, as by the time the peer unchokes us, previous piece requests would probably be fulfilled by other peers, and we would no longer need it.