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: handler separation #19639

Merged
merged 3 commits into from
Aug 21, 2019
Merged

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented May 30, 2019

This PR refactors light client handler a bit by separating the client handler and server handler to two structures.

@rjl493456442 rjl493456442 force-pushed the les-refactor-3 branch 4 times, most recently from 4bbc4ac to e5ff2cd Compare June 3, 2019 06:11
@fjl fjl added this to the 1.9.1 milestone Jun 5, 2019
@rjl493456442 rjl493456442 force-pushed the les-refactor-3 branch 3 times, most recently from f02b6ab to b79d16b Compare July 4, 2019 01:44
@rjl493456442 rjl493456442 changed the title [WIP] les: handler separation les: handler separation Jul 4, 2019
@rjl493456442
Copy link
Member Author

rjl493456442 commented Jul 15, 2019

@zsfelfoldi Could you please take a look when you back :)

This PR basically separates the client handler and server handler into two structures so that it's easier to read.

Besides in the server handler, this PR replaces some direct disk access with cached enabled approach(core.Blockchain).

@karalabe karalabe modified the milestones: 1.9.1, 1.9.2 Jul 23, 2019
@rjl493456442 rjl493456442 force-pushed the les-refactor-3 branch 2 times, most recently from 389e104 to 3aab5a3 Compare July 31, 2019 04:39
@karalabe karalabe modified the milestones: 1.9.2, 1.9.3 Aug 13, 2019
Copy link
Contributor

@zsfelfoldi zsfelfoldi left a comment

Choose a reason for hiding this comment

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

Most of the PR looks good. It is hard to judge the correctness of such a huge refactoring though. Please take another look at the server handler (accept and sendResponse fns in particular) because there are some changes that I am not sure about. If it is just out of sync with latest master then please fix it, otherwise comment why those changes have been made. It is a really sensitive part of the code.

les/server_handler.go Show resolved Hide resolved
les/server_handler.go Show resolved Hide resolved
les/peer.go Outdated Show resolved Hide resolved
les/costtracker.go Show resolved Hide resolved
les/distributor.go Outdated Show resolved Hide resolved
@rjl493456442
Copy link
Member Author

@zsfelfoldi I address the comments. I know it's super hard to review such a huge refactor PR. I review it a few times and do it again today. I think it should sync with master branch. But really hope you can check it again to ensure this PR doesn't break something :))

Btw there is a tiny conflict with master branch(it's only 2 line change I made a few days ago). I would leave it now. Since I always squash all commits and then rebase. I think the commit I made today probably will make it easier for you to catch all changes.

les/metrics.go Outdated Show resolved Hide resolved
les/distributor.go Outdated Show resolved Hide resolved
Copy link
Contributor

@zsfelfoldi zsfelfoldi left a comment

Choose a reason for hiding this comment

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

LGTM with some minor things to fix

les/server_handler.go Show resolved Hide resolved
les/peer.go Show resolved Hide resolved
core: address comments

les: address comments

les: fix metrics
@rjl493456442
Copy link
Member Author

@zsfelfoldi Fixed and rebased. The fix is in the last commit.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

The core parts looks good to me

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.

5 participants