From dbd8bf3d2c1741158965d9da56f4e8f8263d519d Mon Sep 17 00:00:00 2001 From: Svarog Date: Sun, 1 Dec 2019 17:58:05 +0200 Subject: [PATCH] [NOD-478] Add buffer to newOutboundConnection channel (#502) --- connmgr/connmanager.go | 3 ++- server/p2p/p2p.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/connmgr/connmanager.go b/connmgr/connmanager.go index 0da57120a..a345ff77a 100644 --- a/connmgr/connmanager.go +++ b/connmgr/connmanager.go @@ -7,11 +7,12 @@ package connmgr import ( nativeerrors "errors" "fmt" - "github.com/pkg/errors" "net" "sync" "sync/atomic" "time" + + "github.com/pkg/errors" ) // maxFailedAttempts is the maximum number of successive failed connection diff --git a/server/p2p/p2p.go b/server/p2p/p2p.go index ef1f0944b..5db4fc1bf 100644 --- a/server/p2p/p2p.go +++ b/server/p2p/p2p.go @@ -10,7 +10,6 @@ import ( "crypto/rand" "encoding/binary" "fmt" - "github.com/pkg/errors" "math" "net" "runtime" @@ -21,6 +20,8 @@ import ( "sync/atomic" "time" + "github.com/pkg/errors" + "github.com/daglabs/btcd/util/subnetworkid" "github.com/daglabs/btcd/addrmgr" @@ -1610,7 +1611,7 @@ func NewServer(listenAddrs []string, db database.DB, dagParams *dagconfig.Params broadcast: make(chan broadcastMsg, config.ActiveConfig().MaxPeers), quit: make(chan struct{}), modifyRebroadcastInv: make(chan interface{}), - newOutboundConnection: make(chan *outboundPeerConnectedMsg), + newOutboundConnection: make(chan *outboundPeerConnectedMsg, config.ActiveConfig().MaxPeers), // TODO: replace with target outbound nat: nat, db: db, TimeSource: blockdag.NewMedianTime(),