From 7c7aa58885befb6aee8d69f68a45e7c1c3eda0c2 Mon Sep 17 00:00:00 2001 From: hai007 Date: Thu, 8 Aug 2024 09:48:32 -0700 Subject: [PATCH] Check if both sides support MultiplexSocket before enabling it. PiperOrigin-RevId: 660874323 --- connections/implementation/base_pcp_handler.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/connections/implementation/base_pcp_handler.cc b/connections/implementation/base_pcp_handler.cc index 793f4c20..a5c7e97c 100644 --- a/connections/implementation/base_pcp_handler.cc +++ b/connections/implementation/base_pcp_handler.cc @@ -2183,9 +2183,20 @@ void BasePcpHandler::EvaluateConnectionResult(ClientProxy* client, std::shared_ptr channel = channel_manager_->GetChannelForEndpoint(endpoint_id); if (channel != nullptr) { - if (!channel->EnableMultiplexSocket()) { - NEARBY_LOGS(INFO) - << "MultiplexSocket is not implemented for this channel."; + if (client->IsMultiplexSocketSupported(endpoint_id, + channel->GetMedium())) { + if (!channel->EnableMultiplexSocket()) { + NEARBY_LOGS(INFO) + << "MultiplexSocket is not implemented for Medium: " + << location::nearby::proto::connections::Medium_Name( + channel->GetMedium()); + } else { + NEARBY_LOGS(INFO) + << "MultiplexSocket is supported for Medium: " + << location::nearby::proto::connections::Medium_Name( + channel->GetMedium()) + << " on both sides."; + } } } else { NEARBY_LOGS(INFO) << "channel is null";