-
Notifications
You must be signed in to change notification settings - Fork 5.5k
listener: enable connection balancer to support multiple addresses listener #21774
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
Changes from 13 commits
614b019
e43ebf1
22c6f46
7f48d18
4a797f0
af214ea
5a21424
529d0d4
caf3566
cb8de67
23ad91b
a7c93cd
eace31a
95163a4
a6ee594
44b5a02
a59c318
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,9 +27,13 @@ class ActiveTcpListener final : public Network::TcpListenerCallbacks, | |||||||
| public Network::BalancedConnectionHandler { | ||||||||
| public: | ||||||||
| ActiveTcpListener(Network::TcpConnectionHandler& parent, Network::ListenerConfig& config, | ||||||||
| Runtime::Loader& runtime, Network::SocketSharedPtr&& socket); | ||||||||
| Runtime::Loader& runtime, Network::SocketSharedPtr&& socket, | ||||||||
| Network::Address::InstanceConstSharedPtr& address, | ||||||||
| Network::ConnectionBalancer& connection_balancer); | ||||||||
| ActiveTcpListener(Network::TcpConnectionHandler& parent, Network::ListenerPtr&& listener, | ||||||||
| Network::ListenerConfig& config, Runtime::Loader& runtime); | ||||||||
| Network::Address::InstanceConstSharedPtr& address, | ||||||||
| Network::ListenerConfig& config, | ||||||||
| Network::ConnectionBalancer& connection_balancer, Runtime::Loader& runtime); | ||||||||
| ~ActiveTcpListener() override; | ||||||||
|
|
||||||||
| bool listenerConnectionLimitReached() const { | ||||||||
|
|
@@ -81,6 +85,12 @@ class ActiveTcpListener final : public Network::TcpListenerCallbacks, | |||||||
| // The number of connections currently active on this listener. This is typically used for | ||||||||
| // connection balancing across per-handler listeners. | ||||||||
| std::atomic<uint64_t> num_listener_connections_{}; | ||||||||
|
|
||||||||
| Network::ConnectionBalancer& connection_balancer_; | ||||||||
| // This is the address of this listener is listening on. And used for get the correct listener | ||||||||
| // when rebalancing. The accepted socket can't be used to get the listening address, since | ||||||||
| // the accepted socket's remote address can be another address than the listening address. | ||||||||
| Network::Address::InstanceConstSharedPtr address_; | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This listener must know it's address because it has a socket, right? It seems like this shouldn't be necessary?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have think about another two ways:
The second way works also. But let me know if the second way you think better.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I add a comment here https://github.com/envoyproxy/envoy/pull/21774/files#diff-55b19f848d75e4c86be99ac5c87457e24a960e71913de4b60153ea5e47c4d32cR90 But let me know if you prefer another way.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Can't you get this from the config though? Is't that stored in ActiveListenerImplBase in config_ or somewhere else?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After add multiple addresses support for ListenerImpl, then the ListenerImpl's
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK this makes sense, thanks. |
||||||||
| }; | ||||||||
|
|
||||||||
| using ActiveTcpListenerOptRef = absl::optional<std::reference_wrapper<ActiveTcpListener>>; | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.