diff --git a/CHANGELOG.md b/CHANGELOG.md index 5475412c2..17e71b53b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bitswap/network/ipfs_impl.go b/bitswap/network/ipfs_impl.go index ac9ab66a6..7acc3abcc 100644 --- a/bitswap/network/ipfs_impl.go +++ b/bitswap/network/ipfs_impl.go @@ -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 @@ -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 }