dariusc93 / rust-ipfs

The InterPlanetary File System (IPFS), implemented in Rust.
Apache License 2.0
36 stars 7 forks source link

bitswap: Timeout peers who have not respond #211

Open dariusc93 opened 1 month ago

dariusc93 commented 1 month ago

Currently, we would send a message with sendDontHave being true, however not all bitswap implementations would act on this field or may ignore it causing us to wait as a result. What we should do instead is add a timeout to each peer when we send a request and if a message does not arrive before it timeout then we should pop the peer from the session or move them into a separate queue to be removed so when the session is polled again we can send a cancel request as we remove them, but if they respond before this happen, we could move them back into the session.