Skip to content

Commit

Permalink
fix(bitswap): increase timeout to ensure hole punching completes (ipf…
Browse files Browse the repository at this point in the history
…s#651)

Co-authored-by: Marcin Rataj <[email protected]>
  • Loading branch information
2 people authored and wenyue committed Oct 17, 2024
1 parent da98ddf commit e766b6d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
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

0 comments on commit e766b6d

Please sign in to comment.