Issue with lost packets

I’m developing a protocol that requires peers sending data to each other. To achieve that I use libp2p’s tcp::tokio::Transport with the request_response Behaviour. It’s my general understanding that the TCP transport should take care of resending lost packets: however, during unit testing, some peers sometimes get stuck indefinitely waiting for data. After implementing my own resend mechanism based on timeouts, the issue seems to be resolved, but I’m still wondering why TCP isn’t already taking care of that.

It’s worth noting that the peers all run on the same machine during testing, just inside different tokio tasks. That definitely doesn’t fully recapitulate real-world behavior but I’m not sure it would affect this particular issue. Any insight is welcome, thanks!

Would you mind reopening this discussion on libp2p/rust-libp2p · Discussions · GitHub, either with a simple reproducer or snippets of your code?

Sure, just posted it here: Issue with lost packets · libp2p/rust-libp2p · Discussion #4666 · GitHub