-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add RPC daemon using Silkworm #8486
Conversation
eth/backend.go
Outdated
s.logger.Error(err.Error()) | ||
return | ||
} | ||
defer s.silkworm.StopRpcDaemon() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you did mean:
go func() {
select {
case <-ctx.Done(): // it's just a Ctrl+C listener
s.silkworm.StopRpcDaemon()
}
}{}
s.silkworm.StartRpcDaemon()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it that way because the existing cli.StartRpcServer
call blocks the calling goroutine and StartRpcDaemon
does not, so I replicated the same behaviour; in other words, StartRpcServer
calls startRegularRpcServer
, which uses a pattern similar to mine (i.e. defer + <- ctx.Done()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and if it blocks - then only way to get to this line of code - “exit without error” - which means server already don’t need shutdown.
In my head “StopRpcDaemon” can gracefuly stop working server. We need call it at “Ctrl+C”
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, now I see it, I changed the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, ok. can add it to name like "StartInBackground" - because most of go's funcs are blocking.
16a7fc6
to
48062b3
Compare
This introduces experimental RPC daemon run by embedded Silkworm library. Same notes as in PR #8353 apply here plus the following ones:
http
command-line option is enabled andsilkworm.path
option is present, nothing more is required (i.e. currently, both block execution and RPC daemon run by Silkworm when specifyingsilkworm.path
, just to keep things as simple as possible)