mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
p2p: set timeout on FairMix in Backend,reduce timeout
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
7e96294f17
commit
83b16c72f7
2 changed files with 14 additions and 3 deletions
|
|
@ -62,6 +62,16 @@ import (
|
|||
gethversion "github.com/ethereum/go-ethereum/version"
|
||||
)
|
||||
|
||||
const (
|
||||
// This is the fairness knob for the discovery mixer. When looking for peers, we'll
|
||||
// wait this long for a single source of candidates before moving on and trying other
|
||||
// sources. If this timeout expires, the source will be skipped in this round, but it
|
||||
// will continue to fetch in the background and will have a chance with a new timeout
|
||||
// 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.
|
||||
discmixTimeout = 100 * time.Millisecond
|
||||
)
|
||||
|
||||
// Config contains the configuration options of the ETH protocol.
|
||||
// Deprecated: use ethconfig.Config instead.
|
||||
type Config = ethconfig.Config
|
||||
|
|
@ -169,7 +179,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
networkID: networkID,
|
||||
gasPrice: config.Miner.GasPrice,
|
||||
p2pServer: stack.Server(),
|
||||
discmix: enode.NewFairMix(0),
|
||||
discmix: enode.NewFairMix(discmixTimeout),
|
||||
shutdownTracker: shutdowncheck.NewShutdownTracker(chainDb),
|
||||
}
|
||||
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ const (
|
|||
|
||||
// This is the fairness knob for the discovery mixer. When looking for peers, we'll
|
||||
// wait this long for a single source of candidates before moving on and trying other
|
||||
// sources.
|
||||
discmixTimeout = 5 * time.Second
|
||||
// sources. Currently there is only one source at the Server level, so this has no effect.
|
||||
// Check the fairMox tineout in the Backend for the actual timeout.
|
||||
discmixTimeout = 100 * time.Millisecond
|
||||
|
||||
// Connectivity defaults.
|
||||
defaultMaxPendingPeers = 50
|
||||
|
|
|
|||
Loading…
Reference in a new issue