Check listening options as well when we want to enforce topology constraints

PiperOrigin-RevId: 543497497
This commit is contained in:
Anay Wadhera
2023-06-26 11:40:17 -07:00
committed by Copybara-Service
parent 7a25b33603
commit 7f1d6a4bba
5 changed files with 63 additions and 17 deletions
@@ -711,6 +711,21 @@ bool ClientProxy::RemoteConnectionIsAccepted(std::string endpoint_id) const {
endpoint_id, ClientProxy::Connection::kRemoteEndpointAccepted);
}
bool ClientProxy::ShouldEnforceTopologyConstraints() const {
bool result = false;
if (IsAdvertising() &&
(GetAdvertisingOptions().strategy.IsNone() ||
GetAdvertisingOptions().enforce_topology_constraints)) {
result |= true;
}
if (IsListeningForIncomingConnections() &&
(GetListeningOptions().strategy.IsNone() ||
GetListeningOptions().enforce_topology_constraints)) {
result |= true;
}
return result;
}
void ClientProxy::AddCancellationFlag(const std::string& endpoint_id) {
// Don't insert the CancellationFlag to the map if feature flag is disabled.
if (!FeatureFlags::GetInstance().GetFlags().enable_cancellation_flag) {