cleanup(falco): consolidate falco::grpc::server in one class #3150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind cleanup
Any specific area of the project related to this PR?
/area engine
What this PR does / why we need it:
I was investigating the following warning from UBSan
Essentially, what's happening is that
request_stream_context<outputs::service, outputs::request, outputs::response>::process(server* srv)
is trying to invoke(srv->*m_process_func)(*m_stream_ctx, m_req, res);
which is assigned to&server::get
. Now, theget()
function is not defined inserver
(the type ofsrv
) but in its base classserver_impl
. I read through some posts and documentation and I could not be convinced if this is undefined behavior (like UBSan was saying) or not.However, after looking at these classes it looks like that there is only one derived class of
server_impl
which isserver
, whereserver
acts as an interface with the rest of the code. Since it looked a bit odd that the interface derives from the implementation and there is no other use of this inheritance, I think it's safe to use a single class for the server. Any potential UB is gone and the files are a bit easier to read.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: