Add an unused implementation NoOpTransportSocketCallbacks#4172
Add an unused implementation NoOpTransportSocketCallbacks#4172danzh2010 wants to merge 9 commits intoenvoyproxy:masterfrom
Conversation
setTransportSocketCallbacks().
from underlying socket in a TransportSocket implementation which wraps another socket.
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
I'm not sure how common this is. In Seems the purpose of this is extracting the callbacks in #4153, am I missed anything? |
| /** | ||
| * @return the TransportSocketCallbacks object passed in through setTransportSocketCallbacks(). | ||
| */ | ||
| virtual TransportSocketCallbacks* callbacks() PURE; |
There was a problem hiding this comment.
Why do you need this? (see comments on NoOpTransportSocketCallbacks too)
| */ | ||
| class NoOpTransportSocketCallbacks : public Network::TransportSocketCallbacks { | ||
| public: | ||
| explicit NoOpTransportSocketCallbacks(Network::TransportSocket* parent) : parent_(parent) {} |
There was a problem hiding this comment.
All you need is parent_->callbacks(), so why just not taking a Network::TransportSocketCallbacks& as parameter?
There was a problem hiding this comment.
It depends on the timing when NoOpTransportSocketCallbacks is initialized and parent socket's setTransportSocketCallbacks() is called. In #4153 it is initialized before parent knows its callbacks. It can take a TransportSocketCallbacks** too, but I feel not much more simpler.
|
This class is for #4153 as well as some internal usage where we need to wrap a transport socket. |
Signed-off-by: Dan Zhang danzh@chromium.com
Description:
Add an implementation of TransportSocketCallbacks which does nothing when setReadBufferReady() or raiseEvent() is call. This implementation is supposed to be used in TransportSocket implementation which wraps another socket object. In this case, the underlying socket's callbacks should be suppressed.
Risk Level: Low (not enabled in main)
Testing: bazel test //test/...
Docs Changes: N/A
Release Notes: N/A