Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

les: fix retriever logic #17705

Merged
merged 1 commit into from
Sep 20, 2018
Merged

les: fix retriever logic #17705

merged 1 commit into from
Sep 20, 2018

Conversation

zsfelfoldi
Copy link
Contributor

@zsfelfoldi zsfelfoldi commented Sep 19, 2018

This PR fixes stateRequesting() behavior in the retriever state machine.
It is always assumed that tryRequest is called before entering stateRequesting and an rpSent event will occur. If ev.peer != nil then we stay in requesting state and assume that either a delivery or a soft timeout event will follow. The existing implementation did not handle rpDeliveredInvalid though in which case it stayed in stateRequesting while no further event was happening in relation to that request, resulting in a deadlock. This PR handles rpDeliveredInvalid similarly to rpSoftTimeout, initiating a new request attempt and then staying in stateRequesting.

It also fixes a minor bug in stateNoMorePeers() to properly exit when there is nothing to wait for any more, similarly to stateRequesting. This missing condition did not cause a noticeable trouble because case <-time.After(retryQueue) saved the situation, going to stateRequesting and then not going back to stateNoMorePeers if not necessary but exiting properly instead.

@karalabe karalabe added this to the 1.8.16 milestone Sep 20, 2018
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@karalabe karalabe merged commit c37238c into ethereum:master Sep 20, 2018
nizsheanez referenced this pull request in nizsheanez/go-ethereum Sep 21, 2018
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