Skip to content

Commit fcf915f

Browse files
committed
Define discoveryConnTimeout and set it to 30s
License: MIT Signed-off-by: rht <[email protected]>
1 parent a7202fa commit fcf915f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/core.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ import (
3939
routing "github.com/ipfs/go-ipfs/routing"
4040
dht "github.com/ipfs/go-ipfs/routing/dht"
4141
kb "github.com/ipfs/go-ipfs/routing/kbucket"
42-
offroute "github.com/ipfs/go-ipfs/routing/offline"
4342
nilrouting "github.com/ipfs/go-ipfs/routing/none"
43+
offroute "github.com/ipfs/go-ipfs/routing/offline"
4444

4545
bstore "github.com/ipfs/go-ipfs/blocks/blockstore"
4646
bserv "github.com/ipfs/go-ipfs/blockservice"
@@ -63,6 +63,7 @@ import (
6363
const IpnsValidatorTag = "ipns"
6464
const kSizeBlockstoreWriteCache = 100
6565
const kReprovideFrequency = time.Hour * 12
66+
const discoveryConnTimeout = time.Second * 30
6667

6768
var log = eventlog.Logger("core")
6869

@@ -320,7 +321,7 @@ func setupDiscoveryOption(d config.Discovery) DiscoveryOption {
320321

321322
func (n *IpfsNode) HandlePeerFound(p peer.PeerInfo) {
322323
log.Warning("trying peer info: ", p)
323-
ctx, cancel := context.WithTimeout(n.Context(), time.Second*10)
324+
ctx, cancel := context.WithTimeout(n.Context(), discoveryConnTimeout)
324325
defer cancel()
325326
if err := n.PeerHost.Connect(ctx, p); err != nil {
326327
log.Warning("Failed to connect to peer found by discovery: ", err)

0 commit comments

Comments
 (0)