-
Notifications
You must be signed in to change notification settings - Fork 11k
[subchannel] restructure APIs for starting a subchannel call #41009
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
base: master
Are you sure you want to change the base?
Conversation
ctiller
left a comment
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.
A couple of nits to take care of... let's discuss landing timing offline
| watchers_; | ||
| }; | ||
|
|
||
| class ConnectedSubchannel; |
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.
Describe what these are in a comment
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.
Done.
|
|
||
| void StartCallLocked() | ||
| // Returns false if there was no connection to start a call on. | ||
| bool StartCallLocked() |
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.
Recommend GPR_MUST_USE_RESULT here
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.
Good idea, done.
This is a prerequisite for queuing calls in the subchannel, which will be needed for A105 (grpc/proposal#516).
Today, callers that need to start a call on a subchannel (primarily the client channel, but there are a couple of others) need to first ask the subchannel for the
ConnectedSubchanneland then start the call on theConnectedSubchannel. That works fine today, but when we add call queuing in the subchannel, this API would require us to acquire and release the subchannel's lock twice: once to get theConnectedSubchannel, and again to add the call to the queue.To avoid that, I have removed the
ConnectedSubchannelfrom the subchannel's API and instead made it an internal implementation detail. Instead, the subchannel itself has methods for starting a call and doing pings.This PR predominantly affects the v1 stack. There are essentially no changes to the v3 stack, since that code was already grabbing the
UnstartedCallDestinationout of theConnectedSubchannelwithin a method on the subchannel.This change is not completely trivial, but it should not cause any behavior changes, and it is sufficiently cross-cutting that I don't see an easy way to make it an experiment.