fix(bitswap): increase timeout to ensure hole punching completes #651
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this PR
This PR increases the Bitswap connection timeout from 5 seconds to 10 seconds. This is based on testing that shows that when one of the peers is behind NAT and holepunching is necessary, it can take a little bit over 5 seconds only for hole punching to succeed.
Hole punching slowness will be handled independently in libp2p/go-libp2p#2898.
This issue aims to prevent bitswap connection timeouts that would otherwise succeed, if given a higher connection timeout. Increasing the timeout appears to be an effective workaround based on some testing.
Based on https://github.com/ipfs/go-bitswap/pull/477/files, it appears that the 5 second timeout was an arbitrary starting that was picked in 2021, prior to which there was no time out. Here's the source of the suggestion of a 5 second timeout.