Skip to content

p2p/enode: implement per-source timeout in FairMix#25962

Merged
fjl merged 5 commits intoethereum:masterfrom
zhiqiangxu:refine_mixSource
Nov 8, 2022
Merged

p2p/enode: implement per-source timeout in FairMix#25962
fjl merged 5 commits intoethereum:masterfrom
zhiqiangxu:refine_mixSource

Conversation

@zhiqiangxu
Copy link
Copy Markdown
Contributor

No description provided.

@fjl
Copy link
Copy Markdown
Contributor

fjl commented Oct 10, 2022

Good catch! Instead of deleting this field, we should really investigate why it isn't used.

@zhiqiangxu
Copy link
Copy Markdown
Contributor Author

zhiqiangxu commented Oct 10, 2022

Good catch! Instead of deleting this field, we should really investigate why it isn't used.

Seems it's unused since 1st day?

@fjl
Copy link
Copy Markdown
Contributor

fjl commented Oct 10, 2022

I think what I wanted to do there is, use this source-specific timeout for exponential backoff when one source gets stuck. The part that's missing is actually applying the source specific timeout instead of m.timeout.

@zhiqiangxu
Copy link
Copy Markdown
Contributor Author

I think what I wanted to do there is, use this source-specific timeout for exponential backoff when one source gets stuck. The part that's missing is actually applying the source specific timeout instead of m.timeout.

OK, added that missing part back.

@fjl fjl changed the title p2p/enode: mixSource.timeout is unused p2p/enode: implement per-source timeout in FairMix Nov 7, 2022
@fjl fjl merged commit 4cb1fca into ethereum:master Nov 8, 2022
@fjl fjl added this to the 1.11.0 milestone Nov 8, 2022
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
nibty pushed a commit to FairCrypto/go-ethereum that referenced this pull request Apr 10, 2024
anacrolix pushed a commit to erigontech/erigon that referenced this pull request Dec 3, 2025
This change fixes an issue where mixSource.timeout was initialized and
mutated but never actually used to drive the timer in FairMix.Next.
Previously the timer was based on the global m.timeout, so the
per-source exponential backoff logic had no effect and the timeout field
was effectively dead code. The fix moves timer creation after picking
the source and bases it on source.timeout, resetting it to m.timeout on
successful reads and halving it on timeouts. This matches the upstream
intent (see go-ethereum PR #25962
ethereum/go-ethereum#25962 ) and restores
per-source backoff, improving responsiveness when individual sources
stall, while preserving the negative-timeout “completely fair” behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants