Skip to content

netty: support listening on multiple port #5067

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

Merged
merged 4 commits into from
Jan 29, 2019

Conversation

carl-mastrangelo
Copy link
Contributor

I did my best to make sure this was thread safe, please be forgiving!

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an alternative approach I was considering: let ServerImpl contain multiple InternalServers. That way the different ports could have different security configuration, and potentially even mixing transport types. It also seems like it'd be pretty easy (not that this solution was hard).

@ST-DDT
Copy link
Contributor

ST-DDT commented Nov 21, 2018

Having multiple connectors is a nice feature for services that serve both internal and external requests. If I also have the ability to omit the encryption or use a different certificate set for internal services that would be awesome.

@creamsoup
Copy link
Contributor

creamsoup commented Dec 8, 2018

Discussed offline with @beschmi and confirmed that this change can solve an internal requirement. For this requirement, it doesn't really need the multiple InternalServers.

I don't expect API changes for the multiple InternalServer approach (at least for the existing APIs like getPorts). if this is true, we can support the multiple InternalServer on top of this change.

@ST-DDT
Copy link
Contributor

ST-DDT commented Dec 11, 2018

@carl-mastrangelo Can I somehow check which endpoint was used to connect to the server/receive a request?
Is there an attribute like Metadata.Key<SocketAddress> TARGET_ADDRESS?

EDIT: Oh this might already be present via Attributes TRANSPORT_ATTR_LOCAL_ADDR

@ST-DDT
Copy link
Contributor

ST-DDT commented Dec 11, 2018

Can we assign special names or attributes for each address? Like internal or external?

@carl-mastrangelo
Copy link
Contributor Author

carl-mastrangelo commented Dec 18, 2018

@ejona86 It seems like this approach will work for @creamsoup 's work. I believe this change should be ready to review because:

  • The API to add multiple multiple ports will be the same either with the multiple ServerImpl or multiple Transport approach
  • This PR currently does not expose that API.

@ejona86
Copy link
Member

ejona86 commented Dec 18, 2018

This change includes invasive changes to NettyServer that would need to be reverted if we go with the alternative approach, and this change won't likely be automatically revertable due to conflicts. So I want to get some basic understanding of how hard it would be to do it in the ServerImpl.

@carl-mastrangelo
Copy link
Contributor Author

@ejona86 This is ready to be reviewed again. NSB is a little more awkward because it has to create a list of transport servers, but aside from that it should be pretty straight forward.

Still not exposing an API, since I haven't thought what it should look like for InProcess.

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed straight-forward.

@carl-mastrangelo carl-mastrangelo merged commit ed0a9f3 into grpc:master Jan 29, 2019
@carl-mastrangelo carl-mastrangelo deleted the multiport branch January 29, 2019 18:13
@lock lock bot locked as resolved and limited conversation to collaborators Apr 29, 2019
@carl-mastrangelo carl-mastrangelo restored the multiport branch August 17, 2019 01:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants