-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Ensure every instance of StreamFilter and PassThroughFilter to contain only one copy of StreamFilterBase. #35341
Conversation
virtually. Change PassThrough(Decoder|Encode)Filter to inherit from Stream(Decoder|Encode)Filter virtually. This ensures every instance of StreamFilter and PassThroughFilter contains only one copy of Stream(Decode|Encode)Filter and StreamFilterBase. Signed-off-by: Bin Wu <[email protected]>
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.
/wait-any
envoy/http/filter.h
Outdated
@@ -857,7 +857,7 @@ class StreamFilterBase { | |||
* onDestroy() invoked. Filters that cross-register as access log handlers receive log() before | |||
* onDestroy(). | |||
*/ | |||
virtual void onDestroy() PURE; | |||
virtual void onDestroy() {} |
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.
Can you keep this method pure virtual if you add override onDestroy in the PassThroughFilter? Or is it causing more build errors than that?
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.
Thanks Yan, but I think if we do that, an existing class will not compile if
- It derives directly from
PassThroughDecoderFilter
orPassThroughEncoderFilter
, and - It doesn't override onDestroy, i.e. it relies on the empty implementation in
PassThroughDecoderFilter
orPassThroughEncoderFilter
.
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.
/assign @yanavlasov
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.
Did you try it? Can you post the compiler error, please?
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.
As discussed, I change to have 3 onDestroy
implementations in PassThroughDecoderFilter
, PassThroughEncoderFilter
, and PassThroughFilter
. PTAL.
/wait-any |
implementations in PassThroughDecoderFilter, PassThroughEncoderFilter and PassThroughFilter. Signed-off-by: Bin Wu <[email protected]>
…n only one copy of StreamFilterBase. (envoyproxy#35341) Change Stream(Decode|Encode)Filter to inherit from StreamFilterBase virtually. Move the default implementation of PassThrough(Decoder|Encode)Filter::onDestroy into StreamFilterBase. --------- Signed-off-by: Bin Wu <[email protected]> Signed-off-by: Martin Duke <[email protected]>
…n only one copy of StreamFilterBase. (envoyproxy#35341) Change Stream(Decode|Encode)Filter to inherit from StreamFilterBase virtually. Move the default implementation of PassThrough(Decoder|Encode)Filter::onDestroy into StreamFilterBase. --------- Signed-off-by: Bin Wu <[email protected]> Signed-off-by: asingh-g <[email protected]>
Change Stream(Decode|Encode)Filter to inherit from StreamFilterBase virtually.
Move the default implementation of PassThrough(Decoder|Encode)Filter::onDestroy into StreamFilterBase.
Commit Message: Ensure every instance of StreamFilter and PassThroughFilter to contain only one copy of Stream(Decode|Encode)Filter and StreamFilterBase.
Additional Description:
Risk Level: Medium
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]