Check if both sides support MultiplexSocket before enabling it.

PiperOrigin-RevId: 660874323
This commit is contained in:
hai007
2024-08-08 09:49:56 -07:00
committed by Copybara-Service
parent dcc9b39413
commit 7c7aa58885
+14 -3
View File
@@ -2183,9 +2183,20 @@ void BasePcpHandler::EvaluateConnectionResult(ClientProxy* client,
std::shared_ptr<EndpointChannel> 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";