listener filter: hiding envoy internal from ListenerFilterCallbacks interface#22732
Conversation
bb9d6e6 to
ec413bb
Compare
…nterface Signed-off-by: He Jie Xu <hejie.xu@intel.com>
4f0c793 to
669384e
Compare
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
KBaichoo
left a comment
There was a problem hiding this comment.
Two high level questions:
Moving continueFilterChain from interface to the concrete class, but how can the listener filters communicate the continue filter chain?
Would this remove the ability to have failure in the onAccept calls?
In the old day, the listener filter use Today, after having #20728, the listener filter only uses the FilterStatus to communicate with listener. The file event is registered by envoy core code now, and that callback will trigger the processes based on the listener filter returned FilterStatus. envoy/source/server/active_tcp_socket.cc Line 87 in aa9ada6
The listener filter just needs to close the sockets and returns envoy/source/server/active_tcp_socket.cc Line 103 in aa9ada6 Thanks for the review! |
KBaichoo
left a comment
There was a problem hiding this comment.
Thanks for the explanation and the change. We should just put this new understanding back into the code.
source/server/active_tcp_socket.h
Outdated
| Network::ConnectionSocket& socket() override { return *socket_.get(); } | ||
| Event::Dispatcher& dispatcher() override; | ||
| void continueFilterChain(bool success) override; | ||
| void continueFilterChain(bool success); |
There was a problem hiding this comment.
Can we move this elsewhere since it's no longer part of the interface commented above and have it documented?
It seems like it's now split into either internal usage or external continueFilterChain(true) call that really just starts the filter chain. We could increase encapsulation splitting this out into startFilterChain() and continueFilterChain with the latter being private and startFilterChain just deferring to it.
There was a problem hiding this comment.
Likewise comments in https://github.com/envoyproxy/envoy/pull/22732/files/e8563f3153394c2ffe8653ca9c9beef7e70dacc0#diff-6708370e112a5097f06e16009c3730b34f5ab0ee4f1e736f8816848409435888R122
and
Line 333 in fb2d0a0
should be updated since the convention is changing e.g the filter doesn't call continue
There was a problem hiding this comment.
Can we move this elsewhere since it's no longer part of the interface commented above and have it documented?
The ActiveTcpSocket is a struct, its all members are public now, I guess that is for convenient for ActiveTcpListener access. And ActiveTcpListener is only place ActiveTcpSocket, and probably we think ActiveTcpSocket is kind of internal struct for ActiveTcpListener(since its only alive short time, it will be deleted when the connection passed all the listener filters or the connection rejected by listener filter)
It seems like it's now split into either internal usage or external
continueFilterChain(true)call that really just starts the filter chain. We could increase encapsulation splitting this out into startFilterChain() and continueFilterChain with the latter being private and startFilterChain just deferring to it.
Yea, that is good idea! The ActiveTcpListener is the place to call startFileChain(), and that make the code clear. Just as above said the whole ActiveTcpSocket are public, not sure I should make continueFilterChain as private. But let me know if this is still something you think should be changed.
There was a problem hiding this comment.
Likewise comments in https://github.com/envoyproxy/envoy/pull/22732/files/e8563f3153394c2ffe8653ca9c9beef7e70dacc0#diff-6708370e112a5097f06e16009c3730b34f5ab0ee4f1e736f8816848409435888R122
and
Line 333 in fb2d0a0
should be updated since the convention is changing e.g the filter doesn't call continue
got it, will update the comments
There was a problem hiding this comment.
Thanks this looks great! It makes a lot of sense that a lot of the class was open as you said, but it seems like it has grown in responsibility e.g. internally buffering listener data.
Having some methods private (continueFilterChain, createListenerFilterBuffer) would make the interface more compact / easier to grok.
There was a problem hiding this comment.
got it, let me try to improve that.
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
61f9cd7 to
8679577
Compare
|
Sorry for having to do a force push due to I mess up with the DCO since my daily dev machine is down and the temp machine has the wrong git config. |
KBaichoo
left a comment
There was a problem hiding this comment.
Thanks this looks great!
envoy/network/filter.h
Outdated
| /** | ||
| * Called when data read from the connection. If the filter chain doesn't get | ||
| * enough data, the filter chain can be stopped, then waiting for more data. | ||
| * Called when data read from the connection. If the filter doesn't get |
source/server/active_tcp_socket.h
Outdated
| Network::ConnectionSocket& socket() override { return *socket_.get(); } | ||
| Event::Dispatcher& dispatcher() override; | ||
| void continueFilterChain(bool success) override; | ||
| void continueFilterChain(bool success); |
There was a problem hiding this comment.
Thanks this looks great! It makes a lot of sense that a lot of the class was open as you said, but it seems like it has grown in responsibility e.g. internally buffering listener data.
Having some methods private (continueFilterChain, createListenerFilterBuffer) would make the interface more compact / easier to grok.
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
763057e to
ac12792
Compare
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
|
/wait that is something failed real |
|
Seems like issue might be resolved by #22792 |
thanks!, let me wait for that merged |
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
…backs interface (envoyproxy#22732)" This reverts commit 350c7f9. Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu hejie.xu@intel.com
Commit Message: listener filter: hiding envoy internal from ListenerFilterCallbacks interface
Additional Description:
Since #20728 remove the need for listener filter to register their own event, the
dispatch()andcontinueFilterChain(bool)interfaces are needn't by any listener filter anymore, and we can hide those envoy internal from the listener filter now.Risk Level: low
Testing: unittest
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a