-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 an unused implementation NoOpTransportSocketCallbacks #4172
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All you need is parent_->callbacks(), so why just not taking a Network::TransportSocketCallbacks&
as parameter?
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.
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