mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
add maxParallelENRRequests parameter
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
83b16c72f7
commit
835a4e5943
1 changed files with 5 additions and 1 deletions
|
|
@ -70,6 +70,10 @@ const (
|
||||||
// in the next rounds, giving it overall more time but a proportionally smaller share.
|
// in the next rounds, giving it overall more time but a proportionally smaller share.
|
||||||
// We expect a normal source to produce ~10 candidates per second.
|
// We expect a normal source to produce ~10 candidates per second.
|
||||||
discmixTimeout = 100 * time.Millisecond
|
discmixTimeout = 100 * time.Millisecond
|
||||||
|
|
||||||
|
// maxParallelENRRequests is the maximum number of parallel ENR requests that can be
|
||||||
|
// performed by a disc/v4 source.
|
||||||
|
maxParallelENRRequests = 16
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config contains the configuration options of the ETH protocol.
|
// Config contains the configuration options of the ETH protocol.
|
||||||
|
|
@ -501,7 +505,7 @@ func (s *Ethereum) setupDiscovery() error {
|
||||||
if s.p2pServer.DiscoveryV4() != nil {
|
if s.p2pServer.DiscoveryV4() != nil {
|
||||||
asyncFilter := s.p2pServer.DiscoveryV4().RequestENR
|
asyncFilter := s.p2pServer.DiscoveryV4().RequestENR
|
||||||
filter := eth.NewNodeFilter(s.blockchain)
|
filter := eth.NewNodeFilter(s.blockchain)
|
||||||
iter := enode.AsyncFilter(s.p2pServer.DiscoveryV4().RandomNodes(), asyncFilter, 16)
|
iter := enode.AsyncFilter(s.p2pServer.DiscoveryV4().RandomNodes(), asyncFilter, maxParallelENRRequests)
|
||||||
iter = enode.Filter(iter, filter)
|
iter = enode.Filter(iter, filter)
|
||||||
s.discmix.AddSource(iter)
|
s.discmix.AddSource(iter)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue