Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bitswap): increase timeout to ensure hole punching completes #651

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The following emojis are used to highlight certain changes:

- `boxo/gateway` now correctly returns 404 Status Not Found instead of 500 when the requested content cannot be found due to offline exchange, gateway running in no-fetch (non-recursive) mode, or a similar restriction that only serves a specific set of CIDs.
- `bitswap/client` fix memory leak in BlockPresenceManager due to unlimited map growth.
- `bitswap/network` fixed race condition when a timeout occurred before hole punching completed while establishing a first-time stream to a peer behind a NAT

### Security

Expand Down
7 changes: 1 addition & 6 deletions bitswap/network/ipfs_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (

var log = logging.Logger("bitswap/network")

var connectTimeout = time.Second * 5

var (
maxSendTimeout = 2 * time.Minute
minSendTimeout = 10 * time.Second
Expand Down Expand Up @@ -323,10 +321,7 @@ func (bsnet *impl) SendMessage(
p peer.ID,
outgoing bsmsg.BitSwapMessage,
) error {
tctx, cancel := context.WithTimeout(ctx, connectTimeout)
defer cancel()

s, err := bsnet.newStreamToPeer(tctx, p)
s, err := bsnet.newStreamToPeer(ctx, p)
if err != nil {
return err
}
Expand Down